@walletmesh/aztec-rpc-wallet 0.1.1 → 0.3.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/CHANGELOG.md +24 -0
- package/README.md +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/aztecRemoteWallet.d.ts +4 -8
- package/dist/aztecRemoteWallet.d.ts.map +1 -1
- package/dist/aztecRemoteWallet.js +5 -30
- package/dist/chainProvider.d.ts.map +1 -1
- package/dist/chainProvider.js +1 -1
- package/dist/contractArtifactCache.d.ts.map +1 -1
- package/dist/contractArtifactCache.js +20 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/handlers/aztecAccountWallet.d.ts.map +1 -1
- package/dist/handlers/aztecAccountWallet.js +12 -45
- package/dist/handlers/transactions.d.ts.map +1 -1
- package/dist/handlers/transactions.js +11 -3
- package/dist/serializers/account.d.ts +24 -24
- package/dist/serializers/account.d.ts.map +1 -1
- package/dist/serializers/account.js +51 -51
- package/dist/serializers/contract.d.ts +22 -76
- package/dist/serializers/contract.d.ts.map +1 -1
- package/dist/serializers/contract.js +68 -120
- package/dist/serializers/index.d.ts +0 -4
- package/dist/serializers/index.d.ts.map +1 -1
- package/dist/serializers/index.js +15 -20
- package/dist/serializers/log.d.ts +16 -16
- package/dist/serializers/log.d.ts.map +1 -1
- package/dist/serializers/log.js +66 -64
- package/dist/serializers/note.d.ts +18 -18
- package/dist/serializers/note.d.ts.map +1 -1
- package/dist/serializers/note.js +54 -51
- package/dist/serializers/transaction.d.ts +25 -26
- package/dist/serializers/transaction.d.ts.map +1 -1
- package/dist/serializers/transaction.js +92 -44
- package/dist/types.d.ts +8 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/docs/README.md +264 -0
- package/docs/classes/AztecChainProvider.md +553 -0
- package/docs/classes/AztecChainWallet.md +409 -0
- package/docs/classes/AztecProvider.md +1112 -0
- package/docs/classes/AztecWalletError.md +213 -0
- package/docs/classes/ContractArtifactCache.md +81 -0
- package/docs/globals.md +34 -0
- package/docs/interfaces/AztecWalletBaseMethodMap.md +135 -0
- package/docs/interfaces/AztecWalletEventMap.md +17 -0
- package/docs/interfaces/AztecWalletMethodMap.md +1012 -0
- package/docs/type-aliases/AztecChainId.md +11 -0
- package/docs/type-aliases/AztecChainWalletMiddleware.md +13 -0
- package/docs/type-aliases/AztecWalletContext.md +29 -0
- package/docs/type-aliases/AztecWalletMethodHandler.md +37 -0
- package/docs/type-aliases/AztecWalletMiddleware.md +13 -0
- package/docs/type-aliases/AztecWalletRouterClient.md +13 -0
- package/docs/type-aliases/TransactionFunctionCall.md +33 -0
- package/docs/type-aliases/TransactionParams.md +27 -0
- package/docs/variables/AztecWalletErrorMap.md +13 -0
- package/package.json +11 -11
- package/src/aztecRemoteWallet.test.ts +23 -65
- package/src/aztecRemoteWallet.ts +8 -36
- package/src/chainProvider.test.ts +117 -38
- package/src/chainProvider.ts +1 -7
- package/src/contractArtifactCache.test.ts +28 -45
- package/src/contractArtifactCache.ts +20 -10
- package/src/errors.ts +0 -1
- package/src/handlers/aztecAccountWallet.test.ts +12 -86
- package/src/handlers/aztecAccountWallet.ts +20 -78
- package/src/handlers/transactions.ts +16 -2
- package/src/provider.test.ts +0 -2
- package/src/serializers/account.test.ts +19 -20
- package/src/serializers/account.ts +65 -65
- package/src/serializers/contract.test.ts +4 -140
- package/src/serializers/contract.ts +98 -176
- package/src/serializers/index.test.ts +30 -28
- package/src/serializers/index.ts +15 -33
- package/src/serializers/log.test.ts +42 -48
- package/src/serializers/log.ts +85 -83
- package/src/serializers/note.test.ts +43 -16
- package/src/serializers/note.ts +62 -63
- package/src/serializers/transaction.test.ts +48 -41
- package/src/serializers/transaction.ts +154 -66
- package/src/types.ts +8 -8
- package/src/wallet.test.ts +3 -3
- package/tsconfig.json +1 -1
- package/dist/serializers/transaction-utils.d.ts +0 -51
- package/dist/serializers/transaction-utils.d.ts.map +0 -1
- package/dist/serializers/transaction-utils.js +0 -94
- package/src/serializers/transaction-utils.ts +0 -161
@@ -0,0 +1,11 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecChainId
|
6
|
+
|
7
|
+
# Type Alias: AztecChainId
|
8
|
+
|
9
|
+
> **AztecChainId**: `` `aztec:${string}` ``
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:296](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L296)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecChainWalletMiddleware
|
6
|
+
|
7
|
+
# Type Alias: AztecChainWalletMiddleware
|
8
|
+
|
9
|
+
> **AztecChainWalletMiddleware**: `JSONRPCMiddleware`\<[`AztecWalletMethodMap`](../interfaces/AztecWalletMethodMap.md), [`AztecWalletContext`](AztecWalletContext.md)\>
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:149](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L149)
|
12
|
+
|
13
|
+
Type for Aztec Chain Wallet middleware.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecWalletContext
|
6
|
+
|
7
|
+
# Type Alias: AztecWalletContext
|
8
|
+
|
9
|
+
> **AztecWalletContext**: `Record`\<`string`, `unknown`\> & `object`
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:133](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L133)
|
12
|
+
|
13
|
+
Holds the context passed through RPC middleware.
|
14
|
+
|
15
|
+
## Type declaration
|
16
|
+
|
17
|
+
### contractArtifactCache
|
18
|
+
|
19
|
+
> **contractArtifactCache**: [`ContractArtifactCache`](../classes/ContractArtifactCache.md)
|
20
|
+
|
21
|
+
### pxe
|
22
|
+
|
23
|
+
> **pxe**: `PXE`
|
24
|
+
|
25
|
+
The PXE instance for the wallet
|
26
|
+
|
27
|
+
### wallet
|
28
|
+
|
29
|
+
> **wallet**: `AccountWallet`
|
@@ -0,0 +1,37 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecWalletMethodHandler
|
6
|
+
|
7
|
+
# Type Alias: AztecWalletMethodHandler()\<T, M, C\>
|
8
|
+
|
9
|
+
> **AztecWalletMethodHandler**\<`T`, `M`, `C`\>: (`context`, `params`, `accountWallet`) => `Promise`\<`T`\[`M`\]\[`"result"`\]\> \| `T`\[`M`\]\[`"result"`\]
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:286](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L286)
|
12
|
+
|
13
|
+
## Type Parameters
|
14
|
+
|
15
|
+
• **T** *extends* [`AztecWalletMethodMap`](../interfaces/AztecWalletMethodMap.md)
|
16
|
+
|
17
|
+
• **M** *extends* keyof `T`
|
18
|
+
|
19
|
+
• **C** *extends* [`AztecWalletContext`](AztecWalletContext.md)
|
20
|
+
|
21
|
+
## Parameters
|
22
|
+
|
23
|
+
### context
|
24
|
+
|
25
|
+
`C`
|
26
|
+
|
27
|
+
### params
|
28
|
+
|
29
|
+
`T`\[`M`\]\[`"params"`\]
|
30
|
+
|
31
|
+
### accountWallet
|
32
|
+
|
33
|
+
`AccountWallet`
|
34
|
+
|
35
|
+
## Returns
|
36
|
+
|
37
|
+
`Promise`\<`T`\[`M`\]\[`"result"`\]\> \| `T`\[`M`\]\[`"result"`\]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecWalletMiddleware
|
6
|
+
|
7
|
+
# Type Alias: AztecWalletMiddleware
|
8
|
+
|
9
|
+
> **AztecWalletMiddleware**: `JSONRPCMiddleware`\<[`AztecWalletBaseMethodMap`](../interfaces/AztecWalletBaseMethodMap.md), [`AztecWalletContext`](AztecWalletContext.md)\>
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:144](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L144)
|
12
|
+
|
13
|
+
Type for Aztec Router Wallet middleware.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecWalletRouterClient
|
6
|
+
|
7
|
+
# Type Alias: AztecWalletRouterClient
|
8
|
+
|
9
|
+
> **AztecWalletRouterClient**: `JSONRPCWalletClient`\<[`AztecWalletMethodMap`](../interfaces/AztecWalletMethodMap.md)\>
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:155](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L155)
|
12
|
+
|
13
|
+
Type for Aztec wallet router client.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / TransactionFunctionCall
|
6
|
+
|
7
|
+
# Type Alias: TransactionFunctionCall
|
8
|
+
|
9
|
+
> **TransactionFunctionCall**: `object`
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:49](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L49)
|
12
|
+
|
13
|
+
Represents a single function call to a contract.
|
14
|
+
|
15
|
+
## Type declaration
|
16
|
+
|
17
|
+
### args
|
18
|
+
|
19
|
+
> **args**: `unknown`[]
|
20
|
+
|
21
|
+
The arguments to pass to the function
|
22
|
+
|
23
|
+
### contractAddress
|
24
|
+
|
25
|
+
> **contractAddress**: `string`
|
26
|
+
|
27
|
+
The address of the contract to interact with
|
28
|
+
|
29
|
+
### functionName
|
30
|
+
|
31
|
+
> **functionName**: `string`
|
32
|
+
|
33
|
+
The name of the function to call
|
@@ -0,0 +1,27 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / TransactionParams
|
6
|
+
|
7
|
+
# Type Alias: TransactionParams
|
8
|
+
|
9
|
+
> **TransactionParams**: `object`
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/types.ts:62](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/types.ts#L62)
|
12
|
+
|
13
|
+
Parameters for sending transactions.
|
14
|
+
|
15
|
+
## Type declaration
|
16
|
+
|
17
|
+
### authwits?
|
18
|
+
|
19
|
+
> `optional` **authwits**: `string`[]
|
20
|
+
|
21
|
+
Optional array of authorization witnesses for the transaction
|
22
|
+
|
23
|
+
### functionCalls
|
24
|
+
|
25
|
+
> **functionCalls**: [`TransactionFunctionCall`](TransactionFunctionCall.md)[]
|
26
|
+
|
27
|
+
Array of function calls to execute
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.0**](../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@walletmesh/aztec-rpc-wallet](../globals.md) / AztecWalletErrorMap
|
6
|
+
|
7
|
+
# Variable: AztecWalletErrorMap
|
8
|
+
|
9
|
+
> `const` **AztecWalletErrorMap**: `Record`\<`AztecWalletErrorType`, \{ `code`: `number`; `message`: `string`; \}\>
|
10
|
+
|
11
|
+
Defined in: [aztec/rpc-wallet/src/errors.ts:37](https://github.com/WalletMesh/walletmesh-packages/blob/937a416f9c444488735f94f0d3eb35a7feadda3e/aztec/rpc-wallet/src/errors.ts#L37)
|
12
|
+
|
13
|
+
Map of error codes and messages for Aztec Wallet RPC errors.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@walletmesh/aztec-rpc-wallet",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.0",
|
4
4
|
"description": "",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -10,9 +10,9 @@
|
|
10
10
|
},
|
11
11
|
"repository": {
|
12
12
|
"type": "git",
|
13
|
-
"url": "git+https://github.com/WalletMesh/
|
13
|
+
"url": "git+https://github.com/WalletMesh/walletmesh-packages.git"
|
14
14
|
},
|
15
|
-
"homepage": "https://github.com/WalletMesh/
|
15
|
+
"homepage": "https://github.com/WalletMesh/walletmesh-packages/tree/main/aztec/aztec-rpc-wallet#readme",
|
16
16
|
"keywords": [],
|
17
17
|
"author": "",
|
18
18
|
"license": "Apache-2.0",
|
@@ -21,12 +21,12 @@
|
|
21
21
|
"typedoc-plugin-markdown": "^4.3.1"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@aztec/aztec.js": "0.
|
25
|
-
"@aztec/circuit-types": "0.
|
26
|
-
"@aztec/circuits.js": "0.
|
27
|
-
"@aztec/foundation": "0.
|
28
|
-
"@walletmesh/jsonrpc": "0.
|
29
|
-
"@walletmesh/router": "0.
|
24
|
+
"@aztec/aztec.js": "0.73.0",
|
25
|
+
"@aztec/circuit-types": "0.73.0",
|
26
|
+
"@aztec/circuits.js": "0.73.0",
|
27
|
+
"@aztec/foundation": "0.73.0",
|
28
|
+
"@walletmesh/jsonrpc": "0.4.0",
|
29
|
+
"@walletmesh/router": "0.4.0"
|
30
30
|
},
|
31
31
|
"scripts": {
|
32
32
|
"build": "tsc --build tsconfig.build.json",
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"lint:fix": "biome lint --fix",
|
39
39
|
"format": "biome format",
|
40
40
|
"format:fix": "biome format --fix",
|
41
|
-
"
|
42
|
-
"version": "pnpm clean && pnpm build && pnpm
|
41
|
+
"docs": "typedoc",
|
42
|
+
"version": "pnpm clean && pnpm build && pnpm run docs"
|
43
43
|
}
|
44
44
|
}
|
@@ -9,9 +9,7 @@ import type {
|
|
9
9
|
ExtendedNote,
|
10
10
|
TxHash,
|
11
11
|
L2Block,
|
12
|
-
NodeInfo,
|
13
12
|
Point,
|
14
|
-
LogFilter,
|
15
13
|
TxReceipt,
|
16
14
|
Tx,
|
17
15
|
CompleteAddress,
|
@@ -204,34 +202,6 @@ describe('AztecRemoteWallet', () => {
|
|
204
202
|
contractClass = await getContractClassFromArtifact(mockContract.artifact);
|
205
203
|
});
|
206
204
|
|
207
|
-
it('gets contract instance', async () => {
|
208
|
-
mockChainBuilder.execute.mockResolvedValueOnce(mockContract.instance);
|
209
|
-
|
210
|
-
const result = await wallet.getContractInstance(mockContract.instance.address);
|
211
|
-
expect(result).toBe(mockContract.instance);
|
212
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractInstance', {
|
213
|
-
address: mockContract.instance.address,
|
214
|
-
});
|
215
|
-
});
|
216
|
-
|
217
|
-
it('gets contract class', async () => {
|
218
|
-
mockChainBuilder.execute.mockResolvedValueOnce(contractClass);
|
219
|
-
|
220
|
-
const result = await wallet.getContractClass(contractClass.id);
|
221
|
-
expect(result).toBe(contractClass);
|
222
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractClass', { id: contractClass.id });
|
223
|
-
});
|
224
|
-
|
225
|
-
it('gets contract artifact', async () => {
|
226
|
-
mockChainBuilder.execute.mockResolvedValueOnce(mockContract.artifact);
|
227
|
-
|
228
|
-
const result = await wallet.getContractArtifact(contractClass.id);
|
229
|
-
expect(result).toBe(mockContract.artifact);
|
230
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractArtifact', {
|
231
|
-
id: contractClass.id,
|
232
|
-
});
|
233
|
-
});
|
234
|
-
|
235
205
|
it('registers contract', async () => {
|
236
206
|
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
237
207
|
await wallet.registerContract({ instance: mockContract.instance, artifact: mockContract.artifact });
|
@@ -257,6 +227,28 @@ describe('AztecRemoteWallet', () => {
|
|
257
227
|
expect(result).toBe(mockContracts);
|
258
228
|
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContracts');
|
259
229
|
});
|
230
|
+
|
231
|
+
it('gets contract metadata', async () => {
|
232
|
+
const mockMetadata = { contractInstance: mockContract.instance };
|
233
|
+
mockChainBuilder.execute.mockResolvedValueOnce(mockMetadata);
|
234
|
+
|
235
|
+
const result = await wallet.getContractMetadata(mockContract.instance.address);
|
236
|
+
expect(result).toBe(mockMetadata);
|
237
|
+
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractMetadata', {
|
238
|
+
address: mockContract.instance.address,
|
239
|
+
});
|
240
|
+
});
|
241
|
+
|
242
|
+
it('gets contract class metadata', async () => {
|
243
|
+
const mockMetadata = { artifact: mockContract.artifact };
|
244
|
+
mockChainBuilder.execute.mockResolvedValueOnce(mockMetadata);
|
245
|
+
|
246
|
+
const result = await wallet.getContractClassMetadata(contractClass.id);
|
247
|
+
expect(result).toBe(mockMetadata);
|
248
|
+
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractClassMetadata', {
|
249
|
+
id: contractClass.id,
|
250
|
+
});
|
251
|
+
});
|
260
252
|
});
|
261
253
|
|
262
254
|
describe('auth witness operations', () => {
|
@@ -296,8 +288,7 @@ describe('AztecRemoteWallet', () => {
|
|
296
288
|
const mockScopes = [mockAddress];
|
297
289
|
mockChainBuilder.execute.mockResolvedValueOnce(mockScopes).mockResolvedValueOnce(mockSimulationResult);
|
298
290
|
|
299
|
-
|
300
|
-
expect(result).toBe(mockSimulationResult);
|
291
|
+
await wallet.simulateTx(mockTxRequest, true);
|
301
292
|
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_simulateTx', {
|
302
293
|
txRequest: mockTxRequest,
|
303
294
|
simulatePublic: true,
|
@@ -395,39 +386,6 @@ describe('AztecRemoteWallet', () => {
|
|
395
386
|
});
|
396
387
|
});
|
397
388
|
|
398
|
-
describe('contract verification operations', () => {
|
399
|
-
it('checks if contract class is publicly registered', async () => {
|
400
|
-
const mockId = Fr.fromString('1');
|
401
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
402
|
-
|
403
|
-
const result = await wallet.isContractClassPubliclyRegistered(mockId);
|
404
|
-
expect(result).toBe(true);
|
405
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractClassPubliclyRegistered', {
|
406
|
-
id: mockId,
|
407
|
-
});
|
408
|
-
});
|
409
|
-
|
410
|
-
it('checks if contract is publicly deployed', async () => {
|
411
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
412
|
-
|
413
|
-
const result = await wallet.isContractPubliclyDeployed(mockAddress);
|
414
|
-
expect(result).toBe(true);
|
415
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractPubliclyDeployed', {
|
416
|
-
address: mockAddress,
|
417
|
-
});
|
418
|
-
});
|
419
|
-
|
420
|
-
it('checks if contract is initialized', async () => {
|
421
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
422
|
-
|
423
|
-
const result = await wallet.isContractInitialized(mockAddress);
|
424
|
-
expect(result).toBe(true);
|
425
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractInitialized', {
|
426
|
-
address: mockAddress,
|
427
|
-
});
|
428
|
-
});
|
429
|
-
});
|
430
|
-
|
431
389
|
describe('PXE operations', () => {
|
432
390
|
it('gets PXE info', async () => {
|
433
391
|
const mockInfo = { version: '1.0.0' } as unknown as PXEInfo;
|
package/src/aztecRemoteWallet.ts
CHANGED
@@ -2,7 +2,6 @@ import type {
|
|
2
2
|
AuthWitness,
|
3
3
|
AztecAddress,
|
4
4
|
ContractArtifact,
|
5
|
-
ContractClassWithId,
|
6
5
|
ContractInstanceWithAddress,
|
7
6
|
ExtendedNote,
|
8
7
|
TxExecutionRequest,
|
@@ -34,6 +33,8 @@ import type {
|
|
34
33
|
TxEffect,
|
35
34
|
GetPublicLogsResponse,
|
36
35
|
GetContractClassLogsResponse,
|
36
|
+
ContractMetadata,
|
37
|
+
ContractClassMetadata,
|
37
38
|
} from '@aztec/circuit-types';
|
38
39
|
import type { GasFees, L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/circuits.js';
|
39
40
|
|
@@ -171,25 +172,18 @@ export class AztecRemoteWallet implements Wallet {
|
|
171
172
|
return scopes;
|
172
173
|
}
|
173
174
|
|
174
|
-
async
|
175
|
+
async getContractMetadata(address: AztecAddress): Promise<ContractMetadata> {
|
175
176
|
return this._provider
|
176
177
|
.chain(this._providerChainId)
|
177
|
-
.call('
|
178
|
-
.execute() as Promise<AztecWalletMethodMap['
|
178
|
+
.call('aztec_getContractMetadata', { address })
|
179
|
+
.execute() as Promise<AztecWalletMethodMap['aztec_getContractMetadata']['result']>;
|
179
180
|
}
|
180
181
|
|
181
|
-
async
|
182
|
+
async getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata> {
|
182
183
|
return this._provider
|
183
184
|
.chain(this._providerChainId)
|
184
|
-
.call('
|
185
|
-
.execute() as Promise<AztecWalletMethodMap['
|
186
|
-
}
|
187
|
-
|
188
|
-
async getContractArtifact(id: Fr): Promise<ContractArtifact | undefined> {
|
189
|
-
return this._provider
|
190
|
-
.chain(this._providerChainId)
|
191
|
-
.call('aztec_getContractArtifact', { id })
|
192
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_getContractArtifact']['result']>;
|
185
|
+
.call('aztec_getContractClassMetadata', { id, includeArtifact })
|
186
|
+
.execute() as Promise<AztecWalletMethodMap['aztec_getContractClassMetadata']['result']>;
|
193
187
|
}
|
194
188
|
|
195
189
|
async addCapsule(capsule: Fr[]): Promise<void> {
|
@@ -278,7 +272,6 @@ export class AztecRemoteWallet implements Wallet {
|
|
278
272
|
enforceFeePayment?: boolean,
|
279
273
|
profile?: boolean,
|
280
274
|
): Promise<TxSimulationResult> {
|
281
|
-
const scopes = await this.getScopesAsync();
|
282
275
|
return this._provider
|
283
276
|
.chain(this._providerChainId)
|
284
277
|
.call('aztec_simulateTx', {
|
@@ -415,27 +408,6 @@ export class AztecRemoteWallet implements Wallet {
|
|
415
408
|
.execute()) as Promise<AztecWalletMethodMap['aztec_getAuthWitness']['result']>;
|
416
409
|
}
|
417
410
|
|
418
|
-
async isContractClassPubliclyRegistered(id: Fr): Promise<boolean> {
|
419
|
-
return this._provider
|
420
|
-
.chain(this._providerChainId)
|
421
|
-
.call('aztec_isContractClassPubliclyRegistered', { id })
|
422
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractClassPubliclyRegistered']['result']>;
|
423
|
-
}
|
424
|
-
|
425
|
-
async isContractPubliclyDeployed(address: AztecAddress): Promise<boolean> {
|
426
|
-
return this._provider
|
427
|
-
.chain(this._providerChainId)
|
428
|
-
.call('aztec_isContractPubliclyDeployed', { address })
|
429
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractPubliclyDeployed']['result']>;
|
430
|
-
}
|
431
|
-
|
432
|
-
async isContractInitialized(address: AztecAddress): Promise<boolean> {
|
433
|
-
return this._provider
|
434
|
-
.chain(this._providerChainId)
|
435
|
-
.call('aztec_isContractInitialized', { address })
|
436
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractInitialized']['result']>;
|
437
|
-
}
|
438
|
-
|
439
411
|
async getPXEInfo(): Promise<PXEInfo> {
|
440
412
|
return this._provider.chain(this._providerChainId).call('aztec_getPXEInfo').execute() as Promise<
|
441
413
|
AztecWalletMethodMap['aztec_getPXEInfo']['result']
|