Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce hooks for low-level contract calls and invocations #104

Closed
Pet3ris opened this issue May 9, 2022 · 5 comments
Closed

Introduce hooks for low-level contract calls and invocations #104

Pet3ris opened this issue May 9, 2022 · 5 comments

Comments

@Pet3ris
Copy link

Pet3ris commented May 9, 2022

There are some use cases which may mandate using the low-level starknet.js operations callContract and invokeFunction. However, today, no hook api exists for them. This is particularly useful in StarkNet where we don't need the full contract signature to call a function.

Examples:

  • Rapid prototyping (e.g., only need to call 1 function without providing abi)
  • Low-level interactions (e.g., trading/MEV contracts in ethereum mainnet)
  • Security testing of contracts
@fracek
Copy link
Contributor

fracek commented May 9, 2022

Agree with this. We should add the following hooks:

  • useProviderCall that has the same behaviour as the current call hook, but calls provider.callContract
  • useProviderInvoke that uses provider.invokeFunction

@fracek
Copy link
Contributor

fracek commented Oct 1, 2022

Another way to do this, change useStarknetCall to:

function useStarknetCall({ contractOrAddress }: { contractOrAddress?: string | Contract })

If it's a Contract, then the behaviour is the same as today. If it's a string, then it uses callContract.

For invoke, I think using useStarknetExecute is enough?

@J4ckyLIM
Copy link
Contributor

J4ckyLIM commented Jan 3, 2023

Is it still open ? I would like to work on this one if possible

@fracek
Copy link
Contributor

fracek commented Jan 3, 2023

Someone else is working on this as part of moving everything to a wagmi-like API.

@fracek
Copy link
Contributor

fracek commented Nov 20, 2023

This is now the default behaviour thanks to starknet.js populateTransaction.

@fracek fracek closed this as completed Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants