@aastar/sdk 0.14.3 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +30 -0
- package/README.md +148 -19
- package/abis/BLSAggregator.json +13 -13
- package/abis/BLSValidator.json +13 -0
- package/abis/DVTValidator.json +13 -0
- package/abis/GToken.json +57 -26
- package/abis/GTokenStaking.json +13 -39
- package/abis/MySBT.json +0 -39
- package/abis/Paymaster.json +0 -13
- package/abis/PaymasterFactory.json +26 -39
- package/abis/PaymasterV4_2.json +68 -58
- package/abis/Registry.json +57 -16
- package/abis/ReputationSystem.json +182 -0
- package/abis/SuperPaymaster.json +169 -0
- package/abis/aPNTs.json +13 -26
- package/abis/xPNTsFactory.json +13 -26
- package/abis/xPNTsToken.json +13 -26
- package/config.anvil.json +1 -0
- package/config.sepolia.json +1 -0
- package/config.test.json +27 -0
- package/docs/ABI_Change_Tracking_Workflow.md +41 -0
- package/docs/ABI_MAINTENANCE_PLAN.md +132 -0
- package/docs/API_REFERENCE.md +169 -9
- package/docs/Configuration_Sync.md +47 -0
- package/docs/DEMO_REFACTOR_PLAN.md +289 -0
- package/docs/ENV_SEPOLIA_UPDATE.md +68 -0
- package/docs/Faucet_Gasless_Plan.md +56 -0
- package/docs/L2_BUSINESS_CLIENTS_PLAN.md +394 -0
- package/docs/L4_Manual_Test_CheatSheet.md +215 -0
- package/docs/SDK_ABI_COVERAGE.md +839 -0
- package/docs/SDK_COVERAGE_STRATEGY.md +397 -0
- package/docs/SDK_REGRESSION_AND_API_PLAN.md +98 -0
- package/docs/SDK_STAGE3_PLAN.md +151 -0
- package/docs/STAGE3.md +191 -0
- package/docs/TESTER_GUIDE_GASLESS.md +663 -0
- package/docs/Verifier_L4_Gasless_Plan.md +454 -0
- package/docs/api/@aastar/account.md +235 -0
- package/docs/api/@aastar/analytics.md +219 -0
- package/docs/api/@aastar/core.md +26830 -0
- package/docs/api/@aastar/dapp.md +130 -0
- package/docs/api/@aastar/identity.md +482 -0
- package/docs/api/@aastar/paymaster.md +1387 -0
- package/docs/api/@aastar/sdk/README.md +155 -0
- package/docs/api/@aastar/sdk/node.md +4044 -0
- package/docs/api/@aastar/tokens.md +1971 -0
- package/docs/api/README.md +8 -4
- package/docs/changelog.md +99 -0
- package/docs/examples/README.md +18 -0
- package/docs/guide/concepts/account-abstraction.md +95 -0
- package/docs/guide/concepts/rainbow-bridge.md +68 -0
- package/docs/guide/concepts/reputation.md +95 -0
- package/docs/guide/concepts/superpaymaster.md +141 -0
- package/docs/guide/use-cases/community-management.md +141 -0
- package/docs/guide/use-cases/gasless-transactions.md +71 -0
- package/docs/guide/use-cases/operator-staking.md +84 -0
- package/docs/guide/use-cases/yop.md +72 -0
- package/docs/refactor/2026-01-13-221242-trae-refactor.md +224 -0
- package/docs/refactor/2026-01-13-audit-analysis.md +96 -0
- package/docs/refactor/2026-01-13-audit-report-v0.16.2.md +76 -0
- package/docs/refactor/2026-01-13-audit-report-v0.17.0.md +74 -0
- package/docs/refactor/2026-01-13-cursor-refactor.md +511 -0
- package/docs/refactor/2026-01-13-refactor-plan.md +88 -0
- package/docs/refactor/2026-01-13-refactor-response-plan.md +77 -0
- package/docs/refactor/2026-01-13-refactor-review.md +39 -0
- package/docs/refactor/2026-01-13-sdk-enhancement-plan.md +120 -0
- package/docs/refactor/2026-01-14-audit-response.md +242 -0
- package/docs/refactor/2026-01-14-audit-summary.md +133 -0
- package/docs/refactor/cursor-2026-01-13-14-00-audit-report.md +267 -0
- package/env.template +32 -0
- package/examples/l1-api-demo.ts +184 -0
- package/examples/l2-clients-demo.ts +138 -0
- package/examples/l3-user-onboarding.ts +74 -0
- package/examples/prepare-gasless.ts +89 -0
- package/examples/simple-gasless-demo.ts +80 -0
- package/examples/simple-superpaymaster-demo.ts +96 -0
- package/l4-setup.sh +11 -0
- package/package.json +12 -8
- package/packages/account/package.json +6 -3
- package/packages/account/src/accounts/simple.test.ts +93 -0
- package/packages/account/src/eoa.test.ts +37 -0
- package/packages/account/src/eoa.ts +4 -2
- package/packages/account/src/index.test.ts +34 -0
- package/packages/account/tsconfig.json +0 -1
- package/packages/analytics/package.json +12 -5
- package/packages/analytics/tsconfig.json +0 -5
- package/packages/core/package.json +16 -6
- package/packages/core/scripts/audit-abi-coverage.ts +165 -0
- package/packages/core/scripts/debug-regex.ts +36 -0
- package/packages/core/src/abis/.abi-hashes.json +26 -0
- package/packages/core/src/abis/BLSAggregator.json +686 -572
- package/packages/core/src/abis/BLSValidator.json +42 -26
- package/packages/core/src/abis/DVTValidator.json +368 -370
- package/packages/core/src/abis/EntryPoint.json +1382 -1379
- package/packages/core/src/abis/GToken.json +513 -523
- package/packages/core/src/abis/GTokenStaking.json +949 -931
- package/packages/core/src/abis/MySBT.json +1518 -1586
- package/packages/core/src/abis/Paymaster.json +1143 -1205
- package/packages/core/src/abis/PaymasterFactory.json +640 -650
- package/packages/core/src/abis/Registry.json +1942 -1636
- package/packages/core/src/abis/ReputationSystem.json +699 -477
- package/packages/core/src/abis/SimpleAccount.json +560 -625
- package/packages/core/src/abis/SimpleAccountFactory.json +111 -108
- package/packages/core/src/abis/SuperPaymaster.json +1781 -1399
- package/packages/core/src/abis/abi.config.json +24 -0
- package/packages/core/src/abis/index.ts +74 -38
- package/packages/core/src/abis/xPNTsFactory.json +718 -728
- package/packages/core/src/abis/xPNTsToken.json +1280 -1173
- package/packages/core/src/actions/StateValidator.test.ts +175 -0
- package/packages/{sdk/src/utils/validation.ts → core/src/actions/StateValidator.ts} +22 -125
- package/packages/core/src/actions/account.test.ts +155 -0
- package/packages/core/src/actions/account.ts +179 -0
- package/packages/core/src/actions/aggregator.test.ts +88 -0
- package/packages/core/src/actions/dvt.test.ts +124 -0
- package/packages/core/src/actions/entryPoint.test.ts +176 -0
- package/packages/core/src/actions/entryPoint.ts +266 -0
- package/packages/core/src/actions/factory.test.ts +250 -0
- package/packages/core/src/actions/factory.ts +586 -14
- package/packages/core/src/actions/faucet.test.ts +202 -0
- package/packages/core/src/actions/faucet.ts +421 -0
- package/packages/core/src/actions/gtokenExtended.test.ts +162 -0
- package/packages/core/src/actions/gtokenExtended.ts +153 -0
- package/packages/core/src/actions/index.ts +8 -0
- package/packages/core/src/actions/paymasterV4.test.ts +209 -0
- package/packages/core/src/actions/paymasterV4.ts +330 -138
- package/packages/core/src/actions/registry.test.ts +443 -0
- package/packages/core/src/actions/registry.ts +768 -28
- package/packages/core/src/actions/reputation.test.ts +225 -0
- package/packages/core/src/actions/reputation.ts +351 -0
- package/packages/core/src/actions/sbt.test.ts +322 -0
- package/packages/core/src/actions/sbt.ts +614 -30
- package/packages/core/src/actions/staking.test.ts +273 -0
- package/packages/core/src/actions/staking.ts +350 -8
- package/packages/core/src/actions/superPaymaster.test.ts +356 -0
- package/packages/core/src/actions/superPaymaster.ts +746 -35
- package/packages/core/src/actions/tokens.test.ts +60 -0
- package/packages/core/src/actions/tokens.ts +482 -20
- package/packages/core/src/actions/validators.test.ts +239 -0
- package/packages/core/src/actions/validators.ts +590 -0
- package/packages/core/src/clients/BaseClient.ts +78 -0
- package/packages/core/src/clients/types.ts +69 -0
- package/packages/core/src/clients.ts +1 -1
- package/packages/core/src/communities.ts +2 -2
- package/packages/core/src/config/ContractConfigManager.ts +63 -0
- package/packages/core/src/constants.ts +64 -0
- package/packages/core/src/contract-addresses.ts +42 -18
- package/packages/core/src/contracts.test.ts +58 -0
- package/packages/core/src/contracts.ts +2 -2
- package/packages/core/src/index.ts +4 -1
- package/packages/core/src/requirementChecker.test.ts +71 -0
- package/packages/core/src/requirementChecker.ts +1 -39
- package/packages/core/src/roles.test.ts +34 -0
- package/packages/core/src/roles.ts +61 -50
- package/packages/core/src/utils/validation.test.ts +50 -0
- package/packages/core/src/utils/validation.ts +66 -0
- package/packages/core/tsconfig.json +2 -2
- package/packages/core/vitest.config.ts +14 -0
- package/packages/dapp/package.json +6 -3
- package/packages/dapp/src/ui/hooks/useCreditScore.ts +1 -1
- package/packages/dapp/tsconfig.json +0 -1
- package/packages/identity/package.json +6 -3
- package/packages/identity/src/index.ts +49 -17
- package/packages/identity/tsconfig.json +0 -1
- package/packages/paymaster/package.json +6 -3
- package/packages/paymaster/src/SuperPaymaster/index.ts +2 -2
- package/packages/paymaster/src/V4/PaymasterClient.test.ts +114 -0
- package/packages/paymaster/src/V4/PaymasterClient.ts +385 -0
- package/packages/paymaster/src/V4/PaymasterOperator.test.ts +80 -0
- package/packages/paymaster/src/V4/PaymasterOperator.ts +282 -0
- package/packages/paymaster/src/V4/PaymasterUtils.test.ts +54 -0
- package/packages/paymaster/src/V4/PaymasterUtils.ts +185 -0
- package/packages/paymaster/src/V4/SuperPaymasterClient.test.ts +79 -0
- package/packages/paymaster/src/V4/SuperPaymasterClient.ts +123 -0
- package/packages/paymaster/src/V4/index.ts +4 -123
- package/packages/paymaster/tsconfig.json +0 -1
- package/packages/sdk/aastar/tsconfig.json +0 -1
- package/packages/sdk/coverage_output.txt +393 -0
- package/packages/sdk/coverage_output_final.txt +739 -0
- package/packages/sdk/coverage_output_final_v2.txt +722 -0
- package/packages/sdk/coverage_output_final_v3.txt +722 -0
- package/packages/sdk/package.json +14 -2
- package/packages/sdk/src/clients/ExperimentClient.test.ts +65 -0
- package/packages/sdk/src/clients/ExperimentClient.ts +80 -0
- package/packages/sdk/src/clients/admin.test.ts +98 -0
- package/packages/sdk/src/clients/admin.ts +108 -8
- package/packages/sdk/src/clients/clients.test.ts +104 -0
- package/packages/sdk/src/clients/community.test.ts +118 -0
- package/packages/sdk/src/clients/community.ts +175 -241
- package/packages/sdk/src/clients/endUser.test.ts +221 -0
- package/packages/sdk/src/clients/endUser.ts +430 -52
- package/packages/sdk/src/clients/operator.test.ts +162 -0
- package/packages/sdk/src/clients/operator.ts +168 -90
- package/packages/sdk/src/errors/AAStarError.test.ts +92 -0
- package/packages/sdk/src/errors/AAStarError.ts +70 -0
- package/packages/sdk/src/errors/decoder.test.ts +107 -0
- package/packages/sdk/src/errors/decoder.ts +84 -41
- package/packages/sdk/src/index.ts +11 -8
- package/packages/sdk/src/node/index.ts +8 -0
- package/packages/sdk/src/types/result.ts +29 -0
- package/packages/sdk/src/utils/errorHandler.test.ts +102 -0
- package/packages/sdk/src/utils/eventDecoder.test.ts +56 -0
- package/packages/sdk/src/utils/eventDecoder.ts +66 -0
- package/packages/sdk/src/utils/funding.test.ts +117 -0
- package/packages/sdk/src/utils/keys.test.ts +105 -0
- package/packages/sdk/src/utils/keys.ts +15 -0
- package/packages/sdk/src/utils/roleData.test.ts +85 -0
- package/packages/sdk/src/utils/roleData.ts +15 -26
- package/packages/sdk/src/utils/testScenarios.test.ts +79 -0
- package/packages/sdk/src/utils/testScenarios.ts +128 -0
- package/packages/sdk/src/utils/userOp.test.ts +190 -0
- package/packages/sdk/src/utils/userOp.ts +265 -0
- package/packages/sdk/tests/scenarios/01_onboard_community.ts +62 -0
- package/packages/sdk/tests/scenarios/02_onboard_operator.ts +109 -0
- package/packages/sdk/tests/scenarios/03_onboard_user.ts +53 -0
- package/packages/sdk/tests/scenarios/04_gasless_tx_flow.ts +68 -0
- package/packages/sdk/tests/scenarios/check_entrypoint.ts +19 -0
- package/packages/sdk/tests/scenarios/check_initialization.ts +65 -0
- package/packages/sdk/tests/scenarios/debug_addresses.ts +26 -0
- package/packages/sdk/tests/scenarios/diagnose_scenario4.ts +55 -0
- package/packages/sdk/tests/scenarios/setup.ts +33 -0
- package/packages/sdk/tests/scenarios/test_entrypoint_nonce.ts +46 -0
- package/packages/sdk/tsconfig.json +0 -1
- package/packages/tokens/package.json +6 -3
- package/packages/tokens/src/index.ts +92 -64
- package/packages/tokens/tsconfig.json +0 -1
- package/run_l4_gasless_regression.sh +79 -0
- package/run_sdk_regression.sh +200 -175
- package/scripts/00_utils.ts +1 -1
- package/scripts/01_prepare_all.ts +149 -198
- package/scripts/02_test_eoa.ts +27 -24
- package/scripts/03_test_standard_aa.ts +48 -153
- package/scripts/04_test_paymaster_v4.ts +41 -198
- package/scripts/05_test_superpaymaster.ts +40 -362
- package/scripts/09_local_test_community_lifecycle.ts +4 -3
- package/scripts/11_test_core_flows_full.ts +75 -197
- package/scripts/15_test_bls_full.ts +25 -2
- package/scripts/15_test_dvt_bls_full.ts +11 -4
- package/scripts/18_test_lifecycle_completion.ts +2 -2
- package/scripts/19_sdk_experiment_runner.ts +41 -16
- package/scripts/20_sdk_full_capability.ts +75 -77
- package/scripts/99_bug_hunting_fast.ts +55 -172
- package/scripts/analyze_abi_coverage.ts +169 -0
- package/scripts/check-admin.ts +95 -0
- package/scripts/check-jason-status.ts +184 -0
- package/scripts/check-roles.ts +36 -0
- package/scripts/clear-nonce.ts +47 -0
- package/scripts/complete-jack-superpaymaster.ts +171 -0
- package/scripts/debug-addr.ts +43 -0
- package/scripts/debug-community-registration.ts +92 -0
- package/scripts/debug-deploy-v4.ts +116 -0
- package/scripts/debug-paymaster.ts +127 -0
- package/scripts/debug-register-role.ts +101 -0
- package/scripts/debug-version.ts +71 -0
- package/scripts/deploy-sync.ts +104 -0
- package/scripts/deprecated/check_aa_entrypoint.ts +29 -0
- package/scripts/deprecated/check_paymaster_deposits.ts +45 -0
- package/scripts/deprecated/debug_aoa_function.ts +28 -0
- package/scripts/deprecated/debug_aoa_issue.ts +16 -0
- package/scripts/deprecated/debug_pimlico_aa23.ts +40 -0
- package/scripts/deprecated/debug_summary.ts +34 -0
- package/scripts/deprecated/deploy_v07_aa.ts +99 -0
- package/scripts/deprecated/fix_all_issues.ts +61 -0
- package/scripts/deprecated/fund_bpnts.ts +52 -0
- package/scripts/deprecated/get_factory_addresses.ts +28 -0
- package/scripts/deprecated/recheck_pim.ts +34 -0
- package/{extract_abis.sh → scripts/dev_tools/extract_abis.sh} +13 -2
- package/scripts/extract-docs.sh +78 -9
- package/scripts/fund-jack.ts +38 -0
- package/scripts/inspect-anni-token.ts +116 -0
- package/scripts/inspect-factory.ts +83 -0
- package/scripts/l4-paymasterv4-transfer-test.ts +228 -0
- package/scripts/l4-setup.ts +453 -0
- package/scripts/l4-state.json +80 -0
- package/scripts/phase1_verify_contracts.ts +207 -0
- package/scripts/pre_test_sync.ts +83 -0
- package/scripts/prepare_sepolia_resources.ts +154 -0
- package/scripts/query-jack-token.ts +22 -0
- package/scripts/quick_setup_account.ts +80 -0
- package/scripts/run_l4_gasless_regression.sh +32 -0
- package/scripts/run_sdk_experiment.sh +13 -0
- package/scripts/run_sdk_regression-v2.sh +38 -0
- package/scripts/sdk_regression_v2.ts +162 -0
- package/scripts/setup-bbq-community.ts +187 -0
- package/scripts/setup-dancing-community.ts +223 -0
- package/scripts/setup_test_accounts.ts +88 -0
- package/scripts/setup_test_environment.ts +147 -0
- package/scripts/sync_anvil_config.cjs +44 -0
- package/scripts/sync_contract_addresses.ts +186 -0
- package/scripts/sync_sepolia_config.cjs +90 -0
- package/scripts/sync_sepolia_config.mjs +74 -0
- package/scripts/test-brown-v4-deploy.ts +90 -0
- package/scripts/test-faucet-and-gasless.ts +170 -0
- package/scripts/test-jack-gasless.ts +119 -0
- package/scripts/test-jack-registration.ts +133 -0
- package/scripts/test-jack-superpaymaster-api.ts +112 -0
- package/scripts/test-kms-gasless.ts +138 -0
- package/scripts/test_groups.ts +63 -192
- package/scripts/test_new_sdk_apis_sepolia.ts +78 -0
- package/scripts/update_env_from_config.ts +83 -0
- package/scripts/v2_regression/00_validate_env.ts +28 -4
- package/scripts/v2_regression/02_operator_onboarding.ts +15 -141
- package/scripts/v2_regression/03_community_registry.ts +23 -57
- package/scripts/v2_regression/04_enduser_flow.ts +15 -48
- package/scripts/verify-tx-status.ts +81 -0
- package/scripts/verify_onchain_milestone.ts +114 -0
- package/scripts/verify_phase1.ts +66 -0
- package/scripts/verify_phase2.ts +66 -0
- package/sdk_experiment_data.csv +2 -0
- package/simple-test-paymaster.sh +2 -0
- package/simple-test-superpaymaster.sh +1 -0
- package/tests/l1-regression.test.ts +458 -0
- package/tests/l4-test-anni-gasless.ts +105 -0
- package/tests/l4-test-jason1-gasless.ts +150 -0
- package/tests/l4-test-jason2-gasless.ts +174 -0
- package/tests/l4-test-pmv4-deposit.ts +111 -0
- package/tests/l4-test-pmv4-gasless.ts +166 -0
- package/tests/l4-test-pmv4-submit.ts +223 -0
- package/tests/regression/README.md +168 -0
- package/tests/regression/config.ts +215 -0
- package/tests/regression/display-versions.ts +85 -0
- package/tests/regression/index.ts +67 -0
- package/tests/regression/l1-tests.ts +267 -0
- package/tests/regression/l2-tests.ts +171 -0
- package/tests/regression/l3-tests.ts +125 -0
- package/tests/regression/l4-gasless.ts +897 -0
- package/tests/regression/l4-runner.ts +52 -0
- package/tests/reports/phase1_contract_verification.md +45 -0
- package/tests/utils/contractVerifier.ts +237 -0
- package/tests/utils/userOpHelper.ts +194 -0
- package/tsconfig.json +32 -6
- package/typedoc.json +39 -5
- package/vitest.config.ts +16 -0
- package/.eslintrc.js +0 -28
- package/docs/STAGE_3_SCENARIO_EXP_PLAN.md +0 -77
- package/docs/api/@aastar/account/README.md +0 -15
- package/docs/api/@aastar/account/classes/UserOpClient.md +0 -87
- package/docs/api/@aastar/account/functions/createEOAWalletClient.md +0 -21
- package/docs/api/@aastar/account/functions/getUserOpHash.md +0 -23
- package/docs/api/@aastar/account/functions/packUserOpLimits.md +0 -19
- package/docs/api/@aastar/account/functions/toSimpleSmartAccount.md +0 -83
- package/docs/api/@aastar/account/type-aliases/EOAWalletClient.md +0 -37
- package/docs/api/@aastar/account/type-aliases/SimpleSmartAccount.md +0 -39
- package/docs/api/@aastar/core/README.md +0 -136
- package/docs/api/@aastar/core/classes/BLSSigner.md +0 -147
- package/docs/api/@aastar/core/enumerations/NodeType.md +0 -33
- package/docs/api/@aastar/core/functions/aggregatorActions.md +0 -2714
- package/docs/api/@aastar/core/functions/createAAStarPublicClient.md +0 -3105
- package/docs/api/@aastar/core/functions/dvtActions.md +0 -2714
- package/docs/api/@aastar/core/functions/factoryActions.md +0 -2714
- package/docs/api/@aastar/core/functions/getAddressUrl.md +0 -32
- package/docs/api/@aastar/core/functions/getAllCommunityConfigs.md +0 -9
- package/docs/api/@aastar/core/functions/getAllV2Contracts.md +0 -20
- package/docs/api/@aastar/core/functions/getBlockExplorer.md +0 -26
- package/docs/api/@aastar/core/functions/getChainId.md +0 -26
- package/docs/api/@aastar/core/functions/getCommunities.md +0 -76
- package/docs/api/@aastar/core/functions/getCommunity.md +0 -32
- package/docs/api/@aastar/core/functions/getCommunityConfig.md +0 -15
- package/docs/api/@aastar/core/functions/getContract.md +0 -37
- package/docs/api/@aastar/core/functions/getContractNetworks.md +0 -18
- package/docs/api/@aastar/core/functions/getContracts.md +0 -178
- package/docs/api/@aastar/core/functions/getCoreContracts.md +0 -55
- package/docs/api/@aastar/core/functions/getDeploymentDate.md +0 -32
- package/docs/api/@aastar/core/functions/getEntryPoint.md +0 -25
- package/docs/api/@aastar/core/functions/getNetwork.md +0 -26
- package/docs/api/@aastar/core/functions/getPaymasterV4_1.md +0 -25
- package/docs/api/@aastar/core/functions/getRpcUrl.md +0 -25
- package/docs/api/@aastar/core/functions/getSimpleAccountFactory.md +0 -25
- package/docs/api/@aastar/core/functions/getSuperPaymasterV2.md +0 -25
- package/docs/api/@aastar/core/functions/getTestAccounts.md +0 -30
- package/docs/api/@aastar/core/functions/getTestTokenContracts.md +0 -38
- package/docs/api/@aastar/core/functions/getTokenContracts.md +0 -31
- package/docs/api/@aastar/core/functions/getTxUrl.md +0 -32
- package/docs/api/@aastar/core/functions/getV2ContractByAddress.md +0 -28
- package/docs/api/@aastar/core/functions/getV2ContractByName.md +0 -28
- package/docs/api/@aastar/core/functions/getV2ContractsByDate.md +0 -26
- package/docs/api/@aastar/core/functions/isContractNetworkSupported.md +0 -27
- package/docs/api/@aastar/core/functions/isRegisteredCommunity.md +0 -15
- package/docs/api/@aastar/core/functions/isV2Contract.md +0 -27
- package/docs/api/@aastar/core/functions/paymasterV4Actions.md +0 -2719
- package/docs/api/@aastar/core/functions/registryActions.md +0 -2720
- package/docs/api/@aastar/core/functions/reputationActions.md +0 -2720
- package/docs/api/@aastar/core/functions/sbtActions.md +0 -2720
- package/docs/api/@aastar/core/functions/stakingActions.md +0 -2720
- package/docs/api/@aastar/core/functions/superPaymasterActions.md +0 -2720
- package/docs/api/@aastar/core/functions/tokenActions.md +0 -2714
- package/docs/api/@aastar/core/interfaces/CommunityConfig.md +0 -81
- package/docs/api/@aastar/core/interfaces/ContractVersion.md +0 -63
- package/docs/api/@aastar/core/type-aliases/AggregatorActions.md +0 -79
- package/docs/api/@aastar/core/type-aliases/ContractCategory.md +0 -5
- package/docs/api/@aastar/core/type-aliases/ContractNetwork.md +0 -5
- package/docs/api/@aastar/core/type-aliases/DVTActions.md +0 -139
- package/docs/api/@aastar/core/type-aliases/FactoryActions.md +0 -99
- package/docs/api/@aastar/core/type-aliases/NetworkContracts.md +0 -5
- package/docs/api/@aastar/core/type-aliases/PaymasterV4Actions.md +0 -422
- package/docs/api/@aastar/core/type-aliases/RegistryActions.md +0 -263
- package/docs/api/@aastar/core/type-aliases/ReputationActions.md +0 -47
- package/docs/api/@aastar/core/type-aliases/RoleConfig.md +0 -83
- package/docs/api/@aastar/core/type-aliases/SBTActions.md +0 -203
- package/docs/api/@aastar/core/type-aliases/StakingActions.md +0 -179
- package/docs/api/@aastar/core/type-aliases/SuperPaymasterActions.md +0 -219
- package/docs/api/@aastar/core/type-aliases/SupportedNetwork.md +0 -3
- package/docs/api/@aastar/core/type-aliases/TokenActions.md +0 -151
- package/docs/api/@aastar/core/variables/AASTAR_COMMUNITY.md +0 -8
- package/docs/api/@aastar/core/variables/ALL_ADDRESSES.md +0 -71
- package/docs/api/@aastar/core/variables/BLSAggregatorABI.md +0 -3
- package/docs/api/@aastar/core/variables/BLSHelpers.md +0 -91
- package/docs/api/@aastar/core/variables/BPS_DENOMINATOR.md +0 -5
- package/docs/api/@aastar/core/variables/BRANDING.md +0 -67
- package/docs/api/@aastar/core/variables/BREAD_COMMUNITY.md +0 -8
- package/docs/api/@aastar/core/variables/COMMUNITIES.md +0 -5
- package/docs/api/@aastar/core/variables/COMMUNITY_OWNERS.md +0 -15
- package/docs/api/@aastar/core/variables/CONTRACTS.md +0 -163
- package/docs/api/@aastar/core/variables/CONTRACT_METADATA.md +0 -67
- package/docs/api/@aastar/core/variables/CORE_ADDRESSES.md +0 -35
- package/docs/api/@aastar/core/variables/DEFAULT_APNTS_PRICE_USD.md +0 -5
- package/docs/api/@aastar/core/variables/DEFAULT_GAS_TOKEN_MINT_AMOUNT.md +0 -5
- package/docs/api/@aastar/core/variables/DEFAULT_USDT_MINT_AMOUNT.md +0 -5
- package/docs/api/@aastar/core/variables/DVTValidatorABI.md +0 -3
- package/docs/api/@aastar/core/variables/EntryPointABI.md +0 -3
- package/docs/api/@aastar/core/variables/FAUCET_API_URL.md +0 -5
- package/docs/api/@aastar/core/variables/GTokenABI.md +0 -3
- package/docs/api/@aastar/core/variables/GTokenStakingABI.md +0 -3
- package/docs/api/@aastar/core/variables/LINKS.md +0 -33
- package/docs/api/@aastar/core/variables/MAX_SERVICE_FEE.md +0 -5
- package/docs/api/@aastar/core/variables/MONITORING_ADDRESSES.md +0 -15
- package/docs/api/@aastar/core/variables/MySBTABI.md +0 -3
- package/docs/api/@aastar/core/variables/NETWORKS.md +0 -79
- package/docs/api/@aastar/core/variables/NODE_STAKE_AMOUNTS.md +0 -31
- package/docs/api/@aastar/core/variables/OFFICIAL_ADDRESSES.md +0 -11
- package/docs/api/@aastar/core/variables/PAYMASTER_ADDRESSES.md +0 -15
- package/docs/api/@aastar/core/variables/PaymasterABI.md +0 -3
- package/docs/api/@aastar/core/variables/PaymasterFactoryABI.md +0 -3
- package/docs/api/@aastar/core/variables/PaymasterV4ABI.md +0 -3
- package/docs/api/@aastar/core/variables/ROLE_ANODE.md +0 -3
- package/docs/api/@aastar/core/variables/ROLE_COMMUNITY.md +0 -3
- package/docs/api/@aastar/core/variables/ROLE_ENDUSER.md +0 -5
- package/docs/api/@aastar/core/variables/ROLE_KMS.md +0 -3
- package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_AOA.md +0 -3
- package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_SUPER.md +0 -3
- package/docs/api/@aastar/core/variables/RegistryABI.md +0 -3
- package/docs/api/@aastar/core/variables/ReputationSystemABI.md +0 -3
- package/docs/api/@aastar/core/variables/ReputationSystemV3ABI.md +0 -3
- package/docs/api/@aastar/core/variables/SEPOLIA_CONTRACTS.md +0 -159
- package/docs/api/@aastar/core/variables/SEPOLIA_V2_VERSIONS.md +0 -67
- package/docs/api/@aastar/core/variables/SERVICE_FEE_RATE.md +0 -5
- package/docs/api/@aastar/core/variables/Simple7702AccountABI.md +0 -3
- package/docs/api/@aastar/core/variables/SimpleAccountABI.md +0 -3
- package/docs/api/@aastar/core/variables/SimpleAccountFactoryABI.md +0 -3
- package/docs/api/@aastar/core/variables/SimpleAccountFactoryV08ABI.md +0 -3
- package/docs/api/@aastar/core/variables/SimpleAccountV08ABI.md +0 -3
- package/docs/api/@aastar/core/variables/SuperPaymasterABI.md +0 -3
- package/docs/api/@aastar/core/variables/SuperPaymasterV3ABI.md +0 -3
- package/docs/api/@aastar/core/variables/TEST_ACCOUNT_ADDRESSES.md +0 -11
- package/docs/api/@aastar/core/variables/TEST_ACCOUNT_POOL_SIZE.md +0 -5
- package/docs/api/@aastar/core/variables/TEST_COMMUNITIES.md +0 -19
- package/docs/api/@aastar/core/variables/TEST_TOKEN_ADDRESSES.md +0 -19
- package/docs/api/@aastar/core/variables/TOKEN_ADDRESSES.md +0 -11
- package/docs/api/@aastar/core/variables/V2_SUMMARY.md +0 -39
- package/docs/api/@aastar/core/variables/xPNTsFactoryABI.md +0 -3
- package/docs/api/@aastar/core/variables/xPNTsTokenABI.md +0 -3
- package/docs/api/@aastar/paymaster/README.md +0 -14
- package/docs/api/@aastar/paymaster/classes/SuperPaymasterClient.md +0 -163
- package/docs/api/@aastar/paymaster/functions/checkEligibility.md +0 -28
- package/docs/api/@aastar/paymaster/functions/getPaymasterV4Middleware.md +0 -32
- package/docs/api/@aastar/paymaster/functions/getSuperPaymasterMiddleware.md +0 -32
- package/docs/api/@aastar/paymaster/type-aliases/PaymasterConfig.md +0 -35
- package/docs/api/@aastar/paymaster/type-aliases/PaymasterV4MiddlewareConfig.md +0 -35
- package/docs/api/@aastar/tokens/README.md +0 -3
- package/docs/api/@aastar/tokens/classes/FinanceClient.md +0 -8653
- package/ext/permissionless.js/.changeset/README.md +0 -8
- package/ext/permissionless.js/.changeset/config.json +0 -11
- package/ext/permissionless.js/.env-example +0 -2
- package/ext/permissionless.js/.github/actions/install-dependencies/action.yml +0 -17
- package/ext/permissionless.js/.github/dependabot.yaml +0 -10
- package/ext/permissionless.js/.github/workflows/canary.yml +0 -49
- package/ext/permissionless.js/.github/workflows/on-pull-request.yml +0 -61
- package/ext/permissionless.js/.github/workflows/on-push-to-main.yml +0 -59
- package/ext/permissionless.js/.github/workflows/prune-tags.yml +0 -92
- package/ext/permissionless.js/.github/workflows/verify.yml +0 -114
- package/ext/permissionless.js/.size-limit.json +0 -13
- package/ext/permissionless.js/LICENSE +0 -21
- package/ext/permissionless.js/assets/banner.png +0 -0
- package/ext/permissionless.js/biome.json +0 -46
- package/ext/permissionless.js/bun.lock +0 -2340
- package/ext/permissionless.js/bun.lockb +0 -0
- package/ext/permissionless.js/package.json +0 -82
- package/ext/permissionless.js/packages/mock-paymaster/CHANGELOG.md +0 -31
- package/ext/permissionless.js/packages/mock-paymaster/constants.ts +0 -84
- package/ext/permissionless.js/packages/mock-paymaster/helpers/abi.ts +0 -1048
- package/ext/permissionless.js/packages/mock-paymaster/helpers/erc20-utils.ts +0 -105
- package/ext/permissionless.js/packages/mock-paymaster/helpers/schema.ts +0 -307
- package/ext/permissionless.js/packages/mock-paymaster/helpers/utils.ts +0 -78
- package/ext/permissionless.js/packages/mock-paymaster/index.ts +0 -63
- package/ext/permissionless.js/packages/mock-paymaster/package.json +0 -33
- package/ext/permissionless.js/packages/mock-paymaster/relay.ts +0 -424
- package/ext/permissionless.js/packages/mock-paymaster/setup.ts +0 -163
- package/ext/permissionless.js/packages/mock-paymaster/singletonPaymasters.ts +0 -230
- package/ext/permissionless.js/packages/permissionless/CHANGELOG.md +0 -893
- package/ext/permissionless.js/packages/permissionless/README.md +0 -122
- package/ext/permissionless.js/packages/permissionless/accounts/biconomy/abi/BiconomySmartAccountAbi.ts +0 -128
- package/ext/permissionless.js/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts +0 -374
- package/ext/permissionless.js/packages/permissionless/accounts/decodeCalls.test.ts +0 -505
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/abi/EtherspotBootstrapAbi.ts +0 -94
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/constants.ts +0 -27
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/toEtherspotSmartAccount.ts +0 -369
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/getInitMSAData.ts +0 -56
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/getNonceKey.ts +0 -21
- package/ext/permissionless.js/packages/permissionless/accounts/etherspot/utils/wrapMessageHash.ts +0 -43
- package/ext/permissionless.js/packages/permissionless/accounts/index.ts +0 -86
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelAccountAbi.ts +0 -87
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3AccountAbi.ts +0 -813
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3FactoryAbi.ts +0 -12
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/abi/KernelV3MetaFactoryAbi.ts +0 -17
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/constants.ts +0 -14
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/to7702KernelSmartAccount.ts +0 -63
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts +0 -62
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/toKernelSmartAccount.ts +0 -984
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/decodeCallData.ts +0 -43
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/encodeCallData.ts +0 -57
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/getNonceKey.ts +0 -33
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/isKernelV2.ts +0 -6
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/isWebAuthnAccount.ts +0 -8
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/signMessage.ts +0 -115
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/signTypedData.ts +0 -97
- package/ext/permissionless.js/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts +0 -44
- package/ext/permissionless.js/packages/permissionless/accounts/light/toLightSmartAccount.ts +0 -496
- package/ext/permissionless.js/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts +0 -351
- package/ext/permissionless.js/packages/permissionless/accounts/safe/index.ts +0 -14
- package/ext/permissionless.js/packages/permissionless/accounts/safe/signUserOperation.test.ts +0 -275
- package/ext/permissionless.js/packages/permissionless/accounts/safe/signUserOperation.ts +0 -316
- package/ext/permissionless.js/packages/permissionless/accounts/safe/toSafeSmartAccount.ts +0 -1980
- package/ext/permissionless.js/packages/permissionless/accounts/simple/to7702SimpleSmartAccount.ts +0 -51
- package/ext/permissionless.js/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts +0 -585
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts +0 -221
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/decodeCallData.ts +0 -87
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts +0 -81
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/getAccountAddress.ts +0 -48
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/getFactoryData.ts +0 -40
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/signMessage.ts +0 -33
- package/ext/permissionless.js/packages/permissionless/accounts/thirdweb/utils/signTypedData.ts +0 -67
- package/ext/permissionless.js/packages/permissionless/accounts/trust/toTrustSmartAccount.ts +0 -232
- package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/decodeCallData.ts +0 -87
- package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/encodeCallData.ts +0 -81
- package/ext/permissionless.js/packages/permissionless/accounts/trust/utils/getFactoryData.ts +0 -51
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/accountId.test.ts +0 -39
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/accountId.ts +0 -93
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModule.test.ts +0 -216
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModule.ts +0 -99
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModules.test.ts +0 -237
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/installModules.ts +0 -96
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts +0 -72
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/isModuleInstalled.ts +0 -132
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsExecutionMode.test.ts +0 -108
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsExecutionMode.ts +0 -158
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsModule.test.ts +0 -35
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/supportsModule.ts +0 -120
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModule.test.ts +0 -129
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModule.ts +0 -98
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModules.test.ts +0 -117
- package/ext/permissionless.js/packages/permissionless/actions/erc7579/uninstallModules.ts +0 -87
- package/ext/permissionless.js/packages/permissionless/actions/erc7579.ts +0 -103
- package/ext/permissionless.js/packages/permissionless/actions/etherspot/getUserOperationGasPrice.ts +0 -32
- package/ext/permissionless.js/packages/permissionless/actions/etherspot.ts +0 -4
- package/ext/permissionless.js/packages/permissionless/actions/index.ts +0 -9
- package/ext/permissionless.js/packages/permissionless/actions/package.json +0 -6
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/getCredentials.ts +0 -47
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/startAuthentication.ts +0 -39
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/startRegistration.ts +0 -126
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/verifyAuthentication.ts +0 -142
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer/verifyRegistration.ts +0 -132
- package/ext/permissionless.js/packages/permissionless/actions/passkeyServer.ts +0 -17
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/estimateErc20PaymasterCost.ts +0 -102
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getTokenQuotes.test.ts +0 -90
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getTokenQuotes.ts +0 -77
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationGasPrice.test.ts +0 -82
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts +0 -67
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationStatus.test.ts +0 -199
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/getUserOperationStatus.ts +0 -49
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts +0 -59
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/sponsorUserOperation.test.ts +0 -236
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/sponsorUserOperation.ts +0 -151
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.test.ts +0 -153
- package/ext/permissionless.js/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts +0 -74
- package/ext/permissionless.js/packages/permissionless/actions/pimlico.ts +0 -38
- package/ext/permissionless.js/packages/permissionless/actions/public/getAccountNonce.test.ts +0 -96
- package/ext/permissionless.js/packages/permissionless/actions/public/getAccountNonce.ts +0 -75
- package/ext/permissionless.js/packages/permissionless/actions/public/getSenderAddress.test.ts +0 -154
- package/ext/permissionless.js/packages/permissionless/actions/public/getSenderAddress.ts +0 -129
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/getCallsStatus.test.ts +0 -255
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/getCallsStatus.ts +0 -91
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendCalls.test.ts +0 -571
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendCalls.ts +0 -38
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendTransaction.test.ts +0 -416
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/sendTransaction.ts +0 -133
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signMessage.test.ts +0 -219
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signMessage.ts +0 -73
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signTypedData.test.ts +0 -228
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/signTypedData.ts +0 -157
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount/writeContract.ts +0 -70
- package/ext/permissionless.js/packages/permissionless/actions/smartAccount.ts +0 -7
- package/ext/permissionless.js/packages/permissionless/clients/createSmartAccountClient.ts +0 -181
- package/ext/permissionless.js/packages/permissionless/clients/decorators/passkeyServer.ts +0 -57
- package/ext/permissionless.js/packages/permissionless/clients/decorators/pimlico.ts +0 -189
- package/ext/permissionless.js/packages/permissionless/clients/decorators/smartAccount.ts +0 -350
- package/ext/permissionless.js/packages/permissionless/clients/index.ts +0 -2
- package/ext/permissionless.js/packages/permissionless/clients/passkeyServer.ts +0 -69
- package/ext/permissionless.js/packages/permissionless/clients/pimlico.ts +0 -124
- package/ext/permissionless.js/packages/permissionless/errors/index.ts +0 -17
- package/ext/permissionless.js/packages/permissionless/experimental/pimlico/index.ts +0 -1
- package/ext/permissionless.js/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -523
- package/ext/permissionless.js/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +0 -369
- package/ext/permissionless.js/packages/permissionless/index.ts +0 -3
- package/ext/permissionless.js/packages/permissionless/package.json +0 -102
- package/ext/permissionless.js/packages/permissionless/types/etherspot.ts +0 -12
- package/ext/permissionless.js/packages/permissionless/types/package.json +0 -6
- package/ext/permissionless.js/packages/permissionless/types/passkeyServer.ts +0 -125
- package/ext/permissionless.js/packages/permissionless/types/pimlico.ts +0 -151
- package/ext/permissionless.js/packages/permissionless/utils/decode7579Calls.ts +0 -133
- package/ext/permissionless.js/packages/permissionless/utils/decodeNonce.test.ts +0 -40
- package/ext/permissionless.js/packages/permissionless/utils/decodeNonce.ts +0 -10
- package/ext/permissionless.js/packages/permissionless/utils/deepHexlify.test.ts +0 -57
- package/ext/permissionless.js/packages/permissionless/utils/deepHexlify.ts +0 -35
- package/ext/permissionless.js/packages/permissionless/utils/encode7579Calls.test.ts +0 -69
- package/ext/permissionless.js/packages/permissionless/utils/encode7579Calls.ts +0 -114
- package/ext/permissionless.js/packages/permissionless/utils/encodeInstallModule.ts +0 -91
- package/ext/permissionless.js/packages/permissionless/utils/encodeNonce.test.ts +0 -38
- package/ext/permissionless.js/packages/permissionless/utils/encodeNonce.ts +0 -8
- package/ext/permissionless.js/packages/permissionless/utils/encodeUninstallModule.ts +0 -88
- package/ext/permissionless.js/packages/permissionless/utils/erc20AllowanceOverride.test.ts +0 -59
- package/ext/permissionless.js/packages/permissionless/utils/erc20AllowanceOverride.ts +0 -66
- package/ext/permissionless.js/packages/permissionless/utils/erc20BalanceOverride.test.ts +0 -57
- package/ext/permissionless.js/packages/permissionless/utils/erc20BalanceOverride.ts +0 -49
- package/ext/permissionless.js/packages/permissionless/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +0 -31
- package/ext/permissionless.js/packages/permissionless/utils/getAddressFromInitCodeOrPaymasterAndData.ts +0 -13
- package/ext/permissionless.js/packages/permissionless/utils/getEstimationCallData.ts +0 -297
- package/ext/permissionless.js/packages/permissionless/utils/getPackedUserOperation.test.ts +0 -204
- package/ext/permissionless.js/packages/permissionless/utils/getPackedUserOperation.ts +0 -122
- package/ext/permissionless.js/packages/permissionless/utils/getRequiredPrefund.test.ts +0 -90
- package/ext/permissionless.js/packages/permissionless/utils/getRequiredPrefund.ts +0 -56
- package/ext/permissionless.js/packages/permissionless/utils/index.ts +0 -43
- package/ext/permissionless.js/packages/permissionless/utils/isSmartAccountDeployed.ts +0 -13
- package/ext/permissionless.js/packages/permissionless/utils/ox.ts +0 -48
- package/ext/permissionless.js/packages/permissionless/utils/toOwner.ts +0 -89
- package/ext/permissionless.js/packages/permissionless/vitest.config.ts +0 -31
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/biconomy.ts +0 -22
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/etherspot.ts +0 -12
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/kernel.ts +0 -63
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/light.ts +0 -10
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/nexus.ts +0 -16
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/safe.ts +0 -75
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/simple.ts +0 -16
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/thirdweb.ts +0 -7
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/accounts/trust.ts +0 -26
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/core.ts +0 -24
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/constants/index.ts +0 -10
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/index.ts +0 -783
- package/ext/permissionless.js/packages/permissionless-test/mock-aa-infra/alto/instance.ts +0 -290
- package/ext/permissionless.js/packages/permissionless-test/src/testWithRpc.ts +0 -128
- package/ext/permissionless.js/packages/permissionless-test/src/types.ts +0 -12
- package/ext/permissionless.js/packages/permissionless-test/src/utils.ts +0 -1091
- package/ext/permissionless.js/packages/wagmi/CHANGELOG.md +0 -53
- package/ext/permissionless.js/packages/wagmi/README.md +0 -93
- package/ext/permissionless.js/packages/wagmi/context.ts +0 -22
- package/ext/permissionless.js/packages/wagmi/hooks/useAvailableCapabilities.ts +0 -43
- package/ext/permissionless.js/packages/wagmi/hooks/useSendTransaction.ts +0 -164
- package/ext/permissionless.js/packages/wagmi/hooks/useWaitForTransactionReceipt.ts +0 -427
- package/ext/permissionless.js/packages/wagmi/index.ts +0 -15
- package/ext/permissionless.js/packages/wagmi/package.json +0 -26
- package/ext/permissionless.js/packages/wagmi/utils/observe.ts +0 -76
- package/ext/permissionless.js/packages/wagmi-demo/README.md +0 -1
- package/ext/permissionless.js/packages/wagmi-demo/biome.json +0 -13
- package/ext/permissionless.js/packages/wagmi-demo/index.html +0 -12
- package/ext/permissionless.js/packages/wagmi-demo/package.json +0 -16
- package/ext/permissionless.js/packages/wagmi-demo/src/App.tsx +0 -98
- package/ext/permissionless.js/packages/wagmi-demo/src/PasskeyServerDemo.tsx +0 -286
- package/ext/permissionless.js/packages/wagmi-demo/src/PasskeysDemo.tsx +0 -457
- package/ext/permissionless.js/packages/wagmi-demo/src/index.css +0 -21
- package/ext/permissionless.js/packages/wagmi-demo/src/main.tsx +0 -275
- package/ext/permissionless.js/packages/wagmi-demo/src/vite-env.d.ts +0 -1
- package/ext/permissionless.js/packages/wagmi-demo/src/wagmi.ts +0 -33
- package/ext/permissionless.js/packages/wagmi-demo/tsconfig.json +0 -25
- package/ext/permissionless.js/packages/wagmi-demo/tsconfig.node.json +0 -12
- package/ext/permissionless.js/packages/wagmi-demo/vite.config.ts +0 -7
- package/ext/permissionless.js/tsconfig/tsconfig.base.json +0 -42
- package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.cjs.json +0 -11
- package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.esm.json +0 -9
- package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.json +0 -17
- package/ext/permissionless.js/tsconfig/tsconfig.mock-paymaster.types.json +0 -13
- package/ext/permissionless.js/tsconfig/tsconfig.permissionless.cjs.json +0 -11
- package/ext/permissionless.js/tsconfig/tsconfig.permissionless.esm.json +0 -9
- package/ext/permissionless.js/tsconfig/tsconfig.permissionless.json +0 -18
- package/ext/permissionless.js/tsconfig/tsconfig.permissionless.types.json +0 -13
- package/ext/permissionless.js/tsconfig/tsconfig.wagmi.esm.json +0 -8
- package/ext/permissionless.js/tsconfig/tsconfig.wagmi.json +0 -19
- package/ext/permissionless.js/tsconfig/tsconfig.wagmi.types.json +0 -12
- package/packages/community/package.json +0 -22
- package/packages/community/src/index.ts +0 -306
- package/packages/community/tsconfig.json +0 -8
- package/packages/core/src/abis/PaymasterV4_2.json +0 -1183
- package/packages/core/src/abis/aPNTs.json +0 -1173
- package/packages/core/src/contract-versions.ts +0 -374
- package/packages/enduser/package.json +0 -21
- package/packages/enduser/src/index.ts +0 -138
- package/packages/enduser/tsconfig.json +0 -8
- package/packages/operator/package.json +0 -21
- package/packages/operator/src/index.ts +0 -172
- package/packages/operator/tsconfig.json +0 -8
- package/run_full_regression.sh +0 -215
- package/scripts/validate_environment.ts +0 -140
- /package/{extract_addresses_to_env.sh → scripts/dev_tools/extract_addresses_to_env.sh} +0 -0
- /package/{final_safe_harmonize.py → scripts/dev_tools/final_safe_harmonize.py} +0 -0
- /package/{safe_harmonize.py → scripts/dev_tools/safe_harmonize.py} +0 -0
- /package/{surgical_harmonize.py → scripts/dev_tools/surgical_harmonize.py} +0 -0
|
@@ -0,0 +1,1971 @@
|
|
|
1
|
+
## Classes
|
|
2
|
+
|
|
3
|
+
### FinanceClient
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/tokens/src/index.ts:31](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L31)
|
|
6
|
+
|
|
7
|
+
#### Constructors
|
|
8
|
+
|
|
9
|
+
##### Constructor
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
new FinanceClient(publicClient, walletClient): FinanceClient;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Defined in: [packages/tokens/src/index.ts:32](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L32)
|
|
16
|
+
|
|
17
|
+
###### Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `publicClient` | \{ `account`: `undefined`; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `call`: (`parameters`) => `Promise`\<`CallReturnType`\>; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `createAccessList`: (`parameters`) => `Promise`\<\{ `accessList`: `AccessList`; `gasUsed`: `bigint`; \}\>; `createBlockFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${string}` ``[] \| `RpcLog`[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>; `createContractEventFilter`: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`CreateContractEventFilterReturnType`\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>; `createEventFilter`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>; `createPendingTransactionFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${string}` ``[] \| `RpcLog`[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>; `estimateContractGas`: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>; `estimateFeesPerGas`: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<`EstimateFeesPerGasReturnType`\<`type`\>\>; `estimateGas`: (`args`) => `Promise`\<`bigint`\>; `estimateMaxPriorityFeePerGas`: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `undefined`, `PublicRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `PublicActions`\<`Transport`, `Chain` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getBalance`: (`args`) => `Promise`\<`bigint`\>; `getBlobBaseFee`: () => `Promise`\<`bigint`\>; `getBlock`: \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? ( \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: `Withdrawal`[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>; `getBlockNumber`: (`args?`) => `Promise`\<`bigint`\>; `getBlockTransactionCount`: (`args?`) => `Promise`\<`number`\>; `getBytecode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getChainId`: () => `Promise`\<`number`\>; `getCode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getContractEvents`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetContractEventsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getEip712Domain`: (`args`) => `Promise`\<`GetEip712DomainReturnType`\>; `getEnsAddress`: (`args`) => `Promise`\<`GetEnsAddressReturnType`\>; `getEnsAvatar`: (`args`) => `Promise`\<`GetEnsAvatarReturnType`\>; `getEnsName`: (`args`) => `Promise`\<`GetEnsNameReturnType`\>; `getEnsResolver`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `getEnsText`: (`args`) => `Promise`\<`GetEnsTextReturnType`\>; `getFeeHistory`: (`args`) => `Promise`\<`GetFeeHistoryReturnType`\>; `getFilterChanges`: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterChangesReturnType`\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getFilterLogs`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterLogsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getGasPrice`: () => `Promise`\<`bigint`\>; `getLogs`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<`GetLogsReturnType`\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>; `getProof`: (`args`) => `Promise`\<`GetProofReturnType`\>; `getStorageAt`: (`args`) => `Promise`\<`GetStorageAtReturnType`\>; `getTransaction`: \<`blockTag`\>(`args`) => `Promise`\< \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>; `getTransactionConfirmations`: (`args`) => `Promise`\<`bigint`\>; `getTransactionCount`: (`args`) => `Promise`\<`number`\>; `getTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `key`: `string`; `multicall`: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<`MulticallReturnType`\<`contracts`, `allowFailure`\>\>; `name`: `string`; `pollingInterval`: `number`; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `readContract`: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<`ReadContractReturnType`\<`abi`, `functionName`, `args`\>\>; `request`: `EIP1193RequestFn`\<`PublicRpcSchema`\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `simulate`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateBlocks`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateCalls`: \<`calls`\>(`args`) => `Promise`\<`SimulateCallsReturnType`\<`calls`\>\>; `simulateContract`: \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`SimulateContractReturnType`\<`abi`, `functionName`, `args`, `Chain` \| `undefined`, `Account` \| `undefined`, `chainOverride`, `accountOverride`\>\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `uninstallFilter`: (`args`) => `Promise`\<`boolean`\>; `verifyHash`: (`args`) => `Promise`\<`boolean`\>; `verifyMessage`: (`args`) => `Promise`\<`boolean`\>; `verifySiweMessage`: (`args`) => `Promise`\<`boolean`\>; `verifyTypedData`: (`args`) => `Promise`\<`boolean`\>; `waitForTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `watchBlockNumber`: (`args`) => `WatchBlockNumberReturnType`; `watchBlocks`: \<`includeTransactions`, `blockTag`\>(`args`) => `WatchBlocksReturnType`; `watchContractEvent`: \<`abi`, `eventName`, `strict`\>(`args`) => `WatchContractEventReturnType`; `watchEvent`: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => `WatchEventReturnType`; `watchPendingTransactions`: (`args`) => `WatchPendingTransactionsReturnType`; \} | - |
|
|
22
|
+
| `publicClient.account` | `undefined` | The Account of the Client. |
|
|
23
|
+
| `publicClient.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
24
|
+
| `publicClient.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
25
|
+
| `publicClient.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
26
|
+
| `publicClient.call` | (`parameters`) => `Promise`\<`CallReturnType`\> | Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })` |
|
|
27
|
+
| `publicClient.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
28
|
+
| `publicClient.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
29
|
+
| `publicClient.createAccessList` | (`parameters`) => `Promise`\<\{ `accessList`: `AccessList`; `gasUsed`: `bigint`; \}\> | Creates an EIP-2930 access list that you can include in a transaction. - Docs: https://viem.sh/docs/actions/public/createAccessList - JSON-RPC Methods: `eth_createAccessList` **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.createAccessList({ data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })` |
|
|
30
|
+
| `publicClient.createBlockFilter` | () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${string}` ``[] \| `RpcLog`[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\> | Creates a Filter to listen for new block hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges). - Docs: https://viem.sh/docs/actions/public/createBlockFilter - JSON-RPC Methods: [`eth_newBlockFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newBlockFilter) **Example** `import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }` |
|
|
31
|
+
| `publicClient.createContractEventFilter` | \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`CreateContractEventFilterReturnType`\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\> | Creates a Filter to retrieve event logs that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges) or [`getFilterLogs`](https://viem.sh/docs/actions/public/getFilterLogs). - Docs: https://viem.sh/docs/contract/createContractEventFilter **Example** `import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })` |
|
|
32
|
+
| `publicClient.createEventFilter` | \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\> | Creates a [`Filter`](https://viem.sh/docs/glossary/types#filter) to listen for new events that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges). - Docs: https://viem.sh/docs/actions/public/createEventFilter - JSON-RPC Methods: [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })` |
|
|
33
|
+
| `publicClient.createPendingTransactionFilter` | () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `` `0x${string}` ``[] \| `RpcLog`[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${string}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\> | Creates a Filter to listen for new pending transaction hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges). - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter - JSON-RPC Methods: [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }` |
|
|
34
|
+
| `publicClient.estimateContractGas` | \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\> | Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas **Remarks** Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`estimateGas` action](https://viem.sh/docs/actions/public/estimateGas) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). **Example** `import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })` |
|
|
35
|
+
| `publicClient.estimateFeesPerGas` | \<`chainOverride`, `type`\>(`args?`) => `Promise`\<`EstimateFeesPerGasReturnType`\<`type`\>\> | Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }` |
|
|
36
|
+
| `publicClient.estimateGas` | (`args`) => `Promise`\<`bigint`\> | Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas) **Example** `import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
37
|
+
| `publicClient.estimateMaxPriorityFeePerGas` | \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\> | Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n` |
|
|
38
|
+
| `publicClient.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
39
|
+
| `publicClient.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `undefined`, `PublicRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `PublicActions`\<`Transport`, `Chain` \| `undefined`\>\> | - |
|
|
40
|
+
| `publicClient.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
41
|
+
| `publicClient.getBalance` | (`args`) => `Promise`\<`bigint`\> | Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance) **Remarks** You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther). `const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942"` **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)` |
|
|
42
|
+
| `publicClient.getBlobBaseFee` | () => `Promise`\<`bigint`\> | Returns the base fee per blob gas in wei. - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee - JSON-RPC Methods: [`eth_blobBaseFee`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blobBaseFee) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getBlobBaseFee } from 'viem/public' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blobBaseFee = await client.getBlobBaseFee()` |
|
|
43
|
+
| `publicClient.getBlock` | \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? ( \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: `Withdrawal`[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\> | Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks - JSON-RPC Methods: - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`. - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()` |
|
|
44
|
+
| `publicClient.getBlockNumber` | (`args?`) => `Promise`\<`bigint`\> | Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n` |
|
|
45
|
+
| `publicClient.getBlockTransactionCount` | (`args?`) => `Promise`\<`number`\> | Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount - JSON-RPC Methods: - Calls [`eth_getBlockTransactionCountByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber) for `blockNumber` & `blockTag`. - Calls [`eth_getBlockTransactionCountByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash) for `blockHash`. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()` |
|
|
46
|
+
| `publicClient.getBytecode` | (`args`) => `Promise`\<`GetCodeReturnType`\> | **Deprecated** Use `getCode` instead. |
|
|
47
|
+
| `publicClient.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1` |
|
|
48
|
+
| `publicClient.getCode` | (`args`) => `Promise`\<`GetCodeReturnType`\> | Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getCode - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getCode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })` |
|
|
49
|
+
| `publicClient.getContractEvents` | \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetContractEventsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\> | Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })` |
|
|
50
|
+
| `publicClient.getEip712Domain` | (`args`) => `Promise`\<`GetEip712DomainReturnType`\> | Reads the EIP-712 domain from a contract, based on the ERC-5267 specification. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const domain = await client.getEip712Domain({ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', }) // { // domain: { // name: 'ExampleContract', // version: '1', // chainId: 1, // verifyingContract: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // }, // fields: '0x0f', // extensions: [], // }` |
|
|
51
|
+
| `publicClient.getEnsAddress` | (`args`) => `Promise`\<`GetEnsAddressReturnType`\> | Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens **Remarks** Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wevm.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'` |
|
|
52
|
+
| `publicClient.getEnsAvatar` | (`args`) => `Promise`\<`GetEnsAvatarReturnType`\> | Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens **Remarks** Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText) with `key` set to `'avatar'`. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wevm.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'` |
|
|
53
|
+
| `publicClient.getEnsName` | (`args`) => `Promise`\<`GetEnsNameReturnType`\> | Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens **Remarks** Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wevm.eth'` |
|
|
54
|
+
| `publicClient.getEnsResolver` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens **Remarks** Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wevm.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'` |
|
|
55
|
+
| `publicClient.getEnsText` | (`args`) => `Promise`\<`GetEnsTextReturnType`\> | Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens **Remarks** Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', }) // 'wevm_dev'` |
|
|
56
|
+
| `publicClient.getFeeHistory` | (`args`) => `Promise`\<`GetFeeHistoryReturnType`\> | Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory - JSON-RPC Methods: [`eth_feeHistory`](https://docs.alchemy.com/reference/eth-feehistory) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })` |
|
|
57
|
+
| `publicClient.getFilterChanges` | \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterChangesReturnType`\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\> | Returns a list of logs or hashes based on a [Filter](/docs/glossary/terms#filter) since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges) **Remarks** A Filter can be created from the following actions: - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter) - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter) - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter) - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter) Depending on the type of filter, the return value will be different: - If the filter was created with `createContractEventFilter` or `createEventFilter`, it returns a list of logs. - If the filter was created with `createPendingTransactionFilter`, it returns a list of transaction hashes. - If the filter was created with `createBlockFilter`, it returns a list of block hashes. **Examples** `// Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter })` `// Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter })` `// Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter })` `// Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })` |
|
|
58
|
+
| `publicClient.getFilterLogs` | \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterLogsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\> | Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs) **Remarks** `getFilterLogs` is only compatible with **event filters**. **Example** `import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })` |
|
|
59
|
+
| `publicClient.getGasPrice` | () => `Promise`\<`bigint`\> | Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()` |
|
|
60
|
+
| `publicClient.getLogs` | \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<`GetLogsReturnType`\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\> | Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) **Example** `import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()` |
|
|
61
|
+
| `publicClient.getProof` | (`args`) => `Promise`\<`GetProofReturnType`\> | Returns the account and storage values of the specified account including the Merkle-proof. - Docs: https://viem.sh/docs/actions/public/getProof - JSON-RPC Methods: - Calls [`eth_getProof`](https://eips.ethereum.org/EIPS/eip-1186) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getProof({ address: '0x...', storageKeys: ['0x...'], })` |
|
|
62
|
+
| `publicClient.getStorageAt` | (`args`) => `Promise`\<`GetStorageAtReturnType`\> | Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt - JSON-RPC Methods: [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })` |
|
|
63
|
+
| `publicClient.getTransaction` | \<`blockTag`\>(`args`) => `Promise`\< \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\> | Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })` |
|
|
64
|
+
| `publicClient.getTransactionConfirmations` | (`args`) => `Promise`\<`bigint`\> | Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })` |
|
|
65
|
+
| `publicClient.getTransactionCount` | (`args`) => `Promise`\<`number`\> | Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
66
|
+
| `publicClient.getTransactionReceipt` | (`args`) => `Promise`\<`TransactionReceipt`\> | Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })` |
|
|
67
|
+
| `publicClient.key` | `string` | A key for the client. |
|
|
68
|
+
| `publicClient.multicall` | \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<`MulticallReturnType`\<`contracts`, `allowFailure`\>\> | Similar to [`readContract`](https://viem.sh/docs/contract/readContract), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall). - Docs: https://viem.sh/docs/contract/multicall **Example** `import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]` |
|
|
69
|
+
| `publicClient.name` | `string` | A name for the client. |
|
|
70
|
+
| `publicClient.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
71
|
+
| `publicClient.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
72
|
+
| `publicClient.readContract` | \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<`ReadContractReturnType`\<`abi`, `functionName`, `args`\>\> | Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts **Remarks** A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). **Example** `import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n` |
|
|
73
|
+
| `publicClient.request` | `EIP1193RequestFn`\<`PublicRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
74
|
+
| `publicClient.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
75
|
+
| `publicClient.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
76
|
+
| `publicClient.simulate` | \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\> | **Deprecated** Use `simulateBlocks` instead. |
|
|
77
|
+
| `publicClient.simulateBlocks` | \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\> | Simulates a set of calls on block(s) with optional block and state overrides. **Example** `import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateBlocks({ blocks: [{ blockOverrides: { number: 69420n, }, calls: [{ { account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929', data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }, }], stateOverrides: [{ address: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929', balance: parseEther('10'), }], }] })` |
|
|
78
|
+
| `publicClient.simulateCalls` | \<`calls`\>(`args`) => `Promise`\<`SimulateCallsReturnType`\<`calls`\>\> | Simulates a set of calls. **Example** `import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateCalls({ account: '0x5a0b54d5dc17e482fe8b0bdca5320161b95fb929', calls: [{ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }, ] })` |
|
|
79
|
+
| `publicClient.simulateContract` | \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`SimulateContractReturnType`\<`abi`, `functionName`, `args`, `Chain` \| `undefined`, `Account` \| `undefined`, `chainOverride`, `accountOverride`\>\> | Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts **Remarks** This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions. Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
80
|
+
| `publicClient.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
81
|
+
| `publicClient.type` | `string` | The type of client. |
|
|
82
|
+
| `publicClient.uid` | `string` | A unique ID for the client. |
|
|
83
|
+
| `publicClient.uninstallFilter` | (`args`) => `Promise`\<`boolean`\> | Destroys a Filter that was created from one of the following Actions: - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter) - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter) - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter) - Docs: https://viem.sh/docs/actions/public/uninstallFilter - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true` |
|
|
84
|
+
| `publicClient.verifyHash` | (`args`) => `Promise`\<`boolean`\> | Verify that a hash was signed by the provided address. - Docs [https://viem.sh/docs/actions/public/verifyHash](https://viem.sh/docs/actions/public/verifyHash) |
|
|
85
|
+
| `publicClient.verifyMessage` | (`args`) => `Promise`\<`boolean`\> | Verify that a message was signed by the provided address. Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492). - Docs [https://viem.sh/docs/actions/public/verifyMessage](https://viem.sh/docs/actions/public/verifyMessage) |
|
|
86
|
+
| `publicClient.verifySiweMessage` | (`args`) => `Promise`\<`boolean`\> | Verifies [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) formatted message was signed. Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492). - Docs [https://viem.sh/docs/siwe/actions/verifySiweMessage](https://viem.sh/docs/siwe/actions/verifySiweMessage) |
|
|
87
|
+
| `publicClient.verifyTypedData` | (`args`) => `Promise`\<`boolean`\> | Verify that typed data was signed by the provided address. - Docs [https://viem.sh/docs/actions/public/verifyTypedData](https://viem.sh/docs/actions/public/verifyTypedData) |
|
|
88
|
+
| `publicClient.waitForTransactionReceipt` | (`args`) => `Promise`\<`TransactionReceipt`\> | Waits for the [Transaction](https://viem.sh/docs/glossary/terms#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt). If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed. - If a Transaction has been replaced: - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt). **Remarks** The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`) - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`) - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`) **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })` |
|
|
89
|
+
| `publicClient.watchBlockNumber` | (`args`) => `WatchBlockNumberReturnType` | Watches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks - JSON-RPC Methods: - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval. - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })` |
|
|
90
|
+
| `publicClient.watchBlocks` | \<`includeTransactions`, `blockTag`\>(`args`) => `WatchBlocksReturnType` | Watches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks - JSON-RPC Methods: - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval. - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })` |
|
|
91
|
+
| `publicClient.watchContractEvent` | \<`abi`, `eventName`, `strict`\>(`args`) => `WatchContractEventReturnType` | Watches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent **Remarks** This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent#onLogs). `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead. **Example** `import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })` |
|
|
92
|
+
| `publicClient.watchEvent` | \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => `WatchEventReturnType` | Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms#event-log). - Docs: https://viem.sh/docs/actions/public/watchEvent - JSON-RPC Methods: - **RPC Provider supports `eth_newFilter`:** - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize). - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges). - **RPC Provider does not support `eth_newFilter`:** - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval. **Remarks** This Action will batch up all the Event Logs found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchEvent#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/actions/public/watchEvent#onLogs). `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/actions/public/createEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead. **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })` |
|
|
93
|
+
| `publicClient.watchPendingTransactions` | (`args`) => `WatchPendingTransactionsReturnType` | Watches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions - JSON-RPC Methods: - When `poll: true` - Calls [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) to initialize the filter. - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval. - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event. **Remarks** This Action will batch up all the pending transactions found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchPendingTransactions#pollinginterval-optional), and invoke them via [`onTransactions`](https://viem.sh/docs/actions/public/watchPendingTransactions#ontransactions). **Example** `import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })` |
|
|
94
|
+
| `walletClient` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
95
|
+
| `walletClient.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
96
|
+
| `walletClient.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
97
|
+
| `walletClient.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
98
|
+
| `walletClient.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
99
|
+
| `walletClient.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
100
|
+
| `walletClient.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
101
|
+
| `walletClient.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
102
|
+
| `walletClient.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
103
|
+
| `walletClient.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
104
|
+
| `walletClient.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
105
|
+
| `walletClient.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
106
|
+
| `walletClient.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
107
|
+
| `walletClient.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
108
|
+
| `walletClient.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
109
|
+
| `walletClient.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
110
|
+
| `walletClient.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
111
|
+
| `walletClient.key` | `string` | A key for the client. |
|
|
112
|
+
| `walletClient.name` | `string` | A name for the client. |
|
|
113
|
+
| `walletClient.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
114
|
+
| `walletClient.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
115
|
+
| `walletClient.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
116
|
+
| `walletClient.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
117
|
+
| `walletClient.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
118
|
+
| `walletClient.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
119
|
+
| `walletClient.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
120
|
+
| `walletClient.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
121
|
+
| `walletClient.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
122
|
+
| `walletClient.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
123
|
+
| `walletClient.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
124
|
+
| `walletClient.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
125
|
+
| `walletClient.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
126
|
+
| `walletClient.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
127
|
+
| `walletClient.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
128
|
+
| `walletClient.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
129
|
+
| `walletClient.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
130
|
+
| `walletClient.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
131
|
+
| `walletClient.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
132
|
+
| `walletClient.type` | `string` | The type of client. |
|
|
133
|
+
| `walletClient.uid` | `string` | A unique ID for the client. |
|
|
134
|
+
| `walletClient.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
135
|
+
| `walletClient.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
136
|
+
| `walletClient.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
137
|
+
| `walletClient.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
138
|
+
|
|
139
|
+
###### Returns
|
|
140
|
+
|
|
141
|
+
[`FinanceClient`](#financeclient)
|
|
142
|
+
|
|
143
|
+
#### Methods
|
|
144
|
+
|
|
145
|
+
##### approveAndStake()
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
approveAndStake(amount): Promise<`0x${string}`>;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Defined in: [packages/tokens/src/index.ts:169](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L169)
|
|
152
|
+
|
|
153
|
+
One-step stake: Approve (if needed) + Stake
|
|
154
|
+
|
|
155
|
+
###### Parameters
|
|
156
|
+
|
|
157
|
+
| Parameter | Type | Description |
|
|
158
|
+
| ------ | ------ | ------ |
|
|
159
|
+
| `amount` | `bigint` | Amount of GToken to stake |
|
|
160
|
+
|
|
161
|
+
###### Returns
|
|
162
|
+
|
|
163
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
164
|
+
|
|
165
|
+
Transaction hash of the stake action
|
|
166
|
+
|
|
167
|
+
##### getAPNTsBalance()
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
getAPNTsBalance(address): Promise<bigint>;
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Defined in: [packages/tokens/src/index.ts:153](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L153)
|
|
174
|
+
|
|
175
|
+
Get aPNTs balance
|
|
176
|
+
|
|
177
|
+
###### Parameters
|
|
178
|
+
|
|
179
|
+
| Parameter | Type |
|
|
180
|
+
| ------ | ------ |
|
|
181
|
+
| `address` | `` `0x${string}` `` |
|
|
182
|
+
|
|
183
|
+
###### Returns
|
|
184
|
+
|
|
185
|
+
`Promise`\<`bigint`\>
|
|
186
|
+
|
|
187
|
+
##### getCirculatingSupply()
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
getCirculatingSupply(): Promise<{
|
|
191
|
+
circulating: bigint;
|
|
192
|
+
locked: bigint;
|
|
193
|
+
total: bigint;
|
|
194
|
+
}>;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Defined in: [packages/tokens/src/index.ts:207](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L207)
|
|
198
|
+
|
|
199
|
+
Get circulating supply (total - locked)
|
|
200
|
+
|
|
201
|
+
###### Returns
|
|
202
|
+
|
|
203
|
+
`Promise`\<\{
|
|
204
|
+
`circulating`: `bigint`;
|
|
205
|
+
`locked`: `bigint`;
|
|
206
|
+
`total`: `bigint`;
|
|
207
|
+
\}\>
|
|
208
|
+
|
|
209
|
+
##### getGTokenBalance()
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
getGTokenBalance(address): Promise<bigint>;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Defined in: [packages/tokens/src/index.ts:140](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L140)
|
|
216
|
+
|
|
217
|
+
Get GToken balance
|
|
218
|
+
|
|
219
|
+
###### Parameters
|
|
220
|
+
|
|
221
|
+
| Parameter | Type |
|
|
222
|
+
| ------ | ------ |
|
|
223
|
+
| `address` | `` `0x${string}` `` |
|
|
224
|
+
|
|
225
|
+
###### Returns
|
|
226
|
+
|
|
227
|
+
`Promise`\<`bigint`\>
|
|
228
|
+
|
|
229
|
+
##### getTokenomicsOverview()
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
getTokenomicsOverview(): Promise<{
|
|
233
|
+
circulatingSupply: bigint;
|
|
234
|
+
stakingRatio: number;
|
|
235
|
+
totalBurned: bigint;
|
|
236
|
+
totalStaked: bigint;
|
|
237
|
+
totalSupply: bigint;
|
|
238
|
+
}>;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Defined in: [packages/tokens/src/index.ts:234](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L234)
|
|
242
|
+
|
|
243
|
+
Get comprehensive tokenomics data
|
|
244
|
+
|
|
245
|
+
###### Returns
|
|
246
|
+
|
|
247
|
+
`Promise`\<\{
|
|
248
|
+
`circulatingSupply`: `bigint`;
|
|
249
|
+
`stakingRatio`: `number`;
|
|
250
|
+
`totalBurned`: `bigint`;
|
|
251
|
+
`totalStaked`: `bigint`;
|
|
252
|
+
`totalSupply`: `bigint`;
|
|
253
|
+
\}\>
|
|
254
|
+
|
|
255
|
+
##### ~~depositToEntryPoint()~~
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
static depositToEntryPoint(
|
|
259
|
+
wallet,
|
|
260
|
+
entryPoint,
|
|
261
|
+
paymaster,
|
|
262
|
+
amount): Promise<`0x${string}`>;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Defined in: [packages/tokens/src/index.ts:92](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L92)
|
|
266
|
+
|
|
267
|
+
###### Parameters
|
|
268
|
+
|
|
269
|
+
| Parameter | Type | Description |
|
|
270
|
+
| ------ | ------ | ------ |
|
|
271
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
272
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
273
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
274
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
275
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
276
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
277
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
278
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
279
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
280
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
281
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
282
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
283
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
284
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
285
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
286
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
287
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
288
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
289
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
290
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
291
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
292
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
293
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
294
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
295
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
296
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
297
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
298
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
299
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
300
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
301
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
302
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
303
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
304
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
305
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
306
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
307
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
308
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
309
|
+
| `wallet.type` | `string` | The type of client. |
|
|
310
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
311
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
312
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
313
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
314
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
315
|
+
| `entryPoint` | `` `0x${string}` `` | - |
|
|
316
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
317
|
+
| `amount` | `bigint` | - |
|
|
318
|
+
|
|
319
|
+
###### Returns
|
|
320
|
+
|
|
321
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
322
|
+
|
|
323
|
+
###### Deprecated
|
|
324
|
+
|
|
325
|
+
Use instance methods instead
|
|
326
|
+
|
|
327
|
+
##### ~~depositToPaymaster()~~
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
static depositToPaymaster(
|
|
331
|
+
wallet,
|
|
332
|
+
paymaster,
|
|
333
|
+
amount): Promise<`0x${string}`>;
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Defined in: [packages/tokens/src/index.ts:40](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L40)
|
|
337
|
+
|
|
338
|
+
###### Parameters
|
|
339
|
+
|
|
340
|
+
| Parameter | Type | Description |
|
|
341
|
+
| ------ | ------ | ------ |
|
|
342
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
343
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
344
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
345
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
346
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
347
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
348
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
349
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
350
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
351
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
352
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
353
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
354
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
355
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
356
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
357
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
358
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
359
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
360
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
361
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
362
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
363
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
364
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
365
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
366
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
367
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
368
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
369
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
370
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
371
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
372
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
373
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
374
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
375
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
376
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
377
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
378
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
379
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
380
|
+
| `wallet.type` | `string` | The type of client. |
|
|
381
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
382
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
383
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
384
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
385
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
386
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
387
|
+
| `amount` | `bigint` | - |
|
|
388
|
+
|
|
389
|
+
###### Returns
|
|
390
|
+
|
|
391
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
392
|
+
|
|
393
|
+
###### Deprecated
|
|
394
|
+
|
|
395
|
+
Use instance methods instead
|
|
396
|
+
|
|
397
|
+
##### ~~depositViaTransferAndCall()~~
|
|
398
|
+
|
|
399
|
+
```ts
|
|
400
|
+
static depositViaTransferAndCall(
|
|
401
|
+
wallet,
|
|
402
|
+
token,
|
|
403
|
+
paymaster,
|
|
404
|
+
amount): Promise<`0x${string}`>;
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Defined in: [packages/tokens/src/index.ts:51](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L51)
|
|
408
|
+
|
|
409
|
+
###### Parameters
|
|
410
|
+
|
|
411
|
+
| Parameter | Type | Description |
|
|
412
|
+
| ------ | ------ | ------ |
|
|
413
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
414
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
415
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
416
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
417
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
418
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
419
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
420
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
421
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
422
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
423
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
424
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
425
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
426
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
427
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
428
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
429
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
430
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
431
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
432
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
433
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
434
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
435
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
436
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
437
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
438
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
439
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
440
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
441
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
442
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
443
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
444
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
445
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
446
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
447
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
448
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
449
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
450
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
451
|
+
| `wallet.type` | `string` | The type of client. |
|
|
452
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
453
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
454
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
455
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
456
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
457
|
+
| `token` | `` `0x${string}` `` | - |
|
|
458
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
459
|
+
| `amount` | `bigint` | - |
|
|
460
|
+
|
|
461
|
+
###### Returns
|
|
462
|
+
|
|
463
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
464
|
+
|
|
465
|
+
###### Deprecated
|
|
466
|
+
|
|
467
|
+
Use instance methods instead
|
|
468
|
+
|
|
469
|
+
##### ~~getEntryPointBalance()~~
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
static getEntryPointBalance(
|
|
473
|
+
client,
|
|
474
|
+
entryPoint,
|
|
475
|
+
account): Promise<bigint>;
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Defined in: [packages/tokens/src/index.ts:104](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L104)
|
|
479
|
+
|
|
480
|
+
###### Parameters
|
|
481
|
+
|
|
482
|
+
| Parameter | Type |
|
|
483
|
+
| ------ | ------ |
|
|
484
|
+
| `client` | `any` |
|
|
485
|
+
| `entryPoint` | `` `0x${string}` `` |
|
|
486
|
+
| `account` | `` `0x${string}` `` |
|
|
487
|
+
|
|
488
|
+
###### Returns
|
|
489
|
+
|
|
490
|
+
`Promise`\<`bigint`\>
|
|
491
|
+
|
|
492
|
+
###### Deprecated
|
|
493
|
+
|
|
494
|
+
Use instance methods instead
|
|
495
|
+
|
|
496
|
+
##### ~~operatorDeposit()~~
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
static operatorDeposit(
|
|
500
|
+
wallet,
|
|
501
|
+
paymaster,
|
|
502
|
+
amount): Promise<`0x${string}`>;
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Defined in: [packages/tokens/src/index.ts:114](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L114)
|
|
506
|
+
|
|
507
|
+
###### Parameters
|
|
508
|
+
|
|
509
|
+
| Parameter | Type | Description |
|
|
510
|
+
| ------ | ------ | ------ |
|
|
511
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
512
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
513
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
514
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
515
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
516
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
517
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
518
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
519
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
520
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
521
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
522
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
523
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
524
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
525
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
526
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
527
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
528
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
529
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
530
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
531
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
532
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
533
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
534
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
535
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
536
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
537
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
538
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
539
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
540
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
541
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
542
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
543
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
544
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
545
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
546
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
547
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
548
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
549
|
+
| `wallet.type` | `string` | The type of client. |
|
|
550
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
551
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
552
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
553
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
554
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
555
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
556
|
+
| `amount` | `bigint` | - |
|
|
557
|
+
|
|
558
|
+
###### Returns
|
|
559
|
+
|
|
560
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
561
|
+
|
|
562
|
+
###### Deprecated
|
|
563
|
+
|
|
564
|
+
Use instance methods instead
|
|
565
|
+
|
|
566
|
+
##### ~~operatorNotifyDeposit()~~
|
|
567
|
+
|
|
568
|
+
```ts
|
|
569
|
+
static operatorNotifyDeposit(
|
|
570
|
+
wallet,
|
|
571
|
+
paymaster,
|
|
572
|
+
amount): Promise<`0x${string}`>;
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Defined in: [packages/tokens/src/index.ts:125](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L125)
|
|
576
|
+
|
|
577
|
+
###### Parameters
|
|
578
|
+
|
|
579
|
+
| Parameter | Type | Description |
|
|
580
|
+
| ------ | ------ | ------ |
|
|
581
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
582
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
583
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
584
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
585
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
586
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
587
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
588
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
589
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
590
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
591
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
592
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
593
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
594
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
595
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
596
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
597
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
598
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
599
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
600
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
601
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
602
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
603
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
604
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
605
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
606
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
607
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
608
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
609
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
610
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
611
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
612
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
613
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
614
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
615
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
616
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
617
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
618
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
619
|
+
| `wallet.type` | `string` | The type of client. |
|
|
620
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
621
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
622
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
623
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
624
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
625
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
626
|
+
| `amount` | `bigint` | - |
|
|
627
|
+
|
|
628
|
+
###### Returns
|
|
629
|
+
|
|
630
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
631
|
+
|
|
632
|
+
###### Deprecated
|
|
633
|
+
|
|
634
|
+
Use instance methods instead
|
|
635
|
+
|
|
636
|
+
##### ~~stakeGToken()~~
|
|
637
|
+
|
|
638
|
+
```ts
|
|
639
|
+
static stakeGToken(
|
|
640
|
+
wallet,
|
|
641
|
+
stakingAddr,
|
|
642
|
+
amount): Promise<`0x${string}`>;
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
Defined in: [packages/tokens/src/index.ts:70](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L70)
|
|
646
|
+
|
|
647
|
+
###### Parameters
|
|
648
|
+
|
|
649
|
+
| Parameter | Type | Description |
|
|
650
|
+
| ------ | ------ | ------ |
|
|
651
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
652
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
653
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
654
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
655
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
656
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
657
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
658
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
659
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
660
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
661
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
662
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
663
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
664
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
665
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
666
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
667
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
668
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
669
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
670
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
671
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
672
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
673
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
674
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
675
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
676
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
677
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
678
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
679
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
680
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
681
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
682
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
683
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
684
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
685
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
686
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
687
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
688
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
689
|
+
| `wallet.type` | `string` | The type of client. |
|
|
690
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
691
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
692
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
693
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
694
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
695
|
+
| `stakingAddr` | `` `0x${string}` `` | - |
|
|
696
|
+
| `amount` | `bigint` | - |
|
|
697
|
+
|
|
698
|
+
###### Returns
|
|
699
|
+
|
|
700
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
701
|
+
|
|
702
|
+
###### Deprecated
|
|
703
|
+
|
|
704
|
+
Use instance methods instead
|
|
705
|
+
|
|
706
|
+
##### ~~withdrawProtocolRevenue()~~
|
|
707
|
+
|
|
708
|
+
```ts
|
|
709
|
+
static withdrawProtocolRevenue(
|
|
710
|
+
wallet,
|
|
711
|
+
paymaster,
|
|
712
|
+
to,
|
|
713
|
+
amount): Promise<`0x${string}`>;
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
Defined in: [packages/tokens/src/index.ts:81](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/tokens/src/index.ts#L81)
|
|
717
|
+
|
|
718
|
+
###### Parameters
|
|
719
|
+
|
|
720
|
+
| Parameter | Type | Description |
|
|
721
|
+
| ------ | ------ | ------ |
|
|
722
|
+
| `wallet` | \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} | - |
|
|
723
|
+
| `wallet.account` | `Account` \| `undefined` | The Account of the Client. |
|
|
724
|
+
| `wallet.addChain` | (`args`) => `Promise`\<`void`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085) **Example** `import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })` |
|
|
725
|
+
| `wallet.batch?` | \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \} | Flags for batch settings. |
|
|
726
|
+
| `wallet.batch.multicall?` | \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \} | Toggle to enable `eth_call` multicall aggregation. |
|
|
727
|
+
| `wallet.cacheTime` | `number` | Time (in ms) that cached data will remain in memory. |
|
|
728
|
+
| `wallet.ccipRead?` | \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \} | [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration. |
|
|
729
|
+
| `wallet.chain` | `Chain` \| `undefined` | Chain for the client. |
|
|
730
|
+
| `wallet.deployContract` | \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_deploying-contracts **Example** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })` |
|
|
731
|
+
| `wallet.experimental_blockTag?` | `BlockTag` | Default block tag to use for RPC requests. |
|
|
732
|
+
| `wallet.extend` | \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\> | - |
|
|
733
|
+
| `wallet.fillTransaction` | \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\> | Fills a transaction request with the necessary fields to be signed over. - Docs: https://viem.sh/docs/actions/public/fillTransaction **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const result = await client.fillTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })` |
|
|
734
|
+
| `wallet.getAddresses` | () => `Promise`\<`GetAddressesReturnType`\> | Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()` |
|
|
735
|
+
| `wallet.getCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Returns the status of a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await client.getCallsStatus({ id: '0xdeadbeef' })` |
|
|
736
|
+
| `wallet.getCapabilities` | \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: "supported" \| "ready" \| "unsupported" \}; paymasterService?: \{ supported: boolean \}; unstable\_addSubAccount?: \{ keyTypes: ((...) \| (...) \| (...) \| (...))\[\]; supported: boolean \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \}\>, number\>)\[K\] \}\> | Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc). - Docs: https://viem.sh/docs/actions/wallet/getCapabilities - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const capabilities = await client.getCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
737
|
+
| `wallet.getChainId` | () => `Promise`\<`number`\> | Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) **Example** `import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1` |
|
|
738
|
+
| `wallet.getPermissions` | () => `Promise`\<`GetPermissionsReturnType`\> | Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()` |
|
|
739
|
+
| `wallet.key` | `string` | A key for the client. |
|
|
740
|
+
| `wallet.name` | `string` | A name for the client. |
|
|
741
|
+
| `wallet.pollingInterval` | `number` | Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. |
|
|
742
|
+
| `wallet.prepareAuthorization` | (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\> | Prepares an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object for signing. This Action will fill the required fields of the Authorization object if they are not provided (e.g. `nonce` and `chainId`). With the prepared Authorization object, you can use [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) to sign over the Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const authorization = await client.prepareAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
743
|
+
| `wallet.prepareTransactionRequest` | \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<UnionOmit\<(...), (...)\> & ((...) extends (...) ? (...) : (...)) & ((...) extends (...) ? (...) : (...)), IsNever\<(...)\> extends true ? unknown : ExactPartial\<(...)\>\> & \{ chainId?: number \}, ParameterTypeToParameters\<request\["parameters"\] extends readonly PrepareTransactionRequestParameterType\[\] ? any\[any\]\[number\] : "type" \| "nonce" \| "chainId" \| "gas" \| "fees" \| "blobVersionedHashes"\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\> | Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })` |
|
|
744
|
+
| `wallet.request` | `EIP1193RequestFn`\<`WalletRpcSchema`\> | Request function wrapped with friendly error handling |
|
|
745
|
+
| `wallet.requestAddresses` | () => `Promise`\<`RequestAddressesReturnType`\> | Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102) Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()` |
|
|
746
|
+
| `wallet.requestPermissions` | (`args`) => `Promise`\<`RequestPermissionsReturnType`\> | Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })` |
|
|
747
|
+
| `wallet.sendCalls` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\> | Requests the connected wallet to send a batch of calls. - Docs: https://viem.sh/docs/actions/wallet/sendCalls - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const id = await client.sendCalls({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
748
|
+
| `wallet.sendCallsSync` | \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Requests the connected wallet to send a batch of calls, and waits for the calls to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendCallsSync - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const status = await client.sendCallsSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', calls: [ { data: '0xdeadbeef', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 69420n, }, ], })` |
|
|
749
|
+
| `wallet.sendRawTransaction` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Sends a **signed** transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
750
|
+
| `wallet.sendRawTransactionSync` | (`args`) => `Promise`\<`TransactionReceipt`\> | Sends a **signed** transaction to the network synchronously, and waits for the transaction to be included in a block. - Docs: https://viem.sh/docs/actions/wallet/sendRawTransactionSync - JSON-RPC Method: [`eth_sendRawTransactionSync`](https://eips.ethereum.org/EIPS/eip-7966) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransactionSync } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendRawTransactionSync({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })` |
|
|
751
|
+
| `wallet.sendTransaction` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
752
|
+
| `wallet.sendTransactionSync` | \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Creates, signs, and sends a new transaction to the network synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/actions/wallet/sendTransactionSync - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.sendTransactionSync({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const receipt = await client.sendTransactionSync({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })` |
|
|
753
|
+
| `wallet.showCallsStatus` | (`parameters`) => `Promise`\<`void`\> | Requests for the wallet to show information about a call batch that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.showCallsStatus({ id: '0xdeadbeef' })` |
|
|
754
|
+
| `wallet.signAuthorization` | (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\> | Signs an [EIP-7702 Authorization](https://eips.ethereum.org/EIPS/eip-7702) object. With the calculated signature, you can: - use [`verifyAuthorization`](https://viem.sh/docs/eip7702/verifyAuthorization) to verify the signed Authorization object, - use [`recoverAuthorizationAddress`](https://viem.sh/docs/eip7702/recoverAuthorizationAddress) to recover the signing address from the signed Authorization object. **Examples** `import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ account: privateKeyToAccount('0x..'), contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signAuthorization({ contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })` |
|
|
755
|
+
| `wallet.signMessage` | (`args`) => `Promise`\<`` `0x${string}` ``\> | Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign) - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature, - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })` |
|
|
756
|
+
| `wallet.signTransaction` | \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\> | Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)` |
|
|
757
|
+
| `wallet.signTypedData` | \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4) - Local Accounts: Signs locally. No JSON-RPC request. **Examples** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` `// Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })` |
|
|
758
|
+
| `wallet.switchChain` | (`args`) => `Promise`\<`void`\> | Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })` |
|
|
759
|
+
| `wallet.transport` | `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\> | The RPC transport |
|
|
760
|
+
| `wallet.type` | `string` | The type of client. |
|
|
761
|
+
| `wallet.uid` | `string` | A unique ID for the client. |
|
|
762
|
+
| `wallet.waitForCallsStatus` | (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\> | Waits for the status & receipts of a call bundle that was sent via `sendCalls`. - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { receipts, status } = await waitForCallsStatus(client, { id: '0xdeadbeef' })` |
|
|
763
|
+
| `wallet.watchAsset` | (`args`) => `Promise`\<`boolean`\> | Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747) **Example** `import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })` |
|
|
764
|
+
| `wallet.writeContract` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\> | Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Examples** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` `// With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)` |
|
|
765
|
+
| `wallet.writeContractSync` | \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\> | Executes a write function on a contract synchronously. Returns the transaction receipt. - Docs: https://viem.sh/docs/contract/writeContract A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state. Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData). __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__ **Example** `import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const receipt = await client.writeContractSync({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], })` |
|
|
766
|
+
| `paymaster` | `` `0x${string}` `` | - |
|
|
767
|
+
| `to` | `` `0x${string}` `` | - |
|
|
768
|
+
| `amount` | `bigint` | - |
|
|
769
|
+
|
|
770
|
+
###### Returns
|
|
771
|
+
|
|
772
|
+
`Promise`\<`` `0x${string}` ``\>
|
|
773
|
+
|
|
774
|
+
###### Deprecated
|
|
775
|
+
|
|
776
|
+
Use instance methods instead
|
|
777
|
+
|
|
778
|
+
## Type Aliases
|
|
779
|
+
|
|
780
|
+
### TokenActions
|
|
781
|
+
|
|
782
|
+
```ts
|
|
783
|
+
type TokenActions = object;
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
Defined in: [packages/core/src/actions/tokens.ts:5](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L5)
|
|
787
|
+
|
|
788
|
+
#### Properties
|
|
789
|
+
|
|
790
|
+
##### tokenAddAutoApprovedSpender()
|
|
791
|
+
|
|
792
|
+
```ts
|
|
793
|
+
tokenAddAutoApprovedSpender: (args) => Promise<Hash>;
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
Defined in: [packages/core/src/actions/tokens.ts:38](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L38)
|
|
797
|
+
|
|
798
|
+
###### Parameters
|
|
799
|
+
|
|
800
|
+
| Parameter | Type |
|
|
801
|
+
| ------ | ------ |
|
|
802
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `spender`: `Address`; `token`: `Address`; \} |
|
|
803
|
+
| `args.account?` | `Account` \| `Address` |
|
|
804
|
+
| `args.spender` | `Address` |
|
|
805
|
+
| `args.token` | `Address` |
|
|
806
|
+
|
|
807
|
+
###### Returns
|
|
808
|
+
|
|
809
|
+
`Promise`\<`Hash`\>
|
|
810
|
+
|
|
811
|
+
##### tokenAllowance()
|
|
812
|
+
|
|
813
|
+
```ts
|
|
814
|
+
tokenAllowance: (args) => Promise<bigint>;
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
Defined in: [packages/core/src/actions/tokens.ts:14](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L14)
|
|
818
|
+
|
|
819
|
+
###### Parameters
|
|
820
|
+
|
|
821
|
+
| Parameter | Type |
|
|
822
|
+
| ------ | ------ |
|
|
823
|
+
| `args` | \{ `owner`: `Address`; `spender`: `Address`; `token`: `Address`; \} |
|
|
824
|
+
| `args.owner` | `Address` |
|
|
825
|
+
| `args.spender` | `Address` |
|
|
826
|
+
| `args.token` | `Address` |
|
|
827
|
+
|
|
828
|
+
###### Returns
|
|
829
|
+
|
|
830
|
+
`Promise`\<`bigint`\>
|
|
831
|
+
|
|
832
|
+
##### tokenApprove()
|
|
833
|
+
|
|
834
|
+
```ts
|
|
835
|
+
tokenApprove: (args) => Promise<Hash>;
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
Defined in: [packages/core/src/actions/tokens.ts:13](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L13)
|
|
839
|
+
|
|
840
|
+
###### Parameters
|
|
841
|
+
|
|
842
|
+
| Parameter | Type |
|
|
843
|
+
| ------ | ------ |
|
|
844
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `spender`: `Address`; `token`: `Address`; \} |
|
|
845
|
+
| `args.account?` | `Account` \| `Address` |
|
|
846
|
+
| `args.amount` | `bigint` |
|
|
847
|
+
| `args.spender` | `Address` |
|
|
848
|
+
| `args.token` | `Address` |
|
|
849
|
+
|
|
850
|
+
###### Returns
|
|
851
|
+
|
|
852
|
+
`Promise`\<`Hash`\>
|
|
853
|
+
|
|
854
|
+
##### tokenAutoApprovedSpenders()
|
|
855
|
+
|
|
856
|
+
```ts
|
|
857
|
+
tokenAutoApprovedSpenders: (args) => Promise<boolean>;
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
Defined in: [packages/core/src/actions/tokens.ts:66](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L66)
|
|
861
|
+
|
|
862
|
+
###### Parameters
|
|
863
|
+
|
|
864
|
+
| Parameter | Type |
|
|
865
|
+
| ------ | ------ |
|
|
866
|
+
| `args` | \{ `spender`: `Address`; `token`: `Address`; \} |
|
|
867
|
+
| `args.spender` | `Address` |
|
|
868
|
+
| `args.token` | `Address` |
|
|
869
|
+
|
|
870
|
+
###### Returns
|
|
871
|
+
|
|
872
|
+
`Promise`\<`boolean`\>
|
|
873
|
+
|
|
874
|
+
##### tokenBalanceOf()
|
|
875
|
+
|
|
876
|
+
```ts
|
|
877
|
+
tokenBalanceOf: (args) => Promise<bigint>;
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
Defined in: [packages/core/src/actions/tokens.ts:8](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L8)
|
|
881
|
+
|
|
882
|
+
###### Parameters
|
|
883
|
+
|
|
884
|
+
| Parameter | Type |
|
|
885
|
+
| ------ | ------ |
|
|
886
|
+
| `args` | \{ `account`: `Address`; `token`: `Address`; \} |
|
|
887
|
+
| `args.account` | `Address` |
|
|
888
|
+
| `args.token` | `Address` |
|
|
889
|
+
|
|
890
|
+
###### Returns
|
|
891
|
+
|
|
892
|
+
`Promise`\<`bigint`\>
|
|
893
|
+
|
|
894
|
+
##### tokenBurn()
|
|
895
|
+
|
|
896
|
+
```ts
|
|
897
|
+
tokenBurn: (args) => Promise<Hash>;
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
Defined in: [packages/core/src/actions/tokens.ts:18](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L18)
|
|
901
|
+
|
|
902
|
+
###### Parameters
|
|
903
|
+
|
|
904
|
+
| Parameter | Type |
|
|
905
|
+
| ------ | ------ |
|
|
906
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `token`: `Address`; \} |
|
|
907
|
+
| `args.account?` | `Account` \| `Address` |
|
|
908
|
+
| `args.amount` | `bigint` |
|
|
909
|
+
| `args.token` | `Address` |
|
|
910
|
+
|
|
911
|
+
###### Returns
|
|
912
|
+
|
|
913
|
+
`Promise`\<`Hash`\>
|
|
914
|
+
|
|
915
|
+
##### tokenBurnFrom()
|
|
916
|
+
|
|
917
|
+
```ts
|
|
918
|
+
tokenBurnFrom: (args) => Promise<Hash>;
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
Defined in: [packages/core/src/actions/tokens.ts:19](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L19)
|
|
922
|
+
|
|
923
|
+
###### Parameters
|
|
924
|
+
|
|
925
|
+
| Parameter | Type |
|
|
926
|
+
| ------ | ------ |
|
|
927
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `from`: `Address`; `token`: `Address`; \} |
|
|
928
|
+
| `args.account?` | `Account` \| `Address` |
|
|
929
|
+
| `args.amount` | `bigint` |
|
|
930
|
+
| `args.from` | `Address` |
|
|
931
|
+
| `args.token` | `Address` |
|
|
932
|
+
|
|
933
|
+
###### Returns
|
|
934
|
+
|
|
935
|
+
`Promise`\<`Hash`\>
|
|
936
|
+
|
|
937
|
+
##### tokenBurnFromWithOpHash()
|
|
938
|
+
|
|
939
|
+
```ts
|
|
940
|
+
tokenBurnFromWithOpHash: (args) => Promise<Hash>;
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
Defined in: [packages/core/src/actions/tokens.ts:67](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L67)
|
|
944
|
+
|
|
945
|
+
###### Parameters
|
|
946
|
+
|
|
947
|
+
| Parameter | Type |
|
|
948
|
+
| ------ | ------ |
|
|
949
|
+
| `args` | \{ `account`: `Address`; `amount`: `bigint`; `opHash`: `Hex`; `token`: `Address`; `userOpAccount?`: `Account` \| `Address`; \} |
|
|
950
|
+
| `args.account` | `Address` |
|
|
951
|
+
| `args.amount` | `bigint` |
|
|
952
|
+
| `args.opHash` | `Hex` |
|
|
953
|
+
| `args.token` | `Address` |
|
|
954
|
+
| `args.userOpAccount?` | `Account` \| `Address` |
|
|
955
|
+
|
|
956
|
+
###### Returns
|
|
957
|
+
|
|
958
|
+
`Promise`\<`Hash`\>
|
|
959
|
+
|
|
960
|
+
##### tokenCap()
|
|
961
|
+
|
|
962
|
+
```ts
|
|
963
|
+
tokenCap: (args) => Promise<bigint>;
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
Defined in: [packages/core/src/actions/tokens.ts:9](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L9)
|
|
967
|
+
|
|
968
|
+
###### Parameters
|
|
969
|
+
|
|
970
|
+
| Parameter | Type |
|
|
971
|
+
| ------ | ------ |
|
|
972
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
973
|
+
| `args.token` | `Address` |
|
|
974
|
+
|
|
975
|
+
###### Returns
|
|
976
|
+
|
|
977
|
+
`Promise`\<`bigint`\>
|
|
978
|
+
|
|
979
|
+
##### tokenCommunityENS()
|
|
980
|
+
|
|
981
|
+
```ts
|
|
982
|
+
tokenCommunityENS: (args) => Promise<string>;
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
Defined in: [packages/core/src/actions/tokens.ts:52](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L52)
|
|
986
|
+
|
|
987
|
+
###### Parameters
|
|
988
|
+
|
|
989
|
+
| Parameter | Type |
|
|
990
|
+
| ------ | ------ |
|
|
991
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
992
|
+
| `args.token` | `Address` |
|
|
993
|
+
|
|
994
|
+
###### Returns
|
|
995
|
+
|
|
996
|
+
`Promise`\<`string`\>
|
|
997
|
+
|
|
998
|
+
##### tokenCommunityName()
|
|
999
|
+
|
|
1000
|
+
```ts
|
|
1001
|
+
tokenCommunityName: (args) => Promise<string>;
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
Defined in: [packages/core/src/actions/tokens.ts:51](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L51)
|
|
1005
|
+
|
|
1006
|
+
###### Parameters
|
|
1007
|
+
|
|
1008
|
+
| Parameter | Type |
|
|
1009
|
+
| ------ | ------ |
|
|
1010
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1011
|
+
| `args.token` | `Address` |
|
|
1012
|
+
|
|
1013
|
+
###### Returns
|
|
1014
|
+
|
|
1015
|
+
`Promise`\<`string`\>
|
|
1016
|
+
|
|
1017
|
+
##### tokenCommunityOwner()
|
|
1018
|
+
|
|
1019
|
+
```ts
|
|
1020
|
+
tokenCommunityOwner: (args) => Promise<Address>;
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
Defined in: [packages/core/src/actions/tokens.ts:68](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L68)
|
|
1024
|
+
|
|
1025
|
+
###### Parameters
|
|
1026
|
+
|
|
1027
|
+
| Parameter | Type |
|
|
1028
|
+
| ------ | ------ |
|
|
1029
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1030
|
+
| `args.token` | `Address` |
|
|
1031
|
+
|
|
1032
|
+
###### Returns
|
|
1033
|
+
|
|
1034
|
+
`Promise`\<`Address`\>
|
|
1035
|
+
|
|
1036
|
+
##### tokenCumulativeSpent()
|
|
1037
|
+
|
|
1038
|
+
```ts
|
|
1039
|
+
tokenCumulativeSpent: (args) => Promise<bigint>;
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
Defined in: [packages/core/src/actions/tokens.ts:56](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L56)
|
|
1043
|
+
|
|
1044
|
+
###### Parameters
|
|
1045
|
+
|
|
1046
|
+
| Parameter | Type |
|
|
1047
|
+
| ------ | ------ |
|
|
1048
|
+
| `args` | \{ `token`: `Address`; `user`: `Address`; \} |
|
|
1049
|
+
| `args.token` | `Address` |
|
|
1050
|
+
| `args.user` | `Address` |
|
|
1051
|
+
|
|
1052
|
+
###### Returns
|
|
1053
|
+
|
|
1054
|
+
`Promise`\<`bigint`\>
|
|
1055
|
+
|
|
1056
|
+
##### tokenDebts()
|
|
1057
|
+
|
|
1058
|
+
```ts
|
|
1059
|
+
tokenDebts: (args) => Promise<bigint>;
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
Defined in: [packages/core/src/actions/tokens.ts:57](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L57)
|
|
1063
|
+
|
|
1064
|
+
###### Parameters
|
|
1065
|
+
|
|
1066
|
+
| Parameter | Type |
|
|
1067
|
+
| ------ | ------ |
|
|
1068
|
+
| `args` | \{ `token`: `Address`; `user`: `Address`; \} |
|
|
1069
|
+
| `args.token` | `Address` |
|
|
1070
|
+
| `args.user` | `Address` |
|
|
1071
|
+
|
|
1072
|
+
###### Returns
|
|
1073
|
+
|
|
1074
|
+
`Promise`\<`bigint`\>
|
|
1075
|
+
|
|
1076
|
+
##### tokenDecimals()
|
|
1077
|
+
|
|
1078
|
+
```ts
|
|
1079
|
+
tokenDecimals: (args) => Promise<number>;
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
Defined in: [packages/core/src/actions/tokens.ts:24](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L24)
|
|
1083
|
+
|
|
1084
|
+
###### Parameters
|
|
1085
|
+
|
|
1086
|
+
| Parameter | Type |
|
|
1087
|
+
| ------ | ------ |
|
|
1088
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1089
|
+
| `args.token` | `Address` |
|
|
1090
|
+
|
|
1091
|
+
###### Returns
|
|
1092
|
+
|
|
1093
|
+
`Promise`\<`number`\>
|
|
1094
|
+
|
|
1095
|
+
##### tokenDEFAULT\_SPENDING\_LIMIT\_APNTS()
|
|
1096
|
+
|
|
1097
|
+
```ts
|
|
1098
|
+
tokenDEFAULT_SPENDING_LIMIT_APNTS: (args) => Promise<bigint>;
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
Defined in: [packages/core/src/actions/tokens.ts:74](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L74)
|
|
1102
|
+
|
|
1103
|
+
###### Parameters
|
|
1104
|
+
|
|
1105
|
+
| Parameter | Type |
|
|
1106
|
+
| ------ | ------ |
|
|
1107
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1108
|
+
| `args.token` | `Address` |
|
|
1109
|
+
|
|
1110
|
+
###### Returns
|
|
1111
|
+
|
|
1112
|
+
`Promise`\<`bigint`\>
|
|
1113
|
+
|
|
1114
|
+
##### tokenDefaultSpendingLimitXPNTs()
|
|
1115
|
+
|
|
1116
|
+
```ts
|
|
1117
|
+
tokenDefaultSpendingLimitXPNTs: (args) => Promise<bigint>;
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
Defined in: [packages/core/src/actions/tokens.ts:55](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L55)
|
|
1121
|
+
|
|
1122
|
+
###### Parameters
|
|
1123
|
+
|
|
1124
|
+
| Parameter | Type |
|
|
1125
|
+
| ------ | ------ |
|
|
1126
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1127
|
+
| `args.token` | `Address` |
|
|
1128
|
+
|
|
1129
|
+
###### Returns
|
|
1130
|
+
|
|
1131
|
+
`Promise`\<`bigint`\>
|
|
1132
|
+
|
|
1133
|
+
##### tokenDOMAIN\_SEPARATOR()
|
|
1134
|
+
|
|
1135
|
+
```ts
|
|
1136
|
+
tokenDOMAIN_SEPARATOR: (args) => Promise<Hex>;
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1139
|
+
Defined in: [packages/core/src/actions/tokens.ts:61](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L61)
|
|
1140
|
+
|
|
1141
|
+
###### Parameters
|
|
1142
|
+
|
|
1143
|
+
| Parameter | Type |
|
|
1144
|
+
| ------ | ------ |
|
|
1145
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1146
|
+
| `args.token` | `Address` |
|
|
1147
|
+
|
|
1148
|
+
###### Returns
|
|
1149
|
+
|
|
1150
|
+
`Promise`\<`Hex`\>
|
|
1151
|
+
|
|
1152
|
+
##### tokenEip712Domain()
|
|
1153
|
+
|
|
1154
|
+
```ts
|
|
1155
|
+
tokenEip712Domain: (args) => Promise<any>;
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
Defined in: [packages/core/src/actions/tokens.ts:69](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L69)
|
|
1159
|
+
|
|
1160
|
+
###### Parameters
|
|
1161
|
+
|
|
1162
|
+
| Parameter | Type |
|
|
1163
|
+
| ------ | ------ |
|
|
1164
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1165
|
+
| `args.token` | `Address` |
|
|
1166
|
+
|
|
1167
|
+
###### Returns
|
|
1168
|
+
|
|
1169
|
+
`Promise`\<`any`\>
|
|
1170
|
+
|
|
1171
|
+
##### tokenExchangeRate()
|
|
1172
|
+
|
|
1173
|
+
```ts
|
|
1174
|
+
tokenExchangeRate: (args) => Promise<bigint>;
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
Defined in: [packages/core/src/actions/tokens.ts:53](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L53)
|
|
1178
|
+
|
|
1179
|
+
###### Parameters
|
|
1180
|
+
|
|
1181
|
+
| Parameter | Type |
|
|
1182
|
+
| ------ | ------ |
|
|
1183
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1184
|
+
| `args.token` | `Address` |
|
|
1185
|
+
|
|
1186
|
+
###### Returns
|
|
1187
|
+
|
|
1188
|
+
`Promise`\<`bigint`\>
|
|
1189
|
+
|
|
1190
|
+
##### tokenFACTORY()
|
|
1191
|
+
|
|
1192
|
+
```ts
|
|
1193
|
+
tokenFACTORY: (args) => Promise<Address>;
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
Defined in: [packages/core/src/actions/tokens.ts:44](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L44)
|
|
1197
|
+
|
|
1198
|
+
###### Parameters
|
|
1199
|
+
|
|
1200
|
+
| Parameter | Type |
|
|
1201
|
+
| ------ | ------ |
|
|
1202
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1203
|
+
| `args.token` | `Address` |
|
|
1204
|
+
|
|
1205
|
+
###### Returns
|
|
1206
|
+
|
|
1207
|
+
`Promise`\<`Address`\>
|
|
1208
|
+
|
|
1209
|
+
##### tokenGetDebt()
|
|
1210
|
+
|
|
1211
|
+
```ts
|
|
1212
|
+
tokenGetDebt: (args) => Promise<bigint>;
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
Defined in: [packages/core/src/actions/tokens.ts:33](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L33)
|
|
1216
|
+
|
|
1217
|
+
###### Parameters
|
|
1218
|
+
|
|
1219
|
+
| Parameter | Type |
|
|
1220
|
+
| ------ | ------ |
|
|
1221
|
+
| `args` | \{ `token`: `Address`; `user`: `Address`; \} |
|
|
1222
|
+
| `args.token` | `Address` |
|
|
1223
|
+
| `args.user` | `Address` |
|
|
1224
|
+
|
|
1225
|
+
###### Returns
|
|
1226
|
+
|
|
1227
|
+
`Promise`\<`bigint`\>
|
|
1228
|
+
|
|
1229
|
+
##### tokenGetDefaultSpendingLimitXPNTs()
|
|
1230
|
+
|
|
1231
|
+
```ts
|
|
1232
|
+
tokenGetDefaultSpendingLimitXPNTs: (args) => Promise<bigint>;
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
Defined in: [packages/core/src/actions/tokens.ts:70](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L70)
|
|
1236
|
+
|
|
1237
|
+
###### Parameters
|
|
1238
|
+
|
|
1239
|
+
| Parameter | Type |
|
|
1240
|
+
| ------ | ------ |
|
|
1241
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1242
|
+
| `args.token` | `Address` |
|
|
1243
|
+
|
|
1244
|
+
###### Returns
|
|
1245
|
+
|
|
1246
|
+
`Promise`\<`bigint`\>
|
|
1247
|
+
|
|
1248
|
+
##### tokenGetMetadata()
|
|
1249
|
+
|
|
1250
|
+
```ts
|
|
1251
|
+
tokenGetMetadata: (args) => Promise<string>;
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
Defined in: [packages/core/src/actions/tokens.ts:71](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L71)
|
|
1255
|
+
|
|
1256
|
+
###### Parameters
|
|
1257
|
+
|
|
1258
|
+
| Parameter | Type |
|
|
1259
|
+
| ------ | ------ |
|
|
1260
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1261
|
+
| `args.token` | `Address` |
|
|
1262
|
+
|
|
1263
|
+
###### Returns
|
|
1264
|
+
|
|
1265
|
+
`Promise`\<`string`\>
|
|
1266
|
+
|
|
1267
|
+
##### tokenIsAutoApprovedSpender()
|
|
1268
|
+
|
|
1269
|
+
```ts
|
|
1270
|
+
tokenIsAutoApprovedSpender: (args) => Promise<boolean>;
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
Defined in: [packages/core/src/actions/tokens.ts:40](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L40)
|
|
1274
|
+
|
|
1275
|
+
###### Parameters
|
|
1276
|
+
|
|
1277
|
+
| Parameter | Type |
|
|
1278
|
+
| ------ | ------ |
|
|
1279
|
+
| `args` | \{ `spender`: `Address`; `token`: `Address`; \} |
|
|
1280
|
+
| `args.spender` | `Address` |
|
|
1281
|
+
| `args.token` | `Address` |
|
|
1282
|
+
|
|
1283
|
+
###### Returns
|
|
1284
|
+
|
|
1285
|
+
`Promise`\<`boolean`\>
|
|
1286
|
+
|
|
1287
|
+
##### tokenMint()
|
|
1288
|
+
|
|
1289
|
+
```ts
|
|
1290
|
+
tokenMint: (args) => Promise<Hash>;
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1293
|
+
Defined in: [packages/core/src/actions/tokens.ts:17](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L17)
|
|
1294
|
+
|
|
1295
|
+
###### Parameters
|
|
1296
|
+
|
|
1297
|
+
| Parameter | Type |
|
|
1298
|
+
| ------ | ------ |
|
|
1299
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `to`: `Address`; `token`: `Address`; \} |
|
|
1300
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1301
|
+
| `args.amount` | `bigint` |
|
|
1302
|
+
| `args.to` | `Address` |
|
|
1303
|
+
| `args.token` | `Address` |
|
|
1304
|
+
|
|
1305
|
+
###### Returns
|
|
1306
|
+
|
|
1307
|
+
`Promise`\<`Hash`\>
|
|
1308
|
+
|
|
1309
|
+
##### tokenName()
|
|
1310
|
+
|
|
1311
|
+
```ts
|
|
1312
|
+
tokenName: (args) => Promise<string>;
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
Defined in: [packages/core/src/actions/tokens.ts:22](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L22)
|
|
1316
|
+
|
|
1317
|
+
###### Parameters
|
|
1318
|
+
|
|
1319
|
+
| Parameter | Type |
|
|
1320
|
+
| ------ | ------ |
|
|
1321
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1322
|
+
| `args.token` | `Address` |
|
|
1323
|
+
|
|
1324
|
+
###### Returns
|
|
1325
|
+
|
|
1326
|
+
`Promise`\<`string`\>
|
|
1327
|
+
|
|
1328
|
+
##### tokenNeedsApproval()
|
|
1329
|
+
|
|
1330
|
+
```ts
|
|
1331
|
+
tokenNeedsApproval: (args) => Promise<boolean>;
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
Defined in: [packages/core/src/actions/tokens.ts:72](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L72)
|
|
1335
|
+
|
|
1336
|
+
###### Parameters
|
|
1337
|
+
|
|
1338
|
+
| Parameter | Type |
|
|
1339
|
+
| ------ | ------ |
|
|
1340
|
+
| `args` | \{ `amount`: `bigint`; `owner`: `Address`; `spender`: `Address`; `token`: `Address`; \} |
|
|
1341
|
+
| `args.amount` | `bigint` |
|
|
1342
|
+
| `args.owner` | `Address` |
|
|
1343
|
+
| `args.spender` | `Address` |
|
|
1344
|
+
| `args.token` | `Address` |
|
|
1345
|
+
|
|
1346
|
+
###### Returns
|
|
1347
|
+
|
|
1348
|
+
`Promise`\<`boolean`\>
|
|
1349
|
+
|
|
1350
|
+
##### tokenNonces()
|
|
1351
|
+
|
|
1352
|
+
```ts
|
|
1353
|
+
tokenNonces: (args) => Promise<bigint>;
|
|
1354
|
+
```
|
|
1355
|
+
|
|
1356
|
+
Defined in: [packages/core/src/actions/tokens.ts:62](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L62)
|
|
1357
|
+
|
|
1358
|
+
###### Parameters
|
|
1359
|
+
|
|
1360
|
+
| Parameter | Type |
|
|
1361
|
+
| ------ | ------ |
|
|
1362
|
+
| `args` | \{ `owner`: `Address`; `token`: `Address`; \} |
|
|
1363
|
+
| `args.owner` | `Address` |
|
|
1364
|
+
| `args.token` | `Address` |
|
|
1365
|
+
|
|
1366
|
+
###### Returns
|
|
1367
|
+
|
|
1368
|
+
`Promise`\<`bigint`\>
|
|
1369
|
+
|
|
1370
|
+
##### tokenOwner()
|
|
1371
|
+
|
|
1372
|
+
```ts
|
|
1373
|
+
tokenOwner: (args) => Promise<Address>;
|
|
1374
|
+
```
|
|
1375
|
+
|
|
1376
|
+
Defined in: [packages/core/src/actions/tokens.ts:27](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L27)
|
|
1377
|
+
|
|
1378
|
+
###### Parameters
|
|
1379
|
+
|
|
1380
|
+
| Parameter | Type |
|
|
1381
|
+
| ------ | ------ |
|
|
1382
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1383
|
+
| `args.token` | `Address` |
|
|
1384
|
+
|
|
1385
|
+
###### Returns
|
|
1386
|
+
|
|
1387
|
+
`Promise`\<`Address`\>
|
|
1388
|
+
|
|
1389
|
+
##### tokenPermit()
|
|
1390
|
+
|
|
1391
|
+
```ts
|
|
1392
|
+
tokenPermit: (args) => Promise<Hash>;
|
|
1393
|
+
```
|
|
1394
|
+
|
|
1395
|
+
Defined in: [packages/core/src/actions/tokens.ts:63](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L63)
|
|
1396
|
+
|
|
1397
|
+
###### Parameters
|
|
1398
|
+
|
|
1399
|
+
| Parameter | Type |
|
|
1400
|
+
| ------ | ------ |
|
|
1401
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `deadline`: `bigint`; `owner`: `Address`; `r`: `Hex`; `s`: `Hex`; `spender`: `Address`; `token`: `Address`; `v`: `number`; `value`: `bigint`; \} |
|
|
1402
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1403
|
+
| `args.deadline` | `bigint` |
|
|
1404
|
+
| `args.owner` | `Address` |
|
|
1405
|
+
| `args.r` | `Hex` |
|
|
1406
|
+
| `args.s` | `Hex` |
|
|
1407
|
+
| `args.spender` | `Address` |
|
|
1408
|
+
| `args.token` | `Address` |
|
|
1409
|
+
| `args.v` | `number` |
|
|
1410
|
+
| `args.value` | `bigint` |
|
|
1411
|
+
|
|
1412
|
+
###### Returns
|
|
1413
|
+
|
|
1414
|
+
`Promise`\<`Hash`\>
|
|
1415
|
+
|
|
1416
|
+
##### tokenRecordDebt()
|
|
1417
|
+
|
|
1418
|
+
```ts
|
|
1419
|
+
tokenRecordDebt: (args) => Promise<Hash>;
|
|
1420
|
+
```
|
|
1421
|
+
|
|
1422
|
+
Defined in: [packages/core/src/actions/tokens.ts:73](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L73)
|
|
1423
|
+
|
|
1424
|
+
###### Parameters
|
|
1425
|
+
|
|
1426
|
+
| Parameter | Type |
|
|
1427
|
+
| ------ | ------ |
|
|
1428
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `token`: `Address`; `user`: `Address`; \} |
|
|
1429
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1430
|
+
| `args.amount` | `bigint` |
|
|
1431
|
+
| `args.token` | `Address` |
|
|
1432
|
+
| `args.user` | `Address` |
|
|
1433
|
+
|
|
1434
|
+
###### Returns
|
|
1435
|
+
|
|
1436
|
+
`Promise`\<`Hash`\>
|
|
1437
|
+
|
|
1438
|
+
##### tokenRemainingMintableSupply()
|
|
1439
|
+
|
|
1440
|
+
```ts
|
|
1441
|
+
tokenRemainingMintableSupply: (args) => Promise<bigint>;
|
|
1442
|
+
```
|
|
1443
|
+
|
|
1444
|
+
Defined in: [packages/core/src/actions/tokens.ts:10](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L10)
|
|
1445
|
+
|
|
1446
|
+
###### Parameters
|
|
1447
|
+
|
|
1448
|
+
| Parameter | Type |
|
|
1449
|
+
| ------ | ------ |
|
|
1450
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1451
|
+
| `args.token` | `Address` |
|
|
1452
|
+
|
|
1453
|
+
###### Returns
|
|
1454
|
+
|
|
1455
|
+
`Promise`\<`bigint`\>
|
|
1456
|
+
|
|
1457
|
+
##### tokenRemoveAutoApprovedSpender()
|
|
1458
|
+
|
|
1459
|
+
```ts
|
|
1460
|
+
tokenRemoveAutoApprovedSpender: (args) => Promise<Hash>;
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
Defined in: [packages/core/src/actions/tokens.ts:39](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L39)
|
|
1464
|
+
|
|
1465
|
+
###### Parameters
|
|
1466
|
+
|
|
1467
|
+
| Parameter | Type |
|
|
1468
|
+
| ------ | ------ |
|
|
1469
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `spender`: `Address`; `token`: `Address`; \} |
|
|
1470
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1471
|
+
| `args.spender` | `Address` |
|
|
1472
|
+
| `args.token` | `Address` |
|
|
1473
|
+
|
|
1474
|
+
###### Returns
|
|
1475
|
+
|
|
1476
|
+
`Promise`\<`Hash`\>
|
|
1477
|
+
|
|
1478
|
+
##### tokenRenounceOwnership()
|
|
1479
|
+
|
|
1480
|
+
```ts
|
|
1481
|
+
tokenRenounceOwnership: (args) => Promise<Hash>;
|
|
1482
|
+
```
|
|
1483
|
+
|
|
1484
|
+
Defined in: [packages/core/src/actions/tokens.ts:29](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L29)
|
|
1485
|
+
|
|
1486
|
+
###### Parameters
|
|
1487
|
+
|
|
1488
|
+
| Parameter | Type |
|
|
1489
|
+
| ------ | ------ |
|
|
1490
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `token`: `Address`; \} |
|
|
1491
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1492
|
+
| `args.token` | `Address` |
|
|
1493
|
+
|
|
1494
|
+
###### Returns
|
|
1495
|
+
|
|
1496
|
+
`Promise`\<`Hash`\>
|
|
1497
|
+
|
|
1498
|
+
##### tokenRepayDebt()
|
|
1499
|
+
|
|
1500
|
+
```ts
|
|
1501
|
+
tokenRepayDebt: (args) => Promise<Hash>;
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
Defined in: [packages/core/src/actions/tokens.ts:34](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L34)
|
|
1505
|
+
|
|
1506
|
+
###### Parameters
|
|
1507
|
+
|
|
1508
|
+
| Parameter | Type |
|
|
1509
|
+
| ------ | ------ |
|
|
1510
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `token`: `Address`; \} |
|
|
1511
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1512
|
+
| `args.amount` | `bigint` |
|
|
1513
|
+
| `args.token` | `Address` |
|
|
1514
|
+
|
|
1515
|
+
###### Returns
|
|
1516
|
+
|
|
1517
|
+
`Promise`\<`Hash`\>
|
|
1518
|
+
|
|
1519
|
+
##### tokenSetPaymasterLimit()
|
|
1520
|
+
|
|
1521
|
+
```ts
|
|
1522
|
+
tokenSetPaymasterLimit: (args) => Promise<Hash>;
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
Defined in: [packages/core/src/actions/tokens.ts:77](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L77)
|
|
1526
|
+
|
|
1527
|
+
###### Parameters
|
|
1528
|
+
|
|
1529
|
+
| Parameter | Type |
|
|
1530
|
+
| ------ | ------ |
|
|
1531
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `limit`: `bigint`; `token`: `Address`; `user`: `Address`; \} |
|
|
1532
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1533
|
+
| `args.limit` | `bigint` |
|
|
1534
|
+
| `args.token` | `Address` |
|
|
1535
|
+
| `args.user` | `Address` |
|
|
1536
|
+
|
|
1537
|
+
###### Returns
|
|
1538
|
+
|
|
1539
|
+
`Promise`\<`Hash`\>
|
|
1540
|
+
|
|
1541
|
+
##### tokenSetSuperPaymasterAddress()
|
|
1542
|
+
|
|
1543
|
+
```ts
|
|
1544
|
+
tokenSetSuperPaymasterAddress: (args) => Promise<Hash>;
|
|
1545
|
+
```
|
|
1546
|
+
|
|
1547
|
+
Defined in: [packages/core/src/actions/tokens.ts:78](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L78)
|
|
1548
|
+
|
|
1549
|
+
###### Parameters
|
|
1550
|
+
|
|
1551
|
+
| Parameter | Type |
|
|
1552
|
+
| ------ | ------ |
|
|
1553
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `superPaymaster`: `Address`; `token`: `Address`; \} |
|
|
1554
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1555
|
+
| `args.superPaymaster` | `Address` |
|
|
1556
|
+
| `args.token` | `Address` |
|
|
1557
|
+
|
|
1558
|
+
###### Returns
|
|
1559
|
+
|
|
1560
|
+
`Promise`\<`Hash`\>
|
|
1561
|
+
|
|
1562
|
+
##### tokenSpendingLimits()
|
|
1563
|
+
|
|
1564
|
+
```ts
|
|
1565
|
+
tokenSpendingLimits: (args) => Promise<bigint>;
|
|
1566
|
+
```
|
|
1567
|
+
|
|
1568
|
+
Defined in: [packages/core/src/actions/tokens.ts:54](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L54)
|
|
1569
|
+
|
|
1570
|
+
###### Parameters
|
|
1571
|
+
|
|
1572
|
+
| Parameter | Type |
|
|
1573
|
+
| ------ | ------ |
|
|
1574
|
+
| `args` | \{ `token`: `Address`; `user`: `Address`; \} |
|
|
1575
|
+
| `args.token` | `Address` |
|
|
1576
|
+
| `args.user` | `Address` |
|
|
1577
|
+
|
|
1578
|
+
###### Returns
|
|
1579
|
+
|
|
1580
|
+
`Promise`\<`bigint`\>
|
|
1581
|
+
|
|
1582
|
+
##### tokenSUPERPAYMASTER\_ADDRESS()
|
|
1583
|
+
|
|
1584
|
+
```ts
|
|
1585
|
+
tokenSUPERPAYMASTER_ADDRESS: (args) => Promise<Address>;
|
|
1586
|
+
```
|
|
1587
|
+
|
|
1588
|
+
Defined in: [packages/core/src/actions/tokens.ts:43](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L43)
|
|
1589
|
+
|
|
1590
|
+
###### Parameters
|
|
1591
|
+
|
|
1592
|
+
| Parameter | Type |
|
|
1593
|
+
| ------ | ------ |
|
|
1594
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1595
|
+
| `args.token` | `Address` |
|
|
1596
|
+
|
|
1597
|
+
###### Returns
|
|
1598
|
+
|
|
1599
|
+
`Promise`\<`Address`\>
|
|
1600
|
+
|
|
1601
|
+
##### tokenSymbol()
|
|
1602
|
+
|
|
1603
|
+
```ts
|
|
1604
|
+
tokenSymbol: (args) => Promise<string>;
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
Defined in: [packages/core/src/actions/tokens.ts:23](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L23)
|
|
1608
|
+
|
|
1609
|
+
###### Parameters
|
|
1610
|
+
|
|
1611
|
+
| Parameter | Type |
|
|
1612
|
+
| ------ | ------ |
|
|
1613
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1614
|
+
| `args.token` | `Address` |
|
|
1615
|
+
|
|
1616
|
+
###### Returns
|
|
1617
|
+
|
|
1618
|
+
`Promise`\<`string`\>
|
|
1619
|
+
|
|
1620
|
+
##### tokenTotalSupply()
|
|
1621
|
+
|
|
1622
|
+
```ts
|
|
1623
|
+
tokenTotalSupply: (args) => Promise<bigint>;
|
|
1624
|
+
```
|
|
1625
|
+
|
|
1626
|
+
Defined in: [packages/core/src/actions/tokens.ts:7](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L7)
|
|
1627
|
+
|
|
1628
|
+
###### Parameters
|
|
1629
|
+
|
|
1630
|
+
| Parameter | Type |
|
|
1631
|
+
| ------ | ------ |
|
|
1632
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1633
|
+
| `args.token` | `Address` |
|
|
1634
|
+
|
|
1635
|
+
###### Returns
|
|
1636
|
+
|
|
1637
|
+
`Promise`\<`bigint`\>
|
|
1638
|
+
|
|
1639
|
+
##### tokenTransfer()
|
|
1640
|
+
|
|
1641
|
+
```ts
|
|
1642
|
+
tokenTransfer: (args) => Promise<Hash>;
|
|
1643
|
+
```
|
|
1644
|
+
|
|
1645
|
+
Defined in: [packages/core/src/actions/tokens.ts:11](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L11)
|
|
1646
|
+
|
|
1647
|
+
###### Parameters
|
|
1648
|
+
|
|
1649
|
+
| Parameter | Type |
|
|
1650
|
+
| ------ | ------ |
|
|
1651
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `to`: `Address`; `token`: `Address`; \} |
|
|
1652
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1653
|
+
| `args.amount` | `bigint` |
|
|
1654
|
+
| `args.to` | `Address` |
|
|
1655
|
+
| `args.token` | `Address` |
|
|
1656
|
+
|
|
1657
|
+
###### Returns
|
|
1658
|
+
|
|
1659
|
+
`Promise`\<`Hash`\>
|
|
1660
|
+
|
|
1661
|
+
##### tokenTransferAndCall()
|
|
1662
|
+
|
|
1663
|
+
```ts
|
|
1664
|
+
tokenTransferAndCall: (args) => Promise<Hash>;
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
Defined in: [packages/core/src/actions/tokens.ts:35](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L35)
|
|
1668
|
+
|
|
1669
|
+
###### Parameters
|
|
1670
|
+
|
|
1671
|
+
| Parameter | Type |
|
|
1672
|
+
| ------ | ------ |
|
|
1673
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `data?`: `Hex`; `to`: `Address`; `token`: `Address`; \} |
|
|
1674
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1675
|
+
| `args.amount` | `bigint` |
|
|
1676
|
+
| `args.data?` | `Hex` |
|
|
1677
|
+
| `args.to` | `Address` |
|
|
1678
|
+
| `args.token` | `Address` |
|
|
1679
|
+
|
|
1680
|
+
###### Returns
|
|
1681
|
+
|
|
1682
|
+
`Promise`\<`Hash`\>
|
|
1683
|
+
|
|
1684
|
+
##### tokenTransferCommunityOwnership()
|
|
1685
|
+
|
|
1686
|
+
```ts
|
|
1687
|
+
tokenTransferCommunityOwnership: (args) => Promise<Hash>;
|
|
1688
|
+
```
|
|
1689
|
+
|
|
1690
|
+
Defined in: [packages/core/src/actions/tokens.ts:48](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L48)
|
|
1691
|
+
|
|
1692
|
+
###### Parameters
|
|
1693
|
+
|
|
1694
|
+
| Parameter | Type |
|
|
1695
|
+
| ------ | ------ |
|
|
1696
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `newOwner`: `Address`; `token`: `Address`; \} |
|
|
1697
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1698
|
+
| `args.newOwner` | `Address` |
|
|
1699
|
+
| `args.token` | `Address` |
|
|
1700
|
+
|
|
1701
|
+
###### Returns
|
|
1702
|
+
|
|
1703
|
+
`Promise`\<`Hash`\>
|
|
1704
|
+
|
|
1705
|
+
##### tokenTransferFrom()
|
|
1706
|
+
|
|
1707
|
+
```ts
|
|
1708
|
+
tokenTransferFrom: (args) => Promise<Hash>;
|
|
1709
|
+
```
|
|
1710
|
+
|
|
1711
|
+
Defined in: [packages/core/src/actions/tokens.ts:12](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L12)
|
|
1712
|
+
|
|
1713
|
+
###### Parameters
|
|
1714
|
+
|
|
1715
|
+
| Parameter | Type |
|
|
1716
|
+
| ------ | ------ |
|
|
1717
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `amount`: `bigint`; `from`: `Address`; `to`: `Address`; `token`: `Address`; \} |
|
|
1718
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1719
|
+
| `args.amount` | `bigint` |
|
|
1720
|
+
| `args.from` | `Address` |
|
|
1721
|
+
| `args.to` | `Address` |
|
|
1722
|
+
| `args.token` | `Address` |
|
|
1723
|
+
|
|
1724
|
+
###### Returns
|
|
1725
|
+
|
|
1726
|
+
`Promise`\<`Hash`\>
|
|
1727
|
+
|
|
1728
|
+
##### tokenTransferOwnership()
|
|
1729
|
+
|
|
1730
|
+
```ts
|
|
1731
|
+
tokenTransferOwnership: (args) => Promise<Hash>;
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
Defined in: [packages/core/src/actions/tokens.ts:47](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L47)
|
|
1735
|
+
|
|
1736
|
+
###### Parameters
|
|
1737
|
+
|
|
1738
|
+
| Parameter | Type |
|
|
1739
|
+
| ------ | ------ |
|
|
1740
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `newOwner`: `Address`; `token`: `Address`; \} |
|
|
1741
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1742
|
+
| `args.newOwner` | `Address` |
|
|
1743
|
+
| `args.token` | `Address` |
|
|
1744
|
+
|
|
1745
|
+
###### Returns
|
|
1746
|
+
|
|
1747
|
+
`Promise`\<`Hash`\>
|
|
1748
|
+
|
|
1749
|
+
##### tokenTransferTokenOwnership()
|
|
1750
|
+
|
|
1751
|
+
```ts
|
|
1752
|
+
tokenTransferTokenOwnership: (args) => Promise<Hash>;
|
|
1753
|
+
```
|
|
1754
|
+
|
|
1755
|
+
Defined in: [packages/core/src/actions/tokens.ts:28](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L28)
|
|
1756
|
+
|
|
1757
|
+
###### Parameters
|
|
1758
|
+
|
|
1759
|
+
| Parameter | Type |
|
|
1760
|
+
| ------ | ------ |
|
|
1761
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `newOwner`: `Address`; `token`: `Address`; \} |
|
|
1762
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1763
|
+
| `args.newOwner` | `Address` |
|
|
1764
|
+
| `args.token` | `Address` |
|
|
1765
|
+
|
|
1766
|
+
###### Returns
|
|
1767
|
+
|
|
1768
|
+
`Promise`\<`Hash`\>
|
|
1769
|
+
|
|
1770
|
+
##### tokenUpdateExchangeRate()
|
|
1771
|
+
|
|
1772
|
+
```ts
|
|
1773
|
+
tokenUpdateExchangeRate: (args) => Promise<Hash>;
|
|
1774
|
+
```
|
|
1775
|
+
|
|
1776
|
+
Defined in: [packages/core/src/actions/tokens.ts:32](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L32)
|
|
1777
|
+
|
|
1778
|
+
###### Parameters
|
|
1779
|
+
|
|
1780
|
+
| Parameter | Type |
|
|
1781
|
+
| ------ | ------ |
|
|
1782
|
+
| `args` | \{ `account?`: `Account` \| `Address`; `newRate`: `bigint`; `token`: `Address`; \} |
|
|
1783
|
+
| `args.account?` | `Account` \| `Address` |
|
|
1784
|
+
| `args.newRate` | `bigint` |
|
|
1785
|
+
| `args.token` | `Address` |
|
|
1786
|
+
|
|
1787
|
+
###### Returns
|
|
1788
|
+
|
|
1789
|
+
`Promise`\<`Hash`\>
|
|
1790
|
+
|
|
1791
|
+
##### tokenUsedOpHashes()
|
|
1792
|
+
|
|
1793
|
+
```ts
|
|
1794
|
+
tokenUsedOpHashes: (args) => Promise<boolean>;
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
Defined in: [packages/core/src/actions/tokens.ts:58](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L58)
|
|
1798
|
+
|
|
1799
|
+
###### Parameters
|
|
1800
|
+
|
|
1801
|
+
| Parameter | Type |
|
|
1802
|
+
| ------ | ------ |
|
|
1803
|
+
| `args` | \{ `hash`: `Hex`; `token`: `Address`; \} |
|
|
1804
|
+
| `args.hash` | `Hex` |
|
|
1805
|
+
| `args.token` | `Address` |
|
|
1806
|
+
|
|
1807
|
+
###### Returns
|
|
1808
|
+
|
|
1809
|
+
`Promise`\<`boolean`\>
|
|
1810
|
+
|
|
1811
|
+
##### tokenVersion()
|
|
1812
|
+
|
|
1813
|
+
```ts
|
|
1814
|
+
tokenVersion: (args) => Promise<string>;
|
|
1815
|
+
```
|
|
1816
|
+
|
|
1817
|
+
Defined in: [packages/core/src/actions/tokens.ts:79](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L79)
|
|
1818
|
+
|
|
1819
|
+
###### Parameters
|
|
1820
|
+
|
|
1821
|
+
| Parameter | Type |
|
|
1822
|
+
| ------ | ------ |
|
|
1823
|
+
| `args` | \{ `token`: `Address`; \} |
|
|
1824
|
+
| `args.token` | `Address` |
|
|
1825
|
+
|
|
1826
|
+
###### Returns
|
|
1827
|
+
|
|
1828
|
+
`Promise`\<`string`\>
|
|
1829
|
+
|
|
1830
|
+
## Variables
|
|
1831
|
+
|
|
1832
|
+
### CORE\_ADDRESSES
|
|
1833
|
+
|
|
1834
|
+
```ts
|
|
1835
|
+
const CORE_ADDRESSES: object;
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
Defined in: [packages/core/src/contract-addresses.ts:29](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L29)
|
|
1839
|
+
|
|
1840
|
+
Core System Addresses
|
|
1841
|
+
|
|
1842
|
+
#### Type Declaration
|
|
1843
|
+
|
|
1844
|
+
| Name | Type | Default value | Defined in |
|
|
1845
|
+
| ------ | ------ | ------ | ------ |
|
|
1846
|
+
| <a id="apnts"></a> `aPNTs` | `` `0x${string}` `` | `APNTS_ADDRESS` | [packages/core/src/contract-addresses.ts:35](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L35) |
|
|
1847
|
+
| <a id="dvtvalidator"></a> `dvtValidator` | `` `0x${string}` `` | `DVT_VALIDATOR_ADDRESS` | [packages/core/src/contract-addresses.ts:39](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L39) |
|
|
1848
|
+
| <a id="entrypoint"></a> `entryPoint` | `` `0x${string}` `` | `ENTRY_POINT_ADDRESS` | [packages/core/src/contract-addresses.ts:40](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L40) |
|
|
1849
|
+
| <a id="gtoken"></a> `gToken` | `` `0x${string}` `` | `GTOKEN_ADDRESS` | [packages/core/src/contract-addresses.ts:31](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L31) |
|
|
1850
|
+
| <a id="gtokenstaking"></a> `gTokenStaking` | `` `0x${string}` `` | `GTOKEN_STAKING_ADDRESS` | [packages/core/src/contract-addresses.ts:32](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L32) |
|
|
1851
|
+
| <a id="mysbt"></a> `mySBT` | `` `0x${string}` `` | `SBT_ADDRESS` | [packages/core/src/contract-addresses.ts:36](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L36) |
|
|
1852
|
+
| <a id="paymasterfactory"></a> `paymasterFactory` | `` `0x${string}` `` | `PAYMASTER_FACTORY_ADDRESS` | [packages/core/src/contract-addresses.ts:34](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L34) |
|
|
1853
|
+
| <a id="paymasterv4"></a> `paymasterV4` | `` `0x${string}` `` | - | [packages/core/src/contract-addresses.ts:38](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L38) |
|
|
1854
|
+
| <a id="registry"></a> `registry` | `` `0x${string}` `` | `REGISTRY_ADDRESS` | [packages/core/src/contract-addresses.ts:30](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L30) |
|
|
1855
|
+
| <a id="reputationsystem"></a> `reputationSystem` | `` `0x${string}` `` | - | [packages/core/src/contract-addresses.ts:42](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L42) |
|
|
1856
|
+
| <a id="superpaymaster"></a> `superPaymaster` | `` `0x${string}` `` | `SUPER_PAYMASTER_ADDRESS` | [packages/core/src/contract-addresses.ts:33](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L33) |
|
|
1857
|
+
| <a id="xpntsfactory"></a> `xPNTsFactory` | `` `0x${string}` `` | `XPNTS_FACTORY_ADDRESS` | [packages/core/src/contract-addresses.ts:41](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/contract-addresses.ts#L41) |
|
|
1858
|
+
|
|
1859
|
+
***
|
|
1860
|
+
|
|
1861
|
+
### GTokenABI
|
|
1862
|
+
|
|
1863
|
+
```ts
|
|
1864
|
+
const GTokenABI: any;
|
|
1865
|
+
```
|
|
1866
|
+
|
|
1867
|
+
Defined in: [packages/core/src/abis/index.ts:47](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/abis/index.ts#L47)
|
|
1868
|
+
|
|
1869
|
+
***
|
|
1870
|
+
|
|
1871
|
+
### xPNTsFactoryABI
|
|
1872
|
+
|
|
1873
|
+
```ts
|
|
1874
|
+
const xPNTsFactoryABI: any;
|
|
1875
|
+
```
|
|
1876
|
+
|
|
1877
|
+
Defined in: [packages/core/src/abis/index.ts:57](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/abis/index.ts#L57)
|
|
1878
|
+
|
|
1879
|
+
***
|
|
1880
|
+
|
|
1881
|
+
### xPNTsTokenABI
|
|
1882
|
+
|
|
1883
|
+
```ts
|
|
1884
|
+
const xPNTsTokenABI: any;
|
|
1885
|
+
```
|
|
1886
|
+
|
|
1887
|
+
Defined in: [packages/core/src/abis/index.ts:56](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/abis/index.ts#L56)
|
|
1888
|
+
|
|
1889
|
+
## Functions
|
|
1890
|
+
|
|
1891
|
+
### gTokenActions()
|
|
1892
|
+
|
|
1893
|
+
```ts
|
|
1894
|
+
function gTokenActions(): (client) => TokenActions;
|
|
1895
|
+
```
|
|
1896
|
+
|
|
1897
|
+
Defined in: [packages/core/src/actions/tokens.ts:87](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L87)
|
|
1898
|
+
|
|
1899
|
+
#### Returns
|
|
1900
|
+
|
|
1901
|
+
```ts
|
|
1902
|
+
(client): TokenActions;
|
|
1903
|
+
```
|
|
1904
|
+
|
|
1905
|
+
##### Parameters
|
|
1906
|
+
|
|
1907
|
+
| Parameter | Type |
|
|
1908
|
+
| ------ | ------ |
|
|
1909
|
+
| `client` | \| \{ `account`: `undefined`; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `call`: (`parameters`) => `Promise`\<`CallReturnType`\>; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `createAccessList`: (`parameters`) => `Promise`\<\{ `accessList`: `AccessList`; `gasUsed`: `bigint`; \}\>; `createBlockFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>; `createContractEventFilter`: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`CreateContractEventFilterReturnType`\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>; `createEventFilter`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>; `createPendingTransactionFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>; `estimateContractGas`: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>; `estimateFeesPerGas`: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<`EstimateFeesPerGasReturnType`\<`type`\>\>; `estimateGas`: (`args`) => `Promise`\<`bigint`\>; `estimateMaxPriorityFeePerGas`: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `undefined`, `PublicRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `PublicActions`\<`Transport`, `Chain` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getBalance`: (`args`) => `Promise`\<`bigint`\>; `getBlobBaseFee`: () => `Promise`\<`bigint`\>; `getBlock`: \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? ( \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId?`: ... \| ...; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"legacy"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip2930"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip1559"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly ...[]; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip4844"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip7702"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: `Withdrawal`[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>; `getBlockNumber`: (`args?`) => `Promise`\<`bigint`\>; `getBlockTransactionCount`: (`args?`) => `Promise`\<`number`\>; `getBytecode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getChainId`: () => `Promise`\<`number`\>; `getCode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getContractEvents`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetContractEventsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getEip712Domain`: (`args`) => `Promise`\<`GetEip712DomainReturnType`\>; `getEnsAddress`: (`args`) => `Promise`\<`GetEnsAddressReturnType`\>; `getEnsAvatar`: (`args`) => `Promise`\<`GetEnsAvatarReturnType`\>; `getEnsName`: (`args`) => `Promise`\<`GetEnsNameReturnType`\>; `getEnsResolver`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `getEnsText`: (`args`) => `Promise`\<`GetEnsTextReturnType`\>; `getFeeHistory`: (`args`) => `Promise`\<`GetFeeHistoryReturnType`\>; `getFilterChanges`: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterChangesReturnType`\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getFilterLogs`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterLogsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getGasPrice`: () => `Promise`\<`bigint`\>; `getLogs`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<`GetLogsReturnType`\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>; `getProof`: (`args`) => `Promise`\<`GetProofReturnType`\>; `getStorageAt`: (`args`) => `Promise`\<`GetStorageAtReturnType`\>; `getTransaction`: \<`blockTag`\>(`args`) => `Promise`\< \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>; `getTransactionConfirmations`: (`args`) => `Promise`\<`bigint`\>; `getTransactionCount`: (`args`) => `Promise`\<`number`\>; `getTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `key`: `string`; `multicall`: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<`MulticallReturnType`\<`contracts`, `allowFailure`\>\>; `name`: `string`; `pollingInterval`: `number`; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `readContract`: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<`ReadContractReturnType`\<`abi`, `functionName`, `args`\>\>; `request`: `EIP1193RequestFn`\<`PublicRpcSchema`\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `simulate`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateBlocks`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateCalls`: \<`calls`\>(`args`) => `Promise`\<`SimulateCallsReturnType`\<`calls`\>\>; `simulateContract`: \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`SimulateContractReturnType`\<`abi`, `functionName`, `args`, `Chain` \| `undefined`, `Account` \| `undefined`, `chainOverride`, `accountOverride`\>\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `uninstallFilter`: (`args`) => `Promise`\<`boolean`\>; `verifyHash`: (`args`) => `Promise`\<`boolean`\>; `verifyMessage`: (`args`) => `Promise`\<`boolean`\>; `verifySiweMessage`: (`args`) => `Promise`\<`boolean`\>; `verifyTypedData`: (`args`) => `Promise`\<`boolean`\>; `waitForTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `watchBlockNumber`: (`args`) => `WatchBlockNumberReturnType`; `watchBlocks`: \<`includeTransactions`, `blockTag`\>(`args`) => `WatchBlocksReturnType`; `watchContractEvent`: \<`abi`, `eventName`, `strict`\>(`args`) => `WatchContractEventReturnType`; `watchEvent`: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => `WatchEventReturnType`; `watchPendingTransactions`: (`args`) => `WatchPendingTransactionsReturnType`; \} \| \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: ...; paymasterService?: ...; unstable\_addSubAccount?: ...; \[key: ...\]: ... \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} |
|
|
1910
|
+
|
|
1911
|
+
##### Returns
|
|
1912
|
+
|
|
1913
|
+
[`TokenActions`](#tokenactions)
|
|
1914
|
+
|
|
1915
|
+
***
|
|
1916
|
+
|
|
1917
|
+
### tokenActions()
|
|
1918
|
+
|
|
1919
|
+
```ts
|
|
1920
|
+
function tokenActions(): (client) => TokenActions;
|
|
1921
|
+
```
|
|
1922
|
+
|
|
1923
|
+
Defined in: [packages/core/src/actions/tokens.ts:143](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/tokens.ts#L143)
|
|
1924
|
+
|
|
1925
|
+
#### Returns
|
|
1926
|
+
|
|
1927
|
+
```ts
|
|
1928
|
+
(client): TokenActions;
|
|
1929
|
+
```
|
|
1930
|
+
|
|
1931
|
+
##### Parameters
|
|
1932
|
+
|
|
1933
|
+
| Parameter | Type |
|
|
1934
|
+
| ------ | ------ |
|
|
1935
|
+
| `client` | \| \{ `account`: `undefined`; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `call`: (`parameters`) => `Promise`\<`CallReturnType`\>; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `createAccessList`: (`parameters`) => `Promise`\<\{ `accessList`: `AccessList`; `gasUsed`: `bigint`; \}\>; `createBlockFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>; `createContractEventFilter`: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`CreateContractEventFilterReturnType`\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>; `createEventFilter`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>; `createPendingTransactionFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>; `estimateContractGas`: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>; `estimateFeesPerGas`: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<`EstimateFeesPerGasReturnType`\<`type`\>\>; `estimateGas`: (`args`) => `Promise`\<`bigint`\>; `estimateMaxPriorityFeePerGas`: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `undefined`, `PublicRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `PublicActions`\<`Transport`, `Chain` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getBalance`: (`args`) => `Promise`\<`bigint`\>; `getBlobBaseFee`: () => `Promise`\<`bigint`\>; `getBlock`: \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? ( \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId?`: ... \| ...; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"legacy"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip2930"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip1559"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly ...[]; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip4844"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip7702"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: `Withdrawal`[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>; `getBlockNumber`: (`args?`) => `Promise`\<`bigint`\>; `getBlockTransactionCount`: (`args?`) => `Promise`\<`number`\>; `getBytecode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getChainId`: () => `Promise`\<`number`\>; `getCode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getContractEvents`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetContractEventsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getEip712Domain`: (`args`) => `Promise`\<`GetEip712DomainReturnType`\>; `getEnsAddress`: (`args`) => `Promise`\<`GetEnsAddressReturnType`\>; `getEnsAvatar`: (`args`) => `Promise`\<`GetEnsAvatarReturnType`\>; `getEnsName`: (`args`) => `Promise`\<`GetEnsNameReturnType`\>; `getEnsResolver`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `getEnsText`: (`args`) => `Promise`\<`GetEnsTextReturnType`\>; `getFeeHistory`: (`args`) => `Promise`\<`GetFeeHistoryReturnType`\>; `getFilterChanges`: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterChangesReturnType`\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getFilterLogs`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterLogsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getGasPrice`: () => `Promise`\<`bigint`\>; `getLogs`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<`GetLogsReturnType`\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>; `getProof`: (`args`) => `Promise`\<`GetProofReturnType`\>; `getStorageAt`: (`args`) => `Promise`\<`GetStorageAtReturnType`\>; `getTransaction`: \<`blockTag`\>(`args`) => `Promise`\< \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>; `getTransactionConfirmations`: (`args`) => `Promise`\<`bigint`\>; `getTransactionCount`: (`args`) => `Promise`\<`number`\>; `getTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `key`: `string`; `multicall`: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<`MulticallReturnType`\<`contracts`, `allowFailure`\>\>; `name`: `string`; `pollingInterval`: `number`; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `readContract`: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<`ReadContractReturnType`\<`abi`, `functionName`, `args`\>\>; `request`: `EIP1193RequestFn`\<`PublicRpcSchema`\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `simulate`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateBlocks`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateCalls`: \<`calls`\>(`args`) => `Promise`\<`SimulateCallsReturnType`\<`calls`\>\>; `simulateContract`: \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`SimulateContractReturnType`\<`abi`, `functionName`, `args`, `Chain` \| `undefined`, `Account` \| `undefined`, `chainOverride`, `accountOverride`\>\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `uninstallFilter`: (`args`) => `Promise`\<`boolean`\>; `verifyHash`: (`args`) => `Promise`\<`boolean`\>; `verifyMessage`: (`args`) => `Promise`\<`boolean`\>; `verifySiweMessage`: (`args`) => `Promise`\<`boolean`\>; `verifyTypedData`: (`args`) => `Promise`\<`boolean`\>; `waitForTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `watchBlockNumber`: (`args`) => `WatchBlockNumberReturnType`; `watchBlocks`: \<`includeTransactions`, `blockTag`\>(`args`) => `WatchBlocksReturnType`; `watchContractEvent`: \<`abi`, `eventName`, `strict`\>(`args`) => `WatchContractEventReturnType`; `watchEvent`: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => `WatchEventReturnType`; `watchPendingTransactions`: (`args`) => `WatchPendingTransactionsReturnType`; \} \| \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: ...; paymasterService?: ...; unstable\_addSubAccount?: ...; \[key: ...\]: ... \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} |
|
|
1936
|
+
|
|
1937
|
+
##### Returns
|
|
1938
|
+
|
|
1939
|
+
[`TokenActions`](#tokenactions)
|
|
1940
|
+
|
|
1941
|
+
***
|
|
1942
|
+
|
|
1943
|
+
### xPNTsFactoryActions()
|
|
1944
|
+
|
|
1945
|
+
```ts
|
|
1946
|
+
function xPNTsFactoryActions(address): (client) => XPNTsFactoryActions;
|
|
1947
|
+
```
|
|
1948
|
+
|
|
1949
|
+
Defined in: [packages/core/src/actions/factory.ts:121](https://github.com/AAStarCommunity/aastar-sdk/blob/9355f214d4f7ac03755d574206ded22f6097f351/packages/core/src/actions/factory.ts#L121)
|
|
1950
|
+
|
|
1951
|
+
#### Parameters
|
|
1952
|
+
|
|
1953
|
+
| Parameter | Type |
|
|
1954
|
+
| ------ | ------ |
|
|
1955
|
+
| `address` | `` `0x${string}` `` |
|
|
1956
|
+
|
|
1957
|
+
#### Returns
|
|
1958
|
+
|
|
1959
|
+
```ts
|
|
1960
|
+
(client): XPNTsFactoryActions;
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
##### Parameters
|
|
1964
|
+
|
|
1965
|
+
| Parameter | Type |
|
|
1966
|
+
| ------ | ------ |
|
|
1967
|
+
| `client` | \| \{ `account`: `undefined`; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `call`: (`parameters`) => `Promise`\<`CallReturnType`\>; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `createAccessList`: (`parameters`) => `Promise`\<\{ `accessList`: `AccessList`; `gasUsed`: `bigint`; \}\>; `createBlockFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"block"`; \}\>; `createContractEventFilter`: \<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`CreateContractEventFilterReturnType`\<`abi`, `eventName`, `args`, `strict`, `fromBlock`, `toBlock`\>\>; `createEventFilter`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`, `_EventName`, `_Args`\>(`args?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: Filter\<"event", abiEvents, \_EventName, \_Args, strict, fromBlock, toBlock\>\[K\] \}\>; `createPendingTransactionFilter`: () => `Promise`\<\{ `id`: `` `0x${string}` ``; `request`: `EIP1193RequestFn`\<readonly \[\{ `Method`: `"eth_getFilterChanges"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: ...[] \| ...[]; \}, \{ `Method`: `"eth_getFilterLogs"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `RpcLog`[]; \}, \{ `Method`: `"eth_uninstallFilter"`; `Parameters`: \[`` `0x${(...)}` ``\]; `ReturnType`: `boolean`; \}\]\>; `type`: `"transaction"`; \}\>; `estimateContractGas`: \<`chain`, `abi`, `functionName`, `args`\>(`args`) => `Promise`\<`bigint`\>; `estimateFeesPerGas`: \<`chainOverride`, `type`\>(`args?`) => `Promise`\<`EstimateFeesPerGasReturnType`\<`type`\>\>; `estimateGas`: (`args`) => `Promise`\<`bigint`\>; `estimateMaxPriorityFeePerGas`: \<`chainOverride`\>(`args?`) => `Promise`\<`bigint`\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `undefined`, `PublicRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `PublicActions`\<`Transport`, `Chain` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getBalance`: (`args`) => `Promise`\<`bigint`\>; `getBlobBaseFee`: () => `Promise`\<`bigint`\>; `getBlock`: \<`includeTransactions`, `blockTag`\>(`args?`) => `Promise`\<\{ `baseFeePerGas`: `bigint` \| `null`; `blobGasUsed`: `bigint`; `difficulty`: `bigint`; `excessBlobGas`: `bigint`; `extraData`: `` `0x${string}` ``; `gasLimit`: `bigint`; `gasUsed`: `bigint`; `hash`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `logsBloom`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `miner`: `` `0x${string}` ``; `mixHash`: `` `0x${string}` ``; `nonce`: `blockTag` *extends* `"pending"` ? `null` : `` `0x${string}` ``; `number`: `blockTag` *extends* `"pending"` ? `null` : `bigint`; `parentBeaconBlockRoot?`: `` `0x${string}` ``; `parentHash`: `` `0x${string}` ``; `receiptsRoot`: `` `0x${string}` ``; `sealFields`: `` `0x${string}` ``[]; `sha3Uncles`: `` `0x${string}` ``; `size`: `bigint`; `stateRoot`: `` `0x${string}` ``; `timestamp`: `bigint`; `totalDifficulty`: `bigint` \| `null`; `transactions`: `includeTransactions` *extends* `true` ? ( \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId?`: ... \| ...; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"legacy"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip2930"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip1559"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly ...[]; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip4844"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: ... *extends* ... ? ... : ...; `blockNumber`: ... *extends* ... ? ... : ...; `chainId`: `number`; `from`: `` `0x${(...)}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${(...)}` ``; `input`: `` `0x${(...)}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${(...)}` ``; `s`: `` `0x${(...)}` ``; `to`: ... \| ...; `transactionIndex`: ... *extends* ... ? ... : ...; `type`: `"eip7702"`; `typeHex`: ... \| ...; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \})[] : `` `0x${string}` ``[]; `transactionsRoot`: `` `0x${string}` ``; `uncles`: `` `0x${string}` ``[]; `withdrawals?`: `Withdrawal`[]; `withdrawalsRoot?`: `` `0x${string}` ``; \}\>; `getBlockNumber`: (`args?`) => `Promise`\<`bigint`\>; `getBlockTransactionCount`: (`args?`) => `Promise`\<`number`\>; `getBytecode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getChainId`: () => `Promise`\<`number`\>; `getCode`: (`args`) => `Promise`\<`GetCodeReturnType`\>; `getContractEvents`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetContractEventsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getEip712Domain`: (`args`) => `Promise`\<`GetEip712DomainReturnType`\>; `getEnsAddress`: (`args`) => `Promise`\<`GetEnsAddressReturnType`\>; `getEnsAvatar`: (`args`) => `Promise`\<`GetEnsAvatarReturnType`\>; `getEnsName`: (`args`) => `Promise`\<`GetEnsNameReturnType`\>; `getEnsResolver`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `getEnsText`: (`args`) => `Promise`\<`GetEnsTextReturnType`\>; `getFeeHistory`: (`args`) => `Promise`\<`GetFeeHistoryReturnType`\>; `getFilterChanges`: \<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterChangesReturnType`\<`filterType`, `abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getFilterLogs`: \<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>(`args`) => `Promise`\<`GetFilterLogsReturnType`\<`abi`, `eventName`, `strict`, `fromBlock`, `toBlock`\>\>; `getGasPrice`: () => `Promise`\<`bigint`\>; `getLogs`: \<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>(`args?`) => `Promise`\<`GetLogsReturnType`\<`abiEvent`, `abiEvents`, `strict`, `fromBlock`, `toBlock`\>\>; `getProof`: (`args`) => `Promise`\<`GetProofReturnType`\>; `getStorageAt`: (`args`) => `Promise`\<`GetStorageAtReturnType`\>; `getTransaction`: \<`blockTag`\>(`args`) => `Promise`\< \| \{ `accessList?`: `undefined`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId?`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"legacy"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity?`: `undefined`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice`: `bigint`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas?`: `undefined`; `maxPriorityFeePerGas?`: `undefined`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip2930"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip1559"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList?`: `undefined`; `blobVersionedHashes`: readonly `` `0x${string}` ``[]; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas`: `bigint`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip4844"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \} \| \{ `accessList`: `AccessList`; `authorizationList`: `SignedAuthorizationList`; `blobVersionedHashes?`: `undefined`; `blockHash`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `` `0x${string}` ``; `blockNumber`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `bigint`; `chainId`: `number`; `from`: `` `0x${string}` ``; `gas`: `bigint`; `gasPrice?`: `undefined`; `hash`: `` `0x${string}` ``; `input`: `` `0x${string}` ``; `maxFeePerBlobGas?`: `undefined`; `maxFeePerGas`: `bigint`; `maxPriorityFeePerGas`: `bigint`; `nonce`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; `to`: `` `0x${string}` `` \| `null`; `transactionIndex`: `blockTag` *extends* `"pending"` ? `true` : `false` *extends* `true` ? `null` : `number`; `type`: `"eip7702"`; `typeHex`: `` `0x${string}` `` \| `null`; `v`: `bigint`; `value`: `bigint`; `yParity`: `number`; \}\>; `getTransactionConfirmations`: (`args`) => `Promise`\<`bigint`\>; `getTransactionCount`: (`args`) => `Promise`\<`number`\>; `getTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `key`: `string`; `multicall`: \<`contracts`, `allowFailure`\>(`args`) => `Promise`\<`MulticallReturnType`\<`contracts`, `allowFailure`\>\>; `name`: `string`; `pollingInterval`: `number`; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `readContract`: \<`abi`, `functionName`, `args`\>(`args`) => `Promise`\<`ReadContractReturnType`\<`abi`, `functionName`, `args`\>\>; `request`: `EIP1193RequestFn`\<`PublicRpcSchema`\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `simulate`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateBlocks`: \<`calls`\>(`args`) => `Promise`\<`SimulateBlocksReturnType`\<`calls`\>\>; `simulateCalls`: \<`calls`\>(`args`) => `Promise`\<`SimulateCallsReturnType`\<`calls`\>\>; `simulateContract`: \<`abi`, `functionName`, `args`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`SimulateContractReturnType`\<`abi`, `functionName`, `args`, `Chain` \| `undefined`, `Account` \| `undefined`, `chainOverride`, `accountOverride`\>\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `uninstallFilter`: (`args`) => `Promise`\<`boolean`\>; `verifyHash`: (`args`) => `Promise`\<`boolean`\>; `verifyMessage`: (`args`) => `Promise`\<`boolean`\>; `verifySiweMessage`: (`args`) => `Promise`\<`boolean`\>; `verifyTypedData`: (`args`) => `Promise`\<`boolean`\>; `waitForTransactionReceipt`: (`args`) => `Promise`\<`TransactionReceipt`\>; `watchBlockNumber`: (`args`) => `WatchBlockNumberReturnType`; `watchBlocks`: \<`includeTransactions`, `blockTag`\>(`args`) => `WatchBlocksReturnType`; `watchContractEvent`: \<`abi`, `eventName`, `strict`\>(`args`) => `WatchContractEventReturnType`; `watchEvent`: \<`abiEvent`, `abiEvents`, `strict`\>(`args`) => `WatchEventReturnType`; `watchPendingTransactions`: (`args`) => `WatchPendingTransactionsReturnType`; \} \| \{ `account`: `Account` \| `undefined`; `addChain`: (`args`) => `Promise`\<`void`\>; `batch?`: \{ `multicall?`: \| `boolean` \| \{ `batchSize?`: `number`; `deployless?`: `boolean`; `wait?`: `number`; \}; \}; `cacheTime`: `number`; `ccipRead?`: \| `false` \| \{ `request?`: (`parameters`) => `Promise`\<`` `0x${string}` ``\>; \}; `chain`: `Chain` \| `undefined`; `deployContract`: \<`abi`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `experimental_blockTag?`: `BlockTag`; `extend`: \<`client`\>(`fn`) => `Client`\<`Transport`, `Chain` \| `undefined`, `Account` \| `undefined`, `WalletRpcSchema`, \{ \[K in string \| number \| symbol\]: client\[K\] \} & `WalletActions`\<`Chain` \| `undefined`, `Account` \| `undefined`\>\>; `fillTransaction`: \<`chainOverride`, `accountOverride`\>(`args`) => `Promise`\<`FillTransactionReturnType`\<`Chain` \| `undefined`, `chainOverride`\>\>; `getAddresses`: () => `Promise`\<`GetAddressesReturnType`\>; `getCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `getCapabilities`: \<`chainId`\>(`parameters?`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (chainId extends number ? \{ atomic?: \{ status: ... \}; paymasterService?: \{ supported: ... \}; unstable\_addSubAccount?: \{ keyTypes: ...; supported: ... \}; \[key: string\]: any \} : ChainIdToCapabilities\<Capabilities\<\{ atomic?: ...; paymasterService?: ...; unstable\_addSubAccount?: ...; \[key: ...\]: ... \}\>, number\>)\[K\] \}\>; `getChainId`: () => `Promise`\<`number`\>; `getPermissions`: () => `Promise`\<`GetPermissionsReturnType`\>; `key`: `string`; `name`: `string`; `pollingInterval`: `number`; `prepareAuthorization`: (`parameters`) => `Promise`\<`PrepareAuthorizationReturnType`\>; `prepareTransactionRequest`: \<`request`, `chainOverride`, `accountOverride`\>(`args`) => `Promise`\<\{ \[K in string \| number \| symbol\]: (UnionRequiredBy\<Extract\<(...), (...)\> & \{ chainId?: ... \}, ParameterTypeToParameters\<(...) extends (...) ? (...) : (...)\>\> & (unknown extends request\["kzg"\] ? \{\} : Pick\<request, "kzg"\>))\[K\] \}\>; `request`: `EIP1193RequestFn`\<`WalletRpcSchema`\>; `requestAddresses`: () => `Promise`\<`RequestAddressesReturnType`\>; `requestPermissions`: (`args`) => `Promise`\<`RequestPermissionsReturnType`\>; `sendCalls`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `capabilities?`: \{ \[`key`: `string`\]: `any`; \}; `id`: `string`; \}\>; `sendCallsSync`: \<`calls`, `chainOverride`\>(`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `sendRawTransaction`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `sendRawTransactionSync`: (`args`) => `Promise`\<`TransactionReceipt`\>; `sendTransaction`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `sendTransactionSync`: \<`request`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; `showCallsStatus`: (`parameters`) => `Promise`\<`void`\>; `signAuthorization`: (`parameters`) => `Promise`\<`SignAuthorizationReturnType`\>; `signMessage`: (`args`) => `Promise`\<`` `0x${string}` ``\>; `signTransaction`: \<`chainOverride`, `request`\>(`args`) => `Promise`\<`TransactionSerialized`\<`GetTransactionType`\<`request`, \| `request` *extends* `LegacyProperties` ? `"legacy"` : `never` \| `request` *extends* `EIP1559Properties` ? `"eip1559"` : `never` \| `request` *extends* `EIP2930Properties` ? `"eip2930"` : `never` \| `request` *extends* `EIP4844Properties` ? `"eip4844"` : `never` \| `request` *extends* `EIP7702Properties` ? `"eip7702"` : `never` \| `request`\[`"type"`\] *extends* `string` \| `undefined` ? `Extract`\<`any`\[`any`\], `string`\> : `never`\>, \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip1559"` ? `` `0x02${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip2930"` ? `` `0x01${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip4844"` ? `` `0x03${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"eip7702"` ? `` `0x04${string}` `` : `never` \| `GetTransactionType`\<`request`, \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ... \| ... *extends* ... ? ... : ...\> *extends* `"legacy"` ? `TransactionSerializedLegacy` : `never`\>\>; `signTypedData`: \<`typedData`, `primaryType`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `switchChain`: (`args`) => `Promise`\<`void`\>; `transport`: `TransportConfig`\<`string`, `EIP1193RequestFn`\> & `Record`\<`string`, `any`\>; `type`: `string`; `uid`: `string`; `waitForCallsStatus`: (`parameters`) => `Promise`\<\{ `atomic`: `boolean`; `capabilities?`: \| \{ \[`key`: `string`\]: `any`; \} \| \{ \[`key`: `string`\]: `any`; \}; `chainId`: `number`; `id`: `string`; `receipts?`: `WalletCallReceipt`\<`bigint`, `"success"` \| `"reverted"`\>[]; `status`: `"success"` \| `"pending"` \| `"failure"` \| `undefined`; `statusCode`: `number`; `version`: `string`; \}\>; `watchAsset`: (`args`) => `Promise`\<`boolean`\>; `writeContract`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`` `0x${string}` ``\>; `writeContractSync`: \<`abi`, `functionName`, `args`, `chainOverride`\>(`args`) => `Promise`\<`TransactionReceipt`\>; \} |
|
|
1968
|
+
|
|
1969
|
+
##### Returns
|
|
1970
|
+
|
|
1971
|
+
[`XPNTsFactoryActions`](core.md#xpntsfactoryactions)
|