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

feat(apto): generate view function, add typed and contexted aptos client #1072

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

zfy0701
Copy link
Contributor

@zfy0701 zfy0701 commented Dec 5, 2024

  • add RichAptosClient inherits base Aptos Client which provides a function to get resource and decode in one run
  const meta = await client.getTypedAccountResource({
   accountAddress: faAddress,
   resourceType: fungible_asset.Metadata.type()
 })
  • ctx.client can return a RichAptosClientWithContext which inherit RichAptosClient client, it will inject context's ledger version into calls like view, getAccountResource
  • generate code include view functions, you can also combine view function with ctx.client to easily to historical function calls e.g.
    const [res] = await coin.view.supply(ctx.getClient(), {
      typeArguments: ["0x1::aptos_coin::AptosCoin"],
    })
    

@zfy0701 zfy0701 merged commit ef6e660 into main Dec 5, 2024
2 checks passed
@zfy0701 zfy0701 deleted the dev/zfy0701/fuel branch December 5, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant