@aztec/aztec.js 0.0.1-commit.8afd444 → 0.0.1-commit.8f9871590

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.
Files changed (46) hide show
  1. package/dest/api/contract.d.ts +2 -2
  2. package/dest/api/contract.js +2 -2
  3. package/dest/api/deployment.d.ts +1 -2
  4. package/dest/api/deployment.d.ts.map +1 -1
  5. package/dest/api/deployment.js +0 -1
  6. package/dest/api/events.d.ts +10 -6
  7. package/dest/api/events.d.ts.map +1 -1
  8. package/dest/api/events.js +30 -20
  9. package/dest/api/fields.d.ts +2 -1
  10. package/dest/api/fields.d.ts.map +1 -1
  11. package/dest/api/fields.js +1 -0
  12. package/dest/api/wallet.d.ts +2 -2
  13. package/dest/api/wallet.d.ts.map +1 -1
  14. package/dest/api/wallet.js +1 -1
  15. package/dest/contract/batch_call.js +4 -1
  16. package/dest/contract/contract_function_interaction.d.ts +3 -12
  17. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  18. package/dest/contract/contract_function_interaction.js +10 -7
  19. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +2 -13
  20. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
  21. package/dest/contract/protocol_contracts/contract-class-registry.js +12 -258
  22. package/dest/fee/fee_juice_payment_method_with_claim.js +6 -6
  23. package/dest/fee/private_fee_payment_method.js +10 -10
  24. package/dest/fee/public_fee_payment_method.js +10 -10
  25. package/dest/fee/sponsored_fee_payment.js +3 -3
  26. package/dest/wallet/wallet.d.ts +146 -76
  27. package/dest/wallet/wallet.d.ts.map +1 -1
  28. package/dest/wallet/wallet.js +25 -21
  29. package/package.json +19 -10
  30. package/src/api/contract.ts +2 -2
  31. package/src/api/deployment.ts +0 -1
  32. package/src/api/events.ts +35 -27
  33. package/src/api/fields.ts +1 -0
  34. package/src/api/wallet.ts +5 -1
  35. package/src/contract/batch_call.ts +1 -1
  36. package/src/contract/contract_function_interaction.ts +17 -7
  37. package/src/contract/protocol_contracts/contract-class-registry.ts +3 -145
  38. package/src/fee/fee_juice_payment_method_with_claim.ts +5 -5
  39. package/src/fee/private_fee_payment_method.ts +7 -7
  40. package/src/fee/public_fee_payment_method.ts +8 -8
  41. package/src/fee/sponsored_fee_payment.ts +3 -3
  42. package/src/wallet/wallet.ts +82 -35
  43. package/dest/deployment/broadcast_function.d.ts +0 -24
  44. package/dest/deployment/broadcast_function.d.ts.map +0 -1
  45. package/dest/deployment/broadcast_function.js +0 -74
  46. package/src/deployment/broadcast_function.ts +0 -148
