question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support account's execute

See original GitHub issue

This is different from #6. The account interface exposes an execute method to invoke multiple external functions in one transaction.

The proposed interface is:

const { execute, loading, error } = useStarknetExecute()

Where execute is:

execute: ({ calls: CallArgs, metadata?: any }) => Promise<AddTransactionResponse | undefined>
type CallArgs = { args?: T, contract?: Contract, method?: string }

Example

const { token } = useTokenContract()
const { other } = useOtherContract()

const { account } = useStarknet()
const { execute } = useStarknetExecute()

const [amount, setAmount] = useState(0)

// ...

execute({
  metadata: { message: 'Approve token and swap' },
  calls: [
    { contract: token, method: 'approve', args: amount && account ? [amount, account] : undefined },
    { contract: other, method: 'swap', args: amount && account ? [amount, account /*, more data here */] : undefined },
  ]
})

Like invoke, execute checks that all calls arguments are defined before making the call.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ponderingdemocrituscommented, Jun 1, 2022

Screenshot from 2022-06-01 16-45-43

Pulled from StarkNet fees - This is a huge potential saving if we batch transactions.

1reaction
tarrencevcommented, May 4, 2022

I like the proposed interface for execute. I’m wondering if we should deprecate invoke api in favor of a single execute api. It seems that is the direction the AccountInterface has taken:

public abstract execute(
    transactions: Call | Call[],
    abis?: Abi[],
    transactionsDetail?: InvocationsDetails
  ): Promise<AddTransactionResponse>;
Read more comments on GitHub >

github_iconTop Results From Across the Web

What Does An Account Support Representative Do - Zippia
Account Support Representative Responsibilities​​ Perform inside sales, including telemarketing, prospecting, account penetration and product application, ...
Read more >
It's Time to Execute Your Account Management Strategy
There are three components of an effective account management strategy: The creation of a plan; The tools to support the plan; Execution.
Read more >
How Key Account Management Supports an Execution Mindset
We've mapped those disciplines to a successful account planning process, and we'll highlight below how the right KAM platform can support your team's...
Read more >
Service Accounts | Microsoft Learn
A service account is a user account that's created explicitly to provide a security context for services that are running on Windows Server ......
Read more >
Applies to - My Oracle Support
How To Execute Bulk Rename Accounts Using runcat.sh/runcat.bat (renameAccounts) (Doc ID 2437991.1). Last updated on SEPTEMBER 30, 2022 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found