@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.0b941701
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 +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 +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 +36 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/auth-registry.js +963 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.js +858 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/fee-juice.js +827 -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 +563 -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 +579 -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/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 +3 -17
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +2 -20
- package/dest/wallet/wallet.d.ts +1297 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/dest/wallet/wallet.js +172 -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 +34 -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 +545 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
- package/src/contract/protocol_contracts/contract-instance-registry.ts +493 -0
- package/src/contract/protocol_contracts/fee-juice.ts +457 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
- package/src/contract/protocol_contracts/public-checks.ts +315 -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/deploy_account_method.ts +150 -0
- package/src/wallet/index.ts +2 -33
- package/src/wallet/wallet.ts +417 -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
package/dest/utils/node.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
2
|
+
import { SortedTxStatuses, TxStatus } from '@aztec/stdlib/tx';
|
|
3
|
+
import { DefaultWaitOpts } from '../contract/wait_opts.js';
|
|
2
4
|
export const waitForNode = async (node, logger)=>{
|
|
3
5
|
await retryUntil(async ()=>{
|
|
4
6
|
try {
|
|
@@ -6,10 +8,54 @@ export const waitForNode = async (node, logger)=>{
|
|
|
6
8
|
await node.getNodeInfo();
|
|
7
9
|
logger?.verbose('Contacted Aztec node');
|
|
8
10
|
return true;
|
|
9
|
-
} catch
|
|
11
|
+
} catch {
|
|
10
12
|
logger?.verbose('Failed to contact Aztec Node');
|
|
11
13
|
}
|
|
12
14
|
return undefined;
|
|
13
15
|
}, 'RPC Get Node Info');
|
|
14
16
|
};
|
|
17
|
+
/** Returns true if the receipt status is at least the desired status level. */ function hasReachedStatus(receipt, desiredStatus) {
|
|
18
|
+
return SortedTxStatuses.indexOf(receipt.status) >= SortedTxStatuses.indexOf(desiredStatus);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Waits for a transaction to be mined and returns its receipt.
|
|
22
|
+
* @param node - The Aztec node to query for transaction status
|
|
23
|
+
* @param txHash - The hash of the transaction to wait for
|
|
24
|
+
* @param opts - Optional configuration for waiting behavior
|
|
25
|
+
* @returns The transaction receipt
|
|
26
|
+
* @throws If the transaction fails and dontThrowOnRevert is not set
|
|
27
|
+
*/ export async function waitForTx(node, txHash, opts) {
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
const ignoreDroppedReceiptsFor = opts?.ignoreDroppedReceiptsFor ?? DefaultWaitOpts.ignoreDroppedReceiptsFor;
|
|
30
|
+
const waitForStatus = opts?.waitForStatus ?? TxStatus.CHECKPOINTED;
|
|
31
|
+
const receipt = await retryUntil(async ()=>{
|
|
32
|
+
const txReceipt = await node.getTxReceipt(txHash);
|
|
33
|
+
// If receipt is not yet available, try again
|
|
34
|
+
if (txReceipt.isPending()) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
// If the tx was "dropped", either return it or ignore based on timing.
|
|
38
|
+
// We can ignore it at first because the transaction may have been sent to node 1, and now we're asking node 2 for the receipt.
|
|
39
|
+
// If we don't allow a short grace period, we could incorrectly return a TxReceipt with status DROPPED.
|
|
40
|
+
if (txReceipt.isDropped()) {
|
|
41
|
+
const elapsedSeconds = (Date.now() - startTime) / 1000;
|
|
42
|
+
if (!ignoreDroppedReceiptsFor || elapsedSeconds > ignoreDroppedReceiptsFor) {
|
|
43
|
+
return txReceipt;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
// Check if the receipt has reached the desired status level
|
|
48
|
+
if (!hasReachedStatus(txReceipt, waitForStatus)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return txReceipt;
|
|
52
|
+
}, 'isMined', opts?.timeout ?? DefaultWaitOpts.timeout, opts?.interval ?? DefaultWaitOpts.interval);
|
|
53
|
+
if (!receipt.isMined()) {
|
|
54
|
+
throw new Error(`Transaction ${txHash.toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`);
|
|
55
|
+
}
|
|
56
|
+
if (!receipt.hasExecutionSucceeded() && !opts?.dontThrowOnRevert) {
|
|
57
|
+
throw new Error(`Transaction ${txHash.toString()} reverted: ${receipt.executionResult}. Reason: ${receipt.error ?? 'unknown'}`);
|
|
58
|
+
}
|
|
59
|
+
return receipt;
|
|
60
|
+
}
|
|
15
61
|
export { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
package/dest/utils/pub_key.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GrumpkinScalar } from '@aztec/foundation/
|
|
1
|
+
import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
2
2
|
import type { PublicKey } from '@aztec/stdlib/keys';
|
|
3
3
|
/**
|
|
4
4
|
* Method for generating a public grumpkin key from a private key.
|
|
@@ -6,4 +6,4 @@ import type { PublicKey } from '@aztec/stdlib/keys';
|
|
|
6
6
|
* @returns The generated public key.
|
|
7
7
|
*/
|
|
8
8
|
export declare function generatePublicKey(privateKey: GrumpkinScalar): Promise<PublicKey>;
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHViX2tleS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3B1Yl9rZXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFcEQ7Ozs7R0FJRztBQUNILHdCQUFnQixpQkFBaUIsQ0FBQyxVQUFVLEVBQUUsY0FBYyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FFaEYifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pub_key.d.ts","sourceRoot":"","sources":["../../src/utils/pub_key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pub_key.d.ts","sourceRoot":"","sources":["../../src/utils/pub_key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAEhF"}
|
package/dest/utils/pub_key.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Grumpkin } from '@aztec/foundation/crypto';
|
|
1
|
+
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
2
2
|
/**
|
|
3
3
|
* Method for generating a public grumpkin key from a private key.
|
|
4
4
|
* @param privateKey - The private key.
|
|
5
5
|
* @returns The generated public key.
|
|
6
6
|
*/ export function generatePublicKey(privateKey) {
|
|
7
|
-
|
|
8
|
-
return grumpkin.mul(grumpkin.generator(), privateKey);
|
|
7
|
+
return Grumpkin.mul(Grumpkin.generator, privateKey);
|
|
9
8
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
3
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { Account } from '../account/account.js';
|
|
5
|
+
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
6
|
+
/**
|
|
7
|
+
* Fee payment method that allows an account contract to pay for its own deployment
|
|
8
|
+
* It works by rerouting the provided fee payment method through the account's entrypoint,
|
|
9
|
+
* which sets itself as fee payer. If no payment method is provided, it is assumed the
|
|
10
|
+
* account will pay with its own fee juice balance.
|
|
11
|
+
*
|
|
12
|
+
* Usually, in order to pay fees it is necessary to obtain an ExecutionPayload that encodes the necessary information
|
|
13
|
+
* that is sent to the user's account entrypoint, that has plumbing to handle it.
|
|
14
|
+
* If there's no account contract yet (it's being deployed) a MultiCallContract is used, which doesn't have a concept of fees or
|
|
15
|
+
* how to handle this payload.
|
|
16
|
+
* HOWEVER, the account contract's entrypoint does, so this method reshapes that fee payload into a call to the account contract entrypoint
|
|
17
|
+
* being deployed with the original fee payload.
|
|
18
|
+
*
|
|
19
|
+
* This class can be seen in action in DeployAccountMethod.ts#getSelfPaymentMethod
|
|
20
|
+
*/
|
|
21
|
+
export declare class AccountEntrypointMetaPaymentMethod implements FeePaymentMethod {
|
|
22
|
+
private account;
|
|
23
|
+
private paymentMethod?;
|
|
24
|
+
private feeEntrypointOptions?;
|
|
25
|
+
constructor(account: Account, paymentMethod?: FeePaymentMethod | undefined, feeEntrypointOptions?: any);
|
|
26
|
+
getAsset(): Promise<AztecAddress>;
|
|
27
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
28
|
+
getFeeP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ENBQUMsWUFBWSxDQUFDLENBRW5DO0lBRUQsY0FBYyxJQUFJLFdBQVcsR0FBRyxTQUFTLENBRXhDO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account_entrypoint_meta_payment_method.d.ts","sourceRoot":"","sources":["../../src/wallet/account_entrypoint_meta_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;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;;;;;;;GAcG;AACH,qBAAa,kCAAmC,YAAW,gBAAgB;IAEvE,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,oBAAoB,CAAC;IAH/B,YACU,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,8BAAkB,EAChC,oBAAoB,CAAC,KAAK,EAChC;IAEJ,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAEhC;IAEK,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA6BrD;IAED,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAEnC;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
2
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
|
+
/**
|
|
5
|
+
* Fee payment method that allows an account contract to pay for its own deployment
|
|
6
|
+
* It works by rerouting the provided fee payment method through the account's entrypoint,
|
|
7
|
+
* which sets itself as fee payer. If no payment method is provided, it is assumed the
|
|
8
|
+
* account will pay with its own fee juice balance.
|
|
9
|
+
*
|
|
10
|
+
* Usually, in order to pay fees it is necessary to obtain an ExecutionPayload that encodes the necessary information
|
|
11
|
+
* that is sent to the user's account entrypoint, that has plumbing to handle it.
|
|
12
|
+
* If there's no account contract yet (it's being deployed) a MultiCallContract is used, which doesn't have a concept of fees or
|
|
13
|
+
* how to handle this payload.
|
|
14
|
+
* HOWEVER, the account contract's entrypoint does, so this method reshapes that fee payload into a call to the account contract entrypoint
|
|
15
|
+
* being deployed with the original fee payload.
|
|
16
|
+
*
|
|
17
|
+
* This class can be seen in action in DeployAccountMethod.ts#getSelfPaymentMethod
|
|
18
|
+
*/ export class AccountEntrypointMetaPaymentMethod {
|
|
19
|
+
account;
|
|
20
|
+
paymentMethod;
|
|
21
|
+
feeEntrypointOptions;
|
|
22
|
+
constructor(account, paymentMethod, feeEntrypointOptions){
|
|
23
|
+
this.account = account;
|
|
24
|
+
this.paymentMethod = paymentMethod;
|
|
25
|
+
this.feeEntrypointOptions = feeEntrypointOptions;
|
|
26
|
+
}
|
|
27
|
+
getAsset() {
|
|
28
|
+
return this.paymentMethod?.getAsset() ?? Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
29
|
+
}
|
|
30
|
+
async getExecutionPayload() {
|
|
31
|
+
// Get the execution payload for the fee
|
|
32
|
+
const innerPayload = await this.paymentMethod?.getExecutionPayload() ?? ExecutionPayload.empty();
|
|
33
|
+
// If no fee entrypoint options were provided, compute them based on the wrapped payment method
|
|
34
|
+
// This mimics how the actual account contract works when invoked directly:
|
|
35
|
+
// - If we are the fee payer, are there calls in the inner payload? In that case, those calls can
|
|
36
|
+
// only be claiming fee juice, so we use FEE_JUICE_WITH_CLAIM
|
|
37
|
+
// - If we are the fee payer, but there are no calls, then we assume the account already has
|
|
38
|
+
// fee juice and can pay directly with PREEXISTING_FEE_JUICE
|
|
39
|
+
// - If we are not the fee payer, then EXTERNAL is used
|
|
40
|
+
let options = this.feeEntrypointOptions;
|
|
41
|
+
if (!options) {
|
|
42
|
+
const feePayer = await this.paymentMethod?.getFeePayer() ?? this.account.getAddress();
|
|
43
|
+
const isFeePayer = feePayer.equals(this.account.getAddress());
|
|
44
|
+
let accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.EXTERNAL;
|
|
45
|
+
if (isFeePayer) {
|
|
46
|
+
accountFeePaymentMethodOptions = innerPayload.calls.length === 0 ? AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE : AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM;
|
|
47
|
+
}
|
|
48
|
+
options = {
|
|
49
|
+
feePaymentMethodOptions: accountFeePaymentMethodOptions
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Use the generic wrapping mechanism from the account interface
|
|
53
|
+
return this.account.wrapExecutionPayload(innerPayload, options);
|
|
54
|
+
}
|
|
55
|
+
getFeePayer() {
|
|
56
|
+
return this.paymentMethod?.getFeePayer() ?? Promise.resolve(this.account.getAddress());
|
|
57
|
+
}
|
|
58
|
+
getGasSettings() {
|
|
59
|
+
return this.paymentMethod?.getGasSettings();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
+
import type { AccountContract } from '../account/account_contract.js';
|
|
4
|
+
import { AccountWithSecretKey } from '../account/account_with_secret_key.js';
|
|
5
|
+
import type { Salt } from '../account/index.js';
|
|
6
|
+
import { DeployAccountMethod } from './deploy_account_method.js';
|
|
7
|
+
import type { Wallet } from './wallet.js';
|
|
8
|
+
/**
|
|
9
|
+
* Manages a user account. Provides methods for calculating the account's address and other related data,
|
|
10
|
+
* plus a helper to return a preconfigured deploy method.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AccountManager {
|
|
13
|
+
private wallet;
|
|
14
|
+
private secretKey;
|
|
15
|
+
private accountContract;
|
|
16
|
+
private instance;
|
|
17
|
+
/**
|
|
18
|
+
* Contract instantiation salt for the account contract
|
|
19
|
+
*/
|
|
20
|
+
readonly salt: Salt;
|
|
21
|
+
private constructor();
|
|
22
|
+
static create(wallet: Wallet, secretKey: Fr, accountContract: AccountContract, salt?: Salt): Promise<AccountManager>;
|
|
23
|
+
protected getPublicKeys(): import("@aztec/stdlib/keys").PublicKeys;
|
|
24
|
+
protected getPublicKeysHash(): Fr | Promise<Fr>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the calculated complete address associated with this account.
|
|
27
|
+
* Does not require the account to have been published for public execution.
|
|
28
|
+
* @returns The address, partial address, and encryption public key.
|
|
29
|
+
*/
|
|
30
|
+
getCompleteAddress(): Promise<CompleteAddress>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the secret key used to derive the rest of the privacy keys for this contract
|
|
33
|
+
*/
|
|
34
|
+
getSecretKey(): Fr;
|
|
35
|
+
get address(): import("@aztec/stdlib/aztec-address").AztecAddress;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the contract instance definition associated with this account.
|
|
38
|
+
* Does not require the account to have been published for public execution.
|
|
39
|
+
* @returns ContractInstance instance.
|
|
40
|
+
*/
|
|
41
|
+
getInstance(): ContractInstanceWithAddress;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a Wallet instance associated with this account. Use it to create Contract
|
|
44
|
+
* instances to be interacted with from this account.
|
|
45
|
+
* @returns A Wallet instance.
|
|
46
|
+
*/
|
|
47
|
+
getAccount(): Promise<AccountWithSecretKey>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the account contract that backs this account.
|
|
50
|
+
* @returns The account contract
|
|
51
|
+
*/
|
|
52
|
+
getAccountContract(): AccountContract;
|
|
53
|
+
/**
|
|
54
|
+
* Returns a preconfigured deploy method that contains all the necessary function
|
|
55
|
+
* calls to deploy the account contract.
|
|
56
|
+
*/
|
|
57
|
+
getDeployMethod(): Promise<DeployAccountMethod>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns whether this account contract has an initializer function.
|
|
60
|
+
*/
|
|
61
|
+
hasInitializer(): Promise<boolean>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudF9tYW5hZ2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L2FjY291bnRfbWFuYWdlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUNMLGVBQWUsRUFDZixLQUFLLDJCQUEyQixFQUVqQyxNQUFNLHdCQUF3QixDQUFDO0FBR2hDLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3RFLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQzdFLE9BQU8sS0FBSyxFQUFFLElBQUksRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWhELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUUxQzs7O0dBR0c7QUFDSCxxQkFBYSxjQUFjO0lBRXZCLE9BQU8sQ0FBQyxNQUFNO0lBQ2QsT0FBTyxDQUFDLFNBQVM7SUFDakIsT0FBTyxDQUFDLGVBQWU7SUFDdkIsT0FBTyxDQUFDLFFBQVE7SUFDaEI7O09BRUc7YUFDYSxJQUFJLEVBQUUsSUFBSTtJQVI1QixPQUFPLGVBU0g7SUFFSixPQUFhLE1BQU0sQ0FBQyxNQUFNLEVBQUUsTUFBTSxFQUFFLFNBQ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1C;;;GAGG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,QAAQ;IAChB;;OAEG;aACa,IAAI,EAAE,IAAI;IAR5B,OAAO,eASH;IAEJ,OAAa,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI,2BAkB/F;IAED,SAAS,CAAC,aAAa,4CAEtB;IAED,SAAS,CAAC,iBAAiB,qBAE1B;IAED;;;;OAIG;IACI,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC,CAEpD;IAED;;OAEG;IACI,YAAY,OAElB;IAED,IAAI,OAAO,uDAEV;IAED;;;;OAIG;IACI,WAAW,IAAI,2BAA2B,CAEhD;IAED;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAIvD;IAED;;;OAGG;IACH,kBAAkB,IAAI,eAAe,CAEpC;IAED;;;OAGG;IACU,eAAe,IAAI,OAAO,CAAC,mBAAmB,CAAC,CA0B3D;IAED;;OAEG;IACU,cAAc,qBAE1B;CACF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { CompleteAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
3
|
+
import { deriveKeys } from '@aztec/stdlib/keys';
|
|
4
|
+
import { AccountWithSecretKey } from '../account/account_with_secret_key.js';
|
|
5
|
+
import { Contract } from '../contract/contract.js';
|
|
6
|
+
import { DeployAccountMethod } from './deploy_account_method.js';
|
|
7
|
+
/**
|
|
8
|
+
* Manages a user account. Provides methods for calculating the account's address and other related data,
|
|
9
|
+
* plus a helper to return a preconfigured deploy method.
|
|
10
|
+
*/ export class AccountManager {
|
|
11
|
+
wallet;
|
|
12
|
+
secretKey;
|
|
13
|
+
accountContract;
|
|
14
|
+
instance;
|
|
15
|
+
salt;
|
|
16
|
+
constructor(wallet, secretKey, accountContract, instance, /**
|
|
17
|
+
* Contract instantiation salt for the account contract
|
|
18
|
+
*/ salt){
|
|
19
|
+
this.wallet = wallet;
|
|
20
|
+
this.secretKey = secretKey;
|
|
21
|
+
this.accountContract = accountContract;
|
|
22
|
+
this.instance = instance;
|
|
23
|
+
this.salt = salt;
|
|
24
|
+
}
|
|
25
|
+
static async create(wallet, secretKey, accountContract, salt) {
|
|
26
|
+
const { publicKeys } = await deriveKeys(secretKey);
|
|
27
|
+
salt = salt !== undefined ? new Fr(salt) : Fr.random();
|
|
28
|
+
const { constructorName, constructorArgs } = await accountContract.getInitializationFunctionAndArgs() ?? {
|
|
29
|
+
constructorName: undefined,
|
|
30
|
+
constructorArgs: undefined
|
|
31
|
+
};
|
|
32
|
+
const artifact = await accountContract.getContractArtifact();
|
|
33
|
+
const instance = await getContractInstanceFromInstantiationParams(artifact, {
|
|
34
|
+
constructorArtifact: constructorName,
|
|
35
|
+
constructorArgs,
|
|
36
|
+
salt: salt,
|
|
37
|
+
publicKeys
|
|
38
|
+
});
|
|
39
|
+
return new AccountManager(wallet, secretKey, accountContract, instance, salt);
|
|
40
|
+
}
|
|
41
|
+
getPublicKeys() {
|
|
42
|
+
return this.instance.publicKeys;
|
|
43
|
+
}
|
|
44
|
+
getPublicKeysHash() {
|
|
45
|
+
return this.getPublicKeys().hash();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the calculated complete address associated with this account.
|
|
49
|
+
* Does not require the account to have been published for public execution.
|
|
50
|
+
* @returns The address, partial address, and encryption public key.
|
|
51
|
+
*/ getCompleteAddress() {
|
|
52
|
+
return CompleteAddress.fromSecretKeyAndInstance(this.secretKey, this.instance);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the secret key used to derive the rest of the privacy keys for this contract
|
|
56
|
+
*/ getSecretKey() {
|
|
57
|
+
return this.secretKey;
|
|
58
|
+
}
|
|
59
|
+
get address() {
|
|
60
|
+
return this.instance.address;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns the contract instance definition associated with this account.
|
|
64
|
+
* Does not require the account to have been published for public execution.
|
|
65
|
+
* @returns ContractInstance instance.
|
|
66
|
+
*/ getInstance() {
|
|
67
|
+
return this.instance;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns a Wallet instance associated with this account. Use it to create Contract
|
|
71
|
+
* instances to be interacted with from this account.
|
|
72
|
+
* @returns A Wallet instance.
|
|
73
|
+
*/ async getAccount() {
|
|
74
|
+
const completeAddress = await this.getCompleteAddress();
|
|
75
|
+
const account = this.accountContract.getAccount(completeAddress);
|
|
76
|
+
return new AccountWithSecretKey(account, this.secretKey, this.salt);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the account contract that backs this account.
|
|
80
|
+
* @returns The account contract
|
|
81
|
+
*/ getAccountContract() {
|
|
82
|
+
return this.accountContract;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns a preconfigured deploy method that contains all the necessary function
|
|
86
|
+
* calls to deploy the account contract.
|
|
87
|
+
*/ async getDeployMethod() {
|
|
88
|
+
const artifact = await this.accountContract.getContractArtifact();
|
|
89
|
+
if (!await this.hasInitializer()) {
|
|
90
|
+
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/15576):
|
|
91
|
+
// there should be a path which enables an account contract's class & instance to be published,
|
|
92
|
+
// even if the account contract doesn't have an initializer function. This should not throw.
|
|
93
|
+
throw new Error(`Account contract ${artifact.name} does not have an initializer function to call.`);
|
|
94
|
+
}
|
|
95
|
+
const { constructorName, constructorArgs } = await this.accountContract.getInitializationFunctionAndArgs() ?? {
|
|
96
|
+
constructorName: undefined,
|
|
97
|
+
constructorArgs: undefined
|
|
98
|
+
};
|
|
99
|
+
const account = await this.getAccount();
|
|
100
|
+
return new DeployAccountMethod(this.getPublicKeys(), this.wallet, artifact, (instance)=>Contract.at(instance.address, artifact, this.wallet), new Fr(this.salt), account, constructorArgs, constructorName);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns whether this account contract has an initializer function.
|
|
104
|
+
*/ async hasInitializer() {
|
|
105
|
+
return await this.accountContract.getInitializationFunctionAndArgs() !== undefined;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
6
|
+
import type { Account } from '../account/account.js';
|
|
7
|
+
import type { Contract } from '../contract/contract.js';
|
|
8
|
+
import type { ContractBase } from '../contract/contract_base.js';
|
|
9
|
+
import { DeployMethod, type DeployOptionsWithoutWait, type RequestDeployOptions, type SimulateDeployOptions } from '../contract/deploy_method.js';
|
|
10
|
+
import type { FeePaymentMethodOption, InteractionWaitOptions } from '../contract/interaction_options.js';
|
|
11
|
+
import type { Wallet } from './index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Extended fee payment method option for account deployments that includes entrypoint wrapping options
|
|
14
|
+
*/
|
|
15
|
+
export type DeployAccountFeePaymentMethodOption = FeePaymentMethodOption & {
|
|
16
|
+
/** Optional entrypoint-specific options for wrapping execution payloads */
|
|
17
|
+
feeEntrypointOptions?: unknown;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The configuration options for the request method. Omits the contractAddressSalt, since
|
|
21
|
+
* for account contracts that is fixed in the constructor
|
|
22
|
+
*/
|
|
23
|
+
export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt' | 'fee'> & {
|
|
24
|
+
/** Fee options specific to account deployment */
|
|
25
|
+
fee?: DeployAccountFeePaymentMethodOption;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Base configuration options for the send/prove methods without wait parameter. Omits:
|
|
29
|
+
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
30
|
+
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
31
|
+
*/
|
|
32
|
+
export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
|
|
33
|
+
/**
|
|
34
|
+
* The configuration options for the send/prove methods. Omits:
|
|
35
|
+
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
36
|
+
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
37
|
+
*/
|
|
38
|
+
export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
|
|
39
|
+
/**
|
|
40
|
+
* Whether to wait for the transaction to be mined.
|
|
41
|
+
* - undefined (default): wait with default options and return TxReceipt
|
|
42
|
+
* - WaitOpts object: wait with custom options and return TxReceipt
|
|
43
|
+
* - false: return txHash immediately without waiting
|
|
44
|
+
*/
|
|
45
|
+
wait?: W;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The configuration options for the simulate method. Omits the contractAddressSalt, since
|
|
49
|
+
* for account contracts that is fixed in the constructor
|
|
50
|
+
*/
|
|
51
|
+
export type SimulateDeployAccountOptions = Omit<SimulateDeployOptions, 'contractAddressSalt'>;
|
|
52
|
+
/**
|
|
53
|
+
* Modified version of the DeployMethod used to deploy account contracts. Supports deploying
|
|
54
|
+
* contracts that can pay for their own fee, plus some preconfigured options to avoid errors.
|
|
55
|
+
*/
|
|
56
|
+
export declare class DeployAccountMethod<TContract extends ContractBase = Contract> extends DeployMethod<TContract> {
|
|
57
|
+
private salt;
|
|
58
|
+
private account;
|
|
59
|
+
constructor(publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract, salt: Fr, account: Account, args?: any[], constructorNameOrArtifact?: string | FunctionArtifact);
|
|
60
|
+
/**
|
|
61
|
+
* Returns a FeePaymentMethod that routes the original one provided as an argument
|
|
62
|
+
* through the account's entrypoint. This allows an account contract to pay
|
|
63
|
+
* for its own deployment and initialization.
|
|
64
|
+
*
|
|
65
|
+
* For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
|
|
66
|
+
*
|
|
67
|
+
* @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
|
|
68
|
+
* @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
|
|
69
|
+
* @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
|
|
70
|
+
*/
|
|
71
|
+
private getSelfFeePaymentMethod;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the execution payload that allows this operation to happen on chain.
|
|
74
|
+
* @param opts - Configuration options.
|
|
75
|
+
* @returns The execution payload for this operation
|
|
76
|
+
*/
|
|
77
|
+
request(opts?: RequestDeployAccountOptions): Promise<ExecutionPayload>;
|
|
78
|
+
convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X2FjY291bnRfbWV0aG9kLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L2RlcGxveV9hY2NvdW50X21ldGhvZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUU1RSxPQUFPLEtB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,MAAM,+BAA+B,GAAG,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,GAAG,iBAAiB,CAAC,CAAC;AAExH;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,IAAI,+BAA+B,GAAG;IACjH;;;;;OAKG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;AAE9F;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,SAAS,SAAS,YAAY,GAAG,QAAQ,CAAE,SAAQ,YAAY,CAAC,SAAS,CAAC;IAMvG,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IANjB,YACE,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,cAAc,EAAE,CAAC,QAAQ,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,KAAK,SAAS,EAC5E,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,OAAO,EACxB,IAAI,GAAE,GAAG,EAAO,EAChB,yBAAyB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAGtD;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,uBAAuB;IAO/B;;;;OAIG;IACmB,OAAO,CAAC,IAAI,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8B3F;IAEQ,oCAAoC,CAAC,OAAO,EAAE,+BAA+B,GAAG,oBAAoB,CAS5G;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
4
|
+
import { DeployMethod } from '../contract/deploy_method.js';
|
|
5
|
+
import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
|
|
6
|
+
/**
|
|
7
|
+
* Modified version of the DeployMethod used to deploy account contracts. Supports deploying
|
|
8
|
+
* contracts that can pay for their own fee, plus some preconfigured options to avoid errors.
|
|
9
|
+
*/ export class DeployAccountMethod extends DeployMethod {
|
|
10
|
+
salt;
|
|
11
|
+
account;
|
|
12
|
+
constructor(publicKeys, wallet, artifact, postDeployCtor, salt, account, args = [], constructorNameOrArtifact){
|
|
13
|
+
super(publicKeys, wallet, artifact, postDeployCtor, args, constructorNameOrArtifact), this.salt = salt, this.account = account;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns a FeePaymentMethod that routes the original one provided as an argument
|
|
17
|
+
* through the account's entrypoint. This allows an account contract to pay
|
|
18
|
+
* for its own deployment and initialization.
|
|
19
|
+
*
|
|
20
|
+
* For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
|
|
21
|
+
*
|
|
22
|
+
* @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
|
|
23
|
+
* @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
|
|
24
|
+
* @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
|
|
25
|
+
*/ getSelfFeePaymentMethod(originalPaymentMethod, feeEntrypointOptions) {
|
|
26
|
+
if (!this.address) {
|
|
27
|
+
throw new Error('Instance is not yet constructed. This is a bug!');
|
|
28
|
+
}
|
|
29
|
+
return new AccountEntrypointMetaPaymentMethod(this.account, originalPaymentMethod, feeEntrypointOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the execution payload that allows this operation to happen on chain.
|
|
33
|
+
* @param opts - Configuration options.
|
|
34
|
+
* @returns The execution payload for this operation
|
|
35
|
+
*/ async request(opts) {
|
|
36
|
+
const optionsWithDefaults = {
|
|
37
|
+
...opts,
|
|
38
|
+
// Regardless of whom sends the transaction, account contracts
|
|
39
|
+
// are always deployed as universalDeployment: true
|
|
40
|
+
deployer: undefined,
|
|
41
|
+
contractAddressSalt: new Fr(this.salt),
|
|
42
|
+
skipClassPublication: opts?.skipClassPublication ?? true,
|
|
43
|
+
skipInstancePublication: opts?.skipInstancePublication ?? true,
|
|
44
|
+
skipInitialization: opts?.skipInitialization ?? false
|
|
45
|
+
};
|
|
46
|
+
// Override the fee to undefined, since we'll replace it
|
|
47
|
+
const deploymentExecutionPayload = await super.request({
|
|
48
|
+
...optionsWithDefaults,
|
|
49
|
+
fee: undefined
|
|
50
|
+
});
|
|
51
|
+
const executionPayloads = [
|
|
52
|
+
deploymentExecutionPayload
|
|
53
|
+
];
|
|
54
|
+
// If this is a self-deployment, manage the fee accordingly
|
|
55
|
+
if (opts?.deployer?.equals(AztecAddress.ZERO)) {
|
|
56
|
+
const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod, opts?.fee?.feeEntrypointOptions);
|
|
57
|
+
const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
|
|
58
|
+
// Notice they are reversed (fee payment usually goes first):
|
|
59
|
+
// this is because we need to construct the contract BEFORE it can pay for its own fee
|
|
60
|
+
executionPayloads.push(feeExecutionPayload);
|
|
61
|
+
} else {
|
|
62
|
+
const feeExecutionPayload = opts?.fee?.paymentMethod ? await opts.fee.paymentMethod.getExecutionPayload() : undefined;
|
|
63
|
+
if (feeExecutionPayload) {
|
|
64
|
+
executionPayloads.unshift(feeExecutionPayload);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return mergeExecutionPayloads(executionPayloads);
|
|
68
|
+
}
|
|
69
|
+
convertDeployOptionsToRequestOptions(options) {
|
|
70
|
+
return {
|
|
71
|
+
...options,
|
|
72
|
+
// Deployer is handled in the request method and forcibly set to undefined,
|
|
73
|
+
// since our account contracts are created with universalDeployment: true
|
|
74
|
+
// We need to forward it though, because depending on the deployer we have to assemble
|
|
75
|
+
// The fee payment method one way or another
|
|
76
|
+
deployer: options.from
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
package/dest/wallet/index.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { AccountWallet } from './account_wallet.js';
|
|
5
|
-
export * from '../account/wallet.js';
|
|
6
|
-
export * from './account_wallet.js';
|
|
7
|
-
export * from './account_wallet_with_private_key.js';
|
|
8
|
-
export * from './signerless_wallet.js';
|
|
9
|
-
/**
|
|
10
|
-
* Gets a wallet for an already registered account.
|
|
11
|
-
* @param pxe - PXE Service instance.
|
|
12
|
-
* @param address - Address for the account.
|
|
13
|
-
* @param accountContract - Account contract implementation.
|
|
14
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getWallet(pxe: PXE, address: AztecAddress, accountContract: AccountContract): Promise<AccountWallet>;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './wallet.js';
|
|
2
|
+
export * from './account_manager.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93YWxsZXQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxhQUFhLENBQUM7QUFDNUIsY0FBYyxzQkFBc0IsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
package/dest/wallet/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '
|
|
3
|
-
export * from './account_wallet.js';
|
|
4
|
-
export * from './account_wallet_with_private_key.js';
|
|
5
|
-
export * from './signerless_wallet.js';
|
|
6
|
-
/**
|
|
7
|
-
* Gets a wallet for an already registered account.
|
|
8
|
-
* @param pxe - PXE Service instance.
|
|
9
|
-
* @param address - Address for the account.
|
|
10
|
-
* @param accountContract - Account contract implementation.
|
|
11
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
12
|
-
*/ export async function getWallet(pxe, address, accountContract) {
|
|
13
|
-
const completeAddress = (await pxe.getRegisteredAccounts()).find((completeAddress)=>completeAddress.address.equals(address));
|
|
14
|
-
if (!completeAddress) {
|
|
15
|
-
throw new Error(`Account ${address} not found`);
|
|
16
|
-
}
|
|
17
|
-
const nodeInfo = await pxe.getNodeInfo();
|
|
18
|
-
const entrypoint = accountContract.getInterface(completeAddress, nodeInfo);
|
|
19
|
-
return new AccountWallet(pxe, entrypoint);
|
|
20
|
-
}
|
|
1
|
+
export * from './wallet.js';
|
|
2
|
+
export * from './account_manager.js';
|