@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.0208eb9
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 +44 -0
- package/dest/account/account.d.ts.map +1 -0
- package/dest/account/account.js +31 -0
- package/dest/account/account_contract.d.ts +42 -0
- package/dest/account/account_contract.d.ts.map +1 -0
- package/dest/account/{contract.js → account_contract.js} +7 -4
- package/dest/account/account_with_secret_key.d.ts +36 -0
- 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} +22 -5
- package/dest/account/index.d.ts +6 -9
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +4 -6
- package/dest/account/signerless_account.d.ts +22 -0
- package/dest/account/signerless_account.d.ts.map +1 -0
- package/dest/account/signerless_account.js +24 -0
- package/dest/api/abi.d.ts +3 -2
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -1
- package/dest/api/account.d.ts +5 -3
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +3 -2
- package/dest/api/addresses.d.ts +2 -1
- 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/api/contract.d.ts +55 -0
- package/dest/api/contract.d.ts.map +1 -0
- package/dest/api/contract.js +53 -0
- 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 +5 -4
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +4 -3
- package/dest/api/eth_address.d.ts +1 -1
- 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 +2 -2
- 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/fields.d.ts +3 -2
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +2 -1
- 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 +2 -1
- 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 +25 -0
- package/dest/api/node.d.ts.map +1 -0
- package/dest/api/node.js +22 -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 +9 -0
- package/dest/api/protocol.d.ts.map +1 -0
- package/dest/api/protocol.js +8 -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 +5 -2
- 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 +18 -84
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +11 -136
- package/dest/contract/batch_call.d.ts +19 -21
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +89 -69
- package/dest/contract/checker.d.ts +2 -2
- package/dest/contract/checker.d.ts.map +1 -1
- package/dest/contract/checker.js +2 -2
- package/dest/contract/contract.d.ts +9 -8
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +10 -20
- package/dest/contract/contract_base.d.ts +8 -18
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +7 -14
- package/dest/contract/contract_function_interaction.d.ts +53 -45
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +78 -74
- package/dest/contract/deploy_method.d.ts +155 -62
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +152 -142
- package/dest/contract/get_gas_limits.d.ts +6 -7
- 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 +151 -0
- package/dest/contract/interaction_options.d.ts.map +1 -0
- package/dest/contract/interaction_options.js +53 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts +27 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/auth-registry.js +558 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +26 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-class-registry.js +385 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/fee-juice.js +426 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +585 -0
- package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/public-checks.js +593 -0
- 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/contract/wait_opts.d.ts +16 -0
- package/dest/contract/wait_opts.d.ts.map +1 -0
- package/dest/contract/wait_opts.js +5 -0
- package/dest/deployment/broadcast_function.d.ts +4 -4
- package/dest/deployment/broadcast_function.d.ts.map +1 -1
- package/dest/deployment/broadcast_function.js +28 -24
- package/dest/deployment/contract_deployer.d.ts +2 -2
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/contract_deployer.js +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/ethereum/portal_manager.d.ts +141 -0
- package/dest/ethereum/portal_manager.d.ts.map +1 -0
- package/dest/ethereum/portal_manager.js +345 -0
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +17 -12
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +27 -17
- package/dest/fee/fee_payment_method.d.ts +12 -8
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.d.ts +26 -9
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +45 -23
- package/dest/fee/public_fee_payment_method.d.ts +27 -10
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +47 -25
- 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/scripts/generate_protocol_contract_types.d.ts +2 -0
- package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
- package/dest/scripts/generate_protocol_contract_types.js +120 -0
- package/dest/utils/abi_types.d.ts +2 -4
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/authwit.d.ts +85 -26
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +234 -41
- 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 +4 -3
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +4 -3
- package/dest/utils/field_compressed_string.d.ts +1 -1
- package/dest/utils/field_compressed_string.d.ts.map +1 -1
- package/dest/utils/field_compressed_string.js +1 -1
- package/dest/utils/node.d.ts +13 -2
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +47 -1
- package/dest/utils/pub_key.d.ts +2 -2
- package/dest/utils/pub_key.d.ts.map +1 -1
- package/dest/utils/pub_key.js +2 -3
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +31 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.js +61 -0
- package/dest/wallet/account_manager.d.ts +63 -0
- package/dest/wallet/account_manager.d.ts.map +1 -0
- package/dest/wallet/account_manager.js +107 -0
- package/dest/wallet/capabilities.d.ts +444 -0
- package/dest/wallet/capabilities.d.ts.map +1 -0
- package/dest/wallet/capabilities.js +3 -0
- package/dest/wallet/deploy_account_method.d.ts +80 -0
- package/dest/wallet/deploy_account_method.d.ts.map +1 -0
- package/dest/wallet/deploy_account_method.js +79 -0
- package/dest/wallet/index.d.ts +4 -17
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +3 -20
- package/dest/wallet/wallet.d.ts +2590 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/dest/wallet/wallet.js +291 -0
- package/package.json +47 -36
- package/src/account/account.ts +72 -0
- package/src/account/account_contract.ts +66 -0
- package/src/account/account_with_secret_key.ts +63 -0
- package/src/account/index.ts +5 -8
- package/src/account/signerless_account.ts +46 -0
- package/src/api/abi.ts +26 -0
- package/src/api/account.ts +8 -5
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +15 -0
- package/src/api/block.ts +2 -0
- package/src/api/contract.ts +88 -0
- 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/fields.ts +2 -1
- 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 +24 -0
- package/src/api/note.ts +1 -0
- package/src/api/protocol.ts +9 -0
- package/src/api/trees.ts +2 -0
- package/src/api/tx.ts +15 -0
- package/src/api/utils.ts +14 -0
- package/src/api/wallet.ts +72 -5
- package/src/authorization/call_authorization_request.ts +63 -0
- package/src/contract/base_contract_interaction.ts +40 -171
- package/src/contract/batch_call.ts +108 -57
- package/src/contract/checker.ts +8 -3
- package/src/contract/contract.ts +14 -21
- package/src/contract/contract_base.ts +9 -26
- package/src/contract/contract_function_interaction.ts +135 -106
- package/src/contract/deploy_method.ts +307 -143
- package/src/contract/get_gas_limits.ts +15 -8
- package/src/contract/interaction_options.ts +208 -0
- package/src/contract/protocol_contracts/auth-registry.ts +351 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +241 -0
- package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
- package/src/contract/protocol_contracts/fee-juice.ts +264 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +332 -0
- package/src/contract/protocol_contracts/public-checks.ts +316 -0
- package/src/contract/wait_for_proven.ts +38 -0
- package/src/contract/wait_opts.ts +21 -0
- package/src/deployment/broadcast_function.ts +58 -58
- package/src/deployment/contract_deployer.ts +4 -3
- package/src/deployment/publish_class.ts +34 -0
- package/src/deployment/publish_instance.ts +23 -0
- package/src/{api/ethereum → ethereum}/portal_manager.ts +166 -89
- package/src/fee/fee_juice_payment_method_with_claim.ts +49 -34
- package/src/fee/fee_payment_method.ts +11 -7
- package/src/fee/private_fee_payment_method.ts +80 -58
- package/src/fee/public_fee_payment_method.ts +94 -68
- package/src/fee/sponsored_fee_payment.ts +46 -0
- package/src/scripts/generate_protocol_contract_types.ts +150 -0
- package/src/utils/abi_types.ts +1 -1
- package/src/utils/authwit.ts +274 -54
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +5 -5
- package/src/utils/field_compressed_string.ts +1 -1
- package/src/utils/node.ts +63 -1
- package/src/utils/pub_key.ts +3 -4
- package/src/wallet/account_entrypoint_meta_payment_method.ts +74 -0
- package/src/wallet/account_manager.ts +146 -0
- package/src/wallet/capabilities.ts +491 -0
- package/src/wallet/deploy_account_method.ts +150 -0
- package/src/wallet/index.ts +3 -33
- package/src/wallet/wallet.ts +533 -0
- package/dest/account/contract.d.ts +0 -37
- package/dest/account/contract.d.ts.map +0 -1
- package/dest/account/interface.d.ts +0 -31
- package/dest/account/interface.d.ts.map +0 -1
- package/dest/account/interface.js +0 -4
- 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 +0 -136
- package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
- package/dest/api/ethereum/portal_manager.js +0 -286
- 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/deploy_sent_tx.d.ts +0 -45
- package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
- package/dest/contract/deploy_sent_tx.js +0 -43
- package/dest/contract/index.d.ts +0 -45
- package/dest/contract/index.d.ts.map +0 -1
- package/dest/contract/index.js +0 -43
- package/dest/contract/protocol_contracts.d.ts +0 -9
- package/dest/contract/protocol_contracts.d.ts.map +0 -1
- package/dest/contract/protocol_contracts.js +0 -26
- 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/contract/sent_tx.d.ts +0 -61
- package/dest/contract/sent_tx.d.ts.map +0 -1
- package/dest/contract/sent_tx.js +0 -102
- package/dest/contract/unsafe_contract.d.ts +0 -15
- package/dest/contract/unsafe_contract.d.ts.map +0 -1
- package/dest/contract/unsafe_contract.js +0 -6
- 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 +0 -26
- package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
- package/dest/wallet/base_wallet.d.ts +0 -73
- package/dest/wallet/base_wallet.d.ts.map +0 -1
- package/dest/wallet/base_wallet.js +0 -123
- 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/contract.ts +0 -56
- package/src/account/interface.ts +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/deploy_sent_tx.ts +0 -74
- package/src/contract/index.ts +0 -48
- package/src/contract/protocol_contracts.ts +0 -35
- package/src/contract/proven_tx.ts +0 -42
- package/src/contract/sent_tx.ts +0 -141
- package/src/contract/unsafe_contract.ts +0 -19
- 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/account_wallet_with_private_key.ts +0 -40
- package/src/wallet/base_wallet.ts +0 -198
- package/src/wallet/signerless_wallet.ts +0 -52
|
@@ -1,146 +1,244 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type ContractArtifact, type
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, getInitializer } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import {
|
|
5
6
|
type ContractInstanceWithAddress,
|
|
6
7
|
computePartialAddress,
|
|
7
8
|
getContractClassFromArtifact,
|
|
8
|
-
|
|
9
|
+
getContractInstanceFromInstantiationParams,
|
|
9
10
|
} from '@aztec/stdlib/contract';
|
|
10
|
-
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
11
11
|
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
12
|
-
import type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import type {
|
|
18
|
-
import { BaseContractInteraction
|
|
19
|
-
import type { Contract } from './contract.js';
|
|
12
|
+
import { type Capsule, TxHash, type TxProfileResult, type TxReceipt, collectOffchainEffects } from '@aztec/stdlib/tx';
|
|
13
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
14
|
+
|
|
15
|
+
import { publishContractClass } from '../deployment/publish_class.js';
|
|
16
|
+
import { publishInstance } from '../deployment/publish_instance.js';
|
|
17
|
+
import type { SendOptions, Wallet } from '../wallet/wallet.js';
|
|
18
|
+
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
20
19
|
import type { ContractBase } from './contract_base.js';
|
|
21
20
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
21
|
+
import { getGasLimits } from './get_gas_limits.js';
|
|
22
|
+
import {
|
|
23
|
+
NO_WAIT,
|
|
24
|
+
type NoWait,
|
|
25
|
+
type ProfileInteractionOptions,
|
|
26
|
+
type RequestInteractionOptions,
|
|
27
|
+
type SendInteractionOptionsWithoutWait,
|
|
28
|
+
type SimulationInteractionFeeOptions,
|
|
29
|
+
type SimulationReturn,
|
|
30
|
+
toProfileOptions,
|
|
31
|
+
toSendOptions,
|
|
32
|
+
toSimulateOptions,
|
|
33
|
+
} from './interaction_options.js';
|
|
34
|
+
import type { WaitOpts } from './wait_opts.js';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Wait options specific to deployment transactions.
|
|
38
|
+
* Extends WaitOpts with a flag to return the full receipt instead of just the contract.
|
|
39
|
+
*/
|
|
40
|
+
export type DeployWaitOptions = WaitOpts & {
|
|
41
|
+
/** If true, return the full DeployTxReceipt instead of just the contract. Defaults to false. */
|
|
42
|
+
returnReceipt?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Type for wait options in deployment interactions.
|
|
47
|
+
* - NO_WAIT symbol: Don't wait, return TxHash immediately
|
|
48
|
+
* - DeployWaitOptions: Wait with custom options
|
|
49
|
+
* - undefined: Wait with default options
|
|
50
|
+
*/
|
|
51
|
+
export type DeployInteractionWaitOptions = NoWait | DeployWaitOptions | undefined;
|
|
24
52
|
|
|
25
53
|
/**
|
|
26
54
|
* Options for deploying a contract on the Aztec network.
|
|
27
|
-
* Allows specifying a contract address salt
|
|
55
|
+
* Allows specifying a contract address salt and different options to tweak contract publication
|
|
56
|
+
* and initialization
|
|
28
57
|
*/
|
|
29
|
-
|
|
30
|
-
export type DeployOptions = {
|
|
58
|
+
export type RequestDeployOptions = RequestInteractionOptions & {
|
|
31
59
|
/** An optional salt value used to deterministically calculate the contract address. */
|
|
32
60
|
contractAddressSalt?: Fr;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Deployer address that will be used for the deployed contract's address computation.
|
|
63
|
+
* If set to 0, the sender's address won't be mixed in
|
|
64
|
+
*/
|
|
65
|
+
deployer?: AztecAddress;
|
|
66
|
+
/** Skip contract class publication. */
|
|
67
|
+
skipClassPublication?: boolean;
|
|
68
|
+
/** Skip publication, instead just privately initialize the contract. */
|
|
69
|
+
skipInstancePublication?: boolean;
|
|
39
70
|
/** Skip contract initialization. */
|
|
40
71
|
skipInitialization?: boolean;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
72
|
+
/** Skip contract registration in the wallet */
|
|
73
|
+
skipRegistration?: boolean;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Base deployment options without wait parameter.
|
|
78
|
+
*/
|
|
79
|
+
export type DeployOptionsWithoutWait = Omit<RequestDeployOptions, 'deployer'> & {
|
|
80
|
+
/**
|
|
81
|
+
* Set to true to *not* include the sender in the address computation. This option
|
|
82
|
+
* is mutually exclusive with "deployer"
|
|
83
|
+
*/
|
|
84
|
+
universalDeploy?: boolean;
|
|
85
|
+
} & Pick<SendInteractionOptionsWithoutWait, 'from' | 'fee'>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Extends the deployment options with the required parameters to send the transaction.
|
|
89
|
+
*/
|
|
90
|
+
export type DeployOptions<W extends DeployInteractionWaitOptions = undefined> = DeployOptionsWithoutWait & {
|
|
91
|
+
/**
|
|
92
|
+
* Options for waiting for the transaction to be mined.
|
|
93
|
+
* - undefined (default): wait with default options and return the contract instance
|
|
94
|
+
* - DeployWaitOptions: wait with custom options and return contract or receipt based on returnReceipt flag
|
|
95
|
+
* - NO_WAIT: return TxHash immediately without waiting
|
|
96
|
+
*/
|
|
97
|
+
wait?: W;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Options for simulating the deployment of a contract
|
|
102
|
+
* Allows skipping certain validations and computing gas estimations
|
|
103
|
+
*/
|
|
104
|
+
export type SimulateDeployOptions = Omit<DeployOptionsWithoutWait, 'fee'> & {
|
|
105
|
+
/** The fee options for the transaction. */
|
|
106
|
+
fee?: SimulationInteractionFeeOptions;
|
|
107
|
+
/** Simulate without checking for the validity of the resulting transaction,
|
|
108
|
+
* e.g. whether it emits any existing nullifiers. */
|
|
109
|
+
skipTxValidation?: boolean;
|
|
110
|
+
/** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
|
|
111
|
+
skipFeeEnforcement?: boolean;
|
|
112
|
+
/** Whether to include metadata such as offchain effects and performance statistics
|
|
113
|
+
* (e.g. timing information of the different circuits and oracles) in
|
|
114
|
+
* the simulation result, instead of just the return value of the function */
|
|
115
|
+
includeMetadata?: boolean;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/** Receipt for a deployment transaction with the deployed contract instance. */
|
|
119
|
+
export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = TxReceipt & {
|
|
120
|
+
/** Type-safe wrapper around the deployed contract instance, linked to the deployment wallet */
|
|
121
|
+
contract: TContract;
|
|
122
|
+
/** The deployed contract instance with address and metadata. */
|
|
123
|
+
instance: ContractInstanceWithAddress;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Represents the result type of deploying a contract.
|
|
128
|
+
* - If wait is NO_WAIT, returns TxHash immediately.
|
|
129
|
+
* - If wait has returnReceipt: true, returns DeployTxReceipt after waiting.
|
|
130
|
+
* - Otherwise (undefined or DeployWaitOptions without returnReceipt), returns TContract after waiting.
|
|
131
|
+
*/
|
|
132
|
+
export type DeployReturn<TContract extends ContractBase, W extends DeployInteractionWaitOptions> = W extends NoWait
|
|
133
|
+
? TxHash
|
|
134
|
+
: W extends {
|
|
135
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
136
|
+
returnReceipt: true;
|
|
137
|
+
}
|
|
138
|
+
? DeployTxReceipt<TContract>
|
|
139
|
+
: TContract;
|
|
44
140
|
|
|
45
141
|
/**
|
|
46
|
-
* Contract interaction for deployment.
|
|
47
|
-
* and initialization of the contract.
|
|
142
|
+
* Contract interaction for deployment.
|
|
143
|
+
* Handles class publication, instance publication, and initialization of the contract.
|
|
144
|
+
*
|
|
145
|
+
* Note that for some contracts, a tx is not required as part of its "creation":
|
|
146
|
+
* If there are no public functions, and if there are no initialization functions,
|
|
147
|
+
* then technically the contract has already been "created", and all of the contract's
|
|
148
|
+
* functions (private and utility) can be interacted-with immediately, without any
|
|
149
|
+
* "deployment tx".
|
|
48
150
|
*/
|
|
49
|
-
export class DeployMethod<TContract extends ContractBase =
|
|
151
|
+
export class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
|
|
50
152
|
/** The contract instance to be deployed. */
|
|
51
153
|
private instance?: ContractInstanceWithAddress = undefined;
|
|
52
154
|
|
|
53
155
|
/** Constructor function to call. */
|
|
54
|
-
private constructorArtifact:
|
|
156
|
+
private constructorArtifact: FunctionAbi | undefined;
|
|
55
157
|
|
|
56
158
|
constructor(
|
|
57
159
|
private publicKeys: PublicKeys,
|
|
58
160
|
wallet: Wallet,
|
|
59
|
-
|
|
60
|
-
|
|
161
|
+
protected artifact: ContractArtifact,
|
|
162
|
+
protected postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
|
|
61
163
|
private args: any[] = [],
|
|
62
164
|
constructorNameOrArtifact?: string | FunctionArtifact,
|
|
165
|
+
authWitnesses: AuthWitness[] = [],
|
|
166
|
+
capsules: Capsule[] = [],
|
|
63
167
|
) {
|
|
64
|
-
super(wallet);
|
|
168
|
+
super(wallet, authWitnesses, capsules);
|
|
65
169
|
this.constructorArtifact = getInitializer(artifact, constructorNameOrArtifact);
|
|
66
170
|
}
|
|
67
171
|
|
|
68
172
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* later sent using the `send()` method.
|
|
73
|
-
*
|
|
74
|
-
* @param options - An object containing optional deployment settings, contractAddressSalt, and from.
|
|
75
|
-
* @returns A Promise resolving to an object containing the signed transaction data and other relevant information.
|
|
173
|
+
* Returns the execution payload that allows this operation to happen on chain.
|
|
174
|
+
* @param options - Configuration options.
|
|
175
|
+
* @returns The execution payload for this operation
|
|
76
176
|
*/
|
|
77
|
-
public async
|
|
78
|
-
|
|
79
|
-
}
|
|
177
|
+
public async request(options?: RequestDeployOptions): Promise<ExecutionPayload> {
|
|
178
|
+
const publication = await this.getPublicationExecutionPayload(options);
|
|
80
179
|
|
|
81
|
-
|
|
82
|
-
|
|
180
|
+
if (!options?.skipRegistration) {
|
|
181
|
+
await this.wallet.registerContract(await this.getInstance(options), this.artifact);
|
|
182
|
+
}
|
|
83
183
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const deployment = await this.getDeploymentFunctionCalls(options);
|
|
94
|
-
|
|
95
|
-
// NOTE: MEGA HACK. Remove with #10007
|
|
96
|
-
// register the contract after generating deployment function calls in order to publicly register the class and (optioanlly) emit its bytecode
|
|
97
|
-
//
|
|
98
|
-
// TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
|
|
99
|
-
// Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
|
|
100
|
-
// runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
|
|
101
|
-
// in case the initializer is public. This hints at the need of having "transient" contracts scoped to a
|
|
102
|
-
// simulation, so we can run the simulation with a set of contracts, but only "commit" them to the wallet
|
|
103
|
-
// once this tx has gone through.
|
|
104
|
-
await this.wallet.registerContract({ artifact: this.artifact, instance: await this.getInstance(options) });
|
|
105
|
-
|
|
106
|
-
const bootstrap = await this.getInitializeFunctionCalls(options);
|
|
107
|
-
|
|
108
|
-
if (deployment.calls.length + bootstrap.calls.length === 0) {
|
|
109
|
-
throw new Error(`No function calls needed to deploy contract ${this.artifact.name}`);
|
|
184
|
+
const initialization = await this.getInitializationExecutionPayload(options);
|
|
185
|
+
const feeExecutionPayload = options?.fee?.paymentMethod
|
|
186
|
+
? await options.fee.paymentMethod.getExecutionPayload()
|
|
187
|
+
: undefined;
|
|
188
|
+
const finalExecutionPayload = feeExecutionPayload
|
|
189
|
+
? mergeExecutionPayloads([feeExecutionPayload, publication, initialization])
|
|
190
|
+
: mergeExecutionPayloads([publication, initialization]);
|
|
191
|
+
if (!finalExecutionPayload.calls.length) {
|
|
192
|
+
throw new Error(`No transactions are needed to publish or initialize contract ${this.artifact.name}`);
|
|
110
193
|
}
|
|
111
194
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const hashedArguments = [...(deployment.hashedArguments ?? []), ...(bootstrap.hashedArguments ?? [])];
|
|
115
|
-
const capsules = [...(deployment.capsules ?? []), ...(bootstrap.capsules ?? [])];
|
|
116
|
-
const { cancellable, nonce, fee: userFee } = options;
|
|
195
|
+
return finalExecutionPayload;
|
|
196
|
+
}
|
|
117
197
|
|
|
118
|
-
|
|
198
|
+
convertDeployOptionsToRequestOptions(options: DeployOptionsWithoutWait): RequestDeployOptions {
|
|
199
|
+
return {
|
|
200
|
+
...options,
|
|
201
|
+
deployer: !options?.universalDeploy ? options.from : undefined,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
119
204
|
|
|
120
|
-
|
|
121
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Converts DeployOptions to SendOptions, stripping out the returnReceipt flag if present.
|
|
207
|
+
* @param options - Deploy options with wait parameter
|
|
208
|
+
* @returns Send options with wait parameter
|
|
209
|
+
*/
|
|
210
|
+
private convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
|
|
211
|
+
options: DeployOptions<W>,
|
|
212
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
213
|
+
): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
|
|
214
|
+
return {
|
|
215
|
+
...toSendOptions({
|
|
216
|
+
...options,
|
|
217
|
+
wait: options.wait as any,
|
|
218
|
+
}),
|
|
219
|
+
} as any;
|
|
122
220
|
}
|
|
123
221
|
|
|
124
222
|
/**
|
|
125
|
-
*
|
|
223
|
+
* Adds this contract to the wallet and returns the Contract object.
|
|
126
224
|
* @param options - Deployment options.
|
|
127
225
|
*/
|
|
128
|
-
public async register(options
|
|
226
|
+
public async register(options?: RequestDeployOptions): Promise<TContract> {
|
|
129
227
|
const instance = await this.getInstance(options);
|
|
130
|
-
await this.wallet.registerContract(
|
|
131
|
-
return this.postDeployCtor(instance
|
|
228
|
+
await this.wallet.registerContract(instance, this.artifact);
|
|
229
|
+
return this.postDeployCtor(instance, this.wallet);
|
|
132
230
|
}
|
|
133
231
|
|
|
134
232
|
/**
|
|
135
|
-
* Returns
|
|
136
|
-
*
|
|
137
|
-
*
|
|
233
|
+
* Returns an execution payload for:
|
|
234
|
+
* - publication of the contract class and
|
|
235
|
+
* - publication of the contract instance to enable public execution
|
|
236
|
+
* depending on the provided options.
|
|
237
|
+
* @param options - Contract creation options.
|
|
238
|
+
* @returns An execution payload with potentially calls (and bytecode capsule) to the class registry and instance registry.
|
|
138
239
|
*/
|
|
139
|
-
protected async
|
|
140
|
-
|
|
141
|
-
): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
|
|
142
|
-
const calls: FunctionCall[] = [];
|
|
143
|
-
const capsules: Capsule[] = [];
|
|
240
|
+
protected async getPublicationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload> {
|
|
241
|
+
const calls: ExecutionPayload[] = [];
|
|
144
242
|
|
|
145
243
|
// Set contract instance object so it's available for populating the DeploySendTx object
|
|
146
244
|
const instance = await this.getInstance(options);
|
|
@@ -154,30 +252,32 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
154
252
|
);
|
|
155
253
|
}
|
|
156
254
|
|
|
157
|
-
//
|
|
158
|
-
if (!options
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`Skipping registration of already registered contract class ${contractClass.id.toString()} for ${instance.address.toString()}`,
|
|
162
|
-
);
|
|
163
|
-
} else {
|
|
255
|
+
// Publish the contract class if it hasn't been published already.
|
|
256
|
+
if (!options?.skipClassPublication) {
|
|
257
|
+
const classMetadata = await this.wallet.getContractClassMetadata(contractClass.id);
|
|
258
|
+
if (!classMetadata.isContractClassPubliclyRegistered) {
|
|
164
259
|
this.log.info(
|
|
165
|
-
`Creating request for
|
|
260
|
+
`Creating request for publishing contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`,
|
|
166
261
|
);
|
|
167
|
-
const registerContractClassInteraction = await
|
|
262
|
+
const registerContractClassInteraction = await publishContractClass(this.wallet, this.artifact);
|
|
168
263
|
calls.push(await registerContractClassInteraction.request());
|
|
169
|
-
|
|
264
|
+
} else {
|
|
265
|
+
this.log.debug(
|
|
266
|
+
`Skipping contract class publication for ${contractClass.id.toString()} as it is already registered`,
|
|
267
|
+
);
|
|
170
268
|
}
|
|
171
269
|
}
|
|
172
270
|
|
|
173
|
-
//
|
|
174
|
-
if (!options
|
|
175
|
-
|
|
271
|
+
// Publish the contract instance:
|
|
272
|
+
if (!options?.skipInstancePublication) {
|
|
273
|
+
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/15596):
|
|
274
|
+
// Read the artifact, and if there are no public functions, warn the caller that publication of the
|
|
275
|
+
// contract instance is not necessary (until such time as they wish to update the instance (i.e. change its class_id)).
|
|
276
|
+
const deploymentInteraction = publishInstance(this.wallet, instance);
|
|
176
277
|
calls.push(await deploymentInteraction.request());
|
|
177
|
-
capsules.push(...deploymentInteraction.getCapsules());
|
|
178
278
|
}
|
|
179
279
|
|
|
180
|
-
return
|
|
280
|
+
return mergeExecutionPayloads(calls);
|
|
181
281
|
}
|
|
182
282
|
|
|
183
283
|
/**
|
|
@@ -185,78 +285,116 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
185
285
|
* @param options - Deployment options.
|
|
186
286
|
* @returns - An array of function calls.
|
|
187
287
|
*/
|
|
188
|
-
protected async
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const calls: FunctionCall[] = [];
|
|
193
|
-
const capsules: Capsule[] = [];
|
|
194
|
-
if (this.constructorArtifact && !options.skipInitialization) {
|
|
288
|
+
protected async getInitializationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload> {
|
|
289
|
+
const executionsPayloads: ExecutionPayload[] = [];
|
|
290
|
+
if (this.constructorArtifact && !options?.skipInitialization) {
|
|
291
|
+
const { address } = await this.getInstance(options);
|
|
195
292
|
const constructorCall = new ContractFunctionInteraction(
|
|
196
293
|
this.wallet,
|
|
197
294
|
address,
|
|
198
295
|
this.constructorArtifact,
|
|
199
296
|
this.args,
|
|
200
297
|
);
|
|
201
|
-
|
|
202
|
-
capsules.push(...constructorCall.getCapsules());
|
|
298
|
+
executionsPayloads.push(await constructorCall.request());
|
|
203
299
|
}
|
|
204
|
-
return
|
|
300
|
+
return mergeExecutionPayloads(executionsPayloads);
|
|
205
301
|
}
|
|
206
302
|
|
|
207
303
|
/**
|
|
208
|
-
* Send
|
|
209
|
-
*
|
|
210
|
-
* allowing us to send a transaction specifically for contract deployment.
|
|
304
|
+
* Send a contract deployment transaction (initialize and/or publish) using the provided options.
|
|
305
|
+
* By default, waits for the transaction to be mined and returns the deployed contract instance.
|
|
211
306
|
*
|
|
212
307
|
* @param options - An object containing various deployment options such as contractAddressSalt and from.
|
|
213
|
-
* @returns
|
|
308
|
+
* @returns TxHash (if wait is NO_WAIT), TContract (if wait is undefined or doesn't have returnReceipt), or DeployTxReceipt (if wait.returnReceipt is true)
|
|
214
309
|
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
310
|
+
// Overload for when wait is not specified at all - returns the contract
|
|
311
|
+
public override send(options: DeployOptionsWithoutWait): Promise<TContract>;
|
|
312
|
+
// Generic overload for explicit wait values
|
|
313
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
314
|
+
public override send<W extends DeployInteractionWaitOptions>(
|
|
315
|
+
options: DeployOptions<W>,
|
|
316
|
+
): Promise<DeployReturn<TContract, W>>;
|
|
317
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
318
|
+
public override async send(options: DeployOptions<DeployInteractionWaitOptions>): Promise<any> {
|
|
319
|
+
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
320
|
+
const sendOptions = this.convertDeployOptionsToSendOptions(options);
|
|
321
|
+
|
|
322
|
+
if (options.wait === NO_WAIT) {
|
|
323
|
+
const txHash = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<NoWait>);
|
|
324
|
+
this.log.debug(`Sent deployment tx ${txHash.hash} of ${this.artifact.name} contract`);
|
|
325
|
+
return txHash;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const receipt = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<WaitOpts | undefined>);
|
|
329
|
+
this.log.debug(`Deployed ${this.artifact.name} contract in tx ${receipt.txHash}`);
|
|
330
|
+
|
|
331
|
+
// Attach contract instance
|
|
332
|
+
const instance = await this.getInstance(options);
|
|
333
|
+
const contract = this.postDeployCtor(instance, this.wallet) as TContract;
|
|
334
|
+
|
|
335
|
+
// Return full receipt if requested, otherwise just the contract
|
|
336
|
+
if (options.wait && typeof options.wait === 'object' && options.wait.returnReceipt) {
|
|
337
|
+
return { ...receipt, contract, instance };
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return contract;
|
|
219
341
|
}
|
|
220
342
|
|
|
221
343
|
/**
|
|
222
|
-
* Builds the contract instance
|
|
344
|
+
* Builds the contract instance and returns it.
|
|
223
345
|
*
|
|
224
|
-
* @param options - An object containing various
|
|
346
|
+
* @param options - An object containing various initialization and publication options.
|
|
225
347
|
* @returns An instance object.
|
|
226
348
|
*/
|
|
227
|
-
public async getInstance(options
|
|
349
|
+
public async getInstance(options?: RequestDeployOptions): Promise<ContractInstanceWithAddress> {
|
|
228
350
|
if (!this.instance) {
|
|
229
|
-
this.instance = await
|
|
351
|
+
this.instance = await getContractInstanceFromInstantiationParams(this.artifact, {
|
|
230
352
|
constructorArgs: this.args,
|
|
231
|
-
salt: options.
|
|
353
|
+
salt: options?.contractAddressSalt ?? Fr.random(),
|
|
232
354
|
publicKeys: this.publicKeys,
|
|
233
355
|
constructorArtifact: this.constructorArtifact,
|
|
234
|
-
deployer: options
|
|
356
|
+
deployer: options?.deployer ? options.deployer : AztecAddress.ZERO,
|
|
235
357
|
});
|
|
236
358
|
}
|
|
237
359
|
return this.instance;
|
|
238
360
|
}
|
|
239
361
|
|
|
240
362
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* @
|
|
363
|
+
* Simulate the deployment
|
|
364
|
+
*
|
|
365
|
+
* @param options - An optional object containing additional configuration for the simulation.
|
|
366
|
+
* @returns A simulation result object containing metadata of the execution, including gas
|
|
367
|
+
* estimations (if requested via options), execution statistics and emitted offchain effects
|
|
244
368
|
*/
|
|
245
|
-
public
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
369
|
+
public async simulate(options: SimulateDeployOptions): Promise<SimulationReturn<true>> {
|
|
370
|
+
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
371
|
+
const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
|
|
372
|
+
|
|
373
|
+
const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
|
|
374
|
+
this.log.verbose(
|
|
375
|
+
`Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`,
|
|
249
376
|
);
|
|
377
|
+
return {
|
|
378
|
+
stats: simulatedTx.stats!,
|
|
379
|
+
offchainEffects: collectOffchainEffects(simulatedTx.privateExecutionResult),
|
|
380
|
+
result: undefined,
|
|
381
|
+
estimatedGas: { gasLimits, teardownGasLimits },
|
|
382
|
+
};
|
|
250
383
|
}
|
|
251
384
|
|
|
252
385
|
/**
|
|
253
|
-
*
|
|
254
|
-
* @param options -
|
|
386
|
+
* Simulate a deployment and profile the gate count for each function in the transaction.
|
|
387
|
+
* @param options - Same options as `send`, plus extra profiling options.
|
|
388
|
+
*
|
|
389
|
+
* @returns An object containing the function return value and profile result.
|
|
255
390
|
*/
|
|
256
|
-
public
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
391
|
+
public async profile(options: DeployOptionsWithoutWait & ProfileInteractionOptions): Promise<TxProfileResult> {
|
|
392
|
+
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
393
|
+
return await this.wallet.profileTx(executionPayload, {
|
|
394
|
+
...toProfileOptions(options),
|
|
395
|
+
profileMode: options.profileMode,
|
|
396
|
+
skipProofGeneration: options.skipProofGeneration,
|
|
397
|
+
});
|
|
260
398
|
}
|
|
261
399
|
|
|
262
400
|
/** Return this deployment address. */
|
|
@@ -268,4 +406,30 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
268
406
|
public get partialAddress() {
|
|
269
407
|
return this.instance && computePartialAddress(this.instance);
|
|
270
408
|
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Augments this DeployMethod with additional metadata, such as authWitnesses and capsules.
|
|
412
|
+
* @param options - An object containing the metadata to add to the interaction
|
|
413
|
+
* @returns A new DeployMethod with the added metadata, but calling the same original function in the same manner
|
|
414
|
+
*/
|
|
415
|
+
public with({
|
|
416
|
+
authWitnesses = [],
|
|
417
|
+
capsules = [],
|
|
418
|
+
}: {
|
|
419
|
+
/** The authWitnesses to add to the deployment */
|
|
420
|
+
authWitnesses?: AuthWitness[];
|
|
421
|
+
/** The capsules to add to the deployment */
|
|
422
|
+
capsules?: Capsule[];
|
|
423
|
+
}): DeployMethod {
|
|
424
|
+
return new DeployMethod(
|
|
425
|
+
this.publicKeys,
|
|
426
|
+
this.wallet,
|
|
427
|
+
this.artifact,
|
|
428
|
+
this.postDeployCtor,
|
|
429
|
+
this.args,
|
|
430
|
+
this.constructorArtifact?.name,
|
|
431
|
+
this.authWitnesses.concat(authWitnesses),
|
|
432
|
+
this.capsules.concat(capsules),
|
|
433
|
+
);
|
|
434
|
+
}
|
|
271
435
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
|
|
2
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
2
3
|
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Returns suggested total and teardown gas limits for a simulated tx.
|
|
6
|
-
* Note that public gas usage is only accounted for if the publicOutput is present.
|
|
7
7
|
* @param pad - Percentage to pad the suggested gas limits by, (as decimal, e.g., 0.10 for 10%).
|
|
8
8
|
*/
|
|
9
9
|
export function getGasLimits(
|
|
@@ -11,16 +11,23 @@ export function getGasLimits(
|
|
|
11
11
|
pad = 0.1,
|
|
12
12
|
): {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Gas limit for the tx, excluding teardown gas
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
gasLimits: Gas;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Gas limit for the teardown phase
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
teardownGasLimits: Gas;
|
|
21
21
|
} {
|
|
22
|
+
// Total gas does not use the teardown gas limit, but the actual total gas used by the tx.
|
|
23
|
+
const gasLimits = simulationResult.gasUsed.totalGas.mul(1 + pad);
|
|
24
|
+
const teardownGasLimits = simulationResult.gasUsed.teardownGas.mul(1 + pad);
|
|
25
|
+
|
|
26
|
+
if (gasLimits.l2Gas > AVM_MAX_PROCESSABLE_L2_GAS) {
|
|
27
|
+
throw new Error('Transaction consumes more gas than the AVM maximum processable gas');
|
|
28
|
+
}
|
|
22
29
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
gasLimits,
|
|
31
|
+
teardownGasLimits,
|
|
25
32
|
};
|
|
26
33
|
}
|