You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be better to have one function that would only create the Call object, and another to execute it. It would also allow queueing shopping cart transactions (as in Loot Survivor) to be executed later.
// avoid breaking changes, allow using the same function as to execute single transactionsconstbank_charge=async(snAccount: Account|AccountInterface,payer: string,value: Bignumberish)=>{try{returnawaitthis.execute(snAccount,[this.bank_calls_charge(payer,value)]);}catch(error){console.error(error);}};// this new function will only build the Call object...constbank_calls_charge(payer: string,value: Bignumberish): Call=>{returnparseDojoCall(provider.manifest,"pistols",{contractName: "bank",entrypoint: "charge",calldata: [payer,value],});};// create another new function to execute multicalls// avoid breaking changes, allow using the same function as to execute single transactionsconstexecute=async(snAccount: Account|AccountInterface,calls: AllowArray<DojoCall|Call>)=>{try{returnawaitaccount.execute(snAccount,calls);}catch(error){console.error(error);}};// single call usage (no changes)client.bank.charge(account,recipient,amount);// mutli-call usageclient.execute(account,[client.token.calls.approve(spender,amount)client.bank.calls.charge(recipient,amount)]);client.execute(account,[controller.calls.vrf(game_contract),client.actions.calls.do_the_thing()]);
I would also move nameSpace inside DojoCall, and remove it from parseDojoCall() and execute(). Besides making it simpler, this would allow multi-calls with functions from different namespaces:
typeDojoCall={nameSpace: string;contractName: string;entrypoint: string;calldata: RawArgs|Calldata;};// remove nameSpace from parseDojoCall()exportconstparseDojoCall=(manifest: any,call: DojoCall|Call): Call// remove nameSpace from execute()execute(account: Account|AccountInterface,call: AllowArray<DojoCall|Call>,details?: UniversalDetails): Promise<InvokeFunctionResponse>
Describe alternatives you've considered
Using a custom contract call, not using contracts.gen.ts
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The
contracts.gen.ts
interface created bysozo build —-typescript
does not allow multi-call transactions.These are common uses of multi-call:
request_random
on the same call, or else it will not be picked by the paymaster and will not work.approve
transaction before the contract call.Describe the solution you'd like
This is a function from
contracts.gen.ts
, it does not allow the inclusion of other calls inprovider.execute()
.It would be better to have one function that would only create the
Call
object, and another to execute it. It would also allow queueing shopping cart transactions (as in Loot Survivor) to be executed later.I would also move
nameSpace
insideDojoCall
, and remove it fromparseDojoCall()
andexecute()
. Besides making it simpler, this would allow multi-calls with functions from different namespaces:Describe alternatives you've considered
Using a custom contract call, not using
contracts.gen.ts
The text was updated successfully, but these errors were encountered: