@aztec/aztec.js 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1
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 +7 -7
- package/dest/account/account_contract.d.ts.map +1 -1
- package/dest/account/account_contract.js +0 -1
- 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 +3 -6
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +1 -4
- package/dest/account/interface.d.ts +2 -2
- package/dest/account/interface.d.ts.map +1 -1
- 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 +2 -1
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/account.d.ts +6 -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 +3 -1
- package/dest/api/authorization.d.ts.map +1 -1
- package/dest/api/authorization.js +2 -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 +8 -9
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +6 -6
- 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 +1 -1
- package/dest/api/eth_address.d.ts +1 -1
- package/dest/api/ethereum.d.ts +1 -2
- package/dest/api/ethereum.d.ts.map +1 -1
- package/dest/api/ethereum.js +0 -1
- 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 -3
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +0 -1
- package/dest/api/fee_testing.d.ts +1 -1
- 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 +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 +11 -7
- package/dest/api/utils.d.ts.map +1 -1
- package/dest/api/utils.js +10 -5
- 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 +2 -23
- package/dest/authorization/call_authorization_request.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +7 -50
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +6 -106
- package/dest/contract/batch_call.d.ts +14 -23
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +72 -64
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/contract.d.ts +3 -3
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +5 -16
- package/dest/contract/contract_base.d.ts +5 -12
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +5 -12
- package/dest/contract/contract_function_interaction.d.ts +32 -43
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +47 -56
- package/dest/contract/deploy_method.d.ts +69 -61
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +72 -88
- package/dest/contract/deploy_sent_tx.d.ts +12 -8
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +15 -12
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/interaction_options.d.ts +76 -21
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +45 -3
- package/dest/contract/protocol_contracts.d.ts +1 -1
- package/dest/contract/sent_tx.d.ts +5 -6
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +6 -6
- package/dest/contract/unsafe_contract.d.ts +1 -1
- 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 +4 -4
- package/dest/contract/wait_for_proven.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.js +2 -2
- package/dest/deployment/broadcast_function.d.ts +1 -1
- package/dest/deployment/broadcast_function.js +1 -1
- package/dest/deployment/contract_deployer.d.ts +1 -1
- 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 +1 -1
- package/dest/deployment/publish_class.js +1 -1
- package/dest/deployment/publish_instance.d.ts +2 -2
- package/dest/deployment/publish_instance.d.ts.map +1 -1
- package/dest/deployment/publish_instance.js +2 -5
- package/dest/ethereum/portal_manager.d.ts +7 -10
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +43 -19
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +14 -9
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +24 -15
- package/dest/fee/fee_payment_method.d.ts +26 -0
- package/dest/fee/fee_payment_method.d.ts.map +1 -0
- package/dest/fee/fee_payment_method.js +3 -0
- package/dest/fee/private_fee_payment_method.d.ts +24 -7
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +38 -17
- package/dest/fee/public_fee_payment_method.d.ts +24 -7
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +41 -18
- package/dest/fee/sponsored_fee_payment.d.ts +4 -2
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/fee/sponsored_fee_payment.js +6 -2
- package/dest/utils/abi_types.d.ts +2 -2
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/authwit.d.ts +80 -28
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +231 -25
- 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 +2 -2
- package/dest/utils/node.d.ts.map +1 -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 +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 +2 -16
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +1 -19
- package/dest/wallet/wallet.d.ts +2012 -7
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +198 -3
- package/package.json +29 -24
- package/src/account/account.ts +96 -0
- package/src/account/account_contract.ts +5 -7
- package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +7 -9
- package/src/account/index.ts +2 -5
- package/src/account/interface.ts +1 -1
- package/src/account/signerless_account.ts +45 -0
- package/src/api/abi.ts +11 -0
- package/src/api/account.ts +5 -2
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +11 -0
- package/src/api/block.ts +2 -0
- package/src/api/contract.ts +20 -11
- package/src/api/crypto.ts +1 -0
- package/src/api/ethereum.ts +0 -1
- package/src/api/events.ts +44 -0
- package/src/api/fee.ts +1 -2
- 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 +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 +12 -19
- package/src/api/wallet.ts +31 -5
- package/src/authorization/call_authorization_request.ts +1 -1
- package/src/contract/base_contract_interaction.ts +9 -139
- package/src/contract/batch_call.ts +87 -79
- package/src/contract/contract.ts +8 -16
- package/src/contract/contract_base.ts +5 -15
- package/src/contract/contract_function_interaction.ts +72 -105
- package/src/contract/deploy_method.ts +123 -104
- package/src/contract/deploy_sent_tx.ts +19 -18
- package/src/contract/interaction_options.ts +121 -25
- package/src/contract/sent_tx.ts +6 -7
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/contract/wait_for_proven.ts +4 -4
- package/src/deployment/broadcast_function.ts +1 -1
- package/src/deployment/contract_deployer.ts +3 -2
- package/src/deployment/publish_class.ts +1 -1
- package/src/deployment/publish_instance.ts +3 -8
- package/src/ethereum/portal_manager.ts +62 -40
- package/src/fee/fee_juice_payment_method_with_claim.ts +30 -19
- package/src/fee/fee_payment_method.ts +26 -0
- package/src/fee/private_fee_payment_method.ts +64 -43
- package/src/fee/public_fee_payment_method.ts +77 -51
- package/src/fee/sponsored_fee_payment.ts +9 -1
- package/src/utils/abi_types.ts +1 -1
- package/src/utils/authwit.ts +257 -39
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +5 -4
- package/src/utils/field_compressed_string.ts +1 -1
- package/src/utils/pub_key.ts +3 -4
- 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 +1 -32
- package/src/wallet/wallet.ts +358 -29
- package/dest/account_manager/account_manager.d.ts +0 -119
- package/dest/account_manager/account_manager.d.ts.map +0 -1
- package/dest/account_manager/account_manager.js +0 -202
- 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 -3
- package/dest/account_manager/index.d.ts.map +0 -1
- package/dest/account_manager/index.js +0 -2
- package/dest/api/interfaces.d.ts +0 -2
- package/dest/api/interfaces.d.ts.map +0 -1
- package/dest/api/interfaces.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/rpc.d.ts +0 -3
- package/dest/api/rpc.d.ts.map +0 -1
- package/dest/api/rpc.js +0 -2
- 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 -21
- package/dest/contract/proven_tx.d.ts +0 -21
- package/dest/contract/proven_tx.d.ts.map +0 -1
- package/dest/contract/proven_tx.js +0 -23
- package/dest/ethereum/l1_contracts.d.ts +0 -3
- package/dest/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/ethereum/l1_contracts.js +0 -13
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts +0 -31
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +0 -1
- package/dest/fee/account_entrypoint_meta_payment_method.js +0 -64
- 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 -21
- package/dest/fee/utils.d.ts +0 -13
- package/dest/fee/utils.d.ts.map +0 -1
- package/dest/fee/utils.js +0 -32
- package/dest/index.d.ts +0 -59
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -62
- 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 -72
- 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/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 -74
- package/dest/wallet/account_wallet.d.ts.map +0 -1
- package/dest/wallet/account_wallet.js +0 -232
- 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 -48
- package/dest/wallet/base_wallet.d.ts.map +0 -1
- package/dest/wallet/base_wallet.js +0 -70
- package/dest/wallet/signerless_wallet.d.ts +0 -23
- package/dest/wallet/signerless_wallet.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.js +0 -33
- package/src/account_manager/account_manager.ts +0 -276
- package/src/account_manager/deploy_account_sent_tx.ts +0 -46
- package/src/account_manager/index.ts +0 -2
- package/src/api/interfaces.ts +0 -1
- package/src/api/log_id.ts +0 -1
- package/src/api/rpc.ts +0 -2
- package/src/api/tx_hash.ts +0 -1
- package/src/contract/deploy_proven_tx.ts +0 -45
- package/src/contract/proven_tx.ts +0 -36
- package/src/ethereum/l1_contracts.ts +0 -21
- package/src/fee/account_entrypoint_meta_payment_method.ts +0 -89
- package/src/fee/fee_juice_payment_method.ts +0 -25
- package/src/fee/utils.ts +0 -39
- package/src/index.ts +0 -85
- package/src/rpc_clients/node/index.ts +0 -77
- package/src/rpc_clients/pxe_client.ts +0 -25
- package/src/utils/pxe.ts +0 -17
- package/src/wallet/account_wallet.ts +0 -246
- package/src/wallet/base_wallet.ts +0 -141
- package/src/wallet/signerless_wallet.ts +0 -56
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
5
|
+
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
6
|
+
import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
|
|
5
7
|
/**
|
|
6
8
|
* Holds information about how the fee for a transaction is to be paid.
|
|
7
9
|
*/ export class PublicFeePaymentMethod {
|
|
8
10
|
paymentContract;
|
|
11
|
+
sender;
|
|
9
12
|
wallet;
|
|
13
|
+
gasSettings;
|
|
10
14
|
assetPromise;
|
|
11
15
|
constructor(/**
|
|
12
16
|
* Address which will hold the fee payment.
|
|
13
17
|
*/ paymentContract, /**
|
|
14
18
|
* An auth witness provider to authorize fee payments
|
|
15
|
-
*/
|
|
19
|
+
*/ sender, /**
|
|
20
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
21
|
+
*/ wallet, /**
|
|
22
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
23
|
+
*/ gasSettings){
|
|
16
24
|
this.paymentContract = paymentContract;
|
|
25
|
+
this.sender = sender;
|
|
17
26
|
this.wallet = wallet;
|
|
27
|
+
this.gasSettings = gasSettings;
|
|
18
28
|
this.assetPromise = null;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* The asset used to pay the fee.
|
|
22
32
|
* @returns The asset used to pay the fee.
|
|
23
|
-
*/ getAsset() {
|
|
33
|
+
*/ async getAsset() {
|
|
24
34
|
if (!this.assetPromise) {
|
|
25
|
-
|
|
26
|
-
// before the associated account is deployed.
|
|
27
|
-
this.assetPromise = simulateWithoutSignature(this.wallet, this.paymentContract, {
|
|
35
|
+
const abi = {
|
|
28
36
|
name: 'get_accepted_asset',
|
|
29
37
|
functionType: FunctionType.PRIVATE,
|
|
30
|
-
|
|
38
|
+
isOnlySelf: false,
|
|
31
39
|
isStatic: false,
|
|
32
40
|
parameters: [],
|
|
33
41
|
returnTypes: [
|
|
@@ -46,7 +54,16 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
46
54
|
],
|
|
47
55
|
errorTypes: {},
|
|
48
56
|
isInitializer: false
|
|
49
|
-
}
|
|
57
|
+
};
|
|
58
|
+
const interaction = new ContractFunctionInteraction(this.wallet, this.paymentContract, abi, []);
|
|
59
|
+
const executionPayload = await interaction.request();
|
|
60
|
+
this.assetPromise = this.wallet.simulateTx(executionPayload, {
|
|
61
|
+
from: AztecAddress.ZERO,
|
|
62
|
+
skipFeeEnforcement: true
|
|
63
|
+
}).then((simulationResult)=>{
|
|
64
|
+
const rawReturnValues = simulationResult.getPrivateReturnValues().nested[0].values;
|
|
65
|
+
return decodeFromAbi(abi.returnTypes, rawReturnValues);
|
|
66
|
+
});
|
|
50
67
|
}
|
|
51
68
|
return this.assetPromise;
|
|
52
69
|
}
|
|
@@ -57,15 +74,15 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
57
74
|
* Creates an execution payload to pay the fee using a public function through an FPC in the desired asset
|
|
58
75
|
* @param gasSettings - The gas settings.
|
|
59
76
|
* @returns An execution payload that contains the required function calls.
|
|
60
|
-
*/ async getExecutionPayload(
|
|
77
|
+
*/ async getExecutionPayload() {
|
|
61
78
|
const txNonce = Fr.random();
|
|
62
|
-
const maxFee = gasSettings.getFeeLimit();
|
|
63
|
-
const
|
|
79
|
+
const maxFee = this.gasSettings.getFeeLimit();
|
|
80
|
+
const intent = {
|
|
64
81
|
caller: this.paymentContract,
|
|
65
|
-
|
|
82
|
+
call: {
|
|
66
83
|
name: 'transfer_in_public',
|
|
67
84
|
args: [
|
|
68
|
-
this.
|
|
85
|
+
this.sender.toField(),
|
|
69
86
|
this.paymentContract.toField(),
|
|
70
87
|
maxFee,
|
|
71
88
|
txNonce
|
|
@@ -73,10 +90,12 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
73
90
|
selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
|
|
74
91
|
type: FunctionType.PUBLIC,
|
|
75
92
|
isStatic: false,
|
|
93
|
+
hideMsgSender: false,
|
|
76
94
|
to: await this.getAsset(),
|
|
77
95
|
returnTypes: []
|
|
78
96
|
}
|
|
79
|
-
}
|
|
97
|
+
};
|
|
98
|
+
const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(this.wallet, this.sender, intent, true);
|
|
80
99
|
return new ExecutionPayload([
|
|
81
100
|
...(await setPublicAuthWitInteraction.request()).calls,
|
|
82
101
|
{
|
|
@@ -84,6 +103,7 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
84
103
|
to: this.paymentContract,
|
|
85
104
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
|
|
86
105
|
type: FunctionType.PRIVATE,
|
|
106
|
+
hideMsgSender: false,
|
|
87
107
|
isStatic: false,
|
|
88
108
|
args: [
|
|
89
109
|
maxFee,
|
|
@@ -91,6 +111,9 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
91
111
|
],
|
|
92
112
|
returnTypes: []
|
|
93
113
|
}
|
|
94
|
-
], [], []);
|
|
114
|
+
], [], [], [], this.paymentContract);
|
|
115
|
+
}
|
|
116
|
+
getGasSettings() {
|
|
117
|
+
return this.gasSettings;
|
|
95
118
|
}
|
|
96
119
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
4
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
4
5
|
/**
|
|
5
6
|
* A fee payment method that uses a contract that blindly sponsors transactions.
|
|
6
7
|
* This contract is expected to be prefunded in testing environments.
|
|
@@ -11,5 +12,6 @@ export declare class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
11
12
|
getAsset(): Promise<AztecAddress>;
|
|
12
13
|
getFeePayer(): Promise<AztecAddress>;
|
|
13
14
|
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
15
|
+
getGasSettings(): GasSettings | undefined;
|
|
14
16
|
}
|
|
15
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BvbnNvcmVkX2ZlZV9wYXltZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmVlL3Nwb25zb3JlZF9mZWVfcGF5bWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTVELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNyRCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUVwRDs7O0dBR0c7QUFDSCxxQkFBYSx5QkFBMEIsWUFBVyxnQkFBZ0I7SUFDcEQsT0FBTyxDQUFDLGVBQWU7SUFBbkMsWUFBb0IsZUFBZSxFQUFFLFlBQVksRUFBSTtJQUVyRCxRQUFRLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUVoQztJQUVELFdBQVcsMEJBRVY7SUFFSyxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FtQnJEO0lBRUQsY0FBYyxJQUFJLFdBQVcsR0FBRyxTQUFTLENBRXhDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/fee/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/fee/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,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;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IACpD,OAAO,CAAC,eAAe;IAAnC,YAAoB,eAAe,EAAE,YAAY,EAAI;IAErD,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAEhC;IAED,WAAW,0BAEV;IAEK,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAmBrD;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
2
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
3
3
|
/**
|
|
4
4
|
* A fee payment method that uses a contract that blindly sponsors transactions.
|
|
5
5
|
* This contract is expected to be prefunded in testing environments.
|
|
@@ -21,10 +21,14 @@ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
|
21
21
|
to: this.paymentContract,
|
|
22
22
|
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
23
23
|
type: FunctionType.PRIVATE,
|
|
24
|
+
hideMsgSender: false,
|
|
24
25
|
isStatic: false,
|
|
25
26
|
args: [],
|
|
26
27
|
returnTypes: []
|
|
27
28
|
}
|
|
28
|
-
], [], []);
|
|
29
|
+
], [], [], [], this.paymentContract);
|
|
30
|
+
}
|
|
31
|
+
getGasSettings() {
|
|
32
|
+
return;
|
|
29
33
|
}
|
|
30
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { EventSelector, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
/** Any type that can be converted into a field for a contract call. */
|
|
@@ -24,4 +24,4 @@ export type U128Like = bigint | number;
|
|
|
24
24
|
export type WrappedFieldLike = {
|
|
25
25
|
inner: FieldLike;
|
|
26
26
|
} | FieldLike;
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJpX3R5cGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvYWJpX3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3pFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRWhFLHVFQUF1RTtBQUN2RSxNQUFNLE1BQU0sU0FBUyxHQUFHLEVBQUUsR0FBRyxNQUFNLEdBQUcsTUFBTSxHQUFHLE1BQU0sR0FBRztJQUEyQixPQUFPLEVBQUUsTUFBTSxFQUFFLENBQUE7Q0FBRSxDQUFDO0FBRXZHLHlFQUF5RTtBQUN6RSxNQUFNLE1BQU0sY0FBYyxHQUFHO0lBQXlCLE9BQU8sRUFBRSxTQUFTLENBQUE7Q0FBRSxHQUFHLFVBQVUsQ0FBQztBQUV4RiwyRUFBMkU7QUFDM0UsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQXlCLE9BQU8sRUFBRSxTQUFTLENBQUE7Q0FBRSxHQUFHLFlBQVksQ0FBQztBQUU1Riw4RUFBOEU7QUFDOUUsTUFBTSxNQUFNLG9CQUFvQixHQUFHLFNBQVMsR0FBRyxnQkFBZ0IsQ0FBQztBQUVoRSw0RUFBNEU7QUFDNUUsTUFBTSxNQUFNLGlCQUFpQixHQUFHLFNBQVMsR0FBRyxhQUFhLENBQUM7QUFFMUQsa0RBQWtEO0FBQ2xELE1BQU0sTUFBTSxRQUFRLEdBQUcsTUFBTSxHQUFHLE1BQU0sQ0FBQztBQUV2QyxnRkFBZ0Y7QUFDaEYsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQXVCLEtBQUssRUFBRSxTQUFTLENBQUE7Q0FBRSxHQUFHLFNBQVMsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abi_types.d.ts","sourceRoot":"","sources":["../../src/utils/abi_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"abi_types.d.ts","sourceRoot":"","sources":["../../src/utils/abi_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG;IAA2B,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvG,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG;IAAyB,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG,UAAU,CAAC;AAExF,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG;IAAyB,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG,YAAY,CAAC;AAE5F,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAEhE,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1D,kDAAkD;AAClD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAAuB,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAAC"}
|
package/dest/utils/authwit.d.ts
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { type FunctionCall } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import type { TxProfileResult } from '@aztec/stdlib/tx';
|
|
4
7
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
chainId: Fr;
|
|
9
|
-
/** The version to approve */
|
|
10
|
-
version: Fr;
|
|
11
|
-
};
|
|
8
|
+
import type { ProfileInteractionOptions, SendInteractionOptions, SimulateInteractionOptions, SimulationReturn } from '../contract/interaction_options.js';
|
|
9
|
+
import type { SentTx } from '../contract/sent_tx.js';
|
|
10
|
+
import type { Wallet } from '../wallet/index.js';
|
|
12
11
|
/** Intent with an inner hash */
|
|
13
12
|
export type IntentInnerHash = {
|
|
14
13
|
/** The consumer */
|
|
15
14
|
consumer: AztecAddress;
|
|
16
15
|
/** The action to approve */
|
|
17
|
-
innerHash:
|
|
16
|
+
innerHash: Fr;
|
|
17
|
+
};
|
|
18
|
+
/** Intent with a call */
|
|
19
|
+
export type CallIntent = {
|
|
20
|
+
/** The caller to approve */
|
|
21
|
+
caller: AztecAddress;
|
|
22
|
+
/** The call to approve */
|
|
23
|
+
call: FunctionCall;
|
|
18
24
|
};
|
|
19
|
-
/** Intent with
|
|
20
|
-
export type
|
|
25
|
+
/** Intent with a ContractFunctionInteraction */
|
|
26
|
+
export type ContractFunctionInteractionCallIntent = {
|
|
21
27
|
/** The caller to approve */
|
|
22
28
|
caller: AztecAddress;
|
|
23
29
|
/** The action to approve */
|
|
24
|
-
action: ContractFunctionInteraction
|
|
30
|
+
action: ContractFunctionInteraction;
|
|
25
31
|
};
|
|
26
32
|
/**
|
|
27
33
|
* Compute an authentication witness message hash from an intent and metadata
|
|
@@ -33,7 +39,7 @@ export type IntentAction = {
|
|
|
33
39
|
* and use it for the authentication check.
|
|
34
40
|
* Therefore, any allowed `innerHash` will therefore also have information around where it can be spent (version, chainId) and who can spend it (consumer).
|
|
35
41
|
*
|
|
36
|
-
* If using the `
|
|
42
|
+
* If using the `CallIntent`, the caller is the address that is making the call, for a token approval from Alice to Bob, this would be Bob.
|
|
37
43
|
* The action is then used along with the `caller` to compute the `innerHash` and the consumer.
|
|
38
44
|
*
|
|
39
45
|
*
|
|
@@ -44,22 +50,68 @@ export type IntentAction = {
|
|
|
44
50
|
* @param metadata - The metadata for the intent (chainId, version)
|
|
45
51
|
* @returns The message hash for the action
|
|
46
52
|
*/
|
|
47
|
-
export declare const computeAuthWitMessageHash: (intent:
|
|
53
|
+
export declare const computeAuthWitMessageHash: (intent: CallIntent | ContractFunctionInteractionCallIntent | IntentInnerHash, metadata: ChainInfo) => Promise<Fr>;
|
|
48
54
|
/**
|
|
49
|
-
*
|
|
55
|
+
* Compute an authentication witness message hash from an intent and metadata. This is just
|
|
56
|
+
* a wrapper around computeAuthwitMessageHash that allows receiving an already computed messageHash as input
|
|
57
|
+
* @param messageHashOrIntent - The precomputed messageHash or intent to approve (consumer and innerHash or caller and call/action)
|
|
58
|
+
* @param metadata - The metadata for the intent (chainId, version)
|
|
59
|
+
* @returns The message hash for the intent
|
|
60
|
+
*/
|
|
61
|
+
export declare function getMessageHashFromIntent(messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent, chainInfo: ChainInfo): Promise<Fr>;
|
|
62
|
+
/**
|
|
63
|
+
* Computes the inner authwitness hash for either a function call or an action, for it to later be combined with the metadata
|
|
50
64
|
* required for the outer hash and eventually the full AuthWitness.
|
|
51
65
|
* @param caller - Who is going to be calling the function
|
|
52
|
-
* @param
|
|
53
|
-
* @returns The inner hash for the function call
|
|
54
|
-
**/
|
|
55
|
-
export declare const computeInnerAuthWitHashFromFunctionCall: (caller: AztecAddress, fnCall: FunctionCall) => Promise<Fr>;
|
|
56
|
-
/**
|
|
57
|
-
* Computes the inner authwitness hash for an action, that can either be a ContractFunctionInteraction
|
|
58
|
-
* or an isolated FunctionCall. Since the former is just a wrapper around the latter, we can just extract
|
|
59
|
-
* the first (and only) call from the ContractFunctionInteraction and use it to compute the inner hash.
|
|
60
|
-
* @param caller - Who is going to be performing the action
|
|
61
|
-
* @param action - The ContractFunctionInteraction or FunctionCall to compute the inner hash for
|
|
66
|
+
* @param action - The action to compute the inner hash from
|
|
62
67
|
* @returns The inner hash for the action
|
|
63
68
|
**/
|
|
64
|
-
export declare const computeInnerAuthWitHashFromAction: (caller: AztecAddress, action:
|
|
65
|
-
|
|
69
|
+
export declare const computeInnerAuthWitHashFromAction: (caller: AztecAddress, action: ContractFunctionInteraction | FunctionCall) => Promise<Fr>;
|
|
70
|
+
/**
|
|
71
|
+
* Lookup the validity of an authwit in private and public contexts.
|
|
72
|
+
*
|
|
73
|
+
* Uses the chain id and version of the wallet.
|
|
74
|
+
*
|
|
75
|
+
* @param wallet - The wallet use to simulate and read the public data
|
|
76
|
+
* @param onBehalfOf - The address of the "approver"
|
|
77
|
+
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
78
|
+
* @param witness - The computed authentication witness to check
|
|
79
|
+
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
80
|
+
*/
|
|
81
|
+
export declare function lookupValidity(wallet: Wallet, onBehalfOf: AztecAddress, intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent, witness: AuthWitness): Promise<{
|
|
82
|
+
/** boolean flag indicating if the authwit is valid in private context */
|
|
83
|
+
isValidInPrivate: boolean;
|
|
84
|
+
/** boolean flag indicating if the authwit is valid in public context */
|
|
85
|
+
isValidInPublic: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Convenience class designed to wrap the very common interaction of setting a public authwit in the AuthRegistry contract
|
|
89
|
+
*/
|
|
90
|
+
export declare class SetPublicAuthwitContractInteraction extends ContractFunctionInteraction {
|
|
91
|
+
private from;
|
|
92
|
+
private constructor();
|
|
93
|
+
static create(wallet: Wallet, from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent, authorized: boolean): Promise<SetPublicAuthwitContractInteraction>;
|
|
94
|
+
/**
|
|
95
|
+
* Overrides the simulate method, adding the sender of the authwit (authorizer) as from
|
|
96
|
+
* and preventing misuse
|
|
97
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
98
|
+
* @returns The result of the transaction as returned by the contract function.
|
|
99
|
+
*/
|
|
100
|
+
simulate<T extends SimulateInteractionOptions>(options: Omit<T, 'from'>): Promise<SimulationReturn<T['includeMetadata']>>;
|
|
101
|
+
/**
|
|
102
|
+
* Overrides the profile method, adding the sender of the authwit (authorizer) as from
|
|
103
|
+
* and preventing misuse
|
|
104
|
+
* @param options - Same options as `simulate`, plus profiling method
|
|
105
|
+
* @returns An object containing the function return value and profile result.
|
|
106
|
+
*/
|
|
107
|
+
profile(options?: Omit<ProfileInteractionOptions, 'from'>): Promise<TxProfileResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Overrides the send method, adding the sender of the authwit (authorizer) as from
|
|
110
|
+
* and preventing misuse
|
|
111
|
+
* @param options - An optional object containing 'fee' options information
|
|
112
|
+
* @returns A SentTx instance for tracking the transaction status and information.
|
|
113
|
+
*/
|
|
114
|
+
send(options?: Omit<SendInteractionOptions, 'from'>): SentTx;
|
|
115
|
+
private static getSetAuthorizedAbi;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aHdpdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2F1dGh3aXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDL0QsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELE9BQU8sRUFBaUQsS0FBSyxZQUFZLEVBQWdCLE1BQU0sbUJBQW1CLENBQUM7QUFDbkgsT0FBTyxFQUFFLFdBQVcsRUFBb0QsTUFBTSw0QkFBNEIsQ0FBQztBQUMzRyxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUV4RCxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSw4Q0FBOEMsQ0FBQztBQUMzRixPQUFPLEtBQUssRUFDVix5QkFBeUIsRUFDekIsc0JBQXNCLEVBQ3RCLDBCQUEwQixFQUMxQixnQkFBZ0IsRUFDakIsTUFBTSxvQ0FBb0MsQ0FBQztBQUM1QyxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxNQUFN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BAAmB;CAuBnC"}
|
package/dest/utils/authwit.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
+
import { FunctionType } from '@aztec/stdlib/abi';
|
|
2
4
|
import { computeInnerAuthWitHash, computeOuterAuthWitHash } from '@aztec/stdlib/auth-witness';
|
|
3
5
|
import { computeVarArgsHash } from '@aztec/stdlib/hash';
|
|
4
6
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
5
|
-
|
|
7
|
+
/** Identifies ContractFunctionInteractionCallIntents */ function isContractFunctionIntractionCallIntent(messageHashOrIntent) {
|
|
8
|
+
return 'caller' in messageHashOrIntent && 'action' in messageHashOrIntent && messageHashOrIntent.action instanceof ContractFunctionInteraction;
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Compute an authentication witness message hash from an intent and metadata
|
|
8
12
|
*
|
|
@@ -13,7 +17,7 @@ import { ContractFunctionInteraction } from '../contract/contract_function_inter
|
|
|
13
17
|
* and use it for the authentication check.
|
|
14
18
|
* Therefore, any allowed `innerHash` will therefore also have information around where it can be spent (version, chainId) and who can spend it (consumer).
|
|
15
19
|
*
|
|
16
|
-
* If using the `
|
|
20
|
+
* If using the `CallIntent`, the caller is the address that is making the call, for a token approval from Alice to Bob, this would be Bob.
|
|
17
21
|
* The action is then used along with the `caller` to compute the `innerHash` and the consumer.
|
|
18
22
|
*
|
|
19
23
|
*
|
|
@@ -27,39 +31,241 @@ import { ContractFunctionInteraction } from '../contract/contract_function_inter
|
|
|
27
31
|
const chainId = metadata.chainId;
|
|
28
32
|
const version = metadata.version;
|
|
29
33
|
if ('caller' in intent) {
|
|
30
|
-
const
|
|
31
|
-
return computeOuterAuthWitHash(
|
|
34
|
+
const call = isContractFunctionIntractionCallIntent(intent) ? await intent.action.getFunctionCall() : intent.call;
|
|
35
|
+
return computeOuterAuthWitHash(call.to, chainId, version, await computeInnerAuthWitHashFromAction(intent.caller, call));
|
|
32
36
|
} else {
|
|
33
37
|
const inner = Buffer.isBuffer(intent.innerHash) ? Fr.fromBuffer(intent.innerHash) : intent.innerHash;
|
|
34
38
|
return computeOuterAuthWitHash(intent.consumer, chainId, version, inner);
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
|
-
// docs:end:authwit_computeAuthWitMessageHash
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
42
|
+
* Compute an authentication witness message hash from an intent and metadata. This is just
|
|
43
|
+
* a wrapper around computeAuthwitMessageHash that allows receiving an already computed messageHash as input
|
|
44
|
+
* @param messageHashOrIntent - The precomputed messageHash or intent to approve (consumer and innerHash or caller and call/action)
|
|
45
|
+
* @param metadata - The metadata for the intent (chainId, version)
|
|
46
|
+
* @returns The message hash for the intent
|
|
47
|
+
*/ export async function getMessageHashFromIntent(messageHashOrIntent, chainInfo) {
|
|
48
|
+
let messageHash;
|
|
49
|
+
const { chainId, version } = chainInfo;
|
|
50
|
+
if (messageHashOrIntent instanceof Fr) {
|
|
51
|
+
messageHash = messageHashOrIntent;
|
|
52
|
+
} else {
|
|
53
|
+
messageHash = await computeAuthWitMessageHash(messageHashOrIntent, {
|
|
54
|
+
chainId,
|
|
55
|
+
version
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return messageHash;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Computes the inner authwitness hash for either a function call or an action, for it to later be combined with the metadata
|
|
40
62
|
* required for the outer hash and eventually the full AuthWitness.
|
|
41
63
|
* @param caller - Who is going to be calling the function
|
|
42
|
-
* @param
|
|
43
|
-
* @returns The inner hash for the function call
|
|
44
|
-
**/ export const computeInnerAuthWitHashFromFunctionCall = async (caller, fnCall)=>{
|
|
45
|
-
return computeInnerAuthWitHash([
|
|
46
|
-
caller.toField(),
|
|
47
|
-
fnCall.selector.toField(),
|
|
48
|
-
await computeVarArgsHash(fnCall.args)
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Computes the inner authwitness hash for an action, that can either be a ContractFunctionInteraction
|
|
53
|
-
* or an isolated FunctionCall. Since the former is just a wrapper around the latter, we can just extract
|
|
54
|
-
* the first (and only) call from the ContractFunctionInteraction and use it to compute the inner hash.
|
|
55
|
-
* @param caller - Who is going to be performing the action
|
|
56
|
-
* @param action - The ContractFunctionInteraction or FunctionCall to compute the inner hash for
|
|
64
|
+
* @param action - The action to compute the inner hash from
|
|
57
65
|
* @returns The inner hash for the action
|
|
58
66
|
**/ export const computeInnerAuthWitHashFromAction = async (caller, action)=>{
|
|
59
|
-
|
|
67
|
+
const call = action instanceof ContractFunctionInteraction ? await action.getFunctionCall() : action;
|
|
60
68
|
return computeInnerAuthWitHash([
|
|
61
69
|
caller.toField(),
|
|
62
|
-
|
|
63
|
-
await computeVarArgsHash(
|
|
70
|
+
call.selector.toField(),
|
|
71
|
+
await computeVarArgsHash(call.args)
|
|
64
72
|
]);
|
|
65
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Lookup the validity of an authwit in private and public contexts.
|
|
76
|
+
*
|
|
77
|
+
* Uses the chain id and version of the wallet.
|
|
78
|
+
*
|
|
79
|
+
* @param wallet - The wallet use to simulate and read the public data
|
|
80
|
+
* @param onBehalfOf - The address of the "approver"
|
|
81
|
+
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
82
|
+
* @param witness - The computed authentication witness to check
|
|
83
|
+
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
84
|
+
*/ export async function lookupValidity(wallet, onBehalfOf, intent, witness) {
|
|
85
|
+
let innerHash, consumer;
|
|
86
|
+
if ('caller' in intent) {
|
|
87
|
+
const call = isContractFunctionIntractionCallIntent(intent) ? await intent.action.getFunctionCall() : intent.call;
|
|
88
|
+
innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
|
|
89
|
+
consumer = call.to;
|
|
90
|
+
} else {
|
|
91
|
+
({ innerHash, consumer } = intent);
|
|
92
|
+
}
|
|
93
|
+
const chainInfo = await wallet.getChainInfo();
|
|
94
|
+
const messageHash = await getMessageHashFromIntent(intent, chainInfo);
|
|
95
|
+
const results = {
|
|
96
|
+
isValidInPrivate: false,
|
|
97
|
+
isValidInPublic: false
|
|
98
|
+
};
|
|
99
|
+
// Check private
|
|
100
|
+
const lookupValidityAbi = {
|
|
101
|
+
name: 'lookup_validity',
|
|
102
|
+
isInitializer: false,
|
|
103
|
+
functionType: FunctionType.UTILITY,
|
|
104
|
+
isOnlySelf: false,
|
|
105
|
+
isStatic: false,
|
|
106
|
+
parameters: [
|
|
107
|
+
{
|
|
108
|
+
name: 'consumer',
|
|
109
|
+
type: {
|
|
110
|
+
fields: [
|
|
111
|
+
{
|
|
112
|
+
name: 'inner',
|
|
113
|
+
type: {
|
|
114
|
+
kind: 'field'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
kind: 'struct',
|
|
119
|
+
path: 'aztec::protocol_types::address::aztec_address::AztecAddress'
|
|
120
|
+
},
|
|
121
|
+
visibility: 'private'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'inner_hash',
|
|
125
|
+
type: {
|
|
126
|
+
kind: 'field'
|
|
127
|
+
},
|
|
128
|
+
visibility: 'private'
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
returnTypes: [
|
|
132
|
+
{
|
|
133
|
+
kind: 'boolean'
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
errorTypes: {}
|
|
137
|
+
};
|
|
138
|
+
try {
|
|
139
|
+
results.isValidInPrivate = await new ContractFunctionInteraction(wallet, onBehalfOf, lookupValidityAbi, [
|
|
140
|
+
consumer,
|
|
141
|
+
innerHash
|
|
142
|
+
]).simulate({
|
|
143
|
+
from: onBehalfOf,
|
|
144
|
+
authWitnesses: [
|
|
145
|
+
witness
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
// TODO: Narrow down the error to make sure simulation failed due to an invalid authwit
|
|
149
|
+
// eslint-disable-next-line no-empty
|
|
150
|
+
} catch {}
|
|
151
|
+
// check public
|
|
152
|
+
const isConsumableAbi = {
|
|
153
|
+
name: 'utility_is_consumable',
|
|
154
|
+
isInitializer: false,
|
|
155
|
+
functionType: FunctionType.UTILITY,
|
|
156
|
+
isOnlySelf: false,
|
|
157
|
+
isStatic: false,
|
|
158
|
+
parameters: [
|
|
159
|
+
{
|
|
160
|
+
name: 'address',
|
|
161
|
+
type: {
|
|
162
|
+
fields: [
|
|
163
|
+
{
|
|
164
|
+
name: 'inner',
|
|
165
|
+
type: {
|
|
166
|
+
kind: 'field'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
kind: 'struct',
|
|
171
|
+
path: 'authwit::aztec::protocol_types::address::aztec_address::AztecAddress'
|
|
172
|
+
},
|
|
173
|
+
visibility: 'private'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'message_hash',
|
|
177
|
+
type: {
|
|
178
|
+
kind: 'field'
|
|
179
|
+
},
|
|
180
|
+
visibility: 'private'
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
returnTypes: [
|
|
184
|
+
{
|
|
185
|
+
kind: 'boolean'
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
errorTypes: {}
|
|
189
|
+
};
|
|
190
|
+
results.isValidInPublic = await new ContractFunctionInteraction(wallet, ProtocolContractAddress.AuthRegistry, isConsumableAbi, [
|
|
191
|
+
onBehalfOf,
|
|
192
|
+
messageHash
|
|
193
|
+
]).simulate({
|
|
194
|
+
from: onBehalfOf
|
|
195
|
+
});
|
|
196
|
+
return results;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Convenience class designed to wrap the very common interaction of setting a public authwit in the AuthRegistry contract
|
|
200
|
+
*/ export class SetPublicAuthwitContractInteraction extends ContractFunctionInteraction {
|
|
201
|
+
from;
|
|
202
|
+
constructor(wallet, from, messageHash, authorized){
|
|
203
|
+
super(wallet, ProtocolContractAddress.AuthRegistry, SetPublicAuthwitContractInteraction.getSetAuthorizedAbi(), [
|
|
204
|
+
messageHash,
|
|
205
|
+
authorized
|
|
206
|
+
]), this.from = from;
|
|
207
|
+
}
|
|
208
|
+
static async create(wallet, from, messageHashOrIntent, authorized) {
|
|
209
|
+
const chainInfo = await wallet.getChainInfo();
|
|
210
|
+
const messageHash = await getMessageHashFromIntent(messageHashOrIntent, chainInfo);
|
|
211
|
+
return new SetPublicAuthwitContractInteraction(wallet, from, messageHash, authorized);
|
|
212
|
+
}
|
|
213
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
214
|
+
simulate(options = {}) {
|
|
215
|
+
return super.simulate({
|
|
216
|
+
...options,
|
|
217
|
+
from: this.from
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Overrides the profile method, adding the sender of the authwit (authorizer) as from
|
|
222
|
+
* and preventing misuse
|
|
223
|
+
* @param options - Same options as `simulate`, plus profiling method
|
|
224
|
+
* @returns An object containing the function return value and profile result.
|
|
225
|
+
*/ profile(options = {
|
|
226
|
+
profileMode: 'gates'
|
|
227
|
+
}) {
|
|
228
|
+
return super.profile({
|
|
229
|
+
...options,
|
|
230
|
+
from: this.from
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Overrides the send method, adding the sender of the authwit (authorizer) as from
|
|
235
|
+
* and preventing misuse
|
|
236
|
+
* @param options - An optional object containing 'fee' options information
|
|
237
|
+
* @returns A SentTx instance for tracking the transaction status and information.
|
|
238
|
+
*/ send(options = {}) {
|
|
239
|
+
return super.send({
|
|
240
|
+
...options,
|
|
241
|
+
from: this.from
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
static getSetAuthorizedAbi() {
|
|
245
|
+
return {
|
|
246
|
+
name: 'set_authorized',
|
|
247
|
+
isInitializer: false,
|
|
248
|
+
functionType: FunctionType.PUBLIC,
|
|
249
|
+
isOnlySelf: true,
|
|
250
|
+
isStatic: false,
|
|
251
|
+
parameters: [
|
|
252
|
+
{
|
|
253
|
+
name: 'message_hash',
|
|
254
|
+
type: {
|
|
255
|
+
kind: 'field'
|
|
256
|
+
},
|
|
257
|
+
visibility: 'private'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: 'authorize',
|
|
261
|
+
type: {
|
|
262
|
+
kind: 'boolean'
|
|
263
|
+
},
|
|
264
|
+
visibility: 'private'
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
returnTypes: [],
|
|
268
|
+
errorTypes: {}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|