@@ -4,264 +4,6 @@ import { ContractBase } from '../contract_base.js';
4
4
  const ContractClassRegistryContractArtifact = {
5
5
  name: 'ContractClassRegistry',
6
6
  functions: [
7
- {
8
- ...{
9
- functionType: FunctionType.PRIVATE,
10
- name: 'broadcast_private_function',
11
- isOnlySelf: false,
12
- isStatic: false,
13
- isInitializer: false,
14
- parameters: [
15
- {
16
- name: 'contract_class_id',
17
- type: {
18
- kind: 'struct',
19
- fields: [
20
- {
21
- name: 'inner',
22
- type: {
23
- kind: 'field'
24
- }
25
- }
26
- ],
27
- path: 'aztec::protocol_types::contract_class_id::ContractClassId'
28
- },
29
- visibility: 'private'
30
- },
31
- {
32
- name: 'artifact_metadata_hash',
33
- type: {
34
- kind: 'field'
35
- },
36
- visibility: 'private'
37
- },
38
- {
39
- name: 'utility_functions_artifact_tree_root',
40
- type: {
41
- kind: 'field'
42
- },
43
- visibility: 'private'
44
- },
45
- {
46
- name: 'private_function_tree_sibling_path',
47
- type: {
48
- kind: 'array',
49
- length: 7,
50
- type: {
51
- kind: 'field'
52
- }
53
- },
54
- visibility: 'private'
55
- },
56
- {
57
- name: 'private_function_tree_leaf_index',
58
- type: {
59
- kind: 'field'
60
- },
61
- visibility: 'private'
62
- },
63
- {
64
- name: 'artifact_function_tree_sibling_path',
65
- type: {
66
- kind: 'array',
67
- length: 7,
68
- type: {
69
- kind: 'field'
70
- }
71
- },
72
- visibility: 'private'
73
- },
74
- {
75
- name: 'artifact_function_tree_leaf_index',
76
- type: {
77
- kind: 'field'
78
- },
79
- visibility: 'private'
80
- },
81
- {
82
- name: 'function_data',
83
- type: {
84
- kind: 'struct',
85
- fields: [
86
- {
87
- name: 'selector',
88
- type: {
89
- kind: 'struct',
90
- fields: [
91
- {
92
- name: 'inner',
93
- type: {
94
- kind: 'integer',
95
- sign: 'unsigned',
96
- width: 32
97
- }
98
- }
99
- ],
100
- path: 'aztec::protocol_types::abis::function_selector::FunctionSelector'
101
- }
102
- },
103
- {
104
- name: 'metadata_hash',
105
- type: {
106
- kind: 'field'
107
- }
108
- },
109
- {
110
- name: 'vk_hash',
111
- type: {
112
- kind: 'field'
113
- }
114
- }
115
- ],
116
- path: 'events::private_function_broadcasted::InnerPrivateFunction'
117
- },
118
- visibility: 'private'
119
- }
120
- ],
121
- returnTypes: [],
122
- errorTypes: {
123
- '1998584279744703196': {
124
- error_kind: 'string',
125
- string: 'attempt to subtract with overflow'
126
- },
127
- '14990209321349310352': {
128
- error_kind: 'string',
129
- string: 'attempt to add with overflow'
130
- },
131
- '15764276373176857197': {
132
- error_kind: 'string',
133
- string: 'Stack too deep'
134
- },
135
- '16431471497789672479': {
136
- error_kind: 'string',
137
- string: 'Index out of bounds'
138
- },
139
- '17655676068928457687': {
140
- error_kind: 'string',
141
- string: 'Reader did not read all data'
142
- }
143
- }
144
- },
145
- bytecode: Buffer.from([]),
146
- debugSymbols: ''
147
- },
148
- {
149
- ...{
150
- functionType: FunctionType.PRIVATE,
151
- name: 'broadcast_utility_function',
152
- isOnlySelf: false,
153
- isStatic: false,
154
- isInitializer: false,
155
- parameters: [
156
- {
157
- name: 'contract_class_id',
158
- type: {
159
- kind: 'struct',
160
- fields: [
161
- {
162
- name: 'inner',
163
- type: {
164
- kind: 'field'
165
- }
166
- }
167
- ],
168
- path: 'aztec::protocol_types::contract_class_id::ContractClassId'
169
- },
170
- visibility: 'private'
171
- },
172
- {
173
- name: 'artifact_metadata_hash',
174
- type: {
175
- kind: 'field'
176
- },
177
- visibility: 'private'
178
- },
179
- {
180
- name: 'private_functions_artifact_tree_root',
181
- type: {
182
- kind: 'field'
183
- },
184
- visibility: 'private'
185
- },
186
- {
187
- name: 'artifact_function_tree_sibling_path',
188
- type: {
189
- kind: 'array',
190
- length: 7,
191
- type: {
192
- kind: 'field'
193
- }
194
- },
195
- visibility: 'private'
196
- },
197
- {
198
- name: 'artifact_function_tree_leaf_index',
199
- type: {
200
- kind: 'field'
201
- },
202
- visibility: 'private'
203
- },
204
- {
205
- name: 'function_data',
206
- type: {
207
- kind: 'struct',
208
- fields: [
209
- {
210
- name: 'selector',
211
- type: {
212
- kind: 'struct',
213
- fields: [
214
- {
215
- name: 'inner',
216
- type: {
217
- kind: 'integer',
218
- sign: 'unsigned',
219
- width: 32
220
- }
221
- }
222
- ],
223
- path: 'aztec::protocol_types::abis::function_selector::FunctionSelector'
224
- }
225
- },
226
- {
227
- name: 'metadata_hash',
228
- type: {
229
- kind: 'field'
230
- }
231
- }
232
- ],
233
- path: 'events::utility_function_broadcasted::InnerUtilityFunction'
234
- },
235
- visibility: 'private'
236
- }
237
- ],
238
- returnTypes: [],
239
- errorTypes: {
240
- '1998584279744703196': {
241
- error_kind: 'string',
242
- string: 'attempt to subtract with overflow'
243
- },
244
- '14990209321349310352': {
245
- error_kind: 'string',
246
- string: 'attempt to add with overflow'
247
- },
248
- '15764276373176857197': {
249
- error_kind: 'string',
250
- string: 'Stack too deep'
251
- },
252
- '16431471497789672479': {
253
- error_kind: 'string',
254
- string: 'Index out of bounds'
255
- },
256
- '17655676068928457687': {
257
- error_kind: 'string',
258
- string: 'Reader did not read all data'
259
- }
260
- }
261
- },
262
- bytecode: Buffer.from([]),
263
- debugSymbols: ''
264
- },
265
7
  {
266
8
  ...{
267
9
  functionType: FunctionType.PRIVATE,
@@ -306,10 +48,18 @@ const ContractClassRegistryContractArtifact = {
306
48
  error_kind: 'string',
307
49
  string: 'attempt to subtract with overflow'
308
50
  },
51
+ '9475115977882098926': {
52
+ error_kind: 'string',
53
+ string: 'Extra bytes in the last field of the bytecode'
54
+ },
309
55
  '10965409165809799877': {
310
56
  error_kind: 'string',
311
57
  string: 'Given in_len to absorb is larger than the input array len'
312
58
  },
59
+ '12469291177396340830': {
60
+ error_kind: 'string',
61
+ string: 'call to assert_max_bit_size'
62
+ },
313
63
  '14990209321349310352': {
314
64
  error_kind: 'string',
315
65
  string: 'attempt to add with overflow'
@@ -322,6 +72,10 @@ const ContractClassRegistryContractArtifact = {
322
72
  error_kind: 'string',
323
73
  string: 'Stack too deep'
324
74
  },
75
+ '15835548349546956319': {
76
+ error_kind: 'string',
77
+ string: 'Field failed to decompose into specified 32 limbs'
78
+ },
325
79
  '16431471497789672479': {
326
80
  error_kind: 'string',
327
81
  string: 'Index out of bounds'
@@ -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 { ExecutionPayload } from '@aztec/stdlib/tx';
5
5
  /**
6
6
  * Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains"
@@ -18,10 +18,11 @@ import { ExecutionPayload } from '@aztec/stdlib/tx';
18
18
  */ async getExecutionPayload() {
19
19
  const selector = await FunctionSelector.fromSignature('claim_and_end_setup((Field),u128,Field,Field)');
20
20
  return new ExecutionPayload([
21
- {
22
- to: ProtocolContractAddress.FeeJuice,
21
+ FunctionCall.from({
23
22
  name: 'claim_and_end_setup',
23
+ to: ProtocolContractAddress.FeeJuice,
24
24
  selector,
25
+ type: FunctionType.PRIVATE,
25
26
  hideMsgSender: false,
26
27
  isStatic: false,
27
28
  args: [
@@ -30,9 +31,8 @@ import { ExecutionPayload } from '@aztec/stdlib/tx';
30
31
  this.claim.claimSecret,
31
32
  new Fr(this.claim.messageLeafIndex)
32
33
  ],
33
- returnTypes: [],
34
- type: FunctionType.PRIVATE
35
- }
34
+ returnTypes: []
35
+ })
36
36
  ], [], [], [], this.sender);
37
37
  }
38
38
  getAsset() {
@@ -1,5 +1,5 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
2
+ import { FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { ExecutionPayload } from '@aztec/stdlib/tx';
5
5
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
@@ -85,24 +85,24 @@ import { ContractFunctionInteraction } from '../contract/contract_function_inter
85
85
  const txNonce = Fr.random();
86
86
  const witness = await this.wallet.createAuthWit(this.sender, {
87
87
  caller: this.paymentContract,
88
- call: {
88
+ call: FunctionCall.from({
89
89
  name: 'transfer_to_public',
90
+ to: await this.getAsset(),
91
+ selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
92
+ type: FunctionType.PRIVATE,
93
+ hideMsgSender: false,
94
+ isStatic: false,
90
95
  args: [
91
96
  this.sender.toField(),
92
97
  this.paymentContract.toField(),
93
98
  maxFee,
94
99
  txNonce
95
100
  ],
96
- selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
97
- type: FunctionType.PRIVATE,
98
- hideMsgSender: false,
99
- isStatic: false,
100
- to: await this.getAsset(),
101
101
  returnTypes: []
102
- }
102
+ })
103
103
  });
104
104
  return new ExecutionPayload([
105
- {
105
+ FunctionCall.from({
106
106
  name: 'fee_entrypoint_private',
107
107
  to: this.paymentContract,
108
108
  selector: await FunctionSelector.fromSignature('fee_entrypoint_private(u128,Field)'),
@@ -114,7 +114,7 @@ import { ContractFunctionInteraction } from '../contract/contract_function_inter
114
114
  txNonce
115
115
  ],
116
116
  returnTypes: []
117
- }
117
+ })
118
118
  ], [
119
119
  witness
120
120
  ], [], [], this.paymentContract);
@@ -1,5 +1,5 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
2
+ import { FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { ExecutionPayload } from '@aztec/stdlib/tx';
5
5
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
@@ -79,26 +79,26 @@ import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
79
79
  const maxFee = this.gasSettings.getFeeLimit();
80
80
  const intent = {
81
81
  caller: this.paymentContract,
82
- call: {
82
+ call: FunctionCall.from({
83
83
  name: 'transfer_in_public',
84
+ to: await this.getAsset(),
85
+ selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
86
+ type: FunctionType.PUBLIC,
87
+ hideMsgSender: false,
88
+ isStatic: false,
84
89
  args: [
85
90
  this.sender.toField(),
86
91
  this.paymentContract.toField(),
87
92
  maxFee,
88
93
  txNonce
89
94
  ],
90
- selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
91
- type: FunctionType.PUBLIC,
92
- isStatic: false,
93
- hideMsgSender: false,
94
- to: await this.getAsset(),
95
95
  returnTypes: []
96
- }
96
+ })
97
97
  };
98
98
  const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(this.wallet, this.sender, intent, true);
99
99
  return new ExecutionPayload([
100
100
  ...(await setPublicAuthWitInteraction.request()).calls,
101
- {
101
+ FunctionCall.from({
102
102
  name: 'fee_entrypoint_public',
103
103
  to: this.paymentContract,
104
104
  selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
@@ -110,7 +110,7 @@ import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
110
110
  txNonce
111
111
  ],
112
112
  returnTypes: []
113
- }
113
+ })
114
114
  ], [], [], [], this.paymentContract);
115
115
  }
116
116
  getGasSettings() {
@@ -1,4 +1,4 @@
1
- import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
1
+ import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
2
2
  import { ExecutionPayload } from '@aztec/stdlib/tx';
3
3
  /**
4
4
  * A fee payment method that uses a contract that blindly sponsors transactions.
@@ -16,7 +16,7 @@ import { ExecutionPayload } from '@aztec/stdlib/tx';
16
16
  }
17
17
  async getExecutionPayload() {
18
18
  return new ExecutionPayload([
19
- {
19
+ FunctionCall.from({
20
20
  name: 'sponsor_unconditionally',
21
21
  to: this.paymentContract,
22
22
  selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
@@ -25,7 +25,7 @@ import { ExecutionPayload } from '@aztec/stdlib/tx';
25
25
  isStatic: false,
26
26
  args: [],
27
27
  returnTypes: []
28
- }
28
+ })
29
29
  ], [], [], [], this.paymentContract);
30
30
  }
31
31
  getGasSettings() {