@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.b655e406
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/README.md +1 -1
- package/dest/account/account.d.ts +60 -0
- package/dest/account/account.d.ts.map +1 -0
- package/dest/account/account.js +59 -0
- package/dest/account/{contract.d.ts → account_contract.d.ts} +16 -10
- package/dest/account/account_contract.d.ts.map +1 -0
- package/dest/account/{contract.js → account_contract.js} +7 -4
- package/dest/{wallet/account_wallet_with_private_key.d.ts → account/account_with_secret_key.d.ts} +7 -8
- package/dest/account/account_with_secret_key.d.ts.map +1 -0
- package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +5 -5
- package/dest/account/index.d.ts +3 -7
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +2 -6
- package/dest/account/interface.d.ts +1 -13
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -0
- package/dest/account/signerless_account.d.ts +24 -0
- package/dest/account/signerless_account.d.ts.map +1 -0
- package/dest/account/signerless_account.js +27 -0
- package/dest/api/abi.d.ts +2 -1
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -1
- package/dest/api/account.d.ts +5 -2
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +3 -1
- package/dest/api/addresses.d.ts +1 -0
- package/dest/api/addresses.d.ts.map +1 -1
- package/dest/api/addresses.js +1 -0
- package/dest/api/authorization.d.ts +5 -0
- package/dest/api/authorization.d.ts.map +1 -0
- package/dest/api/authorization.js +4 -0
- package/dest/api/block.d.ts +3 -0
- package/dest/api/block.d.ts.map +1 -0
- package/dest/api/block.js +2 -0
- package/dest/{contract/index.d.ts → api/contract.d.ts} +15 -11
- package/dest/api/contract.d.ts.map +1 -0
- package/dest/{contract/index.js → api/contract.js} +14 -10
- package/dest/api/crypto.d.ts +2 -0
- package/dest/api/crypto.d.ts.map +1 -0
- package/dest/api/crypto.js +1 -0
- package/dest/api/deployment.d.ts +4 -3
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +4 -3
- package/dest/api/ethereum.d.ts +2 -0
- package/dest/api/ethereum.d.ts.map +1 -0
- package/dest/api/ethereum.js +1 -0
- package/dest/api/events.d.ts +12 -0
- package/dest/api/events.d.ts.map +1 -0
- package/dest/api/events.js +30 -0
- package/dest/api/fee.d.ts +1 -1
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +1 -1
- package/dest/api/fee_testing.d.ts +2 -0
- package/dest/api/fee_testing.d.ts.map +1 -0
- package/dest/api/fee_testing.js +1 -0
- package/dest/api/keys.d.ts +4 -0
- package/dest/api/keys.d.ts.map +1 -0
- package/dest/api/keys.js +3 -0
- package/dest/api/log.d.ts +1 -0
- package/dest/api/log.d.ts.map +1 -1
- package/dest/api/log.js +1 -0
- package/dest/api/messaging.d.ts +3 -0
- package/dest/api/messaging.d.ts.map +1 -0
- package/dest/api/messaging.js +2 -0
- package/dest/api/node.d.ts +21 -0
- package/dest/api/node.d.ts.map +1 -0
- package/dest/api/node.js +18 -0
- package/dest/api/note.d.ts +2 -0
- package/dest/api/note.d.ts.map +1 -0
- package/dest/api/note.js +1 -0
- package/dest/api/protocol.d.ts +3 -0
- package/dest/api/protocol.d.ts.map +1 -0
- package/dest/api/protocol.js +2 -0
- package/dest/api/trees.d.ts +3 -0
- package/dest/api/trees.d.ts.map +1 -0
- package/dest/api/trees.js +2 -0
- package/dest/api/tx.d.ts +2 -0
- package/dest/api/tx.d.ts.map +1 -0
- package/dest/api/tx.js +1 -0
- package/dest/api/utils.d.ts +13 -0
- package/dest/api/utils.d.ts.map +1 -0
- package/dest/api/utils.js +12 -0
- package/dest/api/wallet.d.ts +4 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +4 -1
- package/dest/authorization/call_authorization_request.d.ts +67 -0
- package/dest/authorization/call_authorization_request.d.ts.map +1 -0
- package/dest/authorization/call_authorization_request.js +49 -0
- package/dest/contract/base_contract_interaction.d.ts +16 -79
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +15 -128
- package/dest/contract/batch_call.d.ts +13 -14
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +60 -60
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/checker.d.ts.map +1 -1
- package/dest/contract/checker.js +2 -2
- package/dest/contract/contract.d.ts +7 -6
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +7 -16
- package/dest/contract/contract_base.d.ts +3 -9
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +2 -2
- package/dest/contract/contract_function_interaction.d.ts +52 -44
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +75 -74
- package/dest/contract/deploy_method.d.ts +102 -57
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +122 -132
- package/dest/contract/deploy_sent_tx.d.ts +3 -5
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +10 -13
- package/dest/contract/get_gas_limits.d.ts +5 -6
- package/dest/contract/get_gas_limits.d.ts.map +1 -1
- package/dest/contract/get_gas_limits.js +9 -3
- package/dest/contract/interaction_options.d.ts +114 -0
- package/dest/contract/interaction_options.d.ts.map +1 -0
- package/dest/contract/interaction_options.js +52 -0
- package/dest/contract/protocol_contracts.d.ts +6 -6
- package/dest/contract/protocol_contracts.d.ts.map +1 -1
- package/dest/contract/protocol_contracts.js +7 -7
- package/dest/contract/sent_tx.d.ts +8 -18
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +30 -42
- package/dest/contract/unsafe_contract.d.ts +1 -1
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.d.ts +17 -0
- package/dest/contract/wait_for_proven.d.ts.map +1 -0
- package/dest/contract/wait_for_proven.js +17 -0
- package/dest/deployment/broadcast_function.d.ts +3 -3
- package/dest/deployment/broadcast_function.d.ts.map +1 -1
- package/dest/deployment/broadcast_function.js +27 -23
- package/dest/deployment/contract_deployer.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/publish_class.d.ts +6 -0
- package/dest/deployment/publish_class.d.ts.map +1 -0
- package/dest/deployment/publish_class.js +17 -0
- package/dest/deployment/publish_instance.d.ts +10 -0
- package/dest/deployment/publish_instance.d.ts.map +1 -0
- package/dest/deployment/publish_instance.js +11 -0
- package/dest/{api/ethereum → ethereum}/portal_manager.d.ts +29 -25
- package/dest/ethereum/portal_manager.d.ts.map +1 -0
- package/dest/{api/ethereum → ethereum}/portal_manager.js +106 -73
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +16 -11
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +26 -16
- package/dest/fee/fee_payment_method.d.ts +11 -7
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.d.ts +25 -8
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +43 -21
- package/dest/fee/public_fee_payment_method.d.ts +26 -9
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +45 -23
- package/dest/fee/sponsored_fee_payment.d.ts +17 -0
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
- package/dest/fee/sponsored_fee_payment.js +34 -0
- package/dest/utils/abi_types.d.ts +0 -2
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/authwit.d.ts +81 -24
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +226 -40
- package/dest/utils/cross_chain.d.ts +24 -0
- package/dest/utils/cross_chain.d.ts.map +1 -0
- package/dest/utils/cross_chain.js +30 -0
- package/dest/utils/fee_juice.d.ts +3 -2
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +3 -2
- package/dest/utils/field_compressed_string.d.ts.map +1 -1
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +1 -1
- package/dest/utils/pub_key.d.ts.map +1 -1
- package/dest/utils/pub_key.js +1 -2
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +34 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
- package/dest/wallet/account_manager.d.ts +69 -0
- package/dest/wallet/account_manager.d.ts.map +1 -0
- package/dest/wallet/account_manager.js +113 -0
- package/dest/wallet/base_wallet.d.ts +81 -63
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +221 -106
- package/dest/wallet/deploy_account_method.d.ts +52 -0
- package/dest/wallet/deploy_account_method.d.ts.map +1 -0
- package/dest/wallet/deploy_account_method.js +77 -0
- package/dest/wallet/index.d.ts +3 -16
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +3 -20
- package/dest/wallet/wallet.d.ts +2478 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/dest/wallet/wallet.js +202 -0
- package/package.json +40 -32
- package/src/account/account.ts +97 -0
- package/src/account/{contract.ts → account_contract.ts} +24 -13
- package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
- package/src/account/index.ts +3 -7
- package/src/account/interface.ts +1 -12
- package/src/account/signerless_account.ts +46 -0
- package/src/api/abi.ts +26 -0
- package/src/api/account.ts +5 -9
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +14 -0
- package/src/api/block.ts +2 -0
- package/src/{contract/index.ts → api/contract.ts} +37 -13
- package/src/api/crypto.ts +1 -0
- package/src/api/deployment.ts +4 -3
- package/src/api/ethereum.ts +10 -0
- package/src/api/events.ts +44 -0
- package/src/api/fee.ts +1 -1
- package/src/api/fee_testing.ts +1 -0
- package/src/api/keys.ts +8 -0
- package/src/api/log.ts +1 -0
- package/src/api/messaging.ts +2 -0
- package/src/api/node.ts +20 -0
- package/src/api/note.ts +1 -0
- package/src/api/protocol.ts +2 -0
- package/src/api/trees.ts +2 -0
- package/src/api/tx.ts +11 -0
- package/src/api/utils.ts +14 -0
- package/src/api/wallet.ts +33 -5
- package/src/authorization/call_authorization_request.ts +63 -0
- package/src/contract/base_contract_interaction.ts +24 -166
- package/src/contract/batch_call.ts +81 -49
- package/src/contract/checker.ts +8 -3
- package/src/contract/contract.ts +8 -17
- package/src/contract/contract_base.ts +4 -11
- package/src/contract/contract_function_interaction.ts +136 -106
- package/src/contract/deploy_method.ts +199 -129
- package/src/contract/deploy_sent_tx.ts +9 -15
- package/src/contract/get_gas_limits.ts +15 -8
- package/src/contract/interaction_options.ts +169 -0
- package/src/contract/protocol_contracts.ts +10 -10
- package/src/contract/sent_tx.ts +40 -51
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/contract/wait_for_proven.ts +38 -0
- package/src/deployment/broadcast_function.ts +57 -57
- package/src/deployment/contract_deployer.ts +1 -1
- package/src/deployment/publish_class.ts +34 -0
- package/src/deployment/publish_instance.ts +26 -0
- package/src/{api/ethereum → ethereum}/portal_manager.ts +120 -74
- package/src/fee/fee_juice_payment_method_with_claim.ts +46 -33
- package/src/fee/fee_payment_method.ts +11 -7
- package/src/fee/private_fee_payment_method.ts +77 -57
- package/src/fee/public_fee_payment_method.ts +91 -67
- package/src/fee/sponsored_fee_payment.ts +44 -0
- package/src/utils/authwit.ts +255 -53
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +4 -4
- package/src/utils/node.ts +1 -1
- package/src/utils/pub_key.ts +1 -2
- package/src/wallet/account_entrypoint_meta_payment_method.ts +105 -0
- package/src/wallet/account_manager.ts +154 -0
- package/src/wallet/base_wallet.ts +295 -143
- package/src/wallet/deploy_account_method.ts +125 -0
- package/src/wallet/index.ts +3 -33
- package/src/wallet/wallet.ts +362 -0
- package/dest/account/contract.d.ts.map +0 -1
- package/dest/account/wallet.d.ts +0 -11
- package/dest/account/wallet.d.ts.map +0 -1
- package/dest/account/wallet.js +0 -3
- package/dest/account_manager/deploy_account_method.d.ts +0 -15
- package/dest/account_manager/deploy_account_method.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_method.js +0 -43
- package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_sent_tx.js +0 -29
- package/dest/account_manager/index.d.ts +0 -108
- package/dest/account_manager/index.d.ts.map +0 -1
- package/dest/account_manager/index.js +0 -159
- package/dest/api/cheat_codes.d.ts +0 -26
- package/dest/api/cheat_codes.d.ts.map +0 -1
- package/dest/api/cheat_codes.js +0 -25
- package/dest/api/entrypoint.d.ts +0 -2
- package/dest/api/entrypoint.d.ts.map +0 -1
- package/dest/api/entrypoint.js +0 -1
- package/dest/api/ethereum/anvil_test_watcher.d.ts +0 -32
- package/dest/api/ethereum/anvil_test_watcher.d.ts.map +0 -1
- package/dest/api/ethereum/anvil_test_watcher.js +0 -133
- package/dest/api/ethereum/chain_monitor.d.ts +0 -25
- package/dest/api/ethereum/chain_monitor.d.ts.map +0 -1
- package/dest/api/ethereum/chain_monitor.js +0 -74
- package/dest/api/ethereum/cheat_codes.d.ts +0 -63
- package/dest/api/ethereum/cheat_codes.d.ts.map +0 -1
- package/dest/api/ethereum/cheat_codes.js +0 -162
- package/dest/api/ethereum/index.d.ts +0 -7
- package/dest/api/ethereum/index.d.ts.map +0 -1
- package/dest/api/ethereum/index.js +0 -6
- package/dest/api/ethereum/l1_contracts.d.ts +0 -3
- package/dest/api/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/api/ethereum/l1_contracts.js +0 -13
- package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
- package/dest/api/interfaces/pxe.d.ts +0 -2
- package/dest/api/interfaces/pxe.d.ts.map +0 -1
- package/dest/api/interfaces/pxe.js +0 -1
- package/dest/api/log_id.d.ts +0 -2
- package/dest/api/log_id.d.ts.map +0 -1
- package/dest/api/log_id.js +0 -1
- package/dest/api/tx_hash.d.ts +0 -2
- package/dest/api/tx_hash.d.ts.map +0 -1
- package/dest/api/tx_hash.js +0 -1
- package/dest/contract/deploy_proven_tx.d.ts +0 -21
- package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
- package/dest/contract/deploy_proven_tx.js +0 -19
- package/dest/contract/index.d.ts.map +0 -1
- package/dest/contract/proven_tx.d.ts +0 -17
- package/dest/contract/proven_tx.d.ts.map +0 -1
- package/dest/contract/proven_tx.js +0 -22
- package/dest/deployment/deploy_instance.d.ts +0 -10
- package/dest/deployment/deploy_instance.d.ts.map +0 -1
- package/dest/deployment/deploy_instance.js +0 -14
- package/dest/deployment/index.d.ts +0 -2
- package/dest/deployment/index.d.ts.map +0 -1
- package/dest/deployment/index.js +0 -1
- package/dest/deployment/register_class.d.ts +0 -6
- package/dest/deployment/register_class.d.ts.map +0 -1
- package/dest/deployment/register_class.js +0 -22
- package/dest/entrypoint/default_entrypoint.d.ts +0 -12
- package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/default_entrypoint.js +0 -28
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts +0 -15
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +0 -130
- package/dest/entrypoint/entrypoint.d.ts +0 -35
- package/dest/entrypoint/entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/entrypoint.js +0 -4
- package/dest/entrypoint/payload.d.ts +0 -128
- package/dest/entrypoint/payload.d.ts.map +0 -1
- package/dest/entrypoint/payload.js +0 -143
- package/dest/fee/fee_juice_payment_method.d.ts +0 -14
- package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_juice_payment_method.js +0 -20
- package/dest/index.d.ts +0 -66
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -69
- package/dest/rpc_clients/index.d.ts +0 -3
- package/dest/rpc_clients/index.d.ts.map +0 -1
- package/dest/rpc_clients/index.js +0 -2
- package/dest/rpc_clients/node/index.d.ts +0 -12
- package/dest/rpc_clients/node/index.d.ts.map +0 -1
- package/dest/rpc_clients/node/index.js +0 -78
- package/dest/rpc_clients/pxe_client.d.ts +0 -10
- package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
- package/dest/rpc_clients/pxe_client.js +0 -23
- package/dest/utils/aztec_cheatcodes.d.ts +0 -59
- package/dest/utils/aztec_cheatcodes.d.ts.map +0 -1
- package/dest/utils/aztec_cheatcodes.js +0 -62
- package/dest/utils/index.d.ts +0 -8
- package/dest/utils/index.d.ts.map +0 -1
- package/dest/utils/index.js +0 -6
- package/dest/utils/pxe.d.ts +0 -4
- package/dest/utils/pxe.d.ts.map +0 -1
- package/dest/utils/pxe.js +0 -14
- package/dest/wallet/account_wallet.d.ts +0 -76
- package/dest/wallet/account_wallet.d.ts.map +0 -1
- package/dest/wallet/account_wallet.js +0 -231
- package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.d.ts +0 -25
- package/dest/wallet/signerless_wallet.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.js +0 -36
- package/src/account/wallet.ts +0 -13
- package/src/account_manager/deploy_account_method.ts +0 -86
- package/src/account_manager/deploy_account_sent_tx.ts +0 -42
- package/src/account_manager/index.ts +0 -229
- package/src/api/cheat_codes.ts +0 -35
- package/src/api/entrypoint.ts +0 -1
- package/src/api/ethereum/anvil_test_watcher.ts +0 -158
- package/src/api/ethereum/chain_monitor.ts +0 -88
- package/src/api/ethereum/cheat_codes.ts +0 -184
- package/src/api/ethereum/index.ts +0 -19
- package/src/api/ethereum/l1_contracts.ts +0 -21
- package/src/api/interfaces/pxe.ts +0 -1
- package/src/api/log_id.ts +0 -1
- package/src/api/tx_hash.ts +0 -1
- package/src/contract/deploy_proven_tx.ts +0 -34
- package/src/contract/proven_tx.ts +0 -42
- package/src/deployment/deploy_instance.ts +0 -31
- package/src/deployment/index.ts +0 -1
- package/src/deployment/register_class.ts +0 -44
- package/src/entrypoint/default_entrypoint.ts +0 -39
- package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
- package/src/entrypoint/entrypoint.ts +0 -39
- package/src/entrypoint/payload.ts +0 -238
- package/src/fee/fee_juice_payment_method.ts +0 -26
- package/src/index.ts +0 -106
- package/src/rpc_clients/index.ts +0 -2
- package/src/rpc_clients/node/index.ts +0 -77
- package/src/rpc_clients/pxe_client.ts +0 -25
- package/src/utils/aztec_cheatcodes.ts +0 -77
- package/src/utils/index.ts +0 -21
- package/src/utils/pxe.ts +0 -17
- package/src/wallet/account_wallet.ts +0 -242
- package/src/wallet/signerless_wallet.ts +0 -52
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
|
+
|
|
7
|
+
import type { Contract } from '../contract/contract.js';
|
|
8
|
+
import type { ContractBase } from '../contract/contract_base.js';
|
|
9
|
+
import {
|
|
10
|
+
DeployMethod,
|
|
11
|
+
type DeployOptions,
|
|
12
|
+
type RequestDeployOptions,
|
|
13
|
+
type SimulateDeployOptions,
|
|
14
|
+
} from '../contract/deploy_method.js';
|
|
15
|
+
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
16
|
+
import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
|
|
17
|
+
import type { Wallet } from './index.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The configuration options for the request method. Omits the contractAddressSalt, since
|
|
21
|
+
* for account contracts that is fixed in the constructor
|
|
22
|
+
*/
|
|
23
|
+
export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The configuration options for the send/prove methods. Omits:
|
|
27
|
+
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
28
|
+
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
29
|
+
*/
|
|
30
|
+
export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The configuration options for the simulate method. Omits the contractAddressSalt, since
|
|
34
|
+
* for account contracts that is fixed in the constructor
|
|
35
|
+
*/
|
|
36
|
+
export type SimulateDeployAccountOptions = Omit<SimulateDeployOptions, 'contractAddressSalt'>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Modified version of the DeployMethod used to deploy account contracts. Supports deploying
|
|
40
|
+
* contracts that can pay for their own fee, plus some preconfigured options to avoid errors.
|
|
41
|
+
*/
|
|
42
|
+
export class DeployAccountMethod<TContract extends ContractBase = Contract> extends DeployMethod<TContract> {
|
|
43
|
+
constructor(
|
|
44
|
+
publicKeys: PublicKeys,
|
|
45
|
+
wallet: Wallet,
|
|
46
|
+
artifact: ContractArtifact,
|
|
47
|
+
postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
|
|
48
|
+
private salt: Fr,
|
|
49
|
+
args: any[] = [],
|
|
50
|
+
constructorNameOrArtifact?: string | FunctionArtifact,
|
|
51
|
+
) {
|
|
52
|
+
super(publicKeys, wallet, artifact, postDeployCtor, args, constructorNameOrArtifact);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns a FeePaymentMethod that routes the original one provided as an argument
|
|
57
|
+
* through the account's entrypoint. This allows an account contract to pay
|
|
58
|
+
* for its own deployment and initialization.
|
|
59
|
+
*
|
|
60
|
+
* For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
|
|
61
|
+
*
|
|
62
|
+
* @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
|
|
63
|
+
* @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
|
|
64
|
+
*/
|
|
65
|
+
private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod) {
|
|
66
|
+
if (!this.address) {
|
|
67
|
+
throw new Error('Instance is not yet constructed. This is a bug!');
|
|
68
|
+
}
|
|
69
|
+
return new AccountEntrypointMetaPaymentMethod(
|
|
70
|
+
this.wallet,
|
|
71
|
+
this.artifact,
|
|
72
|
+
'entrypoint',
|
|
73
|
+
this.address,
|
|
74
|
+
originalPaymentMethod,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns the execution payload that allows this operation to happen on chain.
|
|
80
|
+
* @param opts - Configuration options.
|
|
81
|
+
* @returns The execution payload for this operation
|
|
82
|
+
*/
|
|
83
|
+
public override async request(opts?: RequestDeployAccountOptions): Promise<ExecutionPayload> {
|
|
84
|
+
const optionsWithDefaults: RequestDeployOptions = {
|
|
85
|
+
...opts,
|
|
86
|
+
// Regardless of whom sends the transaction, account contracts
|
|
87
|
+
// are always deployed as universalDeployment: true
|
|
88
|
+
deployer: undefined,
|
|
89
|
+
contractAddressSalt: new Fr(this.salt),
|
|
90
|
+
skipClassPublication: opts?.skipClassPublication ?? true,
|
|
91
|
+
skipInstancePublication: opts?.skipInstancePublication ?? true,
|
|
92
|
+
skipInitialization: opts?.skipInitialization ?? false,
|
|
93
|
+
};
|
|
94
|
+
// Override the fee to undefined, since we'll replace it
|
|
95
|
+
const deploymentExecutionPayload = await super.request({ ...optionsWithDefaults, fee: undefined });
|
|
96
|
+
const executionPayloads = [deploymentExecutionPayload];
|
|
97
|
+
// If this is a self-deployment, manage the fee accordingly
|
|
98
|
+
if (opts?.deployer?.equals(AztecAddress.ZERO)) {
|
|
99
|
+
const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod);
|
|
100
|
+
const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
|
|
101
|
+
// Notice they are reversed (fee payment usually goes first):
|
|
102
|
+
// this is because we need to construct the contract BEFORE it can pay for its own fee
|
|
103
|
+
executionPayloads.push(feeExecutionPayload);
|
|
104
|
+
} else {
|
|
105
|
+
const feeExecutionPayload = opts?.fee?.paymentMethod
|
|
106
|
+
? await opts.fee.paymentMethod.getExecutionPayload()
|
|
107
|
+
: undefined;
|
|
108
|
+
if (feeExecutionPayload) {
|
|
109
|
+
executionPayloads.unshift(feeExecutionPayload);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return mergeExecutionPayloads(executionPayloads);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
|
|
116
|
+
return {
|
|
117
|
+
...options,
|
|
118
|
+
// Deployer is handled in the request method and forcibly set to undefined,
|
|
119
|
+
// since our account contracts are created with universalDeployment: true
|
|
120
|
+
// We need to forward it though, because depending on the deployer we have to assemble
|
|
121
|
+
// The fee payment method one way or another
|
|
122
|
+
deployer: options.from,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
package/src/wallet/index.ts
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { AccountContract } from '../account/contract.js';
|
|
5
|
-
import { AccountWallet } from './account_wallet.js';
|
|
6
|
-
|
|
7
|
-
export * from '../account/wallet.js';
|
|
8
|
-
export * from './account_wallet.js';
|
|
9
|
-
export * from './account_wallet_with_private_key.js';
|
|
10
|
-
export * from './signerless_wallet.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Gets a wallet for an already registered account.
|
|
14
|
-
* @param pxe - PXE Service instance.
|
|
15
|
-
* @param address - Address for the account.
|
|
16
|
-
* @param accountContract - Account contract implementation.
|
|
17
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
18
|
-
*/
|
|
19
|
-
export async function getWallet(
|
|
20
|
-
pxe: PXE,
|
|
21
|
-
address: AztecAddress,
|
|
22
|
-
accountContract: AccountContract,
|
|
23
|
-
): Promise<AccountWallet> {
|
|
24
|
-
const completeAddress = (await pxe.getRegisteredAccounts()).find(completeAddress =>
|
|
25
|
-
completeAddress.address.equals(address),
|
|
26
|
-
);
|
|
27
|
-
if (!completeAddress) {
|
|
28
|
-
throw new Error(`Account ${address} not found`);
|
|
29
|
-
}
|
|
30
|
-
const nodeInfo = await pxe.getNodeInfo();
|
|
31
|
-
const entrypoint = accountContract.getInterface(completeAddress, nodeInfo);
|
|
32
|
-
return new AccountWallet(pxe, entrypoint);
|
|
33
|
-
}
|
|
1
|
+
export * from './wallet.js';
|
|
2
|
+
export * from './base_wallet.js';
|
|
3
|
+
export * from './account_manager.js';
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import {
|
|
5
|
+
AbiTypeSchema,
|
|
6
|
+
type ContractArtifact,
|
|
7
|
+
ContractArtifactSchema,
|
|
8
|
+
type EventMetadataDefinition,
|
|
9
|
+
FunctionAbiSchema,
|
|
10
|
+
FunctionType,
|
|
11
|
+
} from '@aztec/stdlib/abi';
|
|
12
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
13
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
+
import {
|
|
15
|
+
type ContractClassMetadata,
|
|
16
|
+
ContractClassWithIdSchema,
|
|
17
|
+
type ContractInstanceWithAddress,
|
|
18
|
+
ContractInstanceWithAddressSchema,
|
|
19
|
+
type ContractInstantiationData,
|
|
20
|
+
type ContractMetadata,
|
|
21
|
+
} from '@aztec/stdlib/contract';
|
|
22
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
23
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
24
|
+
import { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } from '@aztec/stdlib/schemas';
|
|
25
|
+
import {
|
|
26
|
+
Capsule,
|
|
27
|
+
HashedValues,
|
|
28
|
+
TxHash,
|
|
29
|
+
TxProfileResult,
|
|
30
|
+
TxReceipt,
|
|
31
|
+
TxSimulationResult,
|
|
32
|
+
UtilitySimulationResult,
|
|
33
|
+
} from '@aztec/stdlib/tx';
|
|
34
|
+
|
|
35
|
+
import { z } from 'zod';
|
|
36
|
+
|
|
37
|
+
import type { Contract } from '../contract/contract.js';
|
|
38
|
+
import type {
|
|
39
|
+
FeeEstimationOptions,
|
|
40
|
+
GasSettingsOption,
|
|
41
|
+
ProfileInteractionOptions,
|
|
42
|
+
SendInteractionOptions,
|
|
43
|
+
SimulateInteractionOptions,
|
|
44
|
+
} from '../contract/interaction_options.js';
|
|
45
|
+
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A wrapper type that allows any item to be associated with an alias.
|
|
49
|
+
*/
|
|
50
|
+
export type Aliased<T> = {
|
|
51
|
+
/**
|
|
52
|
+
* The alias
|
|
53
|
+
*/
|
|
54
|
+
alias: string;
|
|
55
|
+
/**
|
|
56
|
+
* The item being aliased.
|
|
57
|
+
*/
|
|
58
|
+
item: T;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A reduced representation of a Contract, only including its instance and artifact
|
|
63
|
+
*/
|
|
64
|
+
export type ContractInstanceAndArtifact = Pick<Contract, 'artifact' | 'instance'>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Options that can be provided to the wallet for configuration of the fee payment.
|
|
68
|
+
*/
|
|
69
|
+
export type UserFeeOptions = {
|
|
70
|
+
/**
|
|
71
|
+
* Informs the wallet that the crafted tx already contains the necessary calls to pay for its fee
|
|
72
|
+
* and who is paying
|
|
73
|
+
*/
|
|
74
|
+
embeddedPaymentMethodFeePayer?: AztecAddress;
|
|
75
|
+
} & GasSettingsOption;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
|
|
79
|
+
* a simplified version that only hints at the wallet wether the interaction contains a
|
|
80
|
+
* fee payment method or not
|
|
81
|
+
*/
|
|
82
|
+
export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
|
|
83
|
+
/** The fee options */
|
|
84
|
+
fee?: UserFeeOptions & FeeEstimationOptions;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with
|
|
89
|
+
* a simplified version that only hints at the wallet wether the interaction contains a
|
|
90
|
+
* fee payment method or not
|
|
91
|
+
*/
|
|
92
|
+
export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
|
|
93
|
+
/** The fee options */
|
|
94
|
+
fee?: UserFeeOptions;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with
|
|
99
|
+
* a simplified version that only hints at the wallet wether the interaction contains a
|
|
100
|
+
* fee payment method or not
|
|
101
|
+
*/
|
|
102
|
+
export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
|
|
103
|
+
/** The fee options */
|
|
104
|
+
fee?: UserFeeOptions;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Helper type that represents all methods that can be batched.
|
|
109
|
+
*/
|
|
110
|
+
export type BatchableMethods = Pick<Wallet, 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility'>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* From the batchable methods, we create a type that represents a method call with its name and arguments.
|
|
114
|
+
* This is what the wallet will accept as arguments to the `batch` method.
|
|
115
|
+
*/
|
|
116
|
+
export type BatchedMethod<T extends keyof BatchableMethods> = {
|
|
117
|
+
/** The method name */
|
|
118
|
+
name: T;
|
|
119
|
+
/** The method arguments */
|
|
120
|
+
args: Parameters<BatchableMethods[T]>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Helper type to extract the return type of a batched method
|
|
125
|
+
*/
|
|
126
|
+
export type BatchedMethodResult<T> =
|
|
127
|
+
T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Wrapper type for batch results that includes the method name for discriminated union deserialization.
|
|
131
|
+
* Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
|
|
132
|
+
* when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
|
|
133
|
+
*/
|
|
134
|
+
export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
|
|
135
|
+
/** The method name */
|
|
136
|
+
name: T['name'];
|
|
137
|
+
/** The method result */
|
|
138
|
+
result: BatchedMethodResult<T>;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Maps a tuple of BatchedMethod to a tuple of their wrapped return types
|
|
143
|
+
*/
|
|
144
|
+
export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
|
|
145
|
+
[K in keyof T]: BatchedMethodResultWrapper<T[K]>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The wallet interface.
|
|
150
|
+
*/
|
|
151
|
+
export type Wallet = {
|
|
152
|
+
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
153
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
154
|
+
getPrivateEvents<T>(
|
|
155
|
+
contractAddress: AztecAddress,
|
|
156
|
+
eventMetadata: EventMetadataDefinition,
|
|
157
|
+
from: number,
|
|
158
|
+
numBlocks: number,
|
|
159
|
+
recipients: AztecAddress[],
|
|
160
|
+
): Promise<T[]>;
|
|
161
|
+
getChainInfo(): Promise<ChainInfo>;
|
|
162
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
163
|
+
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
164
|
+
getAddressBook(): Promise<Aliased<AztecAddress>[]>;
|
|
165
|
+
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
166
|
+
registerContract(
|
|
167
|
+
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
|
|
168
|
+
): Promise<ContractInstanceWithAddress>;
|
|
169
|
+
// Overloaded definition to avoid zod issues
|
|
170
|
+
registerContract(
|
|
171
|
+
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
|
|
172
|
+
artifact: ContractArtifact,
|
|
173
|
+
): Promise<ContractInstanceWithAddress>;
|
|
174
|
+
registerContract(
|
|
175
|
+
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
|
|
176
|
+
artifact: ContractArtifact | undefined,
|
|
177
|
+
secretKey: Fr | undefined,
|
|
178
|
+
): Promise<ContractInstanceWithAddress>;
|
|
179
|
+
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
180
|
+
simulateUtility(
|
|
181
|
+
functionName: string,
|
|
182
|
+
args: any[],
|
|
183
|
+
to: AztecAddress,
|
|
184
|
+
authwits?: AuthWitness[],
|
|
185
|
+
): Promise<UtilitySimulationResult>;
|
|
186
|
+
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
187
|
+
sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
|
|
188
|
+
createAuthWit(
|
|
189
|
+
from: AztecAddress,
|
|
190
|
+
messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent,
|
|
191
|
+
): Promise<AuthWitness>;
|
|
192
|
+
batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const ContractInstantiationDataSchema = z.object({
|
|
196
|
+
constructorArtifact: optional(z.union([FunctionAbiSchema, z.string()])),
|
|
197
|
+
constructorArgs: optional(z.array(z.any())),
|
|
198
|
+
skipArgsDecoding: optional(z.boolean()),
|
|
199
|
+
salt: schemas.Fr,
|
|
200
|
+
publicKeys: optional(PublicKeys.schema),
|
|
201
|
+
deployer: optional(schemas.AztecAddress),
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export const FunctionCallSchema = z.object({
|
|
205
|
+
name: z.string(),
|
|
206
|
+
to: schemas.AztecAddress,
|
|
207
|
+
selector: schemas.FunctionSelector,
|
|
208
|
+
type: z.nativeEnum(FunctionType),
|
|
209
|
+
isStatic: z.boolean(),
|
|
210
|
+
hideMsgSender: z.boolean(),
|
|
211
|
+
args: z.array(schemas.Fr),
|
|
212
|
+
returnTypes: z.array(AbiTypeSchema),
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export const ExecutionPayloadSchema = z.object({
|
|
216
|
+
calls: z.array(FunctionCallSchema),
|
|
217
|
+
authWitnesses: z.array(AuthWitness.schema),
|
|
218
|
+
capsules: z.array(Capsule.schema),
|
|
219
|
+
extraHashedArgs: z.array(HashedValues.schema),
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
export const UserFeeOptionsSchema = z.object({
|
|
223
|
+
gasSettings: optional(
|
|
224
|
+
z.object({
|
|
225
|
+
gasLimits: optional(Gas.schema),
|
|
226
|
+
teardownGasLimits: optional(Gas.schema),
|
|
227
|
+
maxFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
|
|
228
|
+
maxPriorityFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
|
|
229
|
+
}),
|
|
230
|
+
),
|
|
231
|
+
embeddedPaymentMethodFeePayer: optional(schemas.AztecAddress),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
export const WalletSimulationFeeOptionSchema = UserFeeOptionsSchema.extend({
|
|
235
|
+
estimatedGasPadding: optional(z.number()),
|
|
236
|
+
estimateGas: optional(z.boolean()),
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export const SendOptionsSchema = z.object({
|
|
240
|
+
from: schemas.AztecAddress,
|
|
241
|
+
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
242
|
+
capsules: optional(z.array(Capsule.schema)),
|
|
243
|
+
fee: optional(UserFeeOptionsSchema),
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
export const SimulateOptionsSchema = z.object({
|
|
247
|
+
from: schemas.AztecAddress,
|
|
248
|
+
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
249
|
+
capsules: optional(z.array(Capsule.schema)),
|
|
250
|
+
fee: optional(WalletSimulationFeeOptionSchema),
|
|
251
|
+
skipTxValidation: optional(z.boolean()),
|
|
252
|
+
skipFeeEnforcement: optional(z.boolean()),
|
|
253
|
+
includeMetadata: optional(z.boolean()),
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
257
|
+
profileMode: z.enum(['gates', 'execution-steps', 'full']),
|
|
258
|
+
skipProofGeneration: optional(z.boolean()),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
export const InstanceDataSchema = z.union([
|
|
262
|
+
schemas.AztecAddress,
|
|
263
|
+
ContractInstanceWithAddressSchema,
|
|
264
|
+
ContractInstantiationDataSchema,
|
|
265
|
+
z.object({ instance: ContractInstanceWithAddressSchema, artifact: ContractArtifactSchema }),
|
|
266
|
+
]);
|
|
267
|
+
|
|
268
|
+
export const MessageHashOrIntentSchema = z.union([
|
|
269
|
+
schemas.Fr,
|
|
270
|
+
schemas.Buffer,
|
|
271
|
+
z.object({ consumer: schemas.AztecAddress, innerHash: z.union([schemas.Buffer, schemas.Fr]) }),
|
|
272
|
+
z.object({
|
|
273
|
+
caller: schemas.AztecAddress,
|
|
274
|
+
call: FunctionCallSchema,
|
|
275
|
+
}),
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
export const BatchedMethodSchema = z.union([
|
|
279
|
+
z.object({
|
|
280
|
+
name: z.literal('registerSender'),
|
|
281
|
+
args: z.tuple([schemas.AztecAddress, optional(z.string())]),
|
|
282
|
+
}),
|
|
283
|
+
z.object({
|
|
284
|
+
name: z.literal('registerContract'),
|
|
285
|
+
args: z.tuple([InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
|
|
286
|
+
}),
|
|
287
|
+
z.object({
|
|
288
|
+
name: z.literal('sendTx'),
|
|
289
|
+
args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
|
|
290
|
+
}),
|
|
291
|
+
z.object({
|
|
292
|
+
name: z.literal('simulateUtility'),
|
|
293
|
+
args: z.tuple([z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema))]),
|
|
294
|
+
}),
|
|
295
|
+
]);
|
|
296
|
+
|
|
297
|
+
export const ContractMetadataSchema = z.object({
|
|
298
|
+
contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
|
|
299
|
+
isContractInitialized: z.boolean(),
|
|
300
|
+
isContractPublished: z.boolean(),
|
|
301
|
+
}) satisfies ZodFor<ContractMetadata>;
|
|
302
|
+
|
|
303
|
+
export const ContractClassMetadataSchema = z.object({
|
|
304
|
+
contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
|
|
305
|
+
isContractClassPubliclyRegistered: z.boolean(),
|
|
306
|
+
artifact: z.union([ContractArtifactSchema, z.undefined()]),
|
|
307
|
+
}) satisfies ZodFor<ContractClassMetadata>;
|
|
308
|
+
|
|
309
|
+
export const EventMetadataDefinitionSchema = z.object({
|
|
310
|
+
eventSelector: schemas.EventSelector,
|
|
311
|
+
abiType: AbiTypeSchema,
|
|
312
|
+
fieldNames: z.array(z.string()),
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
export const WalletSchema: ApiSchemaFor<Wallet> = {
|
|
316
|
+
getChainInfo: z
|
|
317
|
+
.function()
|
|
318
|
+
.args()
|
|
319
|
+
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
320
|
+
getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
|
|
321
|
+
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
322
|
+
getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
|
|
323
|
+
getPrivateEvents: z
|
|
324
|
+
.function()
|
|
325
|
+
.args(schemas.AztecAddress, EventMetadataDefinitionSchema, z.number(), z.number(), z.array(schemas.AztecAddress))
|
|
326
|
+
.returns(z.array(AbiDecodedSchema)),
|
|
327
|
+
registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
|
|
328
|
+
getAddressBook: z
|
|
329
|
+
.function()
|
|
330
|
+
.args()
|
|
331
|
+
.returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
|
|
332
|
+
getAccounts: z
|
|
333
|
+
.function()
|
|
334
|
+
.args()
|
|
335
|
+
.returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
|
|
336
|
+
registerContract: z
|
|
337
|
+
.function()
|
|
338
|
+
.args(InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
339
|
+
.returns(ContractInstanceWithAddressSchema),
|
|
340
|
+
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
341
|
+
simulateUtility: z
|
|
342
|
+
.function()
|
|
343
|
+
.args(z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema)))
|
|
344
|
+
.returns(UtilitySimulationResult.schema),
|
|
345
|
+
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
346
|
+
sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
|
|
347
|
+
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
348
|
+
// @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
|
|
349
|
+
batch: z
|
|
350
|
+
.function()
|
|
351
|
+
.args(z.array(BatchedMethodSchema))
|
|
352
|
+
.returns(
|
|
353
|
+
z.array(
|
|
354
|
+
z.discriminatedUnion('name', [
|
|
355
|
+
z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
|
|
356
|
+
z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
|
|
357
|
+
z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
|
|
358
|
+
z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
|
|
359
|
+
]),
|
|
360
|
+
),
|
|
361
|
+
),
|
|
362
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/account/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG5E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjD;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;IAEhD;;;;;;;OAOG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IAE7E;;;OAGG;IACH,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAAC;CACvE;AAGD;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,+DAUrG"}
|
package/dest/account/wallet.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
2
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
4
|
-
import type { AccountInterface } from './interface.js';
|
|
5
|
-
/**
|
|
6
|
-
* The wallet interface.
|
|
7
|
-
*/
|
|
8
|
-
export type Wallet = AccountInterface & PXE & {
|
|
9
|
-
createAuthWit(intent: IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/account/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,gBAAgB,GACnC,GAAG,GAAG;IACJ,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC7E,CAAC"}
|
package/dest/account/wallet.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact, type FunctionArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
|
-
import type { AuthWitnessProvider } from '../account/interface.js';
|
|
4
|
-
import type { Wallet } from '../account/wallet.js';
|
|
5
|
-
import type { ExecutionRequestInit } from '../api/entrypoint.js';
|
|
6
|
-
import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
|
|
7
|
-
/**
|
|
8
|
-
* Contract interaction for deploying an account contract. Handles fee preparation and contract initialization.
|
|
9
|
-
*/
|
|
10
|
-
export declare class DeployAccountMethod extends DeployMethod {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(authWitnessProvider: AuthWitnessProvider, publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, args?: any[], constructorNameOrArtifact?: string | FunctionArtifact, feePaymentNameOrArtifact?: string | FunctionArtifact);
|
|
13
|
-
protected getInitializeFunctionCalls(options: DeployOptions): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments'>>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=deploy_account_method.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account_method.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_method.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAItB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGhF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;;gBAKjD,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE,GAAG,EAAO,EAChB,yBAAyB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EACrD,wBAAwB,CAAC,EAAE,MAAM,GAAG,gBAAgB;cAkB7B,0BAA0B,CACjD,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,eAAe,GAAG,iBAAiB,CAAC,CAAC;CAmCtF"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { FunctionSelector, encodeArguments, getFunctionArtifactByName } from '@aztec/stdlib/abi';
|
|
2
|
-
import { Contract } from '../contract/contract.js';
|
|
3
|
-
import { DeployMethod } from '../contract/deploy_method.js';
|
|
4
|
-
import { EntrypointPayload, computeCombinedPayloadHash } from '../entrypoint/payload.js';
|
|
5
|
-
/**
|
|
6
|
-
* Contract interaction for deploying an account contract. Handles fee preparation and contract initialization.
|
|
7
|
-
*/ export class DeployAccountMethod extends DeployMethod {
|
|
8
|
-
#authWitnessProvider;
|
|
9
|
-
#feePaymentArtifact;
|
|
10
|
-
constructor(authWitnessProvider, publicKeys, wallet, artifact, args = [], constructorNameOrArtifact, feePaymentNameOrArtifact){
|
|
11
|
-
super(publicKeys, wallet, artifact, (address, wallet)=>Contract.at(address, artifact, wallet), args, constructorNameOrArtifact);
|
|
12
|
-
this.#authWitnessProvider = authWitnessProvider;
|
|
13
|
-
this.#feePaymentArtifact = typeof feePaymentNameOrArtifact === 'string' ? getFunctionArtifactByName(artifact, feePaymentNameOrArtifact) : feePaymentNameOrArtifact;
|
|
14
|
-
}
|
|
15
|
-
async getInitializeFunctionCalls(options) {
|
|
16
|
-
const exec = await super.getInitializeFunctionCalls(options);
|
|
17
|
-
if (options.fee && this.#feePaymentArtifact) {
|
|
18
|
-
const { address } = await this.getInstance();
|
|
19
|
-
const emptyAppPayload = await EntrypointPayload.fromAppExecution([]);
|
|
20
|
-
const fee = await this.getDefaultFeeOptions(options.fee);
|
|
21
|
-
const feePayload = await EntrypointPayload.fromFeeOptions(address, fee);
|
|
22
|
-
exec.calls.push({
|
|
23
|
-
name: this.#feePaymentArtifact.name,
|
|
24
|
-
to: address,
|
|
25
|
-
args: encodeArguments(this.#feePaymentArtifact, [
|
|
26
|
-
emptyAppPayload,
|
|
27
|
-
feePayload,
|
|
28
|
-
false
|
|
29
|
-
]),
|
|
30
|
-
selector: await FunctionSelector.fromNameAndParameters(this.#feePaymentArtifact.name, this.#feePaymentArtifact.parameters),
|
|
31
|
-
type: this.#feePaymentArtifact.functionType,
|
|
32
|
-
isStatic: this.#feePaymentArtifact.isStatic,
|
|
33
|
-
returnTypes: this.#feePaymentArtifact.returnTypes
|
|
34
|
-
});
|
|
35
|
-
exec.authWitnesses ??= [];
|
|
36
|
-
exec.hashedArguments ??= [];
|
|
37
|
-
exec.authWitnesses.push(await this.#authWitnessProvider.createAuthWit(await computeCombinedPayloadHash(emptyAppPayload, feePayload)));
|
|
38
|
-
exec.hashedArguments.push(...emptyAppPayload.hashedArguments);
|
|
39
|
-
exec.hashedArguments.push(...feePayload.hashedArguments);
|
|
40
|
-
}
|
|
41
|
-
return exec;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
2
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
4
|
-
import type { Wallet } from '../account/index.js';
|
|
5
|
-
import { SentTx, type WaitOpts } from '../contract/sent_tx.js';
|
|
6
|
-
/** Extends a transaction receipt with a wallet instance for the newly deployed contract. */
|
|
7
|
-
export type DeployAccountTxReceipt = FieldsOf<TxReceipt> & {
|
|
8
|
-
/** Wallet that corresponds to the newly deployed account contract. */
|
|
9
|
-
wallet: Wallet;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* A deployment transaction for an account contract sent to the network, extending SentTx with methods to get the resulting wallet.
|
|
13
|
-
*/
|
|
14
|
-
export declare class DeployAccountSentTx extends SentTx {
|
|
15
|
-
private getWalletPromise;
|
|
16
|
-
constructor(pxe: PXE, txHashPromise: Promise<TxHash>, getWalletPromise: Promise<Wallet>);
|
|
17
|
-
/**
|
|
18
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
19
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
20
|
-
* @returns The deployed contract instance.
|
|
21
|
-
*/
|
|
22
|
-
getWallet(opts?: WaitOpts): Promise<Wallet>;
|
|
23
|
-
/**
|
|
24
|
-
* Awaits for the tx to be mined and returns the receipt along with a wallet instance. Throws if tx is not mined.
|
|
25
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
26
|
-
* @returns The transaction receipt with the wallet for the deployed account contract.
|
|
27
|
-
*/
|
|
28
|
-
wait(opts?: WaitOpts): Promise<DeployAccountTxReceipt>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=deploy_account_sent_tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account_sent_tx.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_sent_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAmB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEhF,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG;IACzD,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM;IACS,OAAO,CAAC,gBAAgB;gBAAlE,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,EAAU,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;IAI/F;;;;OAIG;IACU,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;OAIG;IACmB,IAAI,CAAC,IAAI,GAAE,QAA0B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAK9F"}
|