@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.5476d83
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 +59 -0
- package/dest/account/account.d.ts.map +1 -0
- package/dest/account/account.js +59 -0
- package/dest/account/account_contract.d.ts +43 -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 +24 -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} +5 -5
- package/dest/account/index.d.ts +4 -8
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +2 -6
- package/dest/account/interface.d.ts +2 -14
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -0
- package/dest/account/signerless_account.d.ts +23 -0
- package/dest/account/signerless_account.d.ts.map +1 -0
- package/dest/account/signerless_account.js +27 -0
- package/dest/api/abi.d.ts +3 -2
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -1
- package/dest/api/account.d.ts +7 -3
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +4 -1
- 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 +49 -0
- package/dest/api/contract.d.ts.map +1 -0
- package/dest/{contract/index.js → api/contract.js} +15 -11
- 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 +1 -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 +21 -0
- package/dest/api/node.d.ts.map +1 -0
- package/dest/api/node.js +18 -0
- package/dest/api/note.d.ts +2 -0
- package/dest/api/note.d.ts.map +1 -0
- package/dest/api/note.js +1 -0
- package/dest/api/protocol.d.ts +3 -0
- package/dest/api/protocol.d.ts.map +1 -0
- package/dest/api/protocol.js +2 -0
- package/dest/api/trees.d.ts +3 -0
- package/dest/api/trees.d.ts.map +1 -0
- package/dest/api/trees.js +2 -0
- package/dest/api/tx.d.ts +2 -0
- package/dest/api/tx.d.ts.map +1 -0
- package/dest/api/tx.js +1 -0
- package/dest/api/utils.d.ts +13 -0
- package/dest/api/utils.d.ts.map +1 -0
- package/dest/api/utils.js +12 -0
- package/dest/api/wallet.d.ts +4 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +3 -1
- package/dest/authorization/call_authorization_request.d.ts +46 -0
- package/dest/authorization/call_authorization_request.d.ts.map +1 -0
- package/dest/authorization/call_authorization_request.js +49 -0
- package/dest/contract/base_contract_interaction.d.ts +16 -80
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +15 -128
- package/dest/contract/batch_call.d.ts +19 -21
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +86 -68
- 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 +7 -20
- 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 +106 -60
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +125 -133
- package/dest/contract/deploy_sent_tx.d.ts +14 -11
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +18 -15
- 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 +114 -0
- package/dest/contract/interaction_options.d.ts.map +1 -0
- package/dest/contract/interaction_options.js +46 -0
- package/dest/contract/protocol_contracts.d.ts +7 -7
- package/dest/contract/protocol_contracts.d.ts.map +1 -1
- package/dest/contract/protocol_contracts.js +7 -7
- package/dest/contract/sent_tx.d.ts +9 -19
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +31 -43
- package/dest/contract/unsafe_contract.d.ts +2 -2
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/unsafe_contract.js +1 -1
- package/dest/contract/wait_for_proven.d.ts +17 -0
- package/dest/contract/wait_for_proven.d.ts.map +1 -0
- package/dest/contract/wait_for_proven.js +17 -0
- package/dest/deployment/broadcast_function.d.ts +4 -4
- package/dest/deployment/broadcast_function.d.ts.map +1 -1
- package/dest/deployment/broadcast_function.js +27 -23
- package/dest/deployment/contract_deployer.d.ts +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 +138 -0
- package/dest/ethereum/portal_manager.d.ts.map +1 -0
- package/dest/{api/ethereum → ethereum}/portal_manager.js +136 -76
- 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 +26 -16
- 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 +44 -22
- 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 +46 -24
- package/dest/fee/sponsored_fee_payment.d.ts +17 -0
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
- package/dest/fee/sponsored_fee_payment.js +34 -0
- package/dest/utils/abi_types.d.ts +1 -3
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/authwit.d.ts +82 -25
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +237 -40
- package/dest/utils/cross_chain.d.ts +24 -0
- package/dest/utils/cross_chain.d.ts.map +1 -0
- package/dest/utils/cross_chain.js +30 -0
- package/dest/utils/fee_juice.d.ts +4 -3
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +3 -2
- package/dest/utils/field_compressed_string.d.ts +1 -1
- package/dest/utils/field_compressed_string.d.ts.map +1 -1
- package/dest/utils/node.d.ts +2 -2
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +1 -1
- package/dest/utils/pub_key.d.ts +1 -1
- package/dest/utils/pub_key.d.ts.map +1 -1
- package/dest/utils/pub_key.js +1 -2
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +34 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
- package/dest/wallet/account_manager.d.ts +66 -0
- package/dest/wallet/account_manager.d.ts.map +1 -0
- package/dest/wallet/account_manager.js +113 -0
- package/dest/wallet/deploy_account_method.d.ts +52 -0
- package/dest/wallet/deploy_account_method.d.ts.map +1 -0
- package/dest/wallet/deploy_account_method.js +77 -0
- package/dest/wallet/index.d.ts +3 -17
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +2 -20
- package/dest/wallet/wallet.d.ts +1965 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/dest/wallet/wallet.js +186 -0
- package/package.json +44 -35
- package/src/account/account.ts +96 -0
- package/src/account/{contract.ts → account_contract.ts} +24 -13
- package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
- package/src/account/index.ts +3 -7
- package/src/account/interface.ts +1 -12
- package/src/account/signerless_account.ts +45 -0
- package/src/api/abi.ts +26 -0
- package/src/api/account.ts +6 -9
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +14 -0
- package/src/api/block.ts +2 -0
- package/src/{contract/index.ts → api/contract.ts} +39 -14
- package/src/api/crypto.ts +1 -0
- package/src/api/deployment.ts +4 -3
- package/src/api/ethereum.ts +10 -0
- package/src/api/events.ts +44 -0
- package/src/api/fee.ts +1 -1
- package/src/api/fee_testing.ts +1 -0
- package/src/api/keys.ts +8 -0
- package/src/api/log.ts +1 -0
- package/src/api/messaging.ts +2 -0
- package/src/api/node.ts +20 -0
- package/src/api/note.ts +1 -0
- package/src/api/protocol.ts +2 -0
- package/src/api/trees.ts +2 -0
- package/src/api/tx.ts +13 -0
- package/src/api/utils.ts +14 -0
- package/src/api/wallet.ts +27 -5
- package/src/authorization/call_authorization_request.ts +63 -0
- package/src/contract/base_contract_interaction.ts +23 -166
- package/src/contract/batch_call.ts +106 -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 +205 -134
- package/src/contract/deploy_sent_tx.ts +24 -23
- package/src/contract/get_gas_limits.ts +15 -8
- package/src/contract/interaction_options.ts +163 -0
- package/src/contract/protocol_contracts.ts +10 -10
- package/src/contract/sent_tx.ts +41 -52
- package/src/contract/unsafe_contract.ts +2 -2
- package/src/contract/wait_for_proven.ts +38 -0
- package/src/deployment/broadcast_function.ts +57 -57
- package/src/deployment/contract_deployer.ts +4 -3
- package/src/deployment/publish_class.ts +34 -0
- package/src/deployment/publish_instance.ts +26 -0
- package/src/{api/ethereum → ethereum}/portal_manager.ts +164 -83
- package/src/fee/fee_juice_payment_method_with_claim.ts +48 -33
- package/src/fee/fee_payment_method.ts +11 -7
- package/src/fee/private_fee_payment_method.ts +79 -57
- package/src/fee/public_fee_payment_method.ts +93 -67
- package/src/fee/sponsored_fee_payment.ts +46 -0
- package/src/utils/authwit.ts +261 -53
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +4 -4
- package/src/utils/node.ts +1 -1
- package/src/utils/pub_key.ts +1 -2
- package/src/wallet/account_entrypoint_meta_payment_method.ts +106 -0
- package/src/wallet/account_manager.ts +154 -0
- package/src/wallet/deploy_account_method.ts +126 -0
- package/src/wallet/index.ts +2 -33
- package/src/wallet/wallet.ts +318 -0
- package/dest/account/contract.d.ts +0 -37
- package/dest/account/contract.d.ts.map +0 -1
- package/dest/account/wallet.d.ts +0 -11
- package/dest/account/wallet.d.ts.map +0 -1
- package/dest/account/wallet.js +0 -3
- package/dest/account_manager/deploy_account_method.d.ts +0 -15
- package/dest/account_manager/deploy_account_method.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_method.js +0 -43
- package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_sent_tx.js +0 -29
- package/dest/account_manager/index.d.ts +0 -108
- package/dest/account_manager/index.d.ts.map +0 -1
- package/dest/account_manager/index.js +0 -159
- package/dest/api/cheat_codes.d.ts +0 -26
- package/dest/api/cheat_codes.d.ts.map +0 -1
- package/dest/api/cheat_codes.js +0 -25
- package/dest/api/entrypoint.d.ts +0 -2
- package/dest/api/entrypoint.d.ts.map +0 -1
- package/dest/api/entrypoint.js +0 -1
- package/dest/api/ethereum/anvil_test_watcher.d.ts +0 -32
- package/dest/api/ethereum/anvil_test_watcher.d.ts.map +0 -1
- package/dest/api/ethereum/anvil_test_watcher.js +0 -133
- package/dest/api/ethereum/chain_monitor.d.ts +0 -25
- package/dest/api/ethereum/chain_monitor.d.ts.map +0 -1
- package/dest/api/ethereum/chain_monitor.js +0 -74
- package/dest/api/ethereum/cheat_codes.d.ts +0 -63
- package/dest/api/ethereum/cheat_codes.d.ts.map +0 -1
- package/dest/api/ethereum/cheat_codes.js +0 -162
- package/dest/api/ethereum/index.d.ts +0 -7
- package/dest/api/ethereum/index.d.ts.map +0 -1
- package/dest/api/ethereum/index.js +0 -6
- package/dest/api/ethereum/l1_contracts.d.ts +0 -3
- package/dest/api/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/api/ethereum/l1_contracts.js +0 -13
- package/dest/api/ethereum/portal_manager.d.ts +0 -136
- package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
- package/dest/api/interfaces/pxe.d.ts +0 -2
- package/dest/api/interfaces/pxe.d.ts.map +0 -1
- package/dest/api/interfaces/pxe.js +0 -1
- package/dest/api/log_id.d.ts +0 -2
- package/dest/api/log_id.d.ts.map +0 -1
- package/dest/api/log_id.js +0 -1
- package/dest/api/tx_hash.d.ts +0 -2
- package/dest/api/tx_hash.d.ts.map +0 -1
- package/dest/api/tx_hash.js +0 -1
- package/dest/contract/deploy_proven_tx.d.ts +0 -21
- package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
- package/dest/contract/deploy_proven_tx.js +0 -19
- package/dest/contract/index.d.ts +0 -45
- package/dest/contract/index.d.ts.map +0 -1
- package/dest/contract/proven_tx.d.ts +0 -17
- package/dest/contract/proven_tx.d.ts.map +0 -1
- package/dest/contract/proven_tx.js +0 -22
- package/dest/deployment/deploy_instance.d.ts +0 -10
- package/dest/deployment/deploy_instance.d.ts.map +0 -1
- package/dest/deployment/deploy_instance.js +0 -14
- package/dest/deployment/index.d.ts +0 -2
- package/dest/deployment/index.d.ts.map +0 -1
- package/dest/deployment/index.js +0 -1
- package/dest/deployment/register_class.d.ts +0 -6
- package/dest/deployment/register_class.d.ts.map +0 -1
- package/dest/deployment/register_class.js +0 -22
- package/dest/entrypoint/default_entrypoint.d.ts +0 -12
- package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/default_entrypoint.js +0 -28
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts +0 -15
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +0 -130
- package/dest/entrypoint/entrypoint.d.ts +0 -35
- package/dest/entrypoint/entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/entrypoint.js +0 -4
- package/dest/entrypoint/payload.d.ts +0 -128
- package/dest/entrypoint/payload.d.ts.map +0 -1
- package/dest/entrypoint/payload.js +0 -143
- package/dest/fee/fee_juice_payment_method.d.ts +0 -14
- package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_juice_payment_method.js +0 -20
- package/dest/index.d.ts +0 -66
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -69
- package/dest/rpc_clients/index.d.ts +0 -3
- package/dest/rpc_clients/index.d.ts.map +0 -1
- package/dest/rpc_clients/index.js +0 -2
- package/dest/rpc_clients/node/index.d.ts +0 -12
- package/dest/rpc_clients/node/index.d.ts.map +0 -1
- package/dest/rpc_clients/node/index.js +0 -78
- package/dest/rpc_clients/pxe_client.d.ts +0 -10
- package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
- package/dest/rpc_clients/pxe_client.js +0 -23
- package/dest/utils/aztec_cheatcodes.d.ts +0 -59
- package/dest/utils/aztec_cheatcodes.d.ts.map +0 -1
- package/dest/utils/aztec_cheatcodes.js +0 -62
- package/dest/utils/index.d.ts +0 -8
- package/dest/utils/index.d.ts.map +0 -1
- package/dest/utils/index.js +0 -6
- package/dest/utils/pxe.d.ts +0 -4
- package/dest/utils/pxe.d.ts.map +0 -1
- package/dest/utils/pxe.js +0 -14
- package/dest/wallet/account_wallet.d.ts +0 -76
- package/dest/wallet/account_wallet.d.ts.map +0 -1
- package/dest/wallet/account_wallet.js +0 -231
- package/dest/wallet/account_wallet_with_private_key.d.ts +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/wallet.ts +0 -13
- package/src/account_manager/deploy_account_method.ts +0 -86
- package/src/account_manager/deploy_account_sent_tx.ts +0 -42
- package/src/account_manager/index.ts +0 -229
- package/src/api/cheat_codes.ts +0 -35
- package/src/api/entrypoint.ts +0 -1
- package/src/api/ethereum/anvil_test_watcher.ts +0 -158
- package/src/api/ethereum/chain_monitor.ts +0 -88
- package/src/api/ethereum/cheat_codes.ts +0 -184
- package/src/api/ethereum/index.ts +0 -19
- package/src/api/ethereum/l1_contracts.ts +0 -21
- package/src/api/interfaces/pxe.ts +0 -1
- package/src/api/log_id.ts +0 -1
- package/src/api/tx_hash.ts +0 -1
- package/src/contract/deploy_proven_tx.ts +0 -34
- package/src/contract/proven_tx.ts +0 -42
- package/src/deployment/deploy_instance.ts +0 -31
- package/src/deployment/index.ts +0 -1
- package/src/deployment/register_class.ts +0 -44
- package/src/entrypoint/default_entrypoint.ts +0 -39
- package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
- package/src/entrypoint/entrypoint.ts +0 -39
- package/src/entrypoint/payload.ts +0 -238
- package/src/fee/fee_juice_payment_method.ts +0 -26
- package/src/index.ts +0 -106
- package/src/rpc_clients/index.ts +0 -2
- package/src/rpc_clients/node/index.ts +0 -77
- package/src/rpc_clients/pxe_client.ts +0 -25
- package/src/utils/aztec_cheatcodes.ts +0 -77
- package/src/utils/index.ts +0 -21
- package/src/utils/pxe.ts +0 -17
- package/src/wallet/account_wallet.ts +0 -242
- package/src/wallet/base_wallet.ts +0 -198
- package/src/wallet/signerless_wallet.ts +0 -52
|
@@ -2,8 +2,13 @@ import { extractEvent } from '@aztec/ethereum/utils';
|
|
|
2
2
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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';
|
|
7
12
|
import { getContract, toFunctionSelector } from 'viem';
|
|
8
13
|
/** Stringifies an eth address for logging. */ function stringifyEthAddress(address, name) {
|
|
9
14
|
return name ? `${name} (${address.toString()})` : address.toString();
|
|
@@ -18,21 +23,37 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
18
23
|
];
|
|
19
24
|
}
|
|
20
25
|
/** Helper for managing an ERC20 on L1. */ export class L1TokenManager {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
tokenAddress;
|
|
27
|
+
handlerAddress;
|
|
28
|
+
extendedClient;
|
|
24
29
|
logger;
|
|
25
30
|
contract;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
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;
|
|
30
36
|
this.logger = logger;
|
|
31
37
|
this.contract = getContract({
|
|
32
|
-
address: this.
|
|
38
|
+
address: this.tokenAddress.toString(),
|
|
33
39
|
abi: TestERC20Abi,
|
|
34
|
-
client: this.
|
|
40
|
+
client: this.extendedClient
|
|
35
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();
|
|
36
57
|
}
|
|
37
58
|
/**
|
|
38
59
|
* Returns the balance of the given address.
|
|
@@ -43,18 +64,19 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
43
64
|
]);
|
|
44
65
|
}
|
|
45
66
|
/**
|
|
46
|
-
* Mints tokens for the given address. Returns once the tx has been mined.
|
|
47
|
-
* @param amount - Amount to mint.
|
|
67
|
+
* Mints a fixed amount of tokens for the given address. Returns once the tx has been mined.
|
|
48
68
|
* @param address - Address to mint the tokens for.
|
|
49
69
|
* @param addressName - Optional name of the address for logging.
|
|
50
|
-
*/ async mint(
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
]);
|
|
58
80
|
}
|
|
59
81
|
/**
|
|
60
82
|
* Approves tokens for the given address. Returns once the tx has been mined.
|
|
@@ -63,7 +85,7 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
63
85
|
* @param addressName - Optional name of the address for logging.
|
|
64
86
|
*/ async approve(amount, address, addressName = '') {
|
|
65
87
|
this.logger.info(`Approving ${amount} tokens for ${stringifyEthAddress(address, addressName)}`);
|
|
66
|
-
await this.
|
|
88
|
+
await this.extendedClient.waitForTransactionReceipt({
|
|
67
89
|
hash: await this.contract.write.approve([
|
|
68
90
|
address,
|
|
69
91
|
amount
|
|
@@ -72,20 +94,18 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
72
94
|
}
|
|
73
95
|
}
|
|
74
96
|
/** Helper for interacting with the FeeJuicePortal on L1. */ export class L1FeeJuicePortalManager {
|
|
75
|
-
|
|
76
|
-
walletClient;
|
|
97
|
+
extendedClient;
|
|
77
98
|
logger;
|
|
78
99
|
tokenManager;
|
|
79
100
|
contract;
|
|
80
|
-
constructor(portalAddress, tokenAddress,
|
|
81
|
-
this.
|
|
82
|
-
this.walletClient = walletClient;
|
|
101
|
+
constructor(portalAddress, tokenAddress, handlerAddress, extendedClient, logger){
|
|
102
|
+
this.extendedClient = extendedClient;
|
|
83
103
|
this.logger = logger;
|
|
84
|
-
this.tokenManager = new L1TokenManager(tokenAddress,
|
|
104
|
+
this.tokenManager = new L1TokenManager(tokenAddress, handlerAddress, extendedClient, logger);
|
|
85
105
|
this.contract = getContract({
|
|
86
106
|
address: portalAddress.toString(),
|
|
87
107
|
abi: FeeJuicePortalAbi,
|
|
88
|
-
client:
|
|
108
|
+
client: extendedClient
|
|
89
109
|
});
|
|
90
110
|
}
|
|
91
111
|
/** Returns the associated token manager for the L1 ERC20. */ getTokenManager() {
|
|
@@ -98,24 +118,42 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
98
118
|
* @param mint - Whether to mint the tokens before sending (only during testing).
|
|
99
119
|
*/ async bridgeTokensPublic(to, amount, mint = false) {
|
|
100
120
|
const [claimSecret, claimSecretHash] = await generateClaimSecret();
|
|
121
|
+
const mintableAmount = await this.tokenManager.getMintAmount();
|
|
122
|
+
const amountToBridge = amount ?? mintableAmount;
|
|
101
123
|
if (mint) {
|
|
102
|
-
|
|
124
|
+
if (amountToBridge !== mintableAmount) {
|
|
125
|
+
throw new Error(`Minting amount must be ${mintableAmount}`);
|
|
126
|
+
}
|
|
127
|
+
await this.tokenManager.mint(this.extendedClient.account.address);
|
|
103
128
|
}
|
|
104
|
-
await this.tokenManager.approve(
|
|
129
|
+
await this.tokenManager.approve(amountToBridge, this.contract.address, 'FeeJuice Portal');
|
|
105
130
|
this.logger.info('Sending L1 Fee Juice to L2 to be claimed publicly');
|
|
106
131
|
const args = [
|
|
107
132
|
to.toString(),
|
|
108
|
-
|
|
133
|
+
amountToBridge,
|
|
109
134
|
claimSecretHash.toString()
|
|
110
135
|
];
|
|
111
136
|
await this.contract.simulate.depositToAztecPublic(args);
|
|
112
|
-
const txReceipt = await this.
|
|
137
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
113
138
|
hash: await this.contract.write.depositToAztecPublic(args)
|
|
114
139
|
});
|
|
115
|
-
this.logger.info('Deposited to Aztec public successfully'
|
|
116
|
-
|
|
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);
|
|
117
155
|
return {
|
|
118
|
-
claimAmount:
|
|
156
|
+
claimAmount: amountToBridge,
|
|
119
157
|
claimSecret,
|
|
120
158
|
claimSecretHash,
|
|
121
159
|
messageHash: log.args.key,
|
|
@@ -124,33 +162,33 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
124
162
|
}
|
|
125
163
|
/**
|
|
126
164
|
* Creates a new instance
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @param walletClient - L1 wallet client.
|
|
165
|
+
* @param node - Aztec node client used for retrieving the L1 contract addresses.
|
|
166
|
+
* @param extendedClient - Wallet client, extended with public actions.
|
|
130
167
|
* @param logger - Logger.
|
|
131
|
-
*/ static async new(
|
|
132
|
-
const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress } } = await
|
|
168
|
+
*/ static async new(node, extendedClient, logger) {
|
|
169
|
+
const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress, feeAssetHandlerAddress } } = await node.getNodeInfo();
|
|
133
170
|
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
134
171
|
throw new Error('Portal or token not deployed on L1');
|
|
135
172
|
}
|
|
136
|
-
|
|
173
|
+
if (!feeAssetHandlerAddress || feeAssetHandlerAddress.isZero()) {
|
|
174
|
+
throw new Error('Handler not deployed on L1, or handler address is zero');
|
|
175
|
+
}
|
|
176
|
+
return new L1FeeJuicePortalManager(feeJuicePortalAddress, feeJuiceAddress, feeAssetHandlerAddress, extendedClient, logger);
|
|
137
177
|
}
|
|
138
178
|
}
|
|
139
179
|
/** Helper for interacting with a test TokenPortal on L1 for sending tokens to L2. */ export class L1ToL2TokenPortalManager {
|
|
140
|
-
|
|
141
|
-
walletClient;
|
|
180
|
+
extendedClient;
|
|
142
181
|
logger;
|
|
143
182
|
portal;
|
|
144
183
|
tokenManager;
|
|
145
|
-
constructor(portalAddress, tokenAddress,
|
|
146
|
-
this.
|
|
147
|
-
this.walletClient = walletClient;
|
|
184
|
+
constructor(portalAddress, tokenAddress, handlerAddress, extendedClient, logger){
|
|
185
|
+
this.extendedClient = extendedClient;
|
|
148
186
|
this.logger = logger;
|
|
149
|
-
this.tokenManager = new L1TokenManager(tokenAddress,
|
|
187
|
+
this.tokenManager = new L1TokenManager(tokenAddress, handlerAddress, extendedClient, logger);
|
|
150
188
|
this.portal = getContract({
|
|
151
189
|
address: portalAddress.toString(),
|
|
152
190
|
abi: TokenPortalAbi,
|
|
153
|
-
client:
|
|
191
|
+
client: extendedClient
|
|
154
192
|
});
|
|
155
193
|
}
|
|
156
194
|
/** Returns the token manager for the underlying L1 token. */ getTokenManager() {
|
|
@@ -169,10 +207,17 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
169
207
|
amount,
|
|
170
208
|
claimSecretHash.toString()
|
|
171
209
|
]);
|
|
172
|
-
const txReceipt = await this.
|
|
173
|
-
hash: await this.
|
|
210
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
211
|
+
hash: await this.extendedClient.writeContract(request)
|
|
174
212
|
});
|
|
175
|
-
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPublic', (log)=>
|
|
213
|
+
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPublic', (log)=>{
|
|
214
|
+
// Normalize hex strings for comparison (case-insensitive, handle different formats)
|
|
215
|
+
const normalizeHex = (val)=>{
|
|
216
|
+
const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
|
|
217
|
+
return hexStr.toLowerCase();
|
|
218
|
+
};
|
|
219
|
+
return normalizeHex(log.args.secretHash) === normalizeHex(claimSecretHash.toString()) && log.args.amount === amount && normalizeHex(log.args.to) === normalizeHex(to.toString());
|
|
220
|
+
}, this.logger);
|
|
176
221
|
return {
|
|
177
222
|
claimAmount: amount,
|
|
178
223
|
claimSecret,
|
|
@@ -193,10 +238,17 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
193
238
|
amount,
|
|
194
239
|
claimSecretHash.toString()
|
|
195
240
|
]);
|
|
196
|
-
const txReceipt = await this.
|
|
197
|
-
hash: await this.
|
|
241
|
+
const txReceipt = await this.extendedClient.waitForTransactionReceipt({
|
|
242
|
+
hash: await this.extendedClient.writeContract(request)
|
|
198
243
|
});
|
|
199
|
-
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPrivate', (log)=>
|
|
244
|
+
const log = extractEvent(txReceipt.logs, this.portal.address, this.portal.abi, 'DepositToAztecPrivate', (log)=>{
|
|
245
|
+
// Normalize hex strings for comparison (case-insensitive, handle different formats)
|
|
246
|
+
const normalizeHex = (val)=>{
|
|
247
|
+
const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
|
|
248
|
+
return hexStr.toLowerCase();
|
|
249
|
+
};
|
|
250
|
+
return log.args.amount === amount && normalizeHex(log.args.secretHashForL2MessageConsumption) === normalizeHex(claimSecretHash.toString());
|
|
251
|
+
}, this.logger);
|
|
200
252
|
this.logger.info(`Claim message secret: ${claimSecret.toString()}, claim message secret hash: ${claimSecretHash.toString()}`);
|
|
201
253
|
return {
|
|
202
254
|
claimAmount: amount,
|
|
@@ -209,7 +261,11 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
209
261
|
}
|
|
210
262
|
async bridgeSetup(amount, mint) {
|
|
211
263
|
if (mint) {
|
|
212
|
-
await this.tokenManager.
|
|
264
|
+
const mintableAmount = await this.tokenManager.getMintAmount();
|
|
265
|
+
if (amount !== mintableAmount) {
|
|
266
|
+
throw new Error(`Minting amount must be ${mintableAmount} for testing`);
|
|
267
|
+
}
|
|
268
|
+
await this.tokenManager.mint(this.extendedClient.account.address);
|
|
213
269
|
}
|
|
214
270
|
await this.tokenManager.approve(amount, this.portal.address, 'TokenPortal');
|
|
215
271
|
return generateClaimSecret();
|
|
@@ -217,12 +273,12 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
217
273
|
}
|
|
218
274
|
/** Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2. */ export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
|
|
219
275
|
outbox;
|
|
220
|
-
constructor(portalAddress, tokenAddress,
|
|
221
|
-
super(portalAddress, tokenAddress,
|
|
276
|
+
constructor(portalAddress, tokenAddress, handlerAddress, outboxAddress, extendedClient, logger){
|
|
277
|
+
super(portalAddress, tokenAddress, handlerAddress, extendedClient, logger);
|
|
222
278
|
this.outbox = getContract({
|
|
223
279
|
address: outboxAddress.toString(),
|
|
224
280
|
abi: OutboxAbi,
|
|
225
|
-
client:
|
|
281
|
+
client: extendedClient
|
|
226
282
|
});
|
|
227
283
|
}
|
|
228
284
|
/**
|
|
@@ -234,12 +290,16 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
234
290
|
* @param siblingPath - Sibling path of the message.
|
|
235
291
|
*/ async withdrawFunds(amount, recipient, blockNumber, messageIndex, siblingPath) {
|
|
236
292
|
this.logger.info(`Sending L1 tx to consume message at block ${blockNumber} index ${messageIndex} to withdraw ${amount}`);
|
|
237
|
-
const
|
|
293
|
+
const messageLeafId = getL2ToL1MessageLeafId({
|
|
294
|
+
leafIndex: messageIndex,
|
|
295
|
+
siblingPath
|
|
296
|
+
});
|
|
297
|
+
const isConsumedBefore = await this.outbox.read.hasMessageBeenConsumedAtCheckpoint([
|
|
238
298
|
blockNumber,
|
|
239
|
-
|
|
299
|
+
messageLeafId
|
|
240
300
|
]);
|
|
241
301
|
if (isConsumedBefore) {
|
|
242
|
-
throw new Error(`L1 to L2 message at block ${blockNumber} index ${messageIndex} has already been consumed`);
|
|
302
|
+
throw new Error(`L1 to L2 message at block ${blockNumber} index ${messageIndex} height ${siblingPath.pathSize} has already been consumed`);
|
|
243
303
|
}
|
|
244
304
|
// Call function on L1 contract to consume the message
|
|
245
305
|
const { request: withdrawRequest } = await this.portal.simulate.withdraw([
|
|
@@ -250,15 +310,15 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
250
310
|
messageIndex,
|
|
251
311
|
siblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
|
|
252
312
|
]);
|
|
253
|
-
await this.
|
|
254
|
-
hash: await this.
|
|
313
|
+
await this.extendedClient.waitForTransactionReceipt({
|
|
314
|
+
hash: await this.extendedClient.writeContract(withdrawRequest)
|
|
255
315
|
});
|
|
256
|
-
const isConsumedAfter = await this.outbox.read.
|
|
316
|
+
const isConsumedAfter = await this.outbox.read.hasMessageBeenConsumedAtCheckpoint([
|
|
257
317
|
blockNumber,
|
|
258
|
-
|
|
318
|
+
messageLeafId
|
|
259
319
|
]);
|
|
260
320
|
if (!isConsumedAfter) {
|
|
261
|
-
throw new Error(`L1 to L2 message at block ${blockNumber} index ${messageIndex} not consumed after withdrawal`);
|
|
321
|
+
throw new Error(`L1 to L2 message at block ${blockNumber} index ${messageIndex} height ${siblingPath.pathSize} not consumed after withdrawal`);
|
|
262
322
|
}
|
|
263
323
|
}
|
|
264
324
|
/**
|
|
@@ -267,20 +327,20 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
267
327
|
* @param recipient - Recipient on L1.
|
|
268
328
|
* @param l2Bridge - Address of the L2 bridge.
|
|
269
329
|
* @param callerOnL1 - Caller address on L1.
|
|
270
|
-
*/ getL2ToL1MessageLeaf(amount, recipient, l2Bridge, callerOnL1 = EthAddress.ZERO) {
|
|
330
|
+
*/ async getL2ToL1MessageLeaf(amount, recipient, l2Bridge, callerOnL1 = EthAddress.ZERO) {
|
|
331
|
+
const version = await this.outbox.read.VERSION();
|
|
271
332
|
const content = sha256ToField([
|
|
272
333
|
Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
|
|
273
334
|
recipient.toBuffer32(),
|
|
274
335
|
new Fr(amount).toBuffer(),
|
|
275
336
|
callerOnL1.toBuffer32()
|
|
276
337
|
]);
|
|
277
|
-
|
|
278
|
-
l2Bridge
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
new Fr(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return leaf;
|
|
338
|
+
return computeL2ToL1MessageHash({
|
|
339
|
+
l2Sender: l2Bridge,
|
|
340
|
+
l1Recipient: EthAddress.fromString(this.portal.address),
|
|
341
|
+
content,
|
|
342
|
+
rollupVersion: new Fr(version),
|
|
343
|
+
chainId: new Fr(this.extendedClient.chain.id)
|
|
344
|
+
});
|
|
285
345
|
}
|
|
286
346
|
}
|
|
@@ -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
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
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"}
|