@aztec/aztec.js 0.81.0 → 0.82.1-alpha-testnet.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/dest/account/{contract.d.ts → account_contract.d.ts} +3 -2
- package/dest/account/account_contract.d.ts.map +1 -0
- package/dest/account/index.d.ts +2 -3
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +1 -2
- package/dest/account/interface.d.ts +1 -13
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -0
- package/dest/account_manager/account_manager.d.ts +106 -0
- package/dest/account_manager/account_manager.d.ts.map +1 -0
- package/dest/account_manager/account_manager.js +216 -0
- package/dest/account_manager/deploy_account_sent_tx.d.ts +3 -3
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_sent_tx.js +2 -2
- package/dest/account_manager/index.d.ts +1 -105
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +1 -166
- package/dest/api/account.d.ts +2 -1
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/contract.d.ts +4 -1
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +3 -0
- package/dest/api/fee.d.ts +2 -1
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +1 -0
- 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/utils.d.ts +2 -1
- package/dest/api/utils.d.ts.map +1 -1
- package/dest/api/utils.js +2 -1
- package/dest/api/wallet.d.ts +1 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +22 -57
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +12 -67
- package/dest/contract/batch_call.d.ts +6 -18
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +25 -54
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract_base.d.ts +1 -1
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.d.ts +38 -18
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +34 -41
- package/dest/contract/deploy_method.d.ts +7 -8
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +27 -32
- package/dest/contract/deploy_proven_tx.d.ts +2 -3
- package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
- package/dest/contract/deploy_proven_tx.js +1 -1
- package/dest/contract/deploy_sent_tx.d.ts +2 -3
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +4 -4
- package/dest/contract/protocol_contracts.d.ts +1 -1
- package/dest/contract/protocol_contracts.d.ts.map +1 -1
- package/dest/contract/proven_tx.d.ts +3 -5
- package/dest/contract/proven_tx.d.ts.map +1 -1
- package/dest/contract/proven_tx.js +2 -6
- package/dest/contract/sent_tx.d.ts +4 -16
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +6 -37
- package/dest/contract/unsafe_contract.d.ts +1 -1
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.d.ts +17 -0
- package/dest/contract/wait_for_proven.d.ts.map +1 -0
- package/dest/contract/wait_for_proven.js +17 -0
- package/dest/deployment/broadcast_function.js +12 -8
- package/dest/deployment/contract_deployer.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/register_class.d.ts +1 -1
- package/dest/deployment/register_class.d.ts.map +1 -1
- package/dest/deployment/register_class.js +6 -11
- package/dest/ethereum/portal_manager.d.ts +20 -11
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +64 -30
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts +31 -0
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/fee/account_entrypoint_meta_payment_method.js +64 -0
- package/dest/fee/fee_juice_payment_method.d.ts +3 -3
- package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method.js +3 -2
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +4 -4
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +6 -5
- package/dest/fee/private_fee_payment_method.d.ts +6 -6
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +13 -12
- package/dest/fee/public_fee_payment_method.d.ts +7 -7
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +10 -11
- package/dest/fee/sponsored_fee_payment.d.ts +15 -0
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
- package/dest/fee/sponsored_fee_payment.js +30 -0
- package/dest/fee/utils.d.ts +13 -0
- package/dest/fee/utils.d.ts.map +1 -0
- package/dest/fee/utils.js +32 -0
- package/dest/utils/authwit.d.ts +16 -9
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +27 -36
- package/dest/wallet/account_wallet.d.ts +6 -6
- package/dest/wallet/account_wallet.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +15 -17
- package/dest/wallet/base_wallet.d.ts +12 -35
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +11 -64
- package/dest/wallet/index.d.ts +2 -2
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +1 -1
- package/dest/wallet/signerless_wallet.d.ts +3 -3
- package/dest/wallet/signerless_wallet.d.ts.map +1 -1
- package/dest/wallet/signerless_wallet.js +3 -6
- package/dest/wallet/wallet.d.ts +11 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/package.json +10 -8
- package/src/account/{contract.ts → account_contract.ts} +2 -1
- package/src/account/index.ts +2 -3
- package/src/account/interface.ts +1 -12
- package/src/account_manager/account_manager.ts +294 -0
- package/src/account_manager/deploy_account_sent_tx.ts +4 -4
- package/src/account_manager/index.ts +1 -237
- package/src/api/account.ts +2 -8
- package/src/api/contract.ts +5 -5
- package/src/api/fee.ts +2 -1
- package/src/api/fee_testing.ts +1 -0
- package/src/api/utils.ts +1 -1
- package/src/api/wallet.ts +7 -1
- package/src/contract/base_contract_interaction.ts +32 -88
- package/src/contract/batch_call.ts +40 -43
- package/src/contract/contract.ts +1 -1
- package/src/contract/contract_base.ts +1 -1
- package/src/contract/contract_function_interaction.ts +85 -56
- package/src/contract/deploy_method.ts +24 -26
- package/src/contract/deploy_proven_tx.ts +3 -4
- package/src/contract/deploy_sent_tx.ts +6 -6
- package/src/contract/protocol_contracts.ts +1 -1
- package/src/contract/proven_tx.ts +4 -22
- package/src/contract/sent_tx.ts +6 -47
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/contract/wait_for_proven.ts +38 -0
- package/src/deployment/broadcast_function.ts +40 -40
- package/src/deployment/contract_deployer.ts +1 -1
- package/src/deployment/register_class.ts +9 -22
- package/src/ethereum/portal_manager.ts +73 -24
- package/src/fee/account_entrypoint_meta_payment_method.ts +90 -0
- package/src/fee/fee_juice_payment_method.ts +4 -5
- package/src/fee/fee_juice_payment_method_with_claim.ts +24 -20
- package/src/fee/private_fee_payment_method.ts +29 -28
- package/src/fee/public_fee_payment_method.ts +29 -29
- package/src/fee/sponsored_fee_payment.ts +38 -0
- package/src/fee/utils.ts +39 -0
- package/src/utils/authwit.ts +26 -37
- package/src/wallet/account_wallet.ts +18 -17
- package/src/wallet/base_wallet.ts +27 -88
- package/src/wallet/index.ts +2 -2
- package/src/wallet/signerless_wallet.ts +9 -8
- package/src/wallet/wallet.ts +34 -0
- package/dest/account/contract.d.ts.map +0 -1
- package/dest/account/wallet.d.ts +0 -11
- package/dest/account/wallet.d.ts.map +0 -1
- package/dest/account_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 -36
- 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/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 -39
- package/dest/entrypoint/entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/entrypoint.js +0 -20
- 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_payment_method.d.ts +0 -22
- package/dest/fee/fee_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_payment_method.js +0 -3
- package/src/account/wallet.ts +0 -13
- package/src/account_manager/deploy_account_method.ts +0 -67
- package/src/api/entrypoint.ts +0 -1
- package/src/entrypoint/default_entrypoint.ts +0 -39
- package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
- package/src/entrypoint/entrypoint.ts +0 -60
- package/src/entrypoint/payload.ts +0 -238
- package/src/fee/fee_payment_method.ts +0 -22
- /package/dest/account/{contract.js → account_contract.js} +0 -0
- /package/dest/{account → wallet}/wallet.js +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
|
+
/**
|
|
4
|
+
* A fee payment method that uses a contract that blindly sponsors transactions.
|
|
5
|
+
* This contract is expected to be prefunded in testing environments.
|
|
6
|
+
*/ export class SponsoredFeePaymentMethod {
|
|
7
|
+
paymentContract;
|
|
8
|
+
constructor(paymentContract){
|
|
9
|
+
this.paymentContract = paymentContract;
|
|
10
|
+
}
|
|
11
|
+
getAsset() {
|
|
12
|
+
throw new Error('Asset is not required for sponsored fpc.');
|
|
13
|
+
}
|
|
14
|
+
getFeePayer() {
|
|
15
|
+
return Promise.resolve(this.paymentContract);
|
|
16
|
+
}
|
|
17
|
+
async getExecutionPayload() {
|
|
18
|
+
return new ExecutionPayload([
|
|
19
|
+
{
|
|
20
|
+
name: 'sponsor_unconditionally',
|
|
21
|
+
to: this.paymentContract,
|
|
22
|
+
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
23
|
+
type: FunctionType.PRIVATE,
|
|
24
|
+
isStatic: false,
|
|
25
|
+
args: [],
|
|
26
|
+
returnTypes: []
|
|
27
|
+
}
|
|
28
|
+
], [], []);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FunctionAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { Wallet } from '../wallet/wallet.js';
|
|
4
|
+
/**
|
|
5
|
+
* Use a wallet to simulate a function avoiding the wallet's entrypoint, as a SignerlessWallet would do
|
|
6
|
+
* @param wallet - The wallet to use for the simulation.
|
|
7
|
+
* @param contractAddress - The address of the contract to call.
|
|
8
|
+
* @param abi - The ABI of the function to simulate.
|
|
9
|
+
* @param args - The arguments to pass to the function.
|
|
10
|
+
* @returns The return values of the function call.
|
|
11
|
+
*/
|
|
12
|
+
export declare function simulateWithoutSignature(wallet: Wallet, contractAddress: AztecAddress, abi: FunctionAbi, args: any[]): Promise<import("@aztec/stdlib/abi").AbiDecoded>;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fee/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,GAAG,EAAE,mDAiBZ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
2
|
+
import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
5
|
+
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
6
|
+
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
7
|
+
/**
|
|
8
|
+
* Use a wallet to simulate a function avoiding the wallet's entrypoint, as a SignerlessWallet would do
|
|
9
|
+
* @param wallet - The wallet to use for the simulation.
|
|
10
|
+
* @param contractAddress - The address of the contract to call.
|
|
11
|
+
* @param abi - The ABI of the function to simulate.
|
|
12
|
+
* @param args - The arguments to pass to the function.
|
|
13
|
+
* @returns The return values of the function call.
|
|
14
|
+
*/ export async function simulateWithoutSignature(wallet, contractAddress, abi, args) {
|
|
15
|
+
const interaction = new ContractFunctionInteraction(wallet, contractAddress, abi, args);
|
|
16
|
+
const request = await interaction.request();
|
|
17
|
+
const maxFeesPerGas = (await wallet.getCurrentBaseFees()).mul(1.5);
|
|
18
|
+
const paymentMethod = new FeeJuicePaymentMethod(AztecAddress.ZERO);
|
|
19
|
+
const gasSettings = GasSettings.default({
|
|
20
|
+
maxFeesPerGas
|
|
21
|
+
});
|
|
22
|
+
const fee = {
|
|
23
|
+
gasSettings,
|
|
24
|
+
paymentMethod
|
|
25
|
+
};
|
|
26
|
+
const { l1ChainId: chainId, protocolVersion } = await wallet.getNodeInfo();
|
|
27
|
+
const entrypoint = new DefaultEntrypoint(chainId, protocolVersion);
|
|
28
|
+
const signerlessTxExecutionRequest = await entrypoint.createTxExecutionRequest(request, fee, {});
|
|
29
|
+
const simulationResult = await wallet.simulateTx(signerlessTxExecutionRequest, false, undefined, undefined, true);
|
|
30
|
+
const rawReturnValues = simulationResult.getPrivateReturnValues().values;
|
|
31
|
+
return decodeFromAbi(abi.returnTypes, rawReturnValues);
|
|
32
|
+
}
|
package/dest/utils/authwit.d.ts
CHANGED
|
@@ -47,14 +47,21 @@ export type IntentAction = {
|
|
|
47
47
|
* @returns The message hash for the action
|
|
48
48
|
*/
|
|
49
49
|
export declare const computeAuthWitMessageHash: (intent: IntentInnerHash | IntentAction, metadata: IntentMetadata) => Promise<Fr>;
|
|
50
|
-
export declare const computeInnerAuthWitHashFromAction: (caller: AztecAddress, action: FunctionCall) => Promise<Fr>;
|
|
51
50
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
* Computes the inner authwitness hash for a function call, for it to later be combined with the metadata
|
|
52
|
+
* required for the outer hash and eventually the full AuthWitness.
|
|
53
|
+
* @param caller - Who is going to be calling the function
|
|
54
|
+
* @param fnCall - The function call to compute the inner hash from
|
|
55
|
+
* @returns The inner hash for the function call
|
|
56
|
+
**/
|
|
57
|
+
export declare const computeInnerAuthWitHashFromFunctionCall: (caller: AztecAddress, fnCall: FunctionCall) => Promise<Fr>;
|
|
58
|
+
/**
|
|
59
|
+
* Computes the inner authwitness hash for an action, that can either be a ContractFunctionInteraction
|
|
60
|
+
* or an isolated FunctionCall. Since the former is just a wrapper around the latter, we can just extract
|
|
61
|
+
* the first (and only) call from the ContractFunctionInteraction and use it to compute the inner hash.
|
|
62
|
+
* @param caller - Who is going to be performing the action
|
|
63
|
+
* @param action - The ContractFunctionInteraction or FunctionCall to compute the inner hash for
|
|
64
|
+
* @returns The inner hash for the action
|
|
65
|
+
**/
|
|
66
|
+
export declare const computeInnerAuthWitHashFromAction: (caller: AztecAddress, action: FunctionCall | ContractFunctionInteraction) => Promise<Fr>;
|
|
60
67
|
//# sourceMappingURL=authwit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authwit.d.ts","sourceRoot":"","sources":["../../src/utils/authwit.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"authwit.d.ts","sourceRoot":"","sources":["../../src/utils/authwit.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE3F,8BAA8B;AAC9B,MAAM,MAAM,cAAc,GAAG;IAC3B,8BAA8B;IAC9B,OAAO,EAAE,EAAE,CAAC;IACZ,8BAA8B;IAC9B,OAAO,EAAE,EAAE,CAAC;CACb,CAAC;AAEF,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG;IAC5B,qBAAqB;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,GAAG,EAAE,CAAC;CACxB,CAAC;AAEF,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GAAG;IACzB,6BAA6B;IAC7B,MAAM,EAAE,YAAY,CAAC;IACrB,4BAA4B;IAC5B,MAAM,EAAE,2BAA2B,GAAG,YAAY,CAAC;CACpD,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yBAAyB,WAAkB,eAAe,GAAG,YAAY,YAAY,cAAc,gBAiB/G,CAAC;AAGF;;;;;;IAMI;AACJ,eAAO,MAAM,uCAAuC,WAAkB,YAAY,UAAU,YAAY,gBAEvG,CAAC;AAEF;;;;;;;IAOI;AACJ,eAAO,MAAM,iCAAiC,WACpC,YAAY,UACZ,YAAY,GAAG,2BAA2B,gBAInD,CAAC"}
|
package/dest/utils/authwit.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
-
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import {
|
|
2
|
+
import { computeInnerAuthWitHash, computeOuterAuthWitHash } from '@aztec/stdlib/auth-witness';
|
|
3
|
+
import { computeVarArgsHash } from '@aztec/stdlib/hash';
|
|
5
4
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
6
5
|
// docs:start:authwit_computeAuthWitMessageHash
|
|
7
6
|
/**
|
|
@@ -28,47 +27,39 @@ import { ContractFunctionInteraction } from '../contract/contract_function_inter
|
|
|
28
27
|
const chainId = metadata.chainId;
|
|
29
28
|
const version = metadata.version;
|
|
30
29
|
if ('caller' in intent) {
|
|
31
|
-
const
|
|
32
|
-
return computeOuterAuthWitHash(
|
|
30
|
+
const fnCall = intent.action instanceof ContractFunctionInteraction ? (await intent.action.request()).calls[0] : intent.action;
|
|
31
|
+
return computeOuterAuthWitHash(fnCall.to, chainId, version, await computeInnerAuthWitHashFromFunctionCall(intent.caller, fnCall));
|
|
33
32
|
} else {
|
|
34
33
|
const inner = Buffer.isBuffer(intent.innerHash) ? Fr.fromBuffer(intent.innerHash) : intent.innerHash;
|
|
35
34
|
return computeOuterAuthWitHash(intent.consumer, chainId, version, inner);
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
// docs:end:authwit_computeAuthWitMessageHash
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Computes the inner authwitness hash for a function call, for it to later be combined with the metadata
|
|
40
|
+
* required for the outer hash and eventually the full AuthWitness.
|
|
41
|
+
* @param caller - Who is going to be calling the function
|
|
42
|
+
* @param fnCall - The function call to compute the inner hash from
|
|
43
|
+
* @returns The inner hash for the function call
|
|
44
|
+
**/ export const computeInnerAuthWitHashFromFunctionCall = async (caller, fnCall)=>{
|
|
45
|
+
return computeInnerAuthWitHash([
|
|
40
46
|
caller.toField(),
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
fnCall.selector.toField(),
|
|
48
|
+
await computeVarArgsHash(fnCall.args)
|
|
43
49
|
]);
|
|
44
|
-
/**
|
|
45
|
-
* Compute the inner hash for an authentication witness.
|
|
46
|
-
* This is the "intent" of the message, before siloed with the consumer.
|
|
47
|
-
* It is used as part of the `computeAuthWitMessageHash` but can also be used
|
|
48
|
-
* in case the message is not a "call" to a function, but arbitrary data.
|
|
49
|
-
* @param args - The arguments to hash
|
|
50
|
-
* @returns The inner hash for the witness
|
|
51
|
-
*/ export const computeInnerAuthWitHash = (args)=>{
|
|
52
|
-
return poseidon2HashWithSeparator(args, GeneratorIndex.AUTHWIT_INNER);
|
|
53
50
|
};
|
|
54
51
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return poseidon2HashWithSeparator([
|
|
69
|
-
consumer.toField(),
|
|
70
|
-
chainId,
|
|
71
|
-
version,
|
|
72
|
-
innerHash
|
|
73
|
-
], GeneratorIndex.AUTHWIT_OUTER);
|
|
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
|
|
57
|
+
* @returns The inner hash for the action
|
|
58
|
+
**/ export const computeInnerAuthWitHashFromAction = async (caller, action)=>{
|
|
59
|
+
action = action instanceof ContractFunctionInteraction ? (await action.request()).calls[0] : action;
|
|
60
|
+
return computeInnerAuthWitHash([
|
|
61
|
+
caller.toField(),
|
|
62
|
+
action.selector.toField(),
|
|
63
|
+
await computeVarArgsHash(action.args)
|
|
64
|
+
]);
|
|
74
65
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
4
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import
|
|
6
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
8
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
7
9
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
10
|
import type { AccountInterface } from '../account/interface.js';
|
|
9
11
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
10
|
-
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
11
12
|
import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js';
|
|
12
13
|
import { BaseWallet } from './base_wallet.js';
|
|
13
14
|
/**
|
|
@@ -16,10 +17,9 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
16
17
|
export declare class AccountWallet extends BaseWallet {
|
|
17
18
|
protected account: AccountInterface;
|
|
18
19
|
constructor(pxe: PXE, account: AccountInterface);
|
|
19
|
-
createTxExecutionRequest(exec:
|
|
20
|
+
createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
|
|
20
21
|
getChainId(): Fr;
|
|
21
22
|
getVersion(): Fr;
|
|
22
|
-
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
23
23
|
/**
|
|
24
24
|
* Computes an authentication witness from either a message hash or an intent.
|
|
25
25
|
*
|
|
@@ -56,10 +56,10 @@ export declare class AccountWallet extends BaseWallet {
|
|
|
56
56
|
*
|
|
57
57
|
* @param onBehalfOf - The address of the "approver"
|
|
58
58
|
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
59
|
-
*
|
|
59
|
+
* @param witness - The computed authentication witness to check
|
|
60
60
|
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
61
61
|
*/
|
|
62
|
-
lookupValidity(onBehalfOf: AztecAddress, intent: IntentInnerHash | IntentAction): Promise<{
|
|
62
|
+
lookupValidity(onBehalfOf: AztecAddress, intent: IntentInnerHash | IntentAction, witness: AuthWitness): Promise<{
|
|
63
63
|
/** boolean flag indicating if the authwit is valid in private context */
|
|
64
64
|
isValidInPrivate: boolean;
|
|
65
65
|
/** boolean flag indicating if the authwit is valid in public context */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/account_wallet.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,
|
|
1
|
+
{"version":3,"file":"account_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/account_wallet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,WAAW,EA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AAyE;QACzE,gBAAgB,EAAE,OAAO,CAAC;QAC1B,wEAAwE;QACxE,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IA2BF,+EAA+E;IACxE,kBAAkB;IAIzB,sEAAsE;IACtD,UAAU;IAI1B,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,kBAAkB;CAuB3B"}
|
|
@@ -9,12 +9,10 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
9
9
|
*/ export class AccountWallet extends BaseWallet {
|
|
10
10
|
account;
|
|
11
11
|
constructor(pxe, account){
|
|
12
|
-
super(pxe,
|
|
13
|
-
account.getAddress()
|
|
14
|
-
]), this.account = account;
|
|
12
|
+
super(pxe), this.account = account;
|
|
15
13
|
}
|
|
16
|
-
createTxExecutionRequest(exec) {
|
|
17
|
-
return this.account.createTxExecutionRequest(exec);
|
|
14
|
+
createTxExecutionRequest(exec, fee, options) {
|
|
15
|
+
return this.account.createTxExecutionRequest(exec, fee, options);
|
|
18
16
|
}
|
|
19
17
|
getChainId() {
|
|
20
18
|
return this.account.getChainId();
|
|
@@ -22,9 +20,6 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
22
20
|
getVersion() {
|
|
23
21
|
return this.account.getVersion();
|
|
24
22
|
}
|
|
25
|
-
isL1ToL2MessageSynced(l1ToL2Message) {
|
|
26
|
-
return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
|
|
27
|
-
}
|
|
28
23
|
/**
|
|
29
24
|
* Computes an authentication witness from either a message hash or an intent.
|
|
30
25
|
*
|
|
@@ -43,9 +38,7 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
43
38
|
} else {
|
|
44
39
|
messageHash = await this.getMessageHash(messageHashOrIntent);
|
|
45
40
|
}
|
|
46
|
-
|
|
47
|
-
await this.pxe.addAuthWitness(witness);
|
|
48
|
-
return witness;
|
|
41
|
+
return this.account.createAuthWit(messageHash);
|
|
49
42
|
}
|
|
50
43
|
/**
|
|
51
44
|
* Returns a function interaction to set a message hash as authorized or revoked in this account.
|
|
@@ -107,9 +100,9 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
107
100
|
*
|
|
108
101
|
* @param onBehalfOf - The address of the "approver"
|
|
109
102
|
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
110
|
-
*
|
|
103
|
+
* @param witness - The computed authentication witness to check
|
|
111
104
|
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
112
|
-
*/ async lookupValidity(onBehalfOf, intent) {
|
|
105
|
+
*/ async lookupValidity(onBehalfOf, intent, witness) {
|
|
113
106
|
const { innerHash, consumer } = await this.getInnerHashAndConsumer(intent);
|
|
114
107
|
const messageHash = await this.getMessageHash(intent);
|
|
115
108
|
const results = {
|
|
@@ -117,13 +110,18 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
117
110
|
isValidInPublic: false
|
|
118
111
|
};
|
|
119
112
|
// Check private
|
|
120
|
-
|
|
121
|
-
if (witness !== undefined) {
|
|
113
|
+
try {
|
|
122
114
|
results.isValidInPrivate = await new ContractFunctionInteraction(this, onBehalfOf, this.getLookupValidityAbi(), [
|
|
123
115
|
consumer,
|
|
124
116
|
innerHash
|
|
125
|
-
]).simulate(
|
|
126
|
-
|
|
117
|
+
]).simulate({
|
|
118
|
+
authWitnesses: [
|
|
119
|
+
witness
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
// TODO: Narrow down the error to make sure simulation failed due to an invalid authwit
|
|
123
|
+
// eslint-disable-next-line no-empty
|
|
124
|
+
} catch {}
|
|
127
125
|
// check public
|
|
128
126
|
results.isValidInPublic = await new ContractFunctionInteraction(this, ProtocolContractAddress.AuthRegistry, this.getIsConsumableAbi(), [
|
|
129
127
|
onBehalfOf,
|
|
@@ -1,40 +1,29 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import type {
|
|
3
|
+
import type { FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
4
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
4
5
|
import type { Fr, Point } from '@aztec/foundation/fields';
|
|
5
|
-
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
6
6
|
import type { AbiDecoded, ContractArtifact } from '@aztec/stdlib/abi';
|
|
7
7
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
8
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import type {
|
|
10
|
-
import type { CompleteAddress, ContractInstanceWithAddress, NodeInfo, PartialAddress } from '@aztec/stdlib/contract';
|
|
9
|
+
import type { CompleteAddress, ContractInstanceWithAddress, NodeInfo } from '@aztec/stdlib/contract';
|
|
11
10
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
12
|
-
import type { ContractClassMetadata, ContractMetadata, EventMetadataDefinition,
|
|
13
|
-
import type {
|
|
14
|
-
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
15
|
-
import type { PrivateExecutionResult, Tx, TxExecutionRequest, TxHash, TxProvingResult, TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
16
|
-
import type { Wallet } from '../account/wallet.js';
|
|
17
|
-
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
11
|
+
import type { ContractClassMetadata, ContractMetadata, EventMetadataDefinition, PXE, PXEInfo } from '@aztec/stdlib/interfaces/client';
|
|
12
|
+
import type { PrivateExecutionResult, Tx, TxExecutionRequest, TxHash, TxProfileResult, TxProvingResult, TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
18
13
|
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
14
|
+
import type { Wallet } from './wallet.js';
|
|
19
15
|
/**
|
|
20
16
|
* A base class for Wallet implementations
|
|
21
17
|
*/
|
|
22
18
|
export declare abstract class BaseWallet implements Wallet {
|
|
23
19
|
protected readonly pxe: PXE;
|
|
24
|
-
|
|
25
|
-
constructor(pxe: PXE, scopes?: AztecAddress[] | undefined);
|
|
26
|
-
abstract isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
20
|
+
constructor(pxe: PXE);
|
|
27
21
|
abstract getCompleteAddress(): CompleteAddress;
|
|
28
22
|
abstract getChainId(): Fr;
|
|
29
23
|
abstract getVersion(): Fr;
|
|
30
|
-
abstract createTxExecutionRequest(exec:
|
|
24
|
+
abstract createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
|
|
31
25
|
abstract createAuthWit(intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
32
|
-
setScopes(scopes: AztecAddress[]): void;
|
|
33
|
-
getScopes(): AztecAddress[] | undefined;
|
|
34
26
|
getAddress(): AztecAddress;
|
|
35
|
-
storeCapsule(contract: AztecAddress, storageSlot: Fr, capsule: Fr[]): Promise<void>;
|
|
36
|
-
registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress>;
|
|
37
|
-
getRegisteredAccounts(): Promise<CompleteAddress[]>;
|
|
38
27
|
registerSender(address: AztecAddress): Promise<AztecAddress>;
|
|
39
28
|
getSenders(): Promise<AztecAddress[]>;
|
|
40
29
|
removeSender(address: AztecAddress): Promise<void>;
|
|
@@ -44,30 +33,18 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
44
33
|
}): Promise<void>;
|
|
45
34
|
registerContractClass(artifact: ContractArtifact): Promise<void>;
|
|
46
35
|
updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
|
|
47
|
-
getContracts(): Promise<AztecAddress[]>;
|
|
48
36
|
proveTx(txRequest: TxExecutionRequest, privateExecutionResult: PrivateExecutionResult): Promise<TxProvingResult>;
|
|
49
|
-
|
|
37
|
+
profileTx(txRequest: TxExecutionRequest, profileMode: 'gates' | 'execution-steps' | 'full', msgSender?: AztecAddress): Promise<TxProfileResult>;
|
|
38
|
+
simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, msgSender?: AztecAddress, skipTxValidation?: boolean, skipFeeEnforcement?: boolean): Promise<TxSimulationResult>;
|
|
50
39
|
sendTx(tx: Tx): Promise<TxHash>;
|
|
51
|
-
getTxEffect(txHash: TxHash): Promise<import("@aztec/stdlib/block").InBlock<import("@aztec/stdlib/tx").TxEffect> | undefined>;
|
|
52
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
53
|
-
getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
|
|
54
|
-
getPublicStorageAt(contract: AztecAddress, storageSlot: Fr): Promise<any>;
|
|
55
|
-
getBlock(number: number): Promise<L2Block | undefined>;
|
|
56
40
|
getCurrentBaseFees(): Promise<GasFees>;
|
|
57
|
-
simulateUnconstrained(functionName: string, args: any[], to: AztecAddress, from?: AztecAddress | undefined): Promise<AbiDecoded>;
|
|
58
|
-
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse>;
|
|
59
|
-
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse>;
|
|
60
|
-
getBlockNumber(): Promise<number>;
|
|
61
|
-
getProvenBlockNumber(): Promise<number>;
|
|
41
|
+
simulateUnconstrained(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress | undefined): Promise<AbiDecoded>;
|
|
62
42
|
getNodeInfo(): Promise<NodeInfo>;
|
|
63
|
-
addAuthWitness(authWitness: AuthWitness): Promise<void>;
|
|
64
|
-
getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
65
43
|
getPXEInfo(): Promise<PXEInfo>;
|
|
66
44
|
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
67
45
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
46
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
68
47
|
getPrivateEvents<T>(event: EventMetadataDefinition, from: number, limit: number, vpks?: Point[]): Promise<T[]>;
|
|
69
48
|
getPublicEvents<T>(event: EventMetadataDefinition, from: number, limit: number): Promise<T[]>;
|
|
70
|
-
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
71
|
-
getL2ToL1MembershipWitness(blockNumber: number, l2Tol1Message: Fr): Promise<[bigint, SiblingPath<number>]>;
|
|
72
49
|
}
|
|
73
50
|
//# sourceMappingURL=base_wallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/base_wallet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/base_wallet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,GAAG,EACH,OAAO,EACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,s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I,GAAE,KAAK,EAA0E,GACpF,OAAO,CAAC,CAAC,EAAE,CAAC;IAGf,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;CAG9F"}
|
|
@@ -2,29 +2,12 @@
|
|
|
2
2
|
* A base class for Wallet implementations
|
|
3
3
|
*/ export class BaseWallet {
|
|
4
4
|
pxe;
|
|
5
|
-
|
|
6
|
-
constructor(pxe, scopes){
|
|
5
|
+
constructor(pxe){
|
|
7
6
|
this.pxe = pxe;
|
|
8
|
-
this.scopes = scopes;
|
|
9
|
-
}
|
|
10
|
-
setScopes(scopes) {
|
|
11
|
-
this.scopes = scopes;
|
|
12
|
-
}
|
|
13
|
-
getScopes() {
|
|
14
|
-
return this.scopes;
|
|
15
7
|
}
|
|
16
8
|
getAddress() {
|
|
17
9
|
return this.getCompleteAddress().address;
|
|
18
10
|
}
|
|
19
|
-
storeCapsule(contract, storageSlot, capsule) {
|
|
20
|
-
return this.pxe.storeCapsule(contract, storageSlot, capsule);
|
|
21
|
-
}
|
|
22
|
-
registerAccount(secretKey, partialAddress) {
|
|
23
|
-
return this.pxe.registerAccount(secretKey, partialAddress);
|
|
24
|
-
}
|
|
25
|
-
getRegisteredAccounts() {
|
|
26
|
-
return this.pxe.getRegisteredAccounts();
|
|
27
|
-
}
|
|
28
11
|
registerSender(address) {
|
|
29
12
|
return this.pxe.registerSender(address);
|
|
30
13
|
}
|
|
@@ -43,60 +26,27 @@
|
|
|
43
26
|
updateContract(contractAddress, artifact) {
|
|
44
27
|
return this.pxe.updateContract(contractAddress, artifact);
|
|
45
28
|
}
|
|
46
|
-
getContracts() {
|
|
47
|
-
return this.pxe.getContracts();
|
|
48
|
-
}
|
|
49
29
|
proveTx(txRequest, privateExecutionResult) {
|
|
50
30
|
return this.pxe.proveTx(txRequest, privateExecutionResult);
|
|
51
31
|
}
|
|
52
|
-
|
|
53
|
-
return this.pxe.
|
|
32
|
+
profileTx(txRequest, profileMode, msgSender) {
|
|
33
|
+
return this.pxe.profileTx(txRequest, profileMode, msgSender);
|
|
34
|
+
}
|
|
35
|
+
simulateTx(txRequest, simulatePublic, msgSender, skipTxValidation, skipFeeEnforcement) {
|
|
36
|
+
return this.pxe.simulateTx(txRequest, simulatePublic, msgSender, skipTxValidation, skipFeeEnforcement);
|
|
54
37
|
}
|
|
55
38
|
sendTx(tx) {
|
|
56
39
|
return this.pxe.sendTx(tx);
|
|
57
40
|
}
|
|
58
|
-
getTxEffect(txHash) {
|
|
59
|
-
return this.pxe.getTxEffect(txHash);
|
|
60
|
-
}
|
|
61
|
-
getTxReceipt(txHash) {
|
|
62
|
-
return this.pxe.getTxReceipt(txHash);
|
|
63
|
-
}
|
|
64
|
-
getNotes(filter) {
|
|
65
|
-
return this.pxe.getNotes(filter);
|
|
66
|
-
}
|
|
67
|
-
getPublicStorageAt(contract, storageSlot) {
|
|
68
|
-
return this.pxe.getPublicStorageAt(contract, storageSlot);
|
|
69
|
-
}
|
|
70
|
-
getBlock(number) {
|
|
71
|
-
return this.pxe.getBlock(number);
|
|
72
|
-
}
|
|
73
41
|
getCurrentBaseFees() {
|
|
74
42
|
return this.pxe.getCurrentBaseFees();
|
|
75
43
|
}
|
|
76
|
-
simulateUnconstrained(functionName, args, to, from) {
|
|
77
|
-
return this.pxe.simulateUnconstrained(functionName, args, to, from);
|
|
78
|
-
}
|
|
79
|
-
getPublicLogs(filter) {
|
|
80
|
-
return this.pxe.getPublicLogs(filter);
|
|
81
|
-
}
|
|
82
|
-
getContractClassLogs(filter) {
|
|
83
|
-
return this.pxe.getContractClassLogs(filter);
|
|
84
|
-
}
|
|
85
|
-
getBlockNumber() {
|
|
86
|
-
return this.pxe.getBlockNumber();
|
|
87
|
-
}
|
|
88
|
-
getProvenBlockNumber() {
|
|
89
|
-
return this.pxe.getProvenBlockNumber();
|
|
44
|
+
simulateUnconstrained(functionName, args, to, authwits, from) {
|
|
45
|
+
return this.pxe.simulateUnconstrained(functionName, args, to, authwits, from);
|
|
90
46
|
}
|
|
91
47
|
getNodeInfo() {
|
|
92
48
|
return this.pxe.getNodeInfo();
|
|
93
49
|
}
|
|
94
|
-
addAuthWitness(authWitness) {
|
|
95
|
-
return this.pxe.addAuthWitness(authWitness);
|
|
96
|
-
}
|
|
97
|
-
getAuthWitness(messageHash) {
|
|
98
|
-
return this.pxe.getAuthWitness(messageHash);
|
|
99
|
-
}
|
|
100
50
|
getPXEInfo() {
|
|
101
51
|
return this.pxe.getPXEInfo();
|
|
102
52
|
}
|
|
@@ -106,6 +56,9 @@
|
|
|
106
56
|
getContractMetadata(address) {
|
|
107
57
|
return this.pxe.getContractMetadata(address);
|
|
108
58
|
}
|
|
59
|
+
getTxReceipt(txHash) {
|
|
60
|
+
return this.pxe.getTxReceipt(txHash);
|
|
61
|
+
}
|
|
109
62
|
getPrivateEvents(event, from, limit, vpks = [
|
|
110
63
|
this.getCompleteAddress().publicKeys.masterIncomingViewingPublicKey
|
|
111
64
|
]) {
|
|
@@ -114,10 +67,4 @@
|
|
|
114
67
|
getPublicEvents(event, from, limit) {
|
|
115
68
|
return this.pxe.getPublicEvents(event, from, limit);
|
|
116
69
|
}
|
|
117
|
-
getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
|
|
118
|
-
return this.pxe.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
119
|
-
}
|
|
120
|
-
getL2ToL1MembershipWitness(blockNumber, l2Tol1Message) {
|
|
121
|
-
return this.pxe.getL2ToL1MembershipWitness(blockNumber, l2Tol1Message);
|
|
122
|
-
}
|
|
123
70
|
}
|
package/dest/wallet/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { AccountContract } from '../account/
|
|
3
|
+
import type { AccountContract } from '../account/account_contract.js';
|
|
4
4
|
import { AccountWallet } from './account_wallet.js';
|
|
5
|
-
export * from '
|
|
5
|
+
export * from './wallet.js';
|
|
6
6
|
export * from './account_wallet.js';
|
|
7
7
|
export * from './account_wallet_with_private_key.js';
|
|
8
8
|
export * from './signerless_wallet.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,CAAC,CAUxB"}
|
package/dest/wallet/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
4
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
5
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
6
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
7
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
8
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
7
9
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
|
-
import type { EntrypointInterface, ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
9
10
|
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
10
11
|
import { BaseWallet } from './base_wallet.js';
|
|
11
12
|
/**
|
|
@@ -14,12 +15,11 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
14
15
|
export declare class SignerlessWallet extends BaseWallet {
|
|
15
16
|
private entrypoint?;
|
|
16
17
|
constructor(pxe: PXE, entrypoint?: EntrypointInterface | undefined);
|
|
17
|
-
createTxExecutionRequest(execution:
|
|
18
|
+
createTxExecutionRequest(execution: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
|
|
18
19
|
getChainId(): Fr;
|
|
19
20
|
getVersion(): Fr;
|
|
20
21
|
getPublicKeysHash(): Fr;
|
|
21
22
|
getCompleteAddress(): CompleteAddress;
|
|
22
23
|
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
23
|
-
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=signerless_wallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signerless_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/signerless_wallet.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"signerless_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/signerless_wallet.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IACxB,OAAO,CAAC,UAAU,CAAC;gBAA7B,GAAG,EAAE,GAAG,EAAU,UAAU,CAAC,iCAAqB;IAGxD,wBAAwB,CAC5B,SAAS,EAAE,gBAAgB,EAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAU9B,UAAU,IAAI,EAAE;IAIhB,UAAU,IAAI,EAAE;IAIhB,iBAAiB,IAAI,EAAE;IAIvB,kBAAkB,IAAI,eAAe;IAIrC,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM,GAAG,eAAe,GAAG,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;CAG3F"}
|