@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.023c3e5
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 +575 -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 +583 -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
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { extractEvent } from '@aztec/ethereum/utils';
|
|
2
|
+
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
6
|
+
import { FeeJuicePortalAbi } from '@aztec/l1-artifacts/FeeJuicePortalAbi';
|
|
7
|
+
import { OutboxAbi } from '@aztec/l1-artifacts/OutboxAbi';
|
|
8
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
9
|
+
import { TokenPortalAbi } from '@aztec/l1-artifacts/TokenPortalAbi';
|
|
10
|
+
import { computeL2ToL1MessageHash, computeSecretHash } from '@aztec/stdlib/hash';
|
|
11
|
+
import { getL2ToL1MessageLeafId } from '@aztec/stdlib/messaging';
|
|
12
|
+
import { getContract, toFunctionSelector } from 'viem';
|
|
13
|
+
/** Stringifies an eth address for logging. */ function stringifyEthAddress(address, name) {
|
|
14
|
+
return name ? `${name} (${address.toString()})` : address.toString();
|
|
15
|
+
}
|
|
16
|
+
/** Generates a pair secret and secret hash */ export async function generateClaimSecret(logger) {
|
|
17
|
+
const secret = Fr.random();
|
|
18
|
+
const secretHash = await computeSecretHash(secret);
|
|
19
|
+
logger?.verbose(`Generated claim secret=${secret.toString()} hash=${secretHash.toString()}`);
|
|
20
|
+
return [
|
|
21
|
+
secret,
|
|
22
|
+
secretHash
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
/** Helper for managing an ERC20 on L1. */ export class L1TokenManager {
|
|
26
|
+
tokenAddress;
|
|
27
|
+
handlerAddress;
|
|
28
|
+
extendedClient;
|
|
29
|
+
logger;
|
|
30
|
+
contract;
|
|
31
|
+
handler;
|
|
32
|
+
constructor(/** Address of the ERC20 contract. */ tokenAddress, /** Address of the handler/faucet contract. */ handlerAddress, extendedClient, logger){
|
|
33
|
+
this.tokenAddress = tokenAddress;
|
|
34
|
+
this.handlerAddress = handlerAddress;
|
|
35
|
+
this.extendedClient = extendedClient;
|
|
36
|
+
this.logger = logger;
|
|
37
|
+
this.contract = getContract({
|
|
38
|
+
address: this.tokenAddress.toString(),
|
|
39
|
+
abi: TestERC20Abi,
|
|
40
|
+
client: this.extendedClient
|
|
41
|
+
});
|
|
42
|
+
if (this.handlerAddress) {
|
|
43
|
+
this.handler = getContract({
|
|
44
|
+
address: this.handlerAddress.toString(),
|
|
45
|
+
abi: FeeAssetHandlerAbi,
|
|
46
|
+
client: this.extendedClient
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Returns the amount of tokens available to mint via the handler.
|
|
51
|
+
* @throws if the handler is not provided.
|
|
52
|
+
*/ async getMintAmount() {
|
|
53
|
+
if (!this.handler) {
|
|
54
|
+
throw new Error('Minting handler was not provided');
|
|
55
|
+
}
|
|
56
|
+
return await this.handler.read.mintAmount();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the balance of the given address.
|
|
60
|
+
* @param address - Address to get the balance of.
|
|
61
|
+
*/ async getL1TokenBalance(address) {
|
|
62
|
+
return await this.contract.read.balanceOf([
|
|
63
|
+
address
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Mints a fixed amount of tokens for the given address. Returns once the tx has been mined.
|
|
68
|
+
* @param address - Address to mint the tokens for.
|
|
69
|
+
* @param addressName - Optional name of the address for logging.
|
|
70
|
+
*/ async mint(address, addressName) {
|
|
71
|
+
if (!this.handler) {
|
|
72
|
+
throw new Error('Minting handler was not provided');
|
|
73
|
+
}
|
|
74
|
+
const mintAmount = await this.getMintAmount();
|
|
75
|
+
this.logger.info(`Minting ${mintAmount} tokens for ${stringifyEthAddress(address, addressName)}`);
|
|
76
|
+
// NOTE: the handler mints a fixed amount.
|
|
77
|
+
await this.handler.write.mint([
|
|
78
|
+
address
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Approves tokens for the given address. Returns once the tx has been mined.
|
|
83
|
+
* @param amount - Amount to approve.
|
|
84
|
+
* @param address - Address to approve the tokens for.
|
|
85
|
+
* @param addressName - Optional name of the address for logging.
|
|
86
|
+
*/ async approve(amount, address, addressName = '') {
|
|
87
|
+
this.logger.info(`Approving ${amount} tokens for ${stringifyEthAddress(address, addressName)}`);
|
|
88
|
+
await this.extendedClient.waitForTransactionReceipt({
|
|
89
|
+
hash: await this.contract.write.approve([
|
|
90
|
+
address,
|
|
91
|
+
amount
|
|
92
|
+
])
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Helper for interacting with the FeeJuicePortal on L1. */ export class L1FeeJuicePortalManager {
|
|
97
|
+
extendedClient;
|
|
98
|
+
logger;
|
|
99
|
+
tokenManager;
|
|
100
|
+
contract;
|
|
101
|
+
constructor(portalAddress, tokenAddress, handlerAddress, extendedClient, logger){
|
|
102
|
+
this.extendedClient = extendedClient;
|
|
103
|
+
this.logger = logger;
|
|
104
|
+
this.tokenManager = new L1TokenManager(tokenAddress, handlerAddress, extendedClient, logger);
|
|
105
|
+
this.contract = getContract({
|
|
106
|
+
address: portalAddress.toString(),
|
|
107
|
+
abi: FeeJuicePortalAbi,
|
|
108
|
+
client: extendedClient
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/** Returns the associated token manager for the L1 ERC20. */ getTokenManager() {
|
|
112
|
+
return this.tokenManager;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Bridges fee juice from L1 to L2 publicly. Handles L1 ERC20 approvals. Returns once the tx has been mined.
|
|
116
|
+
* @param to - Address to send the tokens to on L2.
|
|
117
|
+
* @param amount - Amount of tokens to send.
|
|
118
|
+
* @param mint - Whether to mint the tokens before sending (only during testing).
|
|
119
|
+
*/ async bridgeTokensPublic(to, amount, mint = false) {
|
|
120
|
+
const [claimSecret, claimSecretHash] = await generateClaimSecret();
|
|
121
|
+
const amountToBridge = amount ?? await this.tokenManager.getMintAmount();
|
|
122
|
+
if (mint) {
|
|
123
|
+
const mintableAmount = await this.tokenManager.getMintAmount();
|
|
124
|
+
if (amountToBridge !== mintableAmount) {
|
|
125
|
+
throw new Error(`Minting amount must be ${mintableAmount}`);
|
|
126
|
+
}
|
|
127
|
+
await this.tokenManager.mint(this.extendedClient.account.address);
|
|
128
|
+
}
|
|
129
|
+
await this.tokenManager.approve(amountToBridge, this.contract.address, 'FeeJuice Portal');
|
|
130
|
+
this.logger.info('Sending L1 Fee Juice to L2 to be claimed publicly');
|
|
131
|
+
const args = [
|
|
132
|
+
to.toString(),
|
|
133
|
+
amountToBridge,
|
|
134
|
+
claimSecretHash.toString()
|
|
135
|
+
];
|
|
136
|
+
await this.contract.simulate.depositToAztecPublic(args);
|
|
137
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
138
|
+
hash: await this.contract.write.depositToAztecPublic(args)
|
|
139
|
+
});
|
|
140
|
+
this.logger.info('Deposited to Aztec public successfully', {
|
|
141
|
+
txReceipt
|
|
142
|
+
});
|
|
143
|
+
const log = extractEvent(txReceipt.logs, this.contract.address, this.contract.abi, 'DepositToAztecPublic', (log)=>{
|
|
144
|
+
// Normalize hex strings for comparison (case-insensitive, handle different formats)
|
|
145
|
+
const normalizeHex = (val)=>{
|
|
146
|
+
const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
|
|
147
|
+
return hexStr.toLowerCase();
|
|
148
|
+
};
|
|
149
|
+
const secretHashMatch = normalizeHex(log.args.secretHash) === normalizeHex(claimSecretHash.toString());
|
|
150
|
+
const amountMatch = log.args.amount === amountToBridge;
|
|
151
|
+
const toMatch = normalizeHex(log.args.to) === normalizeHex(to.toString());
|
|
152
|
+
this.logger.debug(`Event filter matching: secretHash=${secretHashMatch} (${log.args.secretHash} vs ${claimSecretHash.toString()}), ` + `amount=${amountMatch} (${log.args.amount} vs ${amountToBridge}), ` + `to=${toMatch} (${log.args.to} vs ${to.toString()})`);
|
|
153
|
+
return secretHashMatch && amountMatch && toMatch;
|
|
154
|
+
}, this.logger);
|
|
155
|
+
return {
|
|
156
|
+
claimAmount: amountToBridge,
|
|
157
|
+
claimSecret,
|
|
158
|
+
claimSecretHash,
|
|
159
|
+
messageHash: log.args.key,
|
|
160
|
+
messageLeafIndex: log.args.index
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Creates a new instance
|
|
165
|
+
* @param node - Aztec node client used for retrieving the L1 contract addresses.
|
|
166
|
+
* @param extendedClient - Wallet client, extended with public actions.
|
|
167
|
+
* @param logger - Logger.
|
|
168
|
+
*/ static async new(node, extendedClient, logger) {
|
|
169
|
+
const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress, feeAssetHandlerAddress } } = await node.getNodeInfo();
|
|
170
|
+
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
171
|
+
throw new Error('Portal or token not deployed on L1');
|
|
172
|
+
}
|
|
173
|
+
// Handler is optional - it's only needed for minting tokens during testing
|
|
174
|
+
const handlerAddress = feeAssetHandlerAddress && !feeAssetHandlerAddress.isZero() ? feeAssetHandlerAddress : undefined;
|
|
175
|
+
return new L1FeeJuicePortalManager(feeJuicePortalAddress, feeJuiceAddress, handlerAddress, extendedClient, logger);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/** Helper for interacting with a test TokenPortal on L1 for sending tokens to L2. */ export class L1ToL2TokenPortalManager {
|
|
179
|
+
extendedClient;
|
|
180
|
+
logger;
|
|
181
|
+
portal;
|
|
182
|
+
tokenManager;
|
|
183
|
+
constructor(portalAddress, tokenAddress, handlerAddress, extendedClient, logger){
|
|
184
|
+
this.extendedClient = extendedClient;
|
|
185
|
+
this.logger = logger;
|
|
186
|
+
this.tokenManager = new L1TokenManager(tokenAddress, handlerAddress, extendedClient, logger);
|
|
187
|
+
this.portal = getContract({
|
|
188
|
+
address: portalAddress.toString(),
|
|
189
|
+
abi: TokenPortalAbi,
|
|
190
|
+
client: extendedClient
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/** Returns the token manager for the underlying L1 token. */ getTokenManager() {
|
|
194
|
+
return this.tokenManager;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Bridges tokens from L1 to L2. Handles token approvals. Returns once the tx has been mined.
|
|
198
|
+
* @param to - Address to send the tokens to on L2.
|
|
199
|
+
* @param amount - Amount of tokens to send.
|
|
200
|
+
* @param mint - Whether to mint the tokens before sending (only during testing).
|
|
201
|
+
*/ async bridgeTokensPublic(to, amount, mint = false) {
|
|
202
|
+
const [claimSecret, claimSecretHash] = await this.bridgeSetup(amount, mint);
|
|
203
|
+
this.logger.info('Sending L1 tokens to L2 to be claimed publicly');
|
|
204
|
+
const { request } = await this.portal.simulate.depositToAztecPublic([
|
|
205
|
+
to.toString(),
|
|
206
|
+
amount,
|
|
207
|
+
claimSecretHash.toString()
|
|
208
|
+
]);
|
|
209
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
210
|
+
hash: await this.extendedClient.writeContract(request)
|
|
211
|
+
});
|
|
212
|
+
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPublic', (log)=>{
|
|
213
|
+
// Normalize hex strings for comparison (case-insensitive, handle different formats)
|
|
214
|
+
const normalizeHex = (val)=>{
|
|
215
|
+
const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
|
|
216
|
+
return hexStr.toLowerCase();
|
|
217
|
+
};
|
|
218
|
+
return normalizeHex(log.args.secretHash) === normalizeHex(claimSecretHash.toString()) && log.args.amount === amount && normalizeHex(log.args.to) === normalizeHex(to.toString());
|
|
219
|
+
}, this.logger);
|
|
220
|
+
return {
|
|
221
|
+
claimAmount: amount,
|
|
222
|
+
claimSecret,
|
|
223
|
+
claimSecretHash,
|
|
224
|
+
messageHash: log.args.key,
|
|
225
|
+
messageLeafIndex: log.args.index
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Bridges tokens from L1 to L2 privately. Handles token approvals. Returns once the tx has been mined.
|
|
230
|
+
* @param to - Address to send the tokens to on L2.
|
|
231
|
+
* @param amount - Amount of tokens to send.
|
|
232
|
+
* @param mint - Whether to mint the tokens before sending (only during testing).
|
|
233
|
+
*/ async bridgeTokensPrivate(to, amount, mint = false) {
|
|
234
|
+
const [claimSecret, claimSecretHash] = await this.bridgeSetup(amount, mint);
|
|
235
|
+
this.logger.info('Sending L1 tokens to L2 to be claimed privately');
|
|
236
|
+
const { request } = await this.portal.simulate.depositToAztecPrivate([
|
|
237
|
+
amount,
|
|
238
|
+
claimSecretHash.toString()
|
|
239
|
+
]);
|
|
240
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
241
|
+
hash: await this.extendedClient.writeContract(request)
|
|
242
|
+
});
|
|
243
|
+
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPrivate', (log)=>{
|
|
244
|
+
// Normalize hex strings for comparison (case-insensitive, handle different formats)
|
|
245
|
+
const normalizeHex = (val)=>{
|
|
246
|
+
const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
|
|
247
|
+
return hexStr.toLowerCase();
|
|
248
|
+
};
|
|
249
|
+
return log.args.amount === amount && normalizeHex(log.args.secretHashForL2MessageConsumption) === normalizeHex(claimSecretHash.toString());
|
|
250
|
+
}, this.logger);
|
|
251
|
+
this.logger.info(`Claim message secret: ${claimSecret.toString()}, claim message secret hash: ${claimSecretHash.toString()}`);
|
|
252
|
+
return {
|
|
253
|
+
claimAmount: amount,
|
|
254
|
+
claimSecret,
|
|
255
|
+
claimSecretHash,
|
|
256
|
+
recipient: to,
|
|
257
|
+
messageHash: log.args.key,
|
|
258
|
+
messageLeafIndex: log.args.index
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
async bridgeSetup(amount, mint) {
|
|
262
|
+
if (mint) {
|
|
263
|
+
const mintableAmount = await this.tokenManager.getMintAmount();
|
|
264
|
+
if (amount !== mintableAmount) {
|
|
265
|
+
throw new Error(`Minting amount must be ${mintableAmount} for testing`);
|
|
266
|
+
}
|
|
267
|
+
await this.tokenManager.mint(this.extendedClient.account.address);
|
|
268
|
+
}
|
|
269
|
+
await this.tokenManager.approve(amount, this.portal.address, 'TokenPortal');
|
|
270
|
+
return generateClaimSecret();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2. */ export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
|
|
274
|
+
outbox;
|
|
275
|
+
constructor(portalAddress, tokenAddress, handlerAddress, outboxAddress, extendedClient, logger){
|
|
276
|
+
super(portalAddress, tokenAddress, handlerAddress, extendedClient, logger);
|
|
277
|
+
this.outbox = getContract({
|
|
278
|
+
address: outboxAddress.toString(),
|
|
279
|
+
abi: OutboxAbi,
|
|
280
|
+
client: extendedClient
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Withdraws funds from the portal by consuming an L2 to L1 message. Returns once the tx is mined on L1.
|
|
285
|
+
* @param amount - Amount to withdraw.
|
|
286
|
+
* @param recipient - Who will receive the funds.
|
|
287
|
+
* @param epochNumber - Epoch number of the message.
|
|
288
|
+
* @param messageIndex - Index of the message.
|
|
289
|
+
* @param siblingPath - Sibling path of the message.
|
|
290
|
+
*/ async withdrawFunds(amount, recipient, epochNumber, messageIndex, siblingPath) {
|
|
291
|
+
this.logger.info(`Sending L1 tx to consume message at epoch ${epochNumber} index ${messageIndex} to withdraw ${amount}`);
|
|
292
|
+
const messageLeafId = getL2ToL1MessageLeafId({
|
|
293
|
+
leafIndex: messageIndex,
|
|
294
|
+
siblingPath
|
|
295
|
+
});
|
|
296
|
+
const isConsumedBefore = await this.outbox.read.hasMessageBeenConsumedAtEpoch([
|
|
297
|
+
BigInt(epochNumber),
|
|
298
|
+
messageLeafId
|
|
299
|
+
]);
|
|
300
|
+
if (isConsumedBefore) {
|
|
301
|
+
throw new Error(`L2 to L1 message at epoch ${epochNumber} index ${messageIndex} height ${siblingPath.pathSize} has already been consumed`);
|
|
302
|
+
}
|
|
303
|
+
// Call function on L1 contract to consume the message
|
|
304
|
+
const { request: withdrawRequest } = await this.portal.simulate.withdraw([
|
|
305
|
+
recipient.toString(),
|
|
306
|
+
amount,
|
|
307
|
+
false,
|
|
308
|
+
BigInt(epochNumber),
|
|
309
|
+
messageIndex,
|
|
310
|
+
siblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
|
|
311
|
+
]);
|
|
312
|
+
await this.extendedClient.waitForTransactionReceipt({
|
|
313
|
+
hash: await this.extendedClient.writeContract(withdrawRequest)
|
|
314
|
+
});
|
|
315
|
+
const isConsumedAfter = await this.outbox.read.hasMessageBeenConsumedAtEpoch([
|
|
316
|
+
BigInt(epochNumber),
|
|
317
|
+
messageLeafId
|
|
318
|
+
]);
|
|
319
|
+
if (!isConsumedAfter) {
|
|
320
|
+
throw new Error(`L2 to L1 message at epoch ${epochNumber} index ${messageIndex} height ${siblingPath.pathSize} not consumed after withdrawal`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Computes the L2 to L1 message leaf for the given parameters.
|
|
325
|
+
* @param amount - Amount to bridge.
|
|
326
|
+
* @param recipient - Recipient on L1.
|
|
327
|
+
* @param l2Bridge - Address of the L2 bridge.
|
|
328
|
+
* @param callerOnL1 - Caller address on L1.
|
|
329
|
+
*/ async getL2ToL1MessageLeaf(amount, recipient, l2Bridge, callerOnL1 = EthAddress.ZERO) {
|
|
330
|
+
const version = await this.outbox.read.VERSION();
|
|
331
|
+
const content = sha256ToField([
|
|
332
|
+
Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
|
|
333
|
+
recipient.toBuffer32(),
|
|
334
|
+
new Fr(amount).toBuffer(),
|
|
335
|
+
callerOnL1.toBuffer32()
|
|
336
|
+
]);
|
|
337
|
+
return computeL2ToL1MessageHash({
|
|
338
|
+
l2Sender: l2Bridge,
|
|
339
|
+
l1Recipient: EthAddress.fromString(this.portal.address),
|
|
340
|
+
content,
|
|
341
|
+
rollupVersion: new Fr(version),
|
|
342
|
+
chainId: new Fr(this.extendedClient.chain.id)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
3
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { L2AmountClaim } from '../ethereum/portal_manager.js';
|
|
5
|
+
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
5
6
|
/**
|
|
6
|
-
* Pay fee directly with Fee Juice claimed
|
|
7
|
+
* Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains"
|
|
8
|
+
* the fee juice bridged from L1.
|
|
7
9
|
*/
|
|
8
|
-
export declare class FeeJuicePaymentMethodWithClaim
|
|
9
|
-
private
|
|
10
|
+
export declare class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
11
|
+
private sender;
|
|
10
12
|
private claim;
|
|
11
|
-
constructor(
|
|
13
|
+
constructor(sender: AztecAddress, claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>);
|
|
12
14
|
/**
|
|
13
|
-
* Creates
|
|
14
|
-
* @returns
|
|
15
|
+
* Creates an execution payload to pay the fee in Fee Juice.
|
|
16
|
+
* @returns An execution payload that just contains the `claim_and_end_setup` function call.
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
19
|
+
getAsset(): Promise<AztecAddress>;
|
|
20
|
+
getFeePayer(): Promise<AztecAddress>;
|
|
21
|
+
getGasSettings(): GasSettings | undefined;
|
|
17
22
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlX2p1aWNlX3BheW1lbnRfbWV0aG9kX3dpdGhfY2xhaW0uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mZWUvZmVlX2p1aWNlX3BheW1lbnRfbWV0aG9kX3dpdGhfY2xhaW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDckQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDbkUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUVoRTs7O0dBR0c7QUFDSCxxQkFBYSw4QkFBK0IsWUFBVyxnQkFBZ0I7SUFFbkUsT0FBTyxDQUFDLE1BQU07SUFDZCxPQUFPLENBQUMsS0FBSztJQUZmLFlBQ1UsTUFBTSxFQUFFLFlBQVksRUFDcEIsS0FBSyxFQUFFLElBQUksQ0FBQyxhQUFhLEVBQUUsYUFBYSxHQUFHLGFBQWEsR0FBRyxrQkFBa0IsQ0FBQyxFQUNwRjtJQUVKOzs7T0FHRztJQUNHLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQTBCckQ7SUFFRCxRQUFRLDBCQUVQO0lBRUQsV0FBVyxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FFbkM7SUFFRCxjQUFjLElBQUksV0FBVyxHQUFHLFNBQVMsQ0FFeEM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee_juice_payment_method_with_claim.d.ts","sourceRoot":"","sources":["../../src/fee/fee_juice_payment_method_with_claim.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fee_juice_payment_method_with_claim.d.ts","sourceRoot":"","sources":["../../src/fee/fee_juice_payment_method_with_claim.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,8BAA+B,YAAW,gBAAgB;IAEnE,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IAFf,YACU,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC,EACpF;IAEJ;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA0BrD;IAED,QAAQ,0BAEP;IAED,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAEnC;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
3
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
|
-
import {
|
|
5
|
-
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
4
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
6
5
|
/**
|
|
7
|
-
* Pay fee directly with Fee Juice claimed
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains"
|
|
7
|
+
* the fee juice bridged from L1.
|
|
8
|
+
*/ export class FeeJuicePaymentMethodWithClaim {
|
|
9
|
+
sender;
|
|
10
10
|
claim;
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
11
|
+
constructor(sender, claim){
|
|
12
|
+
this.sender = sender;
|
|
13
|
+
this.claim = claim;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
* Creates
|
|
16
|
-
* @returns
|
|
17
|
-
*/ async
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
return Promise.resolve([
|
|
16
|
+
* Creates an execution payload to pay the fee in Fee Juice.
|
|
17
|
+
* @returns An execution payload that just contains the `claim_and_end_setup` function call.
|
|
18
|
+
*/ async getExecutionPayload() {
|
|
19
|
+
const selector = await FunctionSelector.fromSignature('claim_and_end_setup((Field),u128,Field,Field)');
|
|
20
|
+
return new ExecutionPayload([
|
|
21
21
|
{
|
|
22
22
|
to: ProtocolContractAddress.FeeJuice,
|
|
23
|
-
name: '
|
|
23
|
+
name: 'claim_and_end_setup',
|
|
24
24
|
selector,
|
|
25
|
+
hideMsgSender: false,
|
|
25
26
|
isStatic: false,
|
|
26
27
|
args: [
|
|
27
|
-
this.
|
|
28
|
+
this.sender.toField(),
|
|
28
29
|
new Fr(this.claim.claimAmount),
|
|
29
30
|
this.claim.claimSecret,
|
|
30
31
|
new Fr(this.claim.messageLeafIndex)
|
|
@@ -32,6 +33,15 @@ import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
|
32
33
|
returnTypes: [],
|
|
33
34
|
type: FunctionType.PRIVATE
|
|
34
35
|
}
|
|
35
|
-
]);
|
|
36
|
+
], [], [], [], this.sender);
|
|
37
|
+
}
|
|
38
|
+
getAsset() {
|
|
39
|
+
return Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
40
|
+
}
|
|
41
|
+
getFeePayer() {
|
|
42
|
+
return Promise.resolve(this.sender);
|
|
43
|
+
}
|
|
44
|
+
getGasSettings() {
|
|
45
|
+
return;
|
|
36
46
|
}
|
|
37
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
3
|
+
import type { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
4
|
/**
|
|
5
5
|
* Holds information about how the fee for a transaction is to be paid.
|
|
6
6
|
*/
|
|
@@ -8,15 +8,19 @@ export interface FeePaymentMethod {
|
|
|
8
8
|
/** The asset used to pay the fee. */
|
|
9
9
|
getAsset(): Promise<AztecAddress>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @returns The function
|
|
11
|
+
* Returns the data to be added to the final execution request
|
|
12
|
+
* to pay the fee in the given asset
|
|
13
|
+
* @returns The function calls to pay the fee.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
16
16
|
/**
|
|
17
17
|
* The expected fee payer for this tx.
|
|
18
|
-
* @param gasSettings - The gas limits and max fees.
|
|
19
18
|
*/
|
|
20
|
-
getFeePayer(
|
|
19
|
+
getFeePayer(): Promise<AztecAddress>;
|
|
20
|
+
/**
|
|
21
|
+
* The gas settings (if any) used to compute the
|
|
22
|
+
* execution payload of the payment method
|
|
23
|
+
*/
|
|
24
|
+
getGasSettings(): GasSettings | undefined;
|
|
21
25
|
}
|
|
22
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlX3BheW1lbnRfbWV0aG9kLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmVlL2ZlZV9wYXltZW50X21ldGhvZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXpEOztHQUVHO0FBQ0gsTUFBTSxXQUFXLGdCQUFnQjtJQUMvQixxQ0FBcUM7SUFDckMsUUFBUSxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQztJQUNsQzs7OztPQUlHO0lBQ0gsbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDakQ7O09BRUc7SUFDSCxXQUFXLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ3JDOzs7T0FHRztJQUNILGNBQWMsSUFBSSxXQUFXLEdBQUcsU0FBUyxDQUFDO0NBQzNDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,IAAI,WAAW,GAAG,SAAS,CAAC;CAC3C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
1
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
4
|
-
import
|
|
3
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { Wallet } from '../wallet/wallet.js';
|
|
5
5
|
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
6
6
|
/**
|
|
7
7
|
* Holds information about how the fee for a transaction is to be paid.
|
|
@@ -12,9 +12,17 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
12
12
|
*/
|
|
13
13
|
private paymentContract;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Address of the account that will pay the fee
|
|
16
|
+
*/
|
|
17
|
+
private sender;
|
|
18
|
+
/**
|
|
19
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
16
20
|
*/
|
|
17
21
|
private wallet;
|
|
22
|
+
/**
|
|
23
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
24
|
+
*/
|
|
25
|
+
protected gasSettings: GasSettings;
|
|
18
26
|
/**
|
|
19
27
|
* If true, the max fee will be set to 1.
|
|
20
28
|
* TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
|
|
@@ -27,9 +35,17 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
27
35
|
*/
|
|
28
36
|
paymentContract: AztecAddress,
|
|
29
37
|
/**
|
|
30
|
-
*
|
|
38
|
+
* Address of the account that will pay the fee
|
|
39
|
+
*/
|
|
40
|
+
sender: AztecAddress,
|
|
41
|
+
/**
|
|
42
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
31
43
|
*/
|
|
32
44
|
wallet: Wallet,
|
|
45
|
+
/**
|
|
46
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
47
|
+
*/
|
|
48
|
+
gasSettings: GasSettings,
|
|
33
49
|
/**
|
|
34
50
|
* If true, the max fee will be set to 1.
|
|
35
51
|
* TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
|
|
@@ -42,10 +58,11 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
42
58
|
getAsset(): Promise<AztecAddress>;
|
|
43
59
|
getFeePayer(): Promise<AztecAddress>;
|
|
44
60
|
/**
|
|
45
|
-
* Creates
|
|
61
|
+
* Creates an execution payload to pay the fee using a private function through an FPC in the desired asset
|
|
46
62
|
* @param gasSettings - The gas settings.
|
|
47
|
-
* @returns
|
|
63
|
+
* @returns An execution payload that contains the required function calls and auth witnesses.
|
|
48
64
|
*/
|
|
49
|
-
|
|
65
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
66
|
+
getGasSettings(): GasSettings | undefined;
|
|
50
67
|
}
|
|
51
|
-
//# sourceMappingURL=
|
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mZWVfcGF5bWVudF9tZXRob2QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mZWUvcHJpdmF0ZV9mZWVfcGF5bWVudF9tZXRob2QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzNELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFaEU7O0dBRUc7QUFDSCxxQkFBYSx1QkFBd0IsWUFBVyxnQkFBZ0I7SUFJNUQ7O09BRUc7SUFDSCxPQUFPLENBQUMsZUFBZTtJQUV2Qjs7T0FFRztJQUNILE9BQU8sQ0FBQyxNQUFNO0lBRWQ7O09BRUc7SUFDSCxPQUFPLENBQUMsTUFBTTtJQUNkOztPQUVHO0lBQ0gsU0FBUyxDQUFDLFdBQVcsRUFBRSxXQUFXO0lBQ2xDOzs7T0FHRztJQUNILE9BQU8sQ0FBQyxjQUFjO0lBekJ4QixPQUFPLENBQUMsWUFBWSxDQUFzQztJQUUxRDtJQUNFOztPQUVHO0lBQ0ssZUFBZSxFQUFFLFlBQVk7SUFFckM7O09BRUc7SUFDSyxNQUFNLEVBQUUsWUFBWTtJQUU1Qjs7T0FFRztJQUNLLE1BQU0sRUFBRSxNQUFNO0lBQ3RCOztPQUVHO0lBQ08sV0FBVyxFQUFFLFdBQVc7SUFDbEM7OztPQUdHO0lBQ0ssY0FBYyxVQUFRLEVBQzVCO0lBRUo7OztPQUdHO0lBQ0csUUFBUSxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0F1Q3RDO0lBRUQsV0FBVyxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FFbkM7SUFFRDs7OztPQUlHO0lBQ0csbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBc0NyRDtJQUVELGNBQWMsSUFBSSxXQUFXLEdBQUcsU0FBUyxDQUV4QztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/private_fee_payment_method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/private_fee_payment_method.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAI5D;;OAEG;IACH,OAAO,CAAC,eAAe;IAEvB;;OAEG;IACH,OAAO,CAAC,MAAM;IAEd;;OAEG;IACH,OAAO,CAAC,MAAM;IACd;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAzBxB,OAAO,CAAC,YAAY,CAAsC;IAE1D;IACE;;OAEG;IACK,eAAe,EAAE,YAAY;IAErC;;OAEG;IACK,MAAM,EAAE,YAAY;IAE5B;;OAEG;IACK,MAAM,EAAE,MAAM;IACtB;;OAEG;IACO,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACK,cAAc,UAAQ,EAC5B;IAEJ;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAuCtC;IAED,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAEnC;IAED;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAsCrD;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
|