@aztec/aztec.js 0.0.1-commit.6d63667d → 0.0.1-commit.7cf39cb55
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/api/contract.d.ts +2 -2
- package/dest/api/contract.js +2 -2
- package/dest/api/deployment.d.ts +1 -2
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +0 -1
- package/dest/api/events.d.ts +10 -6
- package/dest/api/events.d.ts.map +1 -1
- package/dest/api/events.js +30 -20
- package/dest/api/fields.d.ts +2 -1
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +1 -0
- package/dest/api/wallet.d.ts +2 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -1
- package/dest/contract/batch_call.js +4 -1
- package/dest/contract/contract_function_interaction.d.ts +3 -12
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +10 -7
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +2 -13
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +12 -258
- package/dest/fee/fee_juice_payment_method_with_claim.js +6 -6
- package/dest/fee/private_fee_payment_method.js +10 -10
- package/dest/fee/public_fee_payment_method.js +10 -10
- package/dest/fee/sponsored_fee_payment.js +3 -3
- package/dest/wallet/wallet.d.ts +146 -76
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +25 -21
- package/package.json +9 -9
- package/src/api/contract.ts +2 -2
- package/src/api/deployment.ts +0 -1
- package/src/api/events.ts +35 -27
- package/src/api/fields.ts +1 -0
- package/src/api/wallet.ts +5 -1
- package/src/contract/batch_call.ts +1 -1
- package/src/contract/contract_function_interaction.ts +17 -7
- package/src/contract/protocol_contracts/contract-class-registry.ts +3 -145
- package/src/fee/fee_juice_payment_method_with_claim.ts +5 -5
- package/src/fee/private_fee_payment_method.ts +7 -7
- package/src/fee/public_fee_payment_method.ts +8 -8
- package/src/fee/sponsored_fee_payment.ts +3 -3
- package/src/wallet/wallet.ts +82 -35
- package/dest/deployment/broadcast_function.d.ts +0 -24
- package/dest/deployment/broadcast_function.d.ts.map +0 -1
- package/dest/deployment/broadcast_function.js +0 -74
- package/src/deployment/broadcast_function.ts +0 -148
package/src/api/events.ts
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
import { type EventMetadataDefinition, EventSelector, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
|
|
4
|
+
import type { PublicEvent, PublicEventFilter } from '../wallet/wallet.js';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Returns decoded public events given search parameters.
|
|
6
8
|
* @param node - The node to request events from
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* @param eventMetadataDef - Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event
|
|
10
|
+
* @param filter - Filter options for the event query:
|
|
11
|
+
* - `contractAddress`: The address of the contract that emitted the events.
|
|
12
|
+
* - `txHash`: Transaction in which the events were emitted.
|
|
13
|
+
* - `fromBlock`: The block number from which to start fetching events (inclusive). Defaults to 1.
|
|
14
|
+
* - `toBlock`: The block number until which to fetch events (not inclusive). Defaults to latest + 1.
|
|
15
|
+
* @returns - The decoded events with metadata.
|
|
11
16
|
*/
|
|
12
|
-
export async function
|
|
17
|
+
export async function getPublicEvents<T>(
|
|
13
18
|
node: AztecNode,
|
|
14
19
|
eventMetadataDef: EventMetadataDefinition,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
): Promise<T[]> {
|
|
20
|
+
filter: PublicEventFilter,
|
|
21
|
+
): Promise<PublicEvent<T>[]> {
|
|
18
22
|
const { logs } = await node.getPublicLogs({
|
|
19
|
-
fromBlock:
|
|
20
|
-
toBlock:
|
|
23
|
+
fromBlock: filter.fromBlock ? Number(filter.fromBlock) : undefined,
|
|
24
|
+
toBlock: filter.toBlock ? Number(filter.toBlock) : undefined,
|
|
25
|
+
txHash: filter.txHash,
|
|
26
|
+
contractAddress: filter.contractAddress,
|
|
21
27
|
});
|
|
22
28
|
|
|
23
|
-
const decodedEvents =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`Something is weird here, we have matching EventSelectors, but the actual payload has mismatched length. Expected ${expectedLength}. Got ${log.log.fields.length}.`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
29
|
+
const decodedEvents: PublicEvent<T>[] = [];
|
|
30
|
+
|
|
31
|
+
for (const log of logs) {
|
|
32
|
+
const logFields = log.log.getEmittedFields();
|
|
33
|
+
// Event selector is at the last position of the emitted fields
|
|
34
|
+
const logEventSelector = EventSelector.fromField(logFields[logFields.length - 1]);
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
36
|
+
if (!logEventSelector.equals(eventMetadataDef.eventSelector)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
decodedEvents.push({
|
|
41
|
+
event: decodeFromAbi([eventMetadataDef.abiType], log.log.fields) as T,
|
|
42
|
+
metadata: {
|
|
43
|
+
l2BlockNumber: log.id.blockNumber,
|
|
44
|
+
l2BlockHash: log.id.blockHash,
|
|
45
|
+
txHash: log.id.txHash,
|
|
46
|
+
contractAddress: log.log.contractAddress,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
42
50
|
|
|
43
51
|
return decodedEvents;
|
|
44
52
|
}
|
package/src/api/fields.ts
CHANGED
package/src/api/wallet.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type Aliased,
|
|
3
3
|
type SimulateOptions,
|
|
4
|
+
type SimulateUtilityOptions,
|
|
4
5
|
type ProfileOptions,
|
|
5
6
|
type SendOptions,
|
|
6
7
|
type BatchableMethods,
|
|
@@ -11,11 +12,12 @@ export {
|
|
|
11
12
|
type Wallet,
|
|
12
13
|
type PrivateEvent,
|
|
13
14
|
type PrivateEventFilter,
|
|
15
|
+
type PublicEvent,
|
|
16
|
+
type PublicEventFilter,
|
|
14
17
|
type ContractMetadata,
|
|
15
18
|
type ContractClassMetadata,
|
|
16
19
|
AppCapabilitiesSchema,
|
|
17
20
|
WalletCapabilitiesSchema,
|
|
18
|
-
FunctionCallSchema,
|
|
19
21
|
ExecutionPayloadSchema,
|
|
20
22
|
GasSettingsOptionSchema,
|
|
21
23
|
WalletSimulationFeeOptionSchema,
|
|
@@ -28,6 +30,8 @@ export {
|
|
|
28
30
|
EventMetadataDefinitionSchema,
|
|
29
31
|
PrivateEventSchema,
|
|
30
32
|
PrivateEventFilterSchema,
|
|
33
|
+
PublicEventSchema,
|
|
34
|
+
PublicEventFilterSchema,
|
|
31
35
|
ContractClassMetadataSchema,
|
|
32
36
|
ContractMetadataSchema,
|
|
33
37
|
WalletSchema,
|
|
@@ -82,7 +82,7 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
82
82
|
for (const [call] of utility) {
|
|
83
83
|
batchRequests.push({
|
|
84
84
|
name: 'simulateUtility' as const,
|
|
85
|
-
args: [call, options
|
|
85
|
+
args: [call, { scope: options.from, authWitnesses: options.authWitnesses }],
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type FunctionAbi,
|
|
3
|
+
FunctionCall,
|
|
4
|
+
FunctionSelector,
|
|
5
|
+
FunctionType,
|
|
6
|
+
decodeFromAbi,
|
|
7
|
+
encodeArguments,
|
|
8
|
+
} from '@aztec/stdlib/abi';
|
|
2
9
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
11
|
import { type Capsule, type HashedValues, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
|
|
@@ -43,16 +50,16 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
43
50
|
*/
|
|
44
51
|
public async getFunctionCall() {
|
|
45
52
|
const args = encodeArguments(this.functionDao, this.args);
|
|
46
|
-
return {
|
|
53
|
+
return FunctionCall.from({
|
|
47
54
|
name: this.functionDao.name,
|
|
48
|
-
|
|
55
|
+
to: this.contractAddress,
|
|
49
56
|
selector: await FunctionSelector.fromNameAndParameters(this.functionDao.name, this.functionDao.parameters),
|
|
50
57
|
type: this.functionDao.functionType,
|
|
51
|
-
to: this.contractAddress,
|
|
52
|
-
isStatic: this.functionDao.isStatic,
|
|
53
58
|
hideMsgSender: false /** Only set to `true` for enqueued public function calls */,
|
|
59
|
+
isStatic: this.functionDao.isStatic,
|
|
60
|
+
args,
|
|
54
61
|
returnTypes: this.functionDao.returnTypes,
|
|
55
|
-
};
|
|
62
|
+
});
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
/**
|
|
@@ -104,7 +111,10 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
104
111
|
// docs:end:simulate
|
|
105
112
|
if (this.functionDao.functionType == FunctionType.UTILITY) {
|
|
106
113
|
const call = await this.getFunctionCall();
|
|
107
|
-
const utilityResult = await this.wallet.simulateUtility(call,
|
|
114
|
+
const utilityResult = await this.wallet.simulateUtility(call, {
|
|
115
|
+
scope: options.from,
|
|
116
|
+
authWitnesses: options.authWitnesses,
|
|
117
|
+
});
|
|
108
118
|
|
|
109
119
|
// Decode the raw field elements to the actual return type
|
|
110
120
|
const returnValue = utilityResult.result ? decodeFromAbi(this.functionDao.returnTypes, utilityResult.result) : [];
|
|
@@ -19,127 +19,6 @@ import { ContractFunctionInteraction } from '../contract_function_interaction.js
|
|
|
19
19
|
const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
20
20
|
name: 'ContractClassRegistry',
|
|
21
21
|
functions: [
|
|
22
|
-
{
|
|
23
|
-
...{
|
|
24
|
-
functionType: FunctionType.PRIVATE,
|
|
25
|
-
name: 'broadcast_private_function',
|
|
26
|
-
isOnlySelf: false,
|
|
27
|
-
isStatic: false,
|
|
28
|
-
isInitializer: false,
|
|
29
|
-
parameters: [
|
|
30
|
-
{
|
|
31
|
-
name: 'contract_class_id',
|
|
32
|
-
type: {
|
|
33
|
-
kind: 'struct',
|
|
34
|
-
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
35
|
-
path: 'aztec::protocol_types::contract_class_id::ContractClassId',
|
|
36
|
-
},
|
|
37
|
-
visibility: 'private',
|
|
38
|
-
},
|
|
39
|
-
{ name: 'artifact_metadata_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
40
|
-
{ name: 'utility_functions_artifact_tree_root', type: { kind: 'field' }, visibility: 'private' },
|
|
41
|
-
{
|
|
42
|
-
name: 'private_function_tree_sibling_path',
|
|
43
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
44
|
-
visibility: 'private',
|
|
45
|
-
},
|
|
46
|
-
{ name: 'private_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
47
|
-
{
|
|
48
|
-
name: 'artifact_function_tree_sibling_path',
|
|
49
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
50
|
-
visibility: 'private',
|
|
51
|
-
},
|
|
52
|
-
{ name: 'artifact_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
53
|
-
{
|
|
54
|
-
name: 'function_data',
|
|
55
|
-
type: {
|
|
56
|
-
kind: 'struct',
|
|
57
|
-
fields: [
|
|
58
|
-
{
|
|
59
|
-
name: 'selector',
|
|
60
|
-
type: {
|
|
61
|
-
kind: 'struct',
|
|
62
|
-
fields: [{ name: 'inner', type: { kind: 'integer', sign: 'unsigned', width: 32 } }],
|
|
63
|
-
path: 'aztec::protocol_types::abis::function_selector::FunctionSelector',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{ name: 'metadata_hash', type: { kind: 'field' } },
|
|
67
|
-
{ name: 'vk_hash', type: { kind: 'field' } },
|
|
68
|
-
],
|
|
69
|
-
path: 'events::private_function_broadcasted::InnerPrivateFunction',
|
|
70
|
-
},
|
|
71
|
-
visibility: 'private',
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
returnTypes: [],
|
|
75
|
-
errorTypes: {
|
|
76
|
-
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
77
|
-
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
78
|
-
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
79
|
-
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
80
|
-
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
bytecode: Buffer.from([]),
|
|
84
|
-
debugSymbols: '',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
...{
|
|
88
|
-
functionType: FunctionType.PRIVATE,
|
|
89
|
-
name: 'broadcast_utility_function',
|
|
90
|
-
isOnlySelf: false,
|
|
91
|
-
isStatic: false,
|
|
92
|
-
isInitializer: false,
|
|
93
|
-
parameters: [
|
|
94
|
-
{
|
|
95
|
-
name: 'contract_class_id',
|
|
96
|
-
type: {
|
|
97
|
-
kind: 'struct',
|
|
98
|
-
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
99
|
-
path: 'aztec::protocol_types::contract_class_id::ContractClassId',
|
|
100
|
-
},
|
|
101
|
-
visibility: 'private',
|
|
102
|
-
},
|
|
103
|
-
{ name: 'artifact_metadata_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
104
|
-
{ name: 'private_functions_artifact_tree_root', type: { kind: 'field' }, visibility: 'private' },
|
|
105
|
-
{
|
|
106
|
-
name: 'artifact_function_tree_sibling_path',
|
|
107
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
108
|
-
visibility: 'private',
|
|
109
|
-
},
|
|
110
|
-
{ name: 'artifact_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
111
|
-
{
|
|
112
|
-
name: 'function_data',
|
|
113
|
-
type: {
|
|
114
|
-
kind: 'struct',
|
|
115
|
-
fields: [
|
|
116
|
-
{
|
|
117
|
-
name: 'selector',
|
|
118
|
-
type: {
|
|
119
|
-
kind: 'struct',
|
|
120
|
-
fields: [{ name: 'inner', type: { kind: 'integer', sign: 'unsigned', width: 32 } }],
|
|
121
|
-
path: 'aztec::protocol_types::abis::function_selector::FunctionSelector',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{ name: 'metadata_hash', type: { kind: 'field' } },
|
|
125
|
-
],
|
|
126
|
-
path: 'events::utility_function_broadcasted::InnerUtilityFunction',
|
|
127
|
-
},
|
|
128
|
-
visibility: 'private',
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
returnTypes: [],
|
|
132
|
-
errorTypes: {
|
|
133
|
-
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
134
|
-
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
135
|
-
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
136
|
-
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
137
|
-
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
bytecode: Buffer.from([]),
|
|
141
|
-
debugSymbols: '',
|
|
142
|
-
},
|
|
143
22
|
{
|
|
144
23
|
...{
|
|
145
24
|
functionType: FunctionType.PRIVATE,
|
|
@@ -157,13 +36,16 @@ const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
|
157
36
|
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
158
37
|
'922421554006670918': { error_kind: 'string', string: 'num_items is greater than MAX_ITEMS' },
|
|
159
38
|
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
39
|
+
'9475115977882098926': { error_kind: 'string', string: 'Extra bytes in the last field of the bytecode' },
|
|
160
40
|
'10965409165809799877': {
|
|
161
41
|
error_kind: 'string',
|
|
162
42
|
string: 'Given in_len to absorb is larger than the input array len',
|
|
163
43
|
},
|
|
44
|
+
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
164
45
|
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
165
46
|
'15669273164684982983': { error_kind: 'string', string: 'num_permutations is greater than MAX_PERMUTATIONS' },
|
|
166
47
|
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
48
|
+
'15835548349546956319': { error_kind: 'string', string: 'Field failed to decompose into specified 32 limbs' },
|
|
167
49
|
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
168
50
|
'16450579948625159707': { error_kind: 'string', string: 'Sponge must be in cache_size=1' },
|
|
169
51
|
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
@@ -203,30 +85,6 @@ export class ContractClassRegistryContract extends ContractBase {
|
|
|
203
85
|
}
|
|
204
86
|
|
|
205
87
|
declare public methods: {
|
|
206
|
-
/** broadcast_private_function(contract_class_id: struct, artifact_metadata_hash: field, utility_functions_artifact_tree_root: field, private_function_tree_sibling_path: array, private_function_tree_leaf_index: field, artifact_function_tree_sibling_path: array, artifact_function_tree_leaf_index: field, function_data: struct) */
|
|
207
|
-
broadcast_private_function: ((
|
|
208
|
-
contract_class_id: WrappedFieldLike,
|
|
209
|
-
artifact_metadata_hash: FieldLike,
|
|
210
|
-
utility_functions_artifact_tree_root: FieldLike,
|
|
211
|
-
private_function_tree_sibling_path: FieldLike[],
|
|
212
|
-
private_function_tree_leaf_index: FieldLike,
|
|
213
|
-
artifact_function_tree_sibling_path: FieldLike[],
|
|
214
|
-
artifact_function_tree_leaf_index: FieldLike,
|
|
215
|
-
function_data: { selector: FunctionSelectorLike; metadata_hash: FieldLike; vk_hash: FieldLike },
|
|
216
|
-
) => ContractFunctionInteraction) &
|
|
217
|
-
Pick<ContractMethod, 'selector'>;
|
|
218
|
-
|
|
219
|
-
/** broadcast_utility_function(contract_class_id: struct, artifact_metadata_hash: field, private_functions_artifact_tree_root: field, artifact_function_tree_sibling_path: array, artifact_function_tree_leaf_index: field, function_data: struct) */
|
|
220
|
-
broadcast_utility_function: ((
|
|
221
|
-
contract_class_id: WrappedFieldLike,
|
|
222
|
-
artifact_metadata_hash: FieldLike,
|
|
223
|
-
private_functions_artifact_tree_root: FieldLike,
|
|
224
|
-
artifact_function_tree_sibling_path: FieldLike[],
|
|
225
|
-
artifact_function_tree_leaf_index: FieldLike,
|
|
226
|
-
function_data: { selector: FunctionSelectorLike; metadata_hash: FieldLike },
|
|
227
|
-
) => ContractFunctionInteraction) &
|
|
228
|
-
Pick<ContractMethod, 'selector'>;
|
|
229
|
-
|
|
230
88
|
/** public_dispatch(selector: field) */
|
|
231
89
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
232
90
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
|
+
import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
6
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -27,10 +27,11 @@ export class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
|
27
27
|
|
|
28
28
|
return new ExecutionPayload(
|
|
29
29
|
[
|
|
30
|
-
{
|
|
31
|
-
to: ProtocolContractAddress.FeeJuice,
|
|
30
|
+
FunctionCall.from({
|
|
32
31
|
name: 'claim_and_end_setup',
|
|
32
|
+
to: ProtocolContractAddress.FeeJuice,
|
|
33
33
|
selector,
|
|
34
|
+
type: FunctionType.PRIVATE,
|
|
34
35
|
hideMsgSender: false,
|
|
35
36
|
isStatic: false,
|
|
36
37
|
args: [
|
|
@@ -40,8 +41,7 @@ export class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
|
40
41
|
new Fr(this.claim.messageLeafIndex),
|
|
41
42
|
],
|
|
42
43
|
returnTypes: [],
|
|
43
|
-
|
|
44
|
-
},
|
|
44
|
+
}),
|
|
45
45
|
],
|
|
46
46
|
[],
|
|
47
47
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { type FunctionAbi, FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -102,21 +102,21 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
102
102
|
|
|
103
103
|
const witness = await this.wallet.createAuthWit(this.sender, {
|
|
104
104
|
caller: this.paymentContract,
|
|
105
|
-
call: {
|
|
105
|
+
call: FunctionCall.from({
|
|
106
106
|
name: 'transfer_to_public',
|
|
107
|
-
|
|
107
|
+
to: await this.getAsset(),
|
|
108
108
|
selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
|
|
109
109
|
type: FunctionType.PRIVATE,
|
|
110
110
|
hideMsgSender: false,
|
|
111
111
|
isStatic: false,
|
|
112
|
-
|
|
112
|
+
args: [this.sender.toField(), this.paymentContract.toField(), maxFee, txNonce],
|
|
113
113
|
returnTypes: [],
|
|
114
|
-
},
|
|
114
|
+
}),
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
return new ExecutionPayload(
|
|
118
118
|
[
|
|
119
|
-
{
|
|
119
|
+
FunctionCall.from({
|
|
120
120
|
name: 'fee_entrypoint_private',
|
|
121
121
|
to: this.paymentContract,
|
|
122
122
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_private(u128,Field)'),
|
|
@@ -125,7 +125,7 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
125
125
|
isStatic: false,
|
|
126
126
|
args: [maxFee, txNonce],
|
|
127
127
|
returnTypes: [],
|
|
128
|
-
},
|
|
128
|
+
}),
|
|
129
129
|
],
|
|
130
130
|
[witness],
|
|
131
131
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { type FunctionAbi, FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -94,16 +94,16 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
94
94
|
|
|
95
95
|
const intent = {
|
|
96
96
|
caller: this.paymentContract,
|
|
97
|
-
call: {
|
|
97
|
+
call: FunctionCall.from({
|
|
98
98
|
name: 'transfer_in_public',
|
|
99
|
-
|
|
99
|
+
to: await this.getAsset(),
|
|
100
100
|
selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
|
|
101
101
|
type: FunctionType.PUBLIC,
|
|
102
|
-
isStatic: false,
|
|
103
102
|
hideMsgSender: false /** The target function performs an authwit check, so msg_sender is needed */,
|
|
104
|
-
|
|
103
|
+
isStatic: false,
|
|
104
|
+
args: [this.sender.toField(), this.paymentContract.toField(), maxFee, txNonce],
|
|
105
105
|
returnTypes: [],
|
|
106
|
-
},
|
|
106
|
+
}),
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(
|
|
@@ -116,7 +116,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
116
116
|
return new ExecutionPayload(
|
|
117
117
|
[
|
|
118
118
|
...(await setPublicAuthWitInteraction.request()).calls,
|
|
119
|
-
{
|
|
119
|
+
FunctionCall.from({
|
|
120
120
|
name: 'fee_entrypoint_public',
|
|
121
121
|
to: this.paymentContract,
|
|
122
122
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
|
|
@@ -125,7 +125,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
125
125
|
isStatic: false,
|
|
126
126
|
args: [maxFee, txNonce],
|
|
127
127
|
returnTypes: [],
|
|
128
|
-
},
|
|
128
|
+
}),
|
|
129
129
|
],
|
|
130
130
|
[],
|
|
131
131
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
2
|
+
import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -22,7 +22,7 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
22
22
|
async getExecutionPayload(): Promise<ExecutionPayload> {
|
|
23
23
|
return new ExecutionPayload(
|
|
24
24
|
[
|
|
25
|
-
{
|
|
25
|
+
FunctionCall.from({
|
|
26
26
|
name: 'sponsor_unconditionally',
|
|
27
27
|
to: this.paymentContract,
|
|
28
28
|
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
@@ -31,7 +31,7 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
31
31
|
isStatic: false,
|
|
32
32
|
args: [],
|
|
33
33
|
returnTypes: [],
|
|
34
|
-
},
|
|
34
|
+
}),
|
|
35
35
|
],
|
|
36
36
|
[],
|
|
37
37
|
[],
|