@aztec/aztec.js 0.78.1 → 0.80.0
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_manager/deploy_account_method.d.ts +2 -2
- package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.js +14 -21
- package/dest/account_manager/index.d.ts +2 -3
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +1 -1
- package/dest/api/abi.d.ts +1 -1
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -1
- package/dest/api/account.d.ts +1 -1
- package/dest/api/account.d.ts.map +1 -1
- package/dest/{contract/index.d.ts → api/contract.d.ts} +9 -8
- package/dest/api/contract.d.ts.map +1 -0
- package/dest/{contract/index.js → api/contract.js} +8 -7
- package/dest/api/deployment.d.ts +1 -0
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +1 -0
- package/dest/api/ethereum.d.ts +3 -0
- package/dest/api/ethereum.d.ts.map +1 -0
- package/dest/api/ethereum.js +2 -0
- package/dest/api/{interfaces/pxe.d.ts → interfaces.d.ts} +1 -1
- package/dest/api/interfaces.d.ts.map +1 -0
- package/dest/api/rpc.d.ts +3 -0
- package/dest/api/rpc.d.ts.map +1 -0
- package/dest/api/rpc.js +2 -0
- package/dest/api/testing.d.ts +6 -0
- package/dest/api/testing.d.ts.map +1 -0
- package/dest/api/testing.js +5 -0
- package/dest/api/utils.d.ts +8 -0
- package/dest/api/utils.d.ts.map +1 -0
- package/dest/api/utils.js +6 -0
- package/dest/api/wallet.d.ts +1 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -1
- package/dest/contract/base_contract_interaction.d.ts +41 -3
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +39 -1
- package/dest/contract/batch_call.d.ts +25 -6
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +62 -25
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/checker.d.ts.map +1 -1
- package/dest/contract/checker.js +2 -2
- 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_base.js +2 -2
- package/dest/contract/contract_function_interaction.d.ts +8 -6
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +33 -25
- package/dest/contract/deploy_method.d.ts +6 -5
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +26 -50
- package/dest/contract/deploy_proven_tx.d.ts +1 -1
- package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.d.ts +1 -1
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- 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 +1 -1
- package/dest/contract/proven_tx.d.ts.map +1 -1
- package/dest/contract/unsafe_contract.d.ts +1 -1
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/entrypoint/entrypoint.d.ts +4 -0
- package/dest/entrypoint/entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/entrypoint.js +16 -0
- package/dest/ethereum/l1_contracts.d.ts.map +1 -0
- package/dest/{api/ethereum → ethereum}/l1_contracts.js +1 -1
- package/dest/{api/ethereum → ethereum}/portal_manager.d.ts +1 -1
- package/dest/ethereum/portal_manager.d.ts.map +1 -0
- package/dest/{api/ethereum → ethereum}/portal_manager.js +4 -1
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +1 -1
- package/dest/index.d.ts +7 -13
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +8 -14
- package/dest/test/anvil_test_watcher.d.ts.map +1 -0
- package/dest/{api/ethereum → test}/anvil_test_watcher.js +2 -2
- package/dest/{utils/aztec_cheatcodes.d.ts → test/aztec_cheat_codes.d.ts} +1 -1
- package/dest/test/aztec_cheat_codes.d.ts.map +1 -0
- package/dest/{api → test}/cheat_codes.d.ts +2 -2
- package/dest/test/cheat_codes.d.ts.map +1 -0
- package/dest/{api → test}/cheat_codes.js +2 -2
- package/dest/{api/ethereum/cheat_codes.d.ts → test/rollup_cheat_codes.d.ts} +2 -3
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
- package/dest/{api/ethereum/cheat_codes.js → test/rollup_cheat_codes.js} +2 -4
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +1 -1
- package/dest/utils/fee_juice.d.ts +1 -1
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +1 -1
- package/package.json +14 -13
- package/src/account_manager/deploy_account_method.ts +12 -31
- package/src/account_manager/index.ts +1 -1
- package/src/api/abi.ts +15 -0
- package/src/api/account.ts +1 -1
- package/src/{contract/index.ts → api/contract.ts} +21 -7
- package/src/api/deployment.ts +1 -0
- package/src/api/ethereum.ts +11 -0
- package/src/api/rpc.ts +2 -0
- package/src/api/testing.ts +5 -0
- package/src/{utils/index.ts → api/utils.ts} +7 -7
- package/src/api/wallet.ts +1 -7
- package/src/contract/base_contract_interaction.ts +60 -3
- package/src/contract/batch_call.ts +63 -21
- package/src/contract/checker.ts +8 -3
- package/src/contract/contract.ts +1 -1
- package/src/contract/contract_base.ts +4 -3
- package/src/contract/contract_function_interaction.ts +35 -25
- package/src/contract/deploy_method.ts +23 -37
- package/src/contract/deploy_proven_tx.ts +1 -1
- package/src/contract/deploy_sent_tx.ts +1 -1
- package/src/contract/protocol_contracts.ts +1 -1
- package/src/contract/proven_tx.ts +1 -1
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/entrypoint/entrypoint.ts +21 -0
- package/src/{api/ethereum → ethereum}/l1_contracts.ts +1 -1
- package/src/{api/ethereum → ethereum}/portal_manager.ts +4 -1
- package/src/fee/fee_juice_payment_method_with_claim.ts +1 -1
- package/src/fee/public_fee_payment_method.ts +1 -1
- package/src/index.ts +7 -27
- package/src/{api/ethereum → test}/anvil_test_watcher.ts +2 -2
- package/src/{api → test}/cheat_codes.ts +2 -2
- package/src/{api/ethereum/cheat_codes.ts → test/rollup_cheat_codes.ts} +2 -4
- package/src/utils/authwit.ts +2 -1
- package/src/utils/fee_juice.ts +1 -2
- package/src/wallet/account_wallet.ts +1 -1
- package/dest/api/cheat_codes.d.ts.map +0 -1
- package/dest/api/ethereum/anvil_test_watcher.d.ts.map +0 -1
- package/dest/api/ethereum/chain_monitor.d.ts +0 -25
- package/dest/api/ethereum/chain_monitor.d.ts.map +0 -1
- package/dest/api/ethereum/chain_monitor.js +0 -74
- package/dest/api/ethereum/cheat_codes.d.ts.map +0 -1
- package/dest/api/ethereum/index.d.ts +0 -7
- package/dest/api/ethereum/index.d.ts.map +0 -1
- package/dest/api/ethereum/index.js +0 -6
- package/dest/api/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
- package/dest/api/interfaces/pxe.d.ts.map +0 -1
- package/dest/contract/index.d.ts.map +0 -1
- package/dest/deployment/index.d.ts +0 -2
- package/dest/deployment/index.d.ts.map +0 -1
- package/dest/deployment/index.js +0 -1
- package/dest/rpc_clients/index.d.ts +0 -3
- package/dest/rpc_clients/index.d.ts.map +0 -1
- package/dest/rpc_clients/index.js +0 -2
- package/dest/utils/aztec_cheatcodes.d.ts.map +0 -1
- package/dest/utils/index.d.ts +0 -8
- package/dest/utils/index.d.ts.map +0 -1
- package/dest/utils/index.js +0 -6
- package/src/api/ethereum/chain_monitor.ts +0 -88
- package/src/api/ethereum/index.ts +0 -19
- package/src/deployment/index.ts +0 -1
- package/src/rpc_clients/index.ts +0 -2
- /package/dest/api/{interfaces/pxe.js → interfaces.js} +0 -0
- /package/dest/{api/ethereum → ethereum}/l1_contracts.d.ts +0 -0
- /package/dest/{api/ethereum → test}/anvil_test_watcher.d.ts +0 -0
- /package/dest/{utils/aztec_cheatcodes.js → test/aztec_cheat_codes.js} +0 -0
- /package/src/api/{interfaces/pxe.ts → interfaces.ts} +0 -0
- /package/src/{utils/aztec_cheatcodes.ts → test/aztec_cheat_codes.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { mergeExecutionRequestInits } from '../entrypoint/entrypoint.js';
|
|
2
3
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
3
4
|
/** A batch of function calls to be sent as a single transaction through a wallet. */ export class BatchCall extends BaseContractInteraction {
|
|
4
5
|
calls;
|
|
@@ -8,24 +9,33 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
8
9
|
/**
|
|
9
10
|
* Create a transaction execution request that represents this batch, encoded and authenticated by the
|
|
10
11
|
* user's wallet, ready to be simulated.
|
|
11
|
-
* @param
|
|
12
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
12
13
|
* @returns A Promise that resolves to a transaction instance.
|
|
13
|
-
*/ async create(
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
*/ async create(options = {}) {
|
|
15
|
+
const requestWithoutFee = await this.request(options);
|
|
16
|
+
const { fee: userFee } = options;
|
|
16
17
|
const fee = await this.getFeeOptions({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...opts
|
|
18
|
+
...requestWithoutFee,
|
|
19
|
+
fee: userFee
|
|
20
20
|
});
|
|
21
21
|
return await this.wallet.createTxExecutionRequest({
|
|
22
|
-
|
|
23
|
-
capsules,
|
|
24
|
-
...opts,
|
|
22
|
+
...requestWithoutFee,
|
|
25
23
|
fee
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
27
|
+
* Returns an execution request that represents this operation.
|
|
28
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
29
|
+
* @returns An execution request wrapped in promise.
|
|
30
|
+
*/ async request(options = {}) {
|
|
31
|
+
const requests = await this.getRequests();
|
|
32
|
+
const { nonce, cancellable } = options;
|
|
33
|
+
return mergeExecutionRequestInits(requests, {
|
|
34
|
+
nonce,
|
|
35
|
+
cancellable
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
29
39
|
* Simulate a transaction and get its return values
|
|
30
40
|
* Differs from prove in a few important ways:
|
|
31
41
|
* 1. It returns the values of the function execution
|
|
@@ -34,37 +44,36 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
34
44
|
* @param options - An optional object containing additional configuration for the transaction.
|
|
35
45
|
* @returns The result of the transaction as returned by the contract function.
|
|
36
46
|
*/ async simulate(options = {}) {
|
|
37
|
-
const {
|
|
38
|
-
|
|
47
|
+
const { indexedRequests, unconstrained } = (await this.getRequests()).reduce((acc, current, index)=>{
|
|
48
|
+
const call = current.calls[0];
|
|
49
|
+
if (call.type === FunctionType.UNCONSTRAINED) {
|
|
39
50
|
acc.unconstrained.push([
|
|
40
|
-
|
|
51
|
+
call,
|
|
41
52
|
index
|
|
42
53
|
]);
|
|
43
54
|
} else {
|
|
44
|
-
acc.
|
|
55
|
+
acc.indexedRequests.push([
|
|
45
56
|
current,
|
|
46
57
|
index,
|
|
47
|
-
|
|
58
|
+
call.type === FunctionType.PRIVATE ? acc.privateIndex++ : acc.publicIndex++
|
|
48
59
|
]);
|
|
49
60
|
}
|
|
50
61
|
return acc;
|
|
51
62
|
}, {
|
|
52
|
-
|
|
63
|
+
indexedRequests: [],
|
|
53
64
|
unconstrained: [],
|
|
54
65
|
publicIndex: 0,
|
|
55
66
|
privateIndex: 0
|
|
56
67
|
});
|
|
57
|
-
const
|
|
58
|
-
const
|
|
68
|
+
const requests = indexedRequests.map(([request])=>request);
|
|
69
|
+
const requestWithoutFee = mergeExecutionRequestInits(requests);
|
|
70
|
+
const { fee: userFee } = options;
|
|
59
71
|
const fee = await this.getFeeOptions({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...options
|
|
72
|
+
...requestWithoutFee,
|
|
73
|
+
fee: userFee
|
|
63
74
|
});
|
|
64
75
|
const txRequest = await this.wallet.createTxExecutionRequest({
|
|
65
|
-
|
|
66
|
-
capsules,
|
|
67
|
-
...options,
|
|
76
|
+
...requestWithoutFee,
|
|
68
77
|
fee
|
|
69
78
|
});
|
|
70
79
|
const unconstrainedCalls = unconstrained.map(async ([call, index])=>[
|
|
@@ -79,7 +88,8 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
79
88
|
unconstrainedResults.forEach(([result, index])=>{
|
|
80
89
|
results[index] = result;
|
|
81
90
|
});
|
|
82
|
-
|
|
91
|
+
indexedRequests.forEach(([request, callIndex, resultIndex])=>{
|
|
92
|
+
const call = request.calls[0];
|
|
83
93
|
// As account entrypoints are private, for private functions we retrieve the return values from the first nested call
|
|
84
94
|
// since we're interested in the first set of values AFTER the account entrypoint
|
|
85
95
|
// For public functions we retrieve the first values directly from the public output.
|
|
@@ -88,4 +98,31 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
88
98
|
});
|
|
89
99
|
return results;
|
|
90
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Return all authWitnesses added for this interaction.
|
|
103
|
+
*/ getAuthWitnesses() {
|
|
104
|
+
return [
|
|
105
|
+
this.authWitnesses,
|
|
106
|
+
...this.calls.map((c)=>c.getAuthWitnesses())
|
|
107
|
+
].flat();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Return all hashedArguments added for this interaction.
|
|
111
|
+
*/ getHashedArguments() {
|
|
112
|
+
return [
|
|
113
|
+
this.hashedArguments,
|
|
114
|
+
...this.calls.map((c)=>c.getHashedArguments())
|
|
115
|
+
].flat();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Return all capsules added for this interaction.
|
|
119
|
+
*/ getCapsules() {
|
|
120
|
+
return [
|
|
121
|
+
this.capsules,
|
|
122
|
+
...this.calls.map((c)=>c.getCapsules())
|
|
123
|
+
].flat();
|
|
124
|
+
}
|
|
125
|
+
async getRequests() {
|
|
126
|
+
return await Promise.all(this.calls.map((c)=>c.request()));
|
|
127
|
+
}
|
|
91
128
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
/**
|
|
3
3
|
* Validates the given ContractArtifact object by checking its functions and their parameters.
|
|
4
4
|
* Ensures that the ABI has at least one function, a constructor, valid bytecode, and correct parameter types.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../src/contract/checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../src/contract/checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAGtB,MAAM,mBAAmB,CAAC;AAQ3B;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,WA6BpD"}
|
package/dest/contract/checker.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getDefaultInitializer } from '@aztec/stdlib/abi';
|
|
1
2
|
/**
|
|
2
3
|
* Validates the given ContractArtifact object by checking its functions and their parameters.
|
|
3
4
|
* Ensures that the ABI has at least one function, a constructor, valid bytecode, and correct parameter types.
|
|
@@ -24,8 +25,7 @@
|
|
|
24
25
|
abiParameterTypeChecker(param.type);
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
-
if (!artifact.functions.find((func)=>func.name === 'constructor')) {
|
|
28
|
+
if (!getDefaultInitializer(artifact)) {
|
|
29
29
|
throw new Error('ABI has no constructor');
|
|
30
30
|
}
|
|
31
31
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
4
|
-
import type { Wallet } from '../account/
|
|
4
|
+
import type { Wallet } from '../account/wallet.js';
|
|
5
5
|
import { ContractBase } from './contract_base.js';
|
|
6
6
|
import { DeployMethod } from './deploy_method.js';
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC;;;;;;OAMG;WACiB,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAc5G;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM;IAKtG;;;;;;;OAOG;WACW,oBAAoB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,CAAC,EAAE,MAAM;CAK3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ContractArtifact, type ContractNote, type FieldLayout, FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
2
|
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type { Wallet } from '../account/
|
|
3
|
+
import type { Wallet } from '../account/wallet.js';
|
|
4
4
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
5
5
|
/**
|
|
6
6
|
* Type representing a contract method that returns a ContractFunctionInteraction instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_base.d.ts","sourceRoot":"","sources":["../../src/contract/contract_base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"contract_base.d.ts","sourceRoot":"","sources":["../../src/contract/contract_base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,2BAA2B,EAAyB,MAAM,wBAAwB,CAAC;AAEjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI;KACnD,CAAC,IAAI,CAAC,GAAG,WAAW;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;KAC3C,CAAC,IAAI,CAAC,GAAG,YAAY;CACvB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY;IAOrB,iDAAiD;aACjC,QAAQ,EAAE,2BAA2B;IACrD,yDAAyD;aACzC,QAAQ,EAAE,gBAAgB;IAC1C,0DAA0D;IACnD,MAAM,EAAE,MAAM;IAXvB;;OAEG;IACI,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAM;IAExD,SAAS;IACP,iDAAiD;IACjC,QAAQ,EAAE,2BAA2B;IACrD,yDAAyD;IACzC,QAAQ,EAAE,gBAAgB;IAC1C,0DAA0D;IACnD,MAAM,EAAE,MAAM;IAmBvB,+BAA+B;IAC/B,IAAW,OAAO,uDAEjB;IAED,uCAAuC;IACvC,IAAW,cAAc,oDAExB;IAED;;;;OAIG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
1
|
+
import { FunctionSelector, getAllFunctionAbis } from '@aztec/stdlib/abi';
|
|
2
2
|
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
3
3
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ import { ContractFunctionInteraction } from './contract_function_interaction.js'
|
|
|
15
15
|
this.artifact = artifact;
|
|
16
16
|
this.wallet = wallet;
|
|
17
17
|
this.methods = {};
|
|
18
|
-
artifact.
|
|
18
|
+
getAllFunctionAbis(artifact).forEach((f)=>{
|
|
19
19
|
const interactionFunction = (...args)=>{
|
|
20
20
|
return new ContractFunctionInteraction(this.wallet, this.instance.address, f, args);
|
|
21
21
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type FunctionAbi
|
|
1
|
+
import { type FunctionAbi } from '@aztec/stdlib/abi';
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { PrivateKernelProverProfileResult } from '@aztec/stdlib/kernel';
|
|
4
4
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
5
5
|
import type { Wallet } from '../account/wallet.js';
|
|
6
|
+
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
6
7
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
7
8
|
export type { SendMethodOptions };
|
|
8
9
|
/**
|
|
@@ -37,16 +38,17 @@ export declare class ContractFunctionInteraction extends BaseContractInteraction
|
|
|
37
38
|
/**
|
|
38
39
|
* Create a transaction execution request that represents this call, encoded and authenticated by the
|
|
39
40
|
* user's wallet, ready to be simulated.
|
|
40
|
-
* @param
|
|
41
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
41
42
|
* @returns A Promise that resolves to a transaction instance.
|
|
42
43
|
*/
|
|
43
|
-
create(
|
|
44
|
+
create(options?: SendMethodOptions): Promise<TxExecutionRequest>;
|
|
44
45
|
/**
|
|
45
|
-
* Returns an execution request that represents this operation.
|
|
46
|
-
* block for constructing batch requests.
|
|
46
|
+
* Returns an execution request that represents this operation.
|
|
47
|
+
* Can be used as a building block for constructing batch requests.
|
|
48
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
47
49
|
* @returns An execution request wrapped in promise.
|
|
48
50
|
*/
|
|
49
|
-
request(): Promise<
|
|
51
|
+
request(options?: SendMethodOptions): Promise<Omit<ExecutionRequestInit, 'fee'>>;
|
|
50
52
|
/**
|
|
51
53
|
* Simulate a transaction and get its return values
|
|
52
54
|
* Differs from prove in a few important ways:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/contract_function_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"contract_function_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/contract_function_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAkE,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEjG,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,GAAG;IACnE,kCAAkC;IAClC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8HAA8H;IAC9H,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,gCAAgC,GAAG;IAC7D,0EAA0E;IAC1E,YAAY,EAAE,GAAG,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,uBAAuB;IAGpE,SAAS,CAAC,eAAe,EAAE,YAAY;IACvC,SAAS,CAAC,WAAW,EAAE,WAAW;IAClC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE;gBAHrB,MAAM,EAAE,MAAM,EACJ,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,GAAG,EAAE;IASvB;;;;;OAKG;IACU,MAAM,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAcjF;;;;;OAKG;IACU,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IA6BjG;;;;;;;;OAQG;IACU,QAAQ,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,GAAG,CAAC;IAkCxE;;;;;OAKG;IACU,mBAAmB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,aAAa,CAAC;CA0B9F"}
|
|
@@ -19,47 +19,55 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a transaction execution request that represents this call, encoded and authenticated by the
|
|
21
21
|
* user's wallet, ready to be simulated.
|
|
22
|
-
* @param
|
|
22
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
23
23
|
* @returns A Promise that resolves to a transaction instance.
|
|
24
|
-
*/ async create(
|
|
24
|
+
*/ async create(options = {}) {
|
|
25
25
|
// docs:end:create
|
|
26
26
|
if (this.functionDao.functionType === FunctionType.UNCONSTRAINED) {
|
|
27
27
|
throw new Error("Can't call `create` on an unconstrained function.");
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
];
|
|
32
|
-
const capsules = this.getCapsules();
|
|
29
|
+
const requestWithoutFee = await this.request(options);
|
|
30
|
+
const { fee: userFee } = options;
|
|
33
31
|
const fee = await this.getFeeOptions({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...opts
|
|
32
|
+
...requestWithoutFee,
|
|
33
|
+
fee: userFee
|
|
37
34
|
});
|
|
38
|
-
const { nonce, cancellable } = opts;
|
|
39
35
|
return await this.wallet.createTxExecutionRequest({
|
|
40
|
-
|
|
41
|
-
fee
|
|
42
|
-
nonce,
|
|
43
|
-
cancellable,
|
|
44
|
-
capsules
|
|
36
|
+
...requestWithoutFee,
|
|
37
|
+
fee
|
|
45
38
|
});
|
|
46
39
|
}
|
|
47
40
|
// docs:start:request
|
|
48
41
|
/**
|
|
49
|
-
* Returns an execution request that represents this operation.
|
|
50
|
-
* block for constructing batch requests.
|
|
42
|
+
* Returns an execution request that represents this operation.
|
|
43
|
+
* Can be used as a building block for constructing batch requests.
|
|
44
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
51
45
|
* @returns An execution request wrapped in promise.
|
|
52
|
-
*/ async request() {
|
|
46
|
+
*/ async request(options = {}) {
|
|
53
47
|
// docs:end:request
|
|
54
48
|
const args = encodeArguments(this.functionDao, this.args);
|
|
49
|
+
const calls = [
|
|
50
|
+
{
|
|
51
|
+
name: this.functionDao.name,
|
|
52
|
+
args,
|
|
53
|
+
selector: await FunctionSelector.fromNameAndParameters(this.functionDao.name, this.functionDao.parameters),
|
|
54
|
+
type: this.functionDao.functionType,
|
|
55
|
+
to: this.contractAddress,
|
|
56
|
+
isStatic: this.functionDao.isStatic,
|
|
57
|
+
returnTypes: this.functionDao.returnTypes
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
const authWitnesses = this.getAuthWitnesses();
|
|
61
|
+
const hashedArguments = this.getHashedArguments();
|
|
62
|
+
const capsules = this.getCapsules();
|
|
63
|
+
const { nonce, cancellable } = options;
|
|
55
64
|
return {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
returnTypes: this.functionDao.returnTypes
|
|
65
|
+
calls,
|
|
66
|
+
authWitnesses,
|
|
67
|
+
hashedArguments,
|
|
68
|
+
capsules,
|
|
69
|
+
nonce,
|
|
70
|
+
cancellable
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
73
|
// docs:start:simulate
|
|
@@ -5,11 +5,12 @@ import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
|
5
5
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
6
|
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
7
7
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
|
-
import type { Wallet } from '../account/
|
|
9
|
-
import type
|
|
8
|
+
import type { Wallet } from '../account/wallet.js';
|
|
9
|
+
import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
10
10
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
11
11
|
import type { Contract } from './contract.js';
|
|
12
12
|
import type { ContractBase } from './contract_base.js';
|
|
13
|
+
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
13
14
|
import { DeployProvenTx } from './deploy_proven_tx.js';
|
|
14
15
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
15
16
|
/**
|
|
@@ -60,7 +61,7 @@ export declare class DeployMethod<TContract extends ContractBase = Contract> ext
|
|
|
60
61
|
* @remarks This method does not have the same return type as the `request` in the ContractInteraction object,
|
|
61
62
|
* it returns a promise for an array instead of a function call directly.
|
|
62
63
|
*/
|
|
63
|
-
request(options?: DeployOptions): Promise<ExecutionRequestInit
|
|
64
|
+
request(options?: DeployOptions): Promise<Omit<ExecutionRequestInit, 'fee'>>;
|
|
64
65
|
/**
|
|
65
66
|
* Register this contract in the PXE and returns the Contract object.
|
|
66
67
|
* @param options - Deployment options.
|
|
@@ -71,13 +72,13 @@ export declare class DeployMethod<TContract extends ContractBase = Contract> ext
|
|
|
71
72
|
* @param options - Deployment options.
|
|
72
73
|
* @returns A function call array with potentially requests to the class registerer and instance deployer.
|
|
73
74
|
*/
|
|
74
|
-
protected getDeploymentFunctionCalls(options?: DeployOptions): Promise<
|
|
75
|
+
protected getDeploymentFunctionCalls(options?: DeployOptions): Promise<ContractFunctionInteraction[]>;
|
|
75
76
|
/**
|
|
76
77
|
* Returns the calls necessary to initialize the contract.
|
|
77
78
|
* @param options - Deployment options.
|
|
78
79
|
* @returns - An array of function calls.
|
|
79
80
|
*/
|
|
80
|
-
protected getInitializeFunctionCalls(options: DeployOptions): Promise<
|
|
81
|
+
protected getInitializeFunctionCalls(options: DeployOptions): Promise<ContractFunctionInteraction[]>;
|
|
81
82
|
/**
|
|
82
83
|
* Send the contract deployment transaction using the provided options.
|
|
83
84
|
* This function extends the 'send' method from the ContractFunctionInteraction class,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_method.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"deploy_method.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_method.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,6 +3,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import { computePartialAddress, getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
4
4
|
import { deployInstance } from '../deployment/deploy_instance.js';
|
|
5
5
|
import { registerContractClass } from '../deployment/register_class.js';
|
|
6
|
+
import { mergeExecutionRequestInits } from '../entrypoint/entrypoint.js';
|
|
6
7
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
7
8
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
8
9
|
import { DeployProvenTx } from './deploy_proven_tx.js';
|
|
@@ -32,7 +33,15 @@ import { DeploySentTx } from './deploy_sent_tx.js';
|
|
|
32
33
|
* @param options - An object containing optional deployment settings, contractAddressSalt, and from.
|
|
33
34
|
* @returns A Promise resolving to an object containing the signed transaction data and other relevant information.
|
|
34
35
|
*/ async create(options = {}) {
|
|
35
|
-
|
|
36
|
+
const requestWithoutFee = await this.request(options);
|
|
37
|
+
const fee = await this.getFeeOptions({
|
|
38
|
+
...requestWithoutFee,
|
|
39
|
+
fee: options.fee
|
|
40
|
+
});
|
|
41
|
+
return this.wallet.createTxExecutionRequest({
|
|
42
|
+
...requestWithoutFee,
|
|
43
|
+
fee
|
|
44
|
+
});
|
|
36
45
|
}
|
|
37
46
|
// REFACTOR: Having a `request` method with different semantics than the ones in the other
|
|
38
47
|
// derived ContractInteractions is confusing. We should unify the flow of all ContractInteractions.
|
|
@@ -59,40 +68,18 @@ import { DeploySentTx } from './deploy_sent_tx.js';
|
|
|
59
68
|
instance: await this.getInstance(options)
|
|
60
69
|
});
|
|
61
70
|
const bootstrap = await this.getInitializeFunctionCalls(options);
|
|
62
|
-
|
|
71
|
+
const requests = await Promise.all([
|
|
72
|
+
...deployment,
|
|
73
|
+
...bootstrap
|
|
74
|
+
].map((c)=>c.request()));
|
|
75
|
+
if (!requests.length) {
|
|
63
76
|
throw new Error(`No function calls needed to deploy contract ${this.artifact.name}`);
|
|
64
77
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
...deployment.authWitnesses ?? [],
|
|
71
|
-
...bootstrap.authWitnesses ?? []
|
|
72
|
-
];
|
|
73
|
-
const hashedArguments = [
|
|
74
|
-
...deployment.hashedArguments ?? [],
|
|
75
|
-
...bootstrap.hashedArguments ?? []
|
|
76
|
-
];
|
|
77
|
-
const capsules = [
|
|
78
|
-
...deployment.capsules ?? [],
|
|
79
|
-
...bootstrap.capsules ?? []
|
|
80
|
-
];
|
|
81
|
-
const { cancellable, nonce, fee: userFee } = options;
|
|
82
|
-
const request = {
|
|
83
|
-
calls,
|
|
84
|
-
authWitnesses,
|
|
85
|
-
hashedArguments,
|
|
86
|
-
capsules,
|
|
87
|
-
cancellable,
|
|
88
|
-
fee: userFee,
|
|
89
|
-
nonce
|
|
90
|
-
};
|
|
91
|
-
const fee = await this.getFeeOptions(request);
|
|
92
|
-
return {
|
|
93
|
-
...request,
|
|
94
|
-
fee
|
|
95
|
-
};
|
|
78
|
+
const { nonce, cancellable } = options;
|
|
79
|
+
return mergeExecutionRequestInits(requests, {
|
|
80
|
+
nonce,
|
|
81
|
+
cancellable
|
|
82
|
+
});
|
|
96
83
|
}
|
|
97
84
|
/**
|
|
98
85
|
* Register this contract in the PXE and returns the Contract object.
|
|
@@ -111,7 +98,6 @@ import { DeploySentTx } from './deploy_sent_tx.js';
|
|
|
111
98
|
* @returns A function call array with potentially requests to the class registerer and instance deployer.
|
|
112
99
|
*/ async getDeploymentFunctionCalls(options = {}) {
|
|
113
100
|
const calls = [];
|
|
114
|
-
const capsules = [];
|
|
115
101
|
// Set contract instance object so it's available for populating the DeploySendTx object
|
|
116
102
|
const instance = await this.getInstance(options);
|
|
117
103
|
// Obtain contract class from artifact and check it matches the reported one by the instance.
|
|
@@ -127,38 +113,28 @@ import { DeploySentTx } from './deploy_sent_tx.js';
|
|
|
127
113
|
} else {
|
|
128
114
|
this.log.info(`Creating request for registering contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`);
|
|
129
115
|
const registerContractClassInteraction = await registerContractClass(this.wallet, this.artifact);
|
|
130
|
-
calls.push(
|
|
131
|
-
capsules.push(...registerContractClassInteraction.getCapsules());
|
|
116
|
+
calls.push(registerContractClassInteraction);
|
|
132
117
|
}
|
|
133
118
|
}
|
|
134
119
|
// Deploy the contract via the instance deployer.
|
|
135
120
|
if (!options.skipPublicDeployment) {
|
|
136
121
|
const deploymentInteraction = await deployInstance(this.wallet, instance);
|
|
137
|
-
calls.push(
|
|
138
|
-
capsules.push(...deploymentInteraction.getCapsules());
|
|
122
|
+
calls.push(deploymentInteraction);
|
|
139
123
|
}
|
|
140
|
-
return
|
|
141
|
-
calls,
|
|
142
|
-
capsules
|
|
143
|
-
};
|
|
124
|
+
return calls;
|
|
144
125
|
}
|
|
145
126
|
/**
|
|
146
127
|
* Returns the calls necessary to initialize the contract.
|
|
147
128
|
* @param options - Deployment options.
|
|
148
129
|
* @returns - An array of function calls.
|
|
149
130
|
*/ async getInitializeFunctionCalls(options) {
|
|
150
|
-
const { address } = await this.getInstance(options);
|
|
151
131
|
const calls = [];
|
|
152
|
-
const capsules = [];
|
|
153
132
|
if (this.constructorArtifact && !options.skipInitialization) {
|
|
133
|
+
const { address } = await this.getInstance(options);
|
|
154
134
|
const constructorCall = new ContractFunctionInteraction(this.wallet, address, this.constructorArtifact, this.args);
|
|
155
|
-
calls.push(
|
|
156
|
-
capsules.push(...constructorCall.getCapsules());
|
|
135
|
+
calls.push(constructorCall);
|
|
157
136
|
}
|
|
158
|
-
return
|
|
159
|
-
calls,
|
|
160
|
-
capsules
|
|
161
|
-
};
|
|
137
|
+
return calls;
|
|
162
138
|
}
|
|
163
139
|
/**
|
|
164
140
|
* Send the contract deployment transaction using the provided options.
|
|
@@ -2,7 +2,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
2
2
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
3
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
5
|
-
import type { Wallet } from '../account/
|
|
5
|
+
import type { Wallet } from '../account/wallet.js';
|
|
6
6
|
import type { Contract } from './contract.js';
|
|
7
7
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
8
8
|
import { ProvenTx } from './proven_tx.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,qBAAa,cAAc,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,QAAQ;IAI/E,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;gBAHtB,MAAM,EAAE,GAAG,GAAG,MAAM,EACpB,EAAE,EAAE,EAAE,EACE,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAC7E,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC;IAKpE;;OAEG;IACa,IAAI,IAAI,YAAY,CAAC,SAAS,CAAC;CAOhD"}
|
|
@@ -3,7 +3,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { Wallet } from '../account/
|
|
6
|
+
import type { Wallet } from '../account/wallet.js';
|
|
7
7
|
import type { Contract } from './contract.js';
|
|
8
8
|
import type { ContractBase } from './contract_base.js';
|
|
9
9
|
import { SentTx, type WaitOpts } from './sent_tx.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAa,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAa,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,0GAA0G;AAC1G,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,YAAY,GAAG,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG;IAC7F,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,MAAM;IAM3E,OAAO,CAAC,cAAc;IACtB,kDAAkD;IAC3C,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC;IAPnE,OAAO,CAAC,GAAG,CAA0C;gBAGnD,WAAW,EAAE,GAAG,GAAG,MAAM,EACzB,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,EACtB,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC;IACrF,kDAAkD;IAC3C,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC;IAKnE;;;;OAIG;IACU,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAOlE;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;cAMxE,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAUvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Wallet } from '../wallet
|
|
1
|
+
import type { Wallet } from '../account/wallet.js';
|
|
2
2
|
import { UnsafeContract } from './unsafe_contract.js';
|
|
3
3
|
/** Returns a Contract wrapper for the class registerer. */
|
|
4
4
|
export declare function getRegistererContract(wallet: Wallet): Promise<UnsafeContract>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,2DAA2D;AAC3D,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,2BAQzD;AAED,4DAA4D;AAC5D,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,2BAOvD;AAED,mDAAmD;AACnD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
2
2
|
import { Tx } from '@aztec/stdlib/tx';
|
|
3
|
-
import type { Wallet } from '../account/
|
|
3
|
+
import type { Wallet } from '../account/wallet.js';
|
|
4
4
|
import { SentTx } from './sent_tx.js';
|
|
5
5
|
/**
|
|
6
6
|
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,qBAAa,QAAS,SAAQ,EAAE;IAClB,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM;gBAApB,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE;IAWlD,SAAS,CAAC,cAAc,IAAI,EAAE;IAU9B;;OAEG;IACI,IAAI,IAAI,MAAM;CAOtB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type { Wallet } from '../wallet
|
|
3
|
+
import type { Wallet } from '../account/wallet.js';
|
|
4
4
|
import { ContractBase } from './contract_base.js';
|
|
5
5
|
/** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
|
|
6
6
|
export declare class UnsafeContract extends ContractBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,iHAAiH;AACjH,qBAAa,cAAe,SAAQ,YAAY;;IAE5C,iDAAiD;IACjD,QAAQ,EAAE,2BAA2B;IACrC,yDAAyD;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM;CAIjB"}
|
|
@@ -23,6 +23,10 @@ export type ExecutionRequestInit = {
|
|
|
23
23
|
/** Whether the transaction can be cancelled. If true, an extra nullifier will be emitted: H(nonce, GENERATOR_INDEX__TX_NULLIFIER) */
|
|
24
24
|
cancellable?: boolean;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Merges an array of ExecutionRequestInits.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mergeExecutionRequestInits(requests: Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>[], { nonce, cancellable }?: Pick<ExecutionRequestInit, 'nonce' | 'cancellable'>): Omit<ExecutionRequestInit, 'fee'>;
|
|
26
30
|
/** Creates transaction execution requests out of a set of function calls. */
|
|
27
31
|
export interface EntrypointInterface {
|
|
28
32
|
/**
|