Replies: 4 comments 8 replies
|
💯 Love this! Would suggest keeping the await contract.functions.new_game({ value: contract.id, type: 'ContractId' });I assume we'll default to an await contract.functions.new_game({ value: contract.address, type: 'Address' }); |
0 replies
|
I am lacking proper context here, but ideally, this would be: await contract.functions.new_game(value);This would feel more intuitive and standard (like other usages) since the Sway parameter is a single value: fn new_game(player: Identity); |
7 replies
|
Great idea! A solution that'd make the type Identity = {address: string, contractId?: never} | {address?: never; contractId: string}
await contract.functions.new_game({ address: contract.address });
await contract.functions.new_game({ contractId: contract.id });The |
1 reply
|
Thanks, everyone. I created an issue for it: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Take this Sway function signature for example:
If you try to call this function via the TS SDK, it would look something like this:
It works, but this takes 3-4 attempts to get right and involves some mental gymnastics. I was eventually able to find out how to make this work because I have been working on the SDK for more than a year now. Most new users would find this daunting.
I feel like the API should be simplified to something like:
Any comments & ideas welcome!
All reactions