@aztec/aztec.js 0.42.0 → 0.44.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/interface.d.ts +5 -19
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -1
- package/dest/account/wallet.d.ts +5 -2
- package/dest/account/wallet.d.ts.map +1 -1
- package/dest/account_manager/index.d.ts +1 -2
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +4 -11
- package/dest/api/abi.d.ts +1 -1
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +2 -2
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +6 -4
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +12 -11
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +15 -12
- package/dest/index.d.ts +4 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +4 -3
- package/dest/rpc_clients/pxe_client.d.ts.map +1 -1
- package/dest/rpc_clients/pxe_client.js +3 -1
- package/dest/utils/abi_types.d.ts +4 -2
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/account.js +3 -3
- package/dest/utils/authwit.d.ts +45 -29
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +35 -17
- package/dest/utils/cheat_codes.d.ts.map +1 -1
- package/dest/utils/cheat_codes.js +6 -2
- package/dest/wallet/account_wallet.d.ts +27 -58
- package/dest/wallet/account_wallet.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +92 -79
- package/dest/wallet/base_wallet.d.ts +9 -14
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +15 -3
- package/dest/wallet/signerless_wallet.d.ts +3 -1
- package/dest/wallet/signerless_wallet.d.ts.map +1 -1
- package/dest/wallet/signerless_wallet.js +2 -2
- package/package.json +16 -9
- package/src/account/interface.ts +5 -24
- package/src/account/wallet.ts +7 -2
- package/src/account_manager/index.ts +7 -9
- package/src/api/abi.ts +1 -1
- package/src/contract/sent_tx.ts +5 -3
- package/src/fee/private_fee_payment_method.ts +4 -8
- package/src/fee/public_fee_payment_method.ts +17 -16
- package/src/index.ts +8 -3
- package/src/rpc_clients/pxe_client.ts +3 -1
- package/src/utils/abi_types.ts +11 -2
- package/src/utils/account.ts +2 -2
- package/src/utils/authwit.ts +66 -21
- package/src/utils/cheat_codes.ts +5 -1
- package/src/wallet/account_wallet.ts +112 -152
- package/src/wallet/base_wallet.ts +32 -21
- package/src/wallet/signerless_wallet.ts +2 -2
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { type AuthWitness, type
|
|
1
|
+
import { type AuthWitness, type PXE, type TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
2
|
import { AztecAddress, CANONICAL_KEY_REGISTRY_ADDRESS, Fq, Fr, derivePublicKeyFromSecretKey } from '@aztec/circuits.js';
|
|
3
3
|
import { type ABIParameterVisibility, type FunctionAbi, FunctionType } from '@aztec/foundation/abi';
|
|
4
|
+
import { AuthRegistryAddress } from '@aztec/protocol-contracts/auth-registry';
|
|
4
5
|
|
|
5
6
|
import { type AccountInterface } from '../account/interface.js';
|
|
6
7
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
7
8
|
import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
8
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type IntentAction,
|
|
11
|
+
type IntentInnerHash,
|
|
12
|
+
computeAuthWitMessageHash,
|
|
13
|
+
computeInnerAuthWitHashFromAction,
|
|
14
|
+
} from '../utils/authwit.js';
|
|
9
15
|
import { BaseWallet } from './base_wallet.js';
|
|
10
16
|
|
|
11
17
|
/**
|
|
@@ -29,28 +35,25 @@ export class AccountWallet extends BaseWallet {
|
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
/**
|
|
32
|
-
* Computes an authentication witness from either a message or
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* Computes an authentication witness from either a message hash or an intent.
|
|
39
|
+
*
|
|
40
|
+
* If a message hash is provided, it will create a witness for the hash directly.
|
|
41
|
+
* Otherwise, it will compute the message hash using the intent, along with the
|
|
42
|
+
* chain id and the version values provided by the wallet.
|
|
43
|
+
*
|
|
44
|
+
* @param messageHashOrIntent - The message hash of the intent to approve
|
|
36
45
|
* @returns The authentication witness
|
|
37
46
|
*/
|
|
38
|
-
async createAuthWit(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
chainId?: Fr;
|
|
49
|
-
/** The version to approve */
|
|
50
|
-
version?: Fr;
|
|
51
|
-
},
|
|
52
|
-
): Promise<AuthWitness> {
|
|
53
|
-
const messageHash = this.getMessageHash(messageHashOrIntent);
|
|
47
|
+
async createAuthWit(messageHashOrIntent: Fr | Buffer | IntentAction | IntentInnerHash): Promise<AuthWitness> {
|
|
48
|
+
let messageHash: Fr;
|
|
49
|
+
if (Buffer.isBuffer(messageHashOrIntent)) {
|
|
50
|
+
messageHash = Fr.fromBuffer(messageHashOrIntent);
|
|
51
|
+
} else if (messageHashOrIntent instanceof Fr) {
|
|
52
|
+
messageHash = messageHashOrIntent;
|
|
53
|
+
} else {
|
|
54
|
+
messageHash = this.getMessageHash(messageHashOrIntent);
|
|
55
|
+
}
|
|
56
|
+
|
|
54
57
|
const witness = await this.account.createAuthWit(messageHash);
|
|
55
58
|
await this.pxe.addAuthWitness(witness);
|
|
56
59
|
return witness;
|
|
@@ -58,111 +61,104 @@ export class AccountWallet extends BaseWallet {
|
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
* Returns a function interaction to set a message hash as authorized or revoked in this account.
|
|
64
|
+
*
|
|
61
65
|
* Public calls can then consume this authorization.
|
|
62
|
-
*
|
|
66
|
+
*
|
|
67
|
+
* @param messageHashOrIntent - The message hash or intent to authorize/revoke
|
|
63
68
|
* @param authorized - True to authorize, false to revoke authorization.
|
|
64
69
|
* @returns - A function interaction.
|
|
65
70
|
*/
|
|
66
71
|
public setPublicAuthWit(
|
|
67
|
-
messageHashOrIntent:
|
|
68
|
-
| Fr
|
|
69
|
-
| Buffer
|
|
70
|
-
| {
|
|
71
|
-
/** The caller to approve */
|
|
72
|
-
caller: AztecAddress;
|
|
73
|
-
/** The action to approve */
|
|
74
|
-
action: ContractFunctionInteraction | FunctionCall;
|
|
75
|
-
/** The chain id to approve */
|
|
76
|
-
chainId?: Fr;
|
|
77
|
-
/** The version to approve */
|
|
78
|
-
version?: Fr;
|
|
79
|
-
},
|
|
72
|
+
messageHashOrIntent: Fr | Buffer | IntentInnerHash | IntentAction,
|
|
80
73
|
authorized: boolean,
|
|
81
74
|
): ContractFunctionInteraction {
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
|
|
75
|
+
let messageHash: Fr;
|
|
76
|
+
if (Buffer.isBuffer(messageHashOrIntent)) {
|
|
77
|
+
messageHash = Fr.fromBuffer(messageHashOrIntent);
|
|
78
|
+
} else if (messageHashOrIntent instanceof Fr) {
|
|
79
|
+
messageHash = messageHashOrIntent;
|
|
85
80
|
} else {
|
|
86
|
-
|
|
81
|
+
messageHash = this.getMessageHash(messageHashOrIntent);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return new ContractFunctionInteraction(this, AuthRegistryAddress, this.getSetAuthorizedAbi(), [
|
|
85
|
+
messageHash,
|
|
86
|
+
authorized,
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private getInnerHashAndConsumer(intent: IntentInnerHash | IntentAction): {
|
|
91
|
+
/** The inner hash */
|
|
92
|
+
innerHash: Fr;
|
|
93
|
+
/** The consumer of the authwit */
|
|
94
|
+
consumer: AztecAddress;
|
|
95
|
+
} {
|
|
96
|
+
if ('caller' in intent && 'action' in intent) {
|
|
97
|
+
const action = intent.action instanceof ContractFunctionInteraction ? intent.action.request() : intent.action;
|
|
98
|
+
return {
|
|
99
|
+
innerHash: computeInnerAuthWitHashFromAction(intent.caller, action),
|
|
100
|
+
consumer: action.to,
|
|
101
|
+
};
|
|
102
|
+
} else if (Buffer.isBuffer(intent.innerHash)) {
|
|
103
|
+
return { innerHash: Fr.fromBuffer(intent.innerHash), consumer: intent.consumer };
|
|
87
104
|
}
|
|
105
|
+
return { innerHash: intent.innerHash, consumer: intent.consumer };
|
|
88
106
|
}
|
|
89
107
|
|
|
90
108
|
/**
|
|
91
|
-
* Returns the message hash for the given
|
|
92
|
-
*
|
|
109
|
+
* Returns the message hash for the given intent
|
|
110
|
+
*
|
|
111
|
+
* @param intent - A tuple of (consumer and inner hash) or (caller and action)
|
|
93
112
|
* @returns The message hash
|
|
94
113
|
*/
|
|
95
|
-
private getMessageHash(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
| {
|
|
100
|
-
/** The caller to approve */
|
|
101
|
-
caller: AztecAddress;
|
|
102
|
-
/** The action to approve */
|
|
103
|
-
action: ContractFunctionInteraction | FunctionCall;
|
|
104
|
-
/** The chain id to approve */
|
|
105
|
-
chainId?: Fr;
|
|
106
|
-
/** The version to approve */
|
|
107
|
-
version?: Fr;
|
|
108
|
-
},
|
|
109
|
-
): Fr {
|
|
110
|
-
if (Buffer.isBuffer(messageHashOrIntent)) {
|
|
111
|
-
return Fr.fromBuffer(messageHashOrIntent);
|
|
112
|
-
} else if (messageHashOrIntent instanceof Fr) {
|
|
113
|
-
return messageHashOrIntent;
|
|
114
|
-
} else {
|
|
115
|
-
return computeAuthWitMessageHash(
|
|
116
|
-
messageHashOrIntent.caller,
|
|
117
|
-
messageHashOrIntent.chainId || this.getChainId(),
|
|
118
|
-
messageHashOrIntent.version || this.getVersion(),
|
|
119
|
-
messageHashOrIntent.action instanceof ContractFunctionInteraction
|
|
120
|
-
? messageHashOrIntent.action.request()
|
|
121
|
-
: messageHashOrIntent.action,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
114
|
+
private getMessageHash(intent: IntentInnerHash | IntentAction): Fr {
|
|
115
|
+
const chainId = this.getChainId();
|
|
116
|
+
const version = this.getVersion();
|
|
117
|
+
return computeAuthWitMessageHash(intent, { chainId, version });
|
|
124
118
|
}
|
|
125
119
|
|
|
126
120
|
/**
|
|
127
121
|
* Lookup the validity of an authwit in private and public contexts.
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
122
|
+
*
|
|
123
|
+
* Uses the chain id and version of the wallet.
|
|
124
|
+
*
|
|
125
|
+
* @param onBehalfOf - The address of the "approver"
|
|
126
|
+
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
127
|
+
*
|
|
131
128
|
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
132
129
|
*/
|
|
133
130
|
async lookupValidity(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
| Fr
|
|
137
|
-
| Buffer
|
|
138
|
-
| {
|
|
139
|
-
/** The caller to approve */
|
|
140
|
-
caller: AztecAddress;
|
|
141
|
-
/** The action to approve */
|
|
142
|
-
action: ContractFunctionInteraction | FunctionCall;
|
|
143
|
-
/** The chain id to approve */
|
|
144
|
-
chainId?: Fr;
|
|
145
|
-
/** The version to approve */
|
|
146
|
-
version?: Fr;
|
|
147
|
-
},
|
|
131
|
+
onBehalfOf: AztecAddress,
|
|
132
|
+
intent: IntentInnerHash | IntentAction,
|
|
148
133
|
): Promise<{
|
|
149
134
|
/** boolean flag indicating if the authwit is valid in private context */
|
|
150
135
|
isValidInPrivate: boolean;
|
|
151
136
|
/** boolean flag indicating if the authwit is valid in public context */
|
|
152
137
|
isValidInPublic: boolean;
|
|
153
138
|
}> {
|
|
154
|
-
const
|
|
139
|
+
const { innerHash, consumer } = this.getInnerHashAndConsumer(intent);
|
|
140
|
+
|
|
141
|
+
const messageHash = this.getMessageHash(intent);
|
|
142
|
+
const results = { isValidInPrivate: false, isValidInPublic: false };
|
|
143
|
+
|
|
144
|
+
// Check private
|
|
155
145
|
const witness = await this.getAuthWitness(messageHash);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
146
|
+
if (witness !== undefined) {
|
|
147
|
+
results.isValidInPrivate = (await new ContractFunctionInteraction(this, onBehalfOf, this.getLookupValidityAbi(), [
|
|
148
|
+
consumer,
|
|
149
|
+
innerHash,
|
|
150
|
+
]).simulate()) as boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// check public
|
|
154
|
+
results.isValidInPublic = (await new ContractFunctionInteraction(
|
|
155
|
+
this,
|
|
156
|
+
AuthRegistryAddress,
|
|
157
|
+
this.getIsConsumableAbi(),
|
|
158
|
+
[onBehalfOf, messageHash],
|
|
159
|
+
).simulate()) as boolean;
|
|
163
160
|
|
|
164
|
-
|
|
165
|
-
return { isValidInPrivate, isValidInPublic };
|
|
161
|
+
return results;
|
|
166
162
|
}
|
|
167
163
|
|
|
168
164
|
/**
|
|
@@ -189,31 +185,6 @@ export class AccountWallet extends BaseWallet {
|
|
|
189
185
|
await interaction.send().wait();
|
|
190
186
|
}
|
|
191
187
|
|
|
192
|
-
/**
|
|
193
|
-
* Returns a function interaction to cancel a message hash as authorized in this account.
|
|
194
|
-
* @param messageHashOrIntent - The message or the caller and action to authorize/revoke
|
|
195
|
-
* @returns - A function interaction.
|
|
196
|
-
*/
|
|
197
|
-
public cancelAuthWit(
|
|
198
|
-
messageHashOrIntent:
|
|
199
|
-
| Fr
|
|
200
|
-
| Buffer
|
|
201
|
-
| {
|
|
202
|
-
/** The caller to approve */
|
|
203
|
-
caller: AztecAddress;
|
|
204
|
-
/** The action to approve */
|
|
205
|
-
action: ContractFunctionInteraction | FunctionCall;
|
|
206
|
-
/** The chain id to approve */
|
|
207
|
-
chainId?: Fr;
|
|
208
|
-
/** The version to approve */
|
|
209
|
-
version?: Fr;
|
|
210
|
-
},
|
|
211
|
-
): ContractFunctionInteraction {
|
|
212
|
-
const message = this.getMessageHash(messageHashOrIntent);
|
|
213
|
-
const args = [message];
|
|
214
|
-
return new ContractFunctionInteraction(this, this.getAddress(), this.getCancelAuthwitAbi(), args);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
188
|
/** Returns the complete address of the account that implements this wallet. */
|
|
218
189
|
public getCompleteAddress() {
|
|
219
190
|
return this.account.getCompleteAddress();
|
|
@@ -224,9 +195,9 @@ export class AccountWallet extends BaseWallet {
|
|
|
224
195
|
return this.getCompleteAddress().address;
|
|
225
196
|
}
|
|
226
197
|
|
|
227
|
-
private
|
|
198
|
+
private getSetAuthorizedAbi(): FunctionAbi {
|
|
228
199
|
return {
|
|
229
|
-
name: '
|
|
200
|
+
name: 'set_authorized',
|
|
230
201
|
isInitializer: false,
|
|
231
202
|
functionType: FunctionType.PUBLIC,
|
|
232
203
|
isInternal: true,
|
|
@@ -237,59 +208,48 @@ export class AccountWallet extends BaseWallet {
|
|
|
237
208
|
type: { kind: 'field' },
|
|
238
209
|
visibility: 'private' as ABIParameterVisibility,
|
|
239
210
|
},
|
|
211
|
+
{
|
|
212
|
+
name: 'authorize',
|
|
213
|
+
type: { kind: 'boolean' },
|
|
214
|
+
visibility: 'private' as ABIParameterVisibility,
|
|
215
|
+
},
|
|
240
216
|
],
|
|
241
217
|
returnTypes: [],
|
|
242
218
|
};
|
|
243
219
|
}
|
|
244
220
|
|
|
245
|
-
private
|
|
221
|
+
private getLookupValidityAbi(): FunctionAbi {
|
|
246
222
|
return {
|
|
247
|
-
name: '
|
|
223
|
+
name: 'lookup_validity',
|
|
248
224
|
isInitializer: false,
|
|
249
|
-
functionType: FunctionType.
|
|
250
|
-
isInternal:
|
|
225
|
+
functionType: FunctionType.UNCONSTRAINED,
|
|
226
|
+
isInternal: false,
|
|
251
227
|
isStatic: false,
|
|
252
|
-
parameters: [
|
|
253
|
-
|
|
254
|
-
name: 'message_hash',
|
|
255
|
-
type: { kind: 'field' },
|
|
256
|
-
visibility: 'private' as ABIParameterVisibility,
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
returnTypes: [],
|
|
228
|
+
parameters: [{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' as ABIParameterVisibility }],
|
|
229
|
+
returnTypes: [{ kind: 'boolean' }],
|
|
260
230
|
};
|
|
261
231
|
}
|
|
262
232
|
|
|
263
|
-
private
|
|
233
|
+
private getIsConsumableAbi(): FunctionAbi {
|
|
264
234
|
return {
|
|
265
|
-
name: '
|
|
235
|
+
name: 'unconstrained_is_consumable',
|
|
266
236
|
isInitializer: false,
|
|
267
237
|
functionType: FunctionType.UNCONSTRAINED,
|
|
268
238
|
isInternal: false,
|
|
269
239
|
isStatic: false,
|
|
270
240
|
parameters: [
|
|
271
241
|
{
|
|
272
|
-
name: '
|
|
242
|
+
name: 'address',
|
|
273
243
|
type: {
|
|
244
|
+
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
274
245
|
kind: 'struct',
|
|
275
246
|
path: 'authwit::aztec::protocol_types::address::aztec_address::AztecAddress',
|
|
276
|
-
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
277
247
|
},
|
|
278
248
|
visibility: 'private' as ABIParameterVisibility,
|
|
279
249
|
},
|
|
280
|
-
{
|
|
281
|
-
name: 'block_number',
|
|
282
|
-
type: { kind: 'integer', sign: 'unsigned', width: 32 },
|
|
283
|
-
visibility: 'private' as ABIParameterVisibility,
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: 'check_private',
|
|
287
|
-
type: { kind: 'boolean' },
|
|
288
|
-
visibility: 'private' as ABIParameterVisibility,
|
|
289
|
-
},
|
|
290
250
|
{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' as ABIParameterVisibility },
|
|
291
251
|
],
|
|
292
|
-
returnTypes: [{ kind: '
|
|
252
|
+
returnTypes: [{ kind: 'boolean' }],
|
|
293
253
|
};
|
|
294
254
|
}
|
|
295
255
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type AuthWitness,
|
|
3
|
+
type EventMetadata,
|
|
3
4
|
type ExtendedNote,
|
|
4
|
-
type FunctionCall,
|
|
5
5
|
type GetUnencryptedLogsResponse,
|
|
6
|
+
type IncomingNotesFilter,
|
|
6
7
|
type L2Block,
|
|
7
8
|
type LogFilter,
|
|
8
|
-
type
|
|
9
|
+
type OutgoingNotesFilter,
|
|
9
10
|
type PXE,
|
|
10
11
|
type PXEInfo,
|
|
11
12
|
type SimulatedTx,
|
|
@@ -17,14 +18,21 @@ import {
|
|
|
17
18
|
type TxReceipt,
|
|
18
19
|
} from '@aztec/circuit-types';
|
|
19
20
|
import { type NoteProcessorStats } from '@aztec/circuit-types/stats';
|
|
20
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
type AztecAddress,
|
|
23
|
+
type CompleteAddress,
|
|
24
|
+
type Fq,
|
|
25
|
+
type Fr,
|
|
26
|
+
type PartialAddress,
|
|
27
|
+
type Point,
|
|
28
|
+
} from '@aztec/circuits.js';
|
|
21
29
|
import { type ContractArtifact } from '@aztec/foundation/abi';
|
|
22
30
|
import { type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
23
31
|
import { type NodeInfo } from '@aztec/types/interfaces';
|
|
24
32
|
|
|
25
33
|
import { type Wallet } from '../account/wallet.js';
|
|
26
|
-
import { type ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
27
34
|
import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
35
|
+
import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js';
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
38
|
* A base class for Wallet implementations
|
|
@@ -40,21 +48,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
40
48
|
|
|
41
49
|
abstract createTxExecutionRequest(exec: ExecutionRequestInit): Promise<TxExecutionRequest>;
|
|
42
50
|
|
|
43
|
-
abstract createAuthWit(
|
|
44
|
-
messageHashOrIntent:
|
|
45
|
-
| Fr
|
|
46
|
-
| Buffer
|
|
47
|
-
| {
|
|
48
|
-
/** The caller to approve */
|
|
49
|
-
caller: AztecAddress;
|
|
50
|
-
/** The action to approve */
|
|
51
|
-
action: ContractFunctionInteraction | FunctionCall;
|
|
52
|
-
/** The chain id to approve */
|
|
53
|
-
chainId?: Fr;
|
|
54
|
-
/** The version to approve */
|
|
55
|
-
version?: Fr;
|
|
56
|
-
},
|
|
57
|
-
): Promise<AuthWitness>;
|
|
51
|
+
abstract createAuthWit(intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
58
52
|
|
|
59
53
|
abstract rotateNullifierKeys(newNskM: Fq): Promise<void>;
|
|
60
54
|
|
|
@@ -67,6 +61,9 @@ export abstract class BaseWallet implements Wallet {
|
|
|
67
61
|
getContractClass(id: Fr): Promise<ContractClassWithId | undefined> {
|
|
68
62
|
return this.pxe.getContractClass(id);
|
|
69
63
|
}
|
|
64
|
+
getContractArtifact(id: Fr): Promise<ContractArtifact | undefined> {
|
|
65
|
+
return this.pxe.getContractArtifact(id);
|
|
66
|
+
}
|
|
70
67
|
addCapsule(capsule: Fr[]): Promise<void> {
|
|
71
68
|
return this.pxe.addCapsule(capsule);
|
|
72
69
|
}
|
|
@@ -118,8 +115,11 @@ export abstract class BaseWallet implements Wallet {
|
|
|
118
115
|
getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
|
|
119
116
|
return this.pxe.getTxReceipt(txHash);
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
return this.pxe.
|
|
118
|
+
getIncomingNotes(filter: IncomingNotesFilter): Promise<ExtendedNote[]> {
|
|
119
|
+
return this.pxe.getIncomingNotes(filter);
|
|
120
|
+
}
|
|
121
|
+
getOutgoingNotes(filter: OutgoingNotesFilter): Promise<ExtendedNote[]> {
|
|
122
|
+
return this.pxe.getOutgoingNotes(filter);
|
|
123
123
|
}
|
|
124
124
|
// TODO(#4956): Un-expose this
|
|
125
125
|
getNoteNonces(note: ExtendedNote): Promise<Fr[]> {
|
|
@@ -131,6 +131,9 @@ export abstract class BaseWallet implements Wallet {
|
|
|
131
131
|
addNote(note: ExtendedNote): Promise<void> {
|
|
132
132
|
return this.pxe.addNote(note);
|
|
133
133
|
}
|
|
134
|
+
addNullifiedNote(note: ExtendedNote): Promise<void> {
|
|
135
|
+
return this.pxe.addNullifiedNote(note);
|
|
136
|
+
}
|
|
134
137
|
getBlock(number: number): Promise<L2Block | undefined> {
|
|
135
138
|
return this.pxe.getBlock(number);
|
|
136
139
|
}
|
|
@@ -178,4 +181,12 @@ export abstract class BaseWallet implements Wallet {
|
|
|
178
181
|
getPXEInfo(): Promise<PXEInfo> {
|
|
179
182
|
return this.pxe.getPXEInfo();
|
|
180
183
|
}
|
|
184
|
+
getEvents<T>(
|
|
185
|
+
from: number,
|
|
186
|
+
limit: number,
|
|
187
|
+
eventMetadata: EventMetadata<T>,
|
|
188
|
+
ivpk: Point = this.getCompleteAddress().publicKeys.masterIncomingViewingPublicKey,
|
|
189
|
+
): Promise<T[]> {
|
|
190
|
+
return this.pxe.getEvents(from, limit, eventMetadata, ivpk);
|
|
191
|
+
}
|
|
181
192
|
}
|
|
@@ -3,6 +3,7 @@ import { type CompleteAddress, type Fq, type Fr } from '@aztec/circuits.js';
|
|
|
3
3
|
|
|
4
4
|
import { DefaultEntrypoint } from '../entrypoint/default_entrypoint.js';
|
|
5
5
|
import { type EntrypointInterface, type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
6
|
+
import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js';
|
|
6
7
|
import { BaseWallet } from './base_wallet.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -12,7 +13,6 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
12
13
|
constructor(pxe: PXE, private entrypoint?: EntrypointInterface) {
|
|
13
14
|
super(pxe);
|
|
14
15
|
}
|
|
15
|
-
|
|
16
16
|
async createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest> {
|
|
17
17
|
let entrypoint = this.entrypoint;
|
|
18
18
|
if (!entrypoint) {
|
|
@@ -39,7 +39,7 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
39
39
|
throw new Error('SignerlessWallet: Method getCompleteAddress not implemented.');
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
createAuthWit(
|
|
42
|
+
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness> {
|
|
43
43
|
throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
|
|
44
44
|
}
|
|
45
45
|
|