@aztec/aztec.js 0.0.1-commit.d6f2b3f94 → 0.0.1-commit.dbf9cec
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/wallet.d.ts +2 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/contract/batch_call.d.ts +3 -3
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +8 -5
- package/dest/contract/contract_function_interaction.d.ts +1 -1
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +4 -1
- package/dest/contract/deploy_method.d.ts +19 -6
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +25 -10
- package/dest/contract/get_gas_limits.js +3 -3
- package/dest/contract/interaction_options.d.ts +8 -1
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts +10 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.js +498 -59
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +12 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +9 -1
- package/dest/contract/protocol_contracts/public-checks.d.ts +1 -1
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/public-checks.js +9 -1
- package/dest/wallet/capabilities.d.ts +13 -5
- package/dest/wallet/capabilities.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.d.ts +15 -4
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +26 -0
- package/dest/wallet/wallet.d.ts +162 -15
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +14 -5
- package/package.json +10 -10
- package/src/api/wallet.ts +1 -0
- package/src/contract/batch_call.ts +7 -12
- package/src/contract/contract_function_interaction.ts +4 -1
- package/src/contract/deploy_method.ts +48 -14
- package/src/contract/get_gas_limits.ts +3 -3
- package/src/contract/interaction_options.ts +7 -0
- package/src/contract/protocol_contracts/auth-registry.ts +237 -37
- package/src/contract/protocol_contracts/contract-class-registry.ts +3 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +3 -1
- package/src/contract/protocol_contracts/public-checks.ts +3 -1
- package/src/wallet/capabilities.ts +13 -4
- package/src/wallet/deploy_account_method.ts +39 -2
- package/src/wallet/wallet.ts +24 -5
|
@@ -21,38 +21,33 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
21
21
|
functions: [
|
|
22
22
|
{
|
|
23
23
|
...{
|
|
24
|
-
functionType: FunctionType.
|
|
25
|
-
name: '
|
|
24
|
+
functionType: FunctionType.PRIVATE,
|
|
25
|
+
name: 'set_authorized_private',
|
|
26
26
|
isOnlySelf: false,
|
|
27
27
|
isStatic: false,
|
|
28
28
|
isInitializer: false,
|
|
29
|
-
parameters: [
|
|
29
|
+
parameters: [
|
|
30
|
+
{
|
|
31
|
+
name: 'approver',
|
|
32
|
+
type: {
|
|
33
|
+
kind: 'struct',
|
|
34
|
+
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
35
|
+
path: 'aztec::protocol_types::address::aztec_address::AztecAddress',
|
|
36
|
+
},
|
|
37
|
+
visibility: 'private',
|
|
38
|
+
},
|
|
39
|
+
{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
40
|
+
{ name: 'authorize', type: { kind: 'boolean' }, visibility: 'private' },
|
|
41
|
+
],
|
|
30
42
|
returnTypes: [],
|
|
31
43
|
errorTypes: {
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
error_kind: 'string',
|
|
37
|
-
string: 'Function is_reject_all can only be called statically',
|
|
38
|
-
},
|
|
39
|
-
'12511970388699677811': { error_kind: 'fmtstring', length: 27, item_types: [{ kind: 'field' }] },
|
|
40
|
-
'13455385521185560676': {
|
|
41
|
-
error_kind: 'string',
|
|
42
|
-
string: 'Storage slot 0 not allowed. Storage slots must start from 1.',
|
|
43
|
-
},
|
|
44
|
-
'13929691561421487185': {
|
|
45
|
-
error_kind: 'string',
|
|
46
|
-
string: 'Function _set_authorized can only be called by the same contract',
|
|
47
|
-
},
|
|
44
|
+
'7555607922535724711': { error_kind: 'string', string: 'Preimage mismatch' },
|
|
45
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
46
|
+
'9894212961085021188': { error_kind: 'string', string: 'Message not authorized by account' },
|
|
47
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
48
48
|
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
49
49
|
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
50
50
|
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
51
|
-
'17089945683942782951': { error_kind: 'string', string: 'unauthorized' },
|
|
52
|
-
'17312933876399746100': {
|
|
53
|
-
error_kind: 'string',
|
|
54
|
-
string: 'Function is_consumable can only be called statically',
|
|
55
|
-
},
|
|
56
51
|
},
|
|
57
52
|
},
|
|
58
53
|
bytecode: Buffer.from([]),
|
|
@@ -60,14 +55,14 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
60
55
|
},
|
|
61
56
|
{
|
|
62
57
|
...{
|
|
63
|
-
functionType: FunctionType.
|
|
64
|
-
name: '
|
|
58
|
+
functionType: FunctionType.UTILITY,
|
|
59
|
+
name: 'utility_is_consumable',
|
|
65
60
|
isOnlySelf: false,
|
|
66
61
|
isStatic: false,
|
|
67
62
|
isInitializer: false,
|
|
68
63
|
parameters: [
|
|
69
64
|
{
|
|
70
|
-
name: '
|
|
65
|
+
name: 'on_behalf_of',
|
|
71
66
|
type: {
|
|
72
67
|
kind: 'struct',
|
|
73
68
|
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
@@ -76,14 +71,18 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
76
71
|
visibility: 'private',
|
|
77
72
|
},
|
|
78
73
|
{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
79
|
-
{ name: 'authorize', type: { kind: 'boolean' }, visibility: 'private' },
|
|
80
74
|
],
|
|
81
|
-
returnTypes: [],
|
|
75
|
+
returnTypes: [{ kind: 'boolean' }],
|
|
82
76
|
errorTypes: {
|
|
83
|
-
'
|
|
84
|
-
'
|
|
77
|
+
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
78
|
+
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
79
|
+
'13455385521185560676': {
|
|
80
|
+
error_kind: 'string',
|
|
81
|
+
string: 'Storage slot 0 not allowed. Storage slots must start from 1.',
|
|
82
|
+
},
|
|
85
83
|
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
86
84
|
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
85
|
+
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
87
86
|
},
|
|
88
87
|
},
|
|
89
88
|
bytecode: Buffer.from([]),
|
|
@@ -92,33 +91,219 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
92
91
|
{
|
|
93
92
|
...{
|
|
94
93
|
functionType: FunctionType.UTILITY,
|
|
95
|
-
name: '
|
|
94
|
+
name: 'process_message',
|
|
96
95
|
isOnlySelf: false,
|
|
97
96
|
isStatic: false,
|
|
98
97
|
isInitializer: false,
|
|
99
98
|
parameters: [
|
|
100
99
|
{
|
|
101
|
-
name: '
|
|
100
|
+
name: 'message_ciphertext',
|
|
102
101
|
type: {
|
|
103
102
|
kind: 'struct',
|
|
104
|
-
fields: [
|
|
105
|
-
|
|
103
|
+
fields: [
|
|
104
|
+
{ name: 'storage', type: { kind: 'array', length: 15, type: { kind: 'field' } } },
|
|
105
|
+
{ name: 'len', type: { kind: 'integer', sign: 'unsigned', width: 32 } },
|
|
106
|
+
],
|
|
107
|
+
path: 'std::collections::bounded_vec::BoundedVec',
|
|
108
|
+
},
|
|
109
|
+
visibility: 'private',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'message_context',
|
|
113
|
+
type: {
|
|
114
|
+
kind: 'struct',
|
|
115
|
+
fields: [
|
|
116
|
+
{ name: 'tx_hash', type: { kind: 'field' } },
|
|
117
|
+
{
|
|
118
|
+
name: 'unique_note_hashes_in_tx',
|
|
119
|
+
type: {
|
|
120
|
+
kind: 'struct',
|
|
121
|
+
fields: [
|
|
122
|
+
{ name: 'storage', type: { kind: 'array', length: 64, type: { kind: 'field' } } },
|
|
123
|
+
{ name: 'len', type: { kind: 'integer', sign: 'unsigned', width: 32 } },
|
|
124
|
+
],
|
|
125
|
+
path: 'std::collections::bounded_vec::BoundedVec',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{ name: 'first_nullifier_in_tx', type: { kind: 'field' } },
|
|
129
|
+
{
|
|
130
|
+
name: 'recipient',
|
|
131
|
+
type: {
|
|
132
|
+
kind: 'struct',
|
|
133
|
+
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
134
|
+
path: 'aztec::protocol_types::address::aztec_address::AztecAddress',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
path: 'aztec::messages::processing::message_context::MessageContext',
|
|
106
139
|
},
|
|
107
140
|
visibility: 'private',
|
|
108
141
|
},
|
|
109
|
-
{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
110
142
|
],
|
|
111
|
-
returnTypes: [
|
|
143
|
+
returnTypes: [],
|
|
144
|
+
errorTypes: {
|
|
145
|
+
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
146
|
+
'992401946138144806': { error_kind: 'string', string: 'Attempted to read past end of BoundedVec' },
|
|
147
|
+
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
148
|
+
'2967937905572420042': {
|
|
149
|
+
error_kind: 'fmtstring',
|
|
150
|
+
length: 61,
|
|
151
|
+
item_types: [{ kind: 'field' }, { kind: 'field' }],
|
|
152
|
+
},
|
|
153
|
+
'3330370348214585450': {
|
|
154
|
+
error_kind: 'fmtstring',
|
|
155
|
+
length: 48,
|
|
156
|
+
item_types: [{ kind: 'field' }, { kind: 'field' }],
|
|
157
|
+
},
|
|
158
|
+
'3670003311596808700': {
|
|
159
|
+
error_kind: 'fmtstring',
|
|
160
|
+
length: 77,
|
|
161
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
162
|
+
},
|
|
163
|
+
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
164
|
+
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
165
|
+
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
166
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
167
|
+
'9791669845391776238': {
|
|
168
|
+
error_kind: 'string',
|
|
169
|
+
string: '0 has a square root; you cannot claim it is not square',
|
|
170
|
+
},
|
|
171
|
+
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
172
|
+
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
173
|
+
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
174
|
+
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
175
|
+
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
176
|
+
'13557316507370296400': {
|
|
177
|
+
error_kind: 'fmtstring',
|
|
178
|
+
length: 130,
|
|
179
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
180
|
+
},
|
|
181
|
+
'14938672389828944159': {
|
|
182
|
+
error_kind: 'fmtstring',
|
|
183
|
+
length: 146,
|
|
184
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
185
|
+
},
|
|
186
|
+
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
187
|
+
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
188
|
+
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
189
|
+
'17531474008201752295': {
|
|
190
|
+
error_kind: 'fmtstring',
|
|
191
|
+
length: 133,
|
|
192
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
bytecode: Buffer.from([]),
|
|
197
|
+
debugSymbols: '',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
...{
|
|
201
|
+
functionType: FunctionType.PUBLIC,
|
|
202
|
+
name: 'public_dispatch',
|
|
203
|
+
isOnlySelf: false,
|
|
204
|
+
isStatic: false,
|
|
205
|
+
isInitializer: false,
|
|
206
|
+
parameters: [{ name: 'selector', type: { kind: 'field' }, visibility: 'private' }],
|
|
207
|
+
returnTypes: [],
|
|
112
208
|
errorTypes: {
|
|
113
209
|
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
114
210
|
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
211
|
+
'5525725861591553972': { error_kind: 'string', string: 'rejecting all' },
|
|
212
|
+
'11691217184967371519': {
|
|
213
|
+
error_kind: 'string',
|
|
214
|
+
string: 'Function is_reject_all can only be called statically',
|
|
215
|
+
},
|
|
216
|
+
'12511970388699677811': { error_kind: 'fmtstring', length: 27, item_types: [{ kind: 'field' }] },
|
|
115
217
|
'13455385521185560676': {
|
|
116
218
|
error_kind: 'string',
|
|
117
219
|
string: 'Storage slot 0 not allowed. Storage slots must start from 1.',
|
|
118
220
|
},
|
|
221
|
+
'13929691561421487185': {
|
|
222
|
+
error_kind: 'string',
|
|
223
|
+
string: 'Function _set_authorized can only be called by the same contract',
|
|
224
|
+
},
|
|
119
225
|
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
120
226
|
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
121
227
|
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
228
|
+
'17089945683942782951': { error_kind: 'string', string: 'unauthorized' },
|
|
229
|
+
'17312933876399746100': {
|
|
230
|
+
error_kind: 'string',
|
|
231
|
+
string: 'Function is_consumable can only be called statically',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
bytecode: Buffer.from([]),
|
|
236
|
+
debugSymbols: '',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
...{
|
|
240
|
+
functionType: FunctionType.UTILITY,
|
|
241
|
+
name: 'sync_state',
|
|
242
|
+
isOnlySelf: false,
|
|
243
|
+
isStatic: false,
|
|
244
|
+
isInitializer: false,
|
|
245
|
+
parameters: [],
|
|
246
|
+
returnTypes: [],
|
|
247
|
+
errorTypes: {
|
|
248
|
+
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
249
|
+
'992401946138144806': { error_kind: 'string', string: 'Attempted to read past end of BoundedVec' },
|
|
250
|
+
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
251
|
+
'2967937905572420042': {
|
|
252
|
+
error_kind: 'fmtstring',
|
|
253
|
+
length: 61,
|
|
254
|
+
item_types: [{ kind: 'field' }, { kind: 'field' }],
|
|
255
|
+
},
|
|
256
|
+
'3330370348214585450': {
|
|
257
|
+
error_kind: 'fmtstring',
|
|
258
|
+
length: 48,
|
|
259
|
+
item_types: [{ kind: 'field' }, { kind: 'field' }],
|
|
260
|
+
},
|
|
261
|
+
'3670003311596808700': {
|
|
262
|
+
error_kind: 'fmtstring',
|
|
263
|
+
length: 77,
|
|
264
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
265
|
+
},
|
|
266
|
+
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
267
|
+
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
268
|
+
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
269
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
270
|
+
'9791669845391776238': {
|
|
271
|
+
error_kind: 'string',
|
|
272
|
+
string: '0 has a square root; you cannot claim it is not square',
|
|
273
|
+
},
|
|
274
|
+
'9885968605480832328': {
|
|
275
|
+
error_kind: 'string',
|
|
276
|
+
string: 'Attempted to read past the length of a CapsuleArray',
|
|
277
|
+
},
|
|
278
|
+
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
279
|
+
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
280
|
+
'11021520179822076911': {
|
|
281
|
+
error_kind: 'string',
|
|
282
|
+
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
283
|
+
},
|
|
284
|
+
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
285
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
286
|
+
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
287
|
+
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
288
|
+
'13557316507370296400': {
|
|
289
|
+
error_kind: 'fmtstring',
|
|
290
|
+
length: 130,
|
|
291
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
292
|
+
},
|
|
293
|
+
'14938672389828944159': {
|
|
294
|
+
error_kind: 'fmtstring',
|
|
295
|
+
length: 146,
|
|
296
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
297
|
+
},
|
|
298
|
+
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
299
|
+
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
300
|
+
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
301
|
+
'17531474008201752295': {
|
|
302
|
+
error_kind: 'fmtstring',
|
|
303
|
+
length: 133,
|
|
304
|
+
item_types: [{ kind: 'integer', sign: 'unsigned', width: 32 }],
|
|
305
|
+
},
|
|
306
|
+
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
122
307
|
},
|
|
123
308
|
},
|
|
124
309
|
bytecode: Buffer.from([]),
|
|
@@ -326,6 +511,18 @@ export class AuthRegistryContract extends ContractBase {
|
|
|
326
511
|
/** is_reject_all(on_behalf_of: struct) */
|
|
327
512
|
is_reject_all: ((on_behalf_of: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
328
513
|
|
|
514
|
+
/** process_message(message_ciphertext: struct, message_context: struct) */
|
|
515
|
+
process_message: ((
|
|
516
|
+
message_ciphertext: FieldLike[],
|
|
517
|
+
message_context: {
|
|
518
|
+
tx_hash: FieldLike;
|
|
519
|
+
unique_note_hashes_in_tx: FieldLike[];
|
|
520
|
+
first_nullifier_in_tx: FieldLike;
|
|
521
|
+
recipient: AztecAddressLike;
|
|
522
|
+
},
|
|
523
|
+
) => ContractFunctionInteraction) &
|
|
524
|
+
Pick<ContractMethod, 'selector'>;
|
|
525
|
+
|
|
329
526
|
/** public_dispatch(selector: field) */
|
|
330
527
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
331
528
|
|
|
@@ -344,6 +541,9 @@ export class AuthRegistryContract extends ContractBase {
|
|
|
344
541
|
/** set_reject_all(reject: boolean) */
|
|
345
542
|
set_reject_all: ((reject: boolean) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
346
543
|
|
|
544
|
+
/** sync_state() */
|
|
545
|
+
sync_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
546
|
+
|
|
347
547
|
/** utility_is_consumable(on_behalf_of: struct, message_hash: field) */
|
|
348
548
|
utility_is_consumable: ((on_behalf_of: AztecAddressLike, message_hash: FieldLike) => ContractFunctionInteraction) &
|
|
349
549
|
Pick<ContractMethod, 'selector'>;
|
|
@@ -36,13 +36,16 @@ const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
|
36
36
|
'361444214588792908': { error_kind: 'string', string: 'attempt to multiply with overflow' },
|
|
37
37
|
'922421554006670918': { error_kind: 'string', string: 'num_items is greater than MAX_ITEMS' },
|
|
38
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' },
|
|
39
40
|
'10965409165809799877': {
|
|
40
41
|
error_kind: 'string',
|
|
41
42
|
string: 'Given in_len to absorb is larger than the input array len',
|
|
42
43
|
},
|
|
44
|
+
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
43
45
|
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
44
46
|
'15669273164684982983': { error_kind: 'string', string: 'num_permutations is greater than MAX_PERMUTATIONS' },
|
|
45
47
|
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
48
|
+
'15835548349546956319': { error_kind: 'string', string: 'Field failed to decompose into specified 32 limbs' },
|
|
46
49
|
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
47
50
|
'16450579948625159707': { error_kind: 'string', string: 'Sponge must be in cache_size=1' },
|
|
48
51
|
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
@@ -99,7 +99,7 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
99
99
|
type: {
|
|
100
100
|
kind: 'struct',
|
|
101
101
|
fields: [
|
|
102
|
-
{ name: 'storage', type: { kind: 'array', length:
|
|
102
|
+
{ name: 'storage', type: { kind: 'array', length: 15, type: { kind: 'field' } } },
|
|
103
103
|
{ name: 'len', type: { kind: 'integer', sign: 'unsigned', width: 32 } },
|
|
104
104
|
],
|
|
105
105
|
path: 'std::collections::bounded_vec::BoundedVec',
|
|
@@ -161,6 +161,7 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
161
161
|
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
162
162
|
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
163
163
|
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
164
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
164
165
|
'9791669845391776238': {
|
|
165
166
|
error_kind: 'string',
|
|
166
167
|
string: '0 has a square root; you cannot claim it is not square',
|
|
@@ -224,6 +225,7 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
224
225
|
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
225
226
|
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
226
227
|
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
228
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
227
229
|
'9791669845391776238': {
|
|
228
230
|
error_kind: 'string',
|
|
229
231
|
string: '0 has a square root; you cannot claim it is not square',
|
|
@@ -32,7 +32,7 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
32
32
|
type: {
|
|
33
33
|
kind: 'struct',
|
|
34
34
|
fields: [
|
|
35
|
-
{ name: 'storage', type: { kind: 'array', length:
|
|
35
|
+
{ name: 'storage', type: { kind: 'array', length: 15, type: { kind: 'field' } } },
|
|
36
36
|
{ name: 'len', type: { kind: 'integer', sign: 'unsigned', width: 32 } },
|
|
37
37
|
],
|
|
38
38
|
path: 'std::collections::bounded_vec::BoundedVec',
|
|
@@ -94,6 +94,7 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
94
94
|
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
95
95
|
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
96
96
|
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
97
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
97
98
|
'9791669845391776238': {
|
|
98
99
|
error_kind: 'string',
|
|
99
100
|
string: '0 has a square root; you cannot claim it is not square',
|
|
@@ -185,6 +186,7 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
185
186
|
'4261968856572588300': { error_kind: 'string', string: 'Value does not fit in field' },
|
|
186
187
|
'4440399188109668273': { error_kind: 'string', string: 'Input length must be a multiple of 32' },
|
|
187
188
|
'5417577161503694006': { error_kind: 'fmtstring', length: 56, item_types: [{ kind: 'field' }] },
|
|
189
|
+
'9530675838293881722': { error_kind: 'string', string: 'Writer did not write all data' },
|
|
188
190
|
'9791669845391776238': {
|
|
189
191
|
error_kind: 'string',
|
|
190
192
|
string: '0 has a square root; you cannot claim it is not square',
|
|
@@ -32,6 +32,15 @@ export interface ContractFunctionPattern {
|
|
|
32
32
|
|
|
33
33
|
/** Function name or '*' for any function */
|
|
34
34
|
function: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Additional addresses whose private state and keys are accessible
|
|
38
|
+
* when calling this function, beyond the sender's.
|
|
39
|
+
* - undefined: No additional scopes allowed
|
|
40
|
+
* - AztecAddress[]: Only these specific addresses allowed as additional scopes
|
|
41
|
+
* - '*': All known address allowed as an additional scope
|
|
42
|
+
*/
|
|
43
|
+
additionalScopes?: AztecAddress[] | '*';
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
/**
|
|
@@ -180,11 +189,11 @@ export interface ContractClassesCapability {
|
|
|
180
189
|
export interface GrantedContractClassesCapability extends ContractClassesCapability {}
|
|
181
190
|
|
|
182
191
|
/**
|
|
183
|
-
* Transaction simulation capability - for simulating transactions and utilities.
|
|
192
|
+
* Transaction simulation capability - for simulating transactions and executing utilities.
|
|
184
193
|
*
|
|
185
194
|
* Maps to wallet methods:
|
|
186
195
|
* - simulateTx (when transactions scope specified)
|
|
187
|
-
* -
|
|
196
|
+
* - executeUtility (when utilities scope specified)
|
|
188
197
|
* - profileTx (when transactions scope specified)
|
|
189
198
|
*
|
|
190
199
|
* @example
|
|
@@ -200,7 +209,7 @@ export interface GrantedContractClassesCapability extends ContractClassesCapabil
|
|
|
200
209
|
* \}
|
|
201
210
|
*
|
|
202
211
|
* @example
|
|
203
|
-
* // Simulate any transaction and utility call
|
|
212
|
+
* // Simulate any transaction and execute any utility call
|
|
204
213
|
* \{
|
|
205
214
|
* type: 'simulation',
|
|
206
215
|
* transactions: \{ scope: '*' \},
|
|
@@ -221,7 +230,7 @@ export interface SimulationCapability {
|
|
|
221
230
|
scope: '*' | ContractFunctionPattern[];
|
|
222
231
|
};
|
|
223
232
|
|
|
224
|
-
/** Utility
|
|
233
|
+
/** Utility execution scope (unconstrained calls). Maps to: executeUtility */
|
|
225
234
|
utilities?: {
|
|
226
235
|
/**
|
|
227
236
|
* Which contracts/functions to allow:
|
|
@@ -9,15 +9,22 @@ import type { Account } from '../account/account.js';
|
|
|
9
9
|
import type { Contract } from '../contract/contract.js';
|
|
10
10
|
import type { ContractBase } from '../contract/contract_base.js';
|
|
11
11
|
import {
|
|
12
|
+
type DeployInteractionWaitOptions,
|
|
12
13
|
DeployMethod,
|
|
14
|
+
type DeployOptions,
|
|
13
15
|
type DeployOptionsWithoutWait,
|
|
14
16
|
type RequestDeployOptions,
|
|
15
17
|
type SimulateDeployOptions,
|
|
16
18
|
} from '../contract/deploy_method.js';
|
|
17
|
-
import type {
|
|
19
|
+
import type {
|
|
20
|
+
FeePaymentMethodOption,
|
|
21
|
+
InteractionWaitOptions,
|
|
22
|
+
ProfileInteractionOptions,
|
|
23
|
+
} from '../contract/interaction_options.js';
|
|
24
|
+
import type { WaitOpts } from '../contract/wait_opts.js';
|
|
18
25
|
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
19
26
|
import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
|
|
20
|
-
import type { Wallet } from './index.js';
|
|
27
|
+
import type { ProfileOptions, SendOptions, SimulateOptions, Wallet } from './index.js';
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Extended fee payment method option for account deployments that includes entrypoint wrapping options
|
|
@@ -147,4 +154,34 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
147
154
|
deployer: options.from,
|
|
148
155
|
};
|
|
149
156
|
}
|
|
157
|
+
|
|
158
|
+
protected override convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
|
|
159
|
+
options: DeployOptions<W>,
|
|
160
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
161
|
+
): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
|
|
162
|
+
return super.convertDeployOptionsToSendOptions(this.injectContractAddressIntoScopes(options));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected override convertDeployOptionsToSimulateOptions(options: SimulateDeployOptions): SimulateOptions {
|
|
166
|
+
return super.convertDeployOptionsToSimulateOptions(this.injectContractAddressIntoScopes(options));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
protected override convertDeployOptionsToProfileOptions(
|
|
170
|
+
options: DeployOptionsWithoutWait & ProfileInteractionOptions,
|
|
171
|
+
): ProfileOptions {
|
|
172
|
+
return super.convertDeployOptionsToProfileOptions(this.injectContractAddressIntoScopes(options));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Injects the contract's own address into scopes so the constructor can access its own keys.
|
|
177
|
+
* @param options - The deploy options to augment with the contract address.
|
|
178
|
+
*/
|
|
179
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
180
|
+
private injectContractAddressIntoScopes<T extends { additionalScopes?: AztecAddress[] }>(options: T): T {
|
|
181
|
+
if (!this.address) {
|
|
182
|
+
throw new Error('Instance not yet constructed. This is a bug!');
|
|
183
|
+
}
|
|
184
|
+
const existing = options.additionalScopes ?? [];
|
|
185
|
+
return { ...options, additionalScopes: [...existing, this.address] };
|
|
186
|
+
}
|
|
150
187
|
}
|
package/src/wallet/wallet.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
TxProfileResult,
|
|
23
23
|
TxReceipt,
|
|
24
24
|
TxSimulationResult,
|
|
25
|
-
|
|
25
|
+
UtilityExecutionResult,
|
|
26
26
|
inTxSchema,
|
|
27
27
|
} from '@aztec/stdlib/tx';
|
|
28
28
|
|
|
@@ -225,6 +225,16 @@ export type ContractClassMetadata = {
|
|
|
225
225
|
isContractClassPubliclyRegistered: boolean;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Options for executing a utility function call.
|
|
230
|
+
*/
|
|
231
|
+
export type ExecuteUtilityOptions = {
|
|
232
|
+
/** The scope for the utility execution (determines which notes and keys are visible). */
|
|
233
|
+
scope: AztecAddress;
|
|
234
|
+
/** Optional auth witnesses to use during execution. */
|
|
235
|
+
authWitnesses?: AuthWitness[];
|
|
236
|
+
};
|
|
237
|
+
|
|
228
238
|
/**
|
|
229
239
|
* The wallet interface.
|
|
230
240
|
*/
|
|
@@ -245,7 +255,7 @@ export type Wallet = {
|
|
|
245
255
|
secretKey?: Fr,
|
|
246
256
|
): Promise<ContractInstanceWithAddress>;
|
|
247
257
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
248
|
-
|
|
258
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
249
259
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
250
260
|
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
251
261
|
exec: ExecutionPayload,
|
|
@@ -293,6 +303,7 @@ export const SendOptionsSchema = z.object({
|
|
|
293
303
|
capsules: optional(z.array(Capsule.schema)),
|
|
294
304
|
fee: optional(GasSettingsOptionSchema),
|
|
295
305
|
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
306
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
296
307
|
});
|
|
297
308
|
|
|
298
309
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -303,6 +314,7 @@ export const SimulateOptionsSchema = z.object({
|
|
|
303
314
|
skipTxValidation: optional(z.boolean()),
|
|
304
315
|
skipFeeEnforcement: optional(z.boolean()),
|
|
305
316
|
includeMetadata: optional(z.boolean()),
|
|
317
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
306
318
|
});
|
|
307
319
|
|
|
308
320
|
export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
@@ -369,6 +381,7 @@ export const ContractClassMetadataSchema = z.object({
|
|
|
369
381
|
export const ContractFunctionPatternSchema = z.object({
|
|
370
382
|
contract: z.union([schemas.AztecAddress, z.literal('*')]),
|
|
371
383
|
function: z.union([z.string(), z.literal('*')]),
|
|
384
|
+
additionalScopes: optional(z.union([z.array(schemas.AztecAddress), z.literal('*')])),
|
|
372
385
|
});
|
|
373
386
|
|
|
374
387
|
export const AccountsCapabilitySchema = z.object({
|
|
@@ -508,10 +521,16 @@ const WalletMethodSchemas = {
|
|
|
508
521
|
.args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
509
522
|
.returns(ContractInstanceWithAddressSchema),
|
|
510
523
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
511
|
-
|
|
524
|
+
executeUtility: z
|
|
512
525
|
.function()
|
|
513
|
-
.args(
|
|
514
|
-
|
|
526
|
+
.args(
|
|
527
|
+
FunctionCall.schema,
|
|
528
|
+
z.object({
|
|
529
|
+
scope: schemas.AztecAddress,
|
|
530
|
+
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
531
|
+
}),
|
|
532
|
+
)
|
|
533
|
+
.returns(UtilityExecutionResult.schema),
|
|
515
534
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
516
535
|
sendTx: z
|
|
517
536
|
.function()
|