@walletmesh/aztec-rpc-wallet 0.2.0 → 0.3.1
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 +18 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/aztecRemoteWallet.d.ts +5 -9
- package/dist/aztecRemoteWallet.d.ts.map +1 -1
- package/dist/aztecRemoteWallet.js +7 -31
- package/dist/contractArtifactCache.d.ts.map +1 -1
- package/dist/contractArtifactCache.js +20 -9
- package/dist/handlers/aztecAccountWallet.d.ts.map +1 -1
- package/dist/handlers/aztecAccountWallet.js +12 -46
- package/dist/serializers/account.d.ts +16 -16
- package/dist/serializers/account.d.ts.map +1 -1
- package/dist/serializers/account.js +43 -43
- 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 +43 -43
- package/dist/serializers/note.d.ts +12 -12
- package/dist/serializers/note.d.ts.map +1 -1
- package/dist/serializers/note.js +32 -32
- 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 +10 -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 +1020 -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 +9 -9
- package/src/aztecRemoteWallet.test.ts +28 -66
- package/src/aztecRemoteWallet.ts +10 -37
- package/src/chainProvider.test.ts +117 -38
- package/src/contractArtifactCache.test.ts +28 -45
- package/src/contractArtifactCache.ts +20 -10
- package/src/handlers/aztecAccountWallet.test.ts +16 -89
- package/src/handlers/aztecAccountWallet.ts +20 -79
- package/src/provider.test.ts +3 -2
- package/src/serializers/account.test.ts +19 -20
- package/src/serializers/account.ts +52 -52
- package/src/serializers/contract.test.ts +4 -140
- package/src/serializers/contract.ts +93 -166
- package/src/serializers/index.test.ts +30 -28
- package/src/serializers/index.ts +15 -21
- package/src/serializers/log.test.ts +42 -48
- package/src/serializers/log.ts +54 -54
- package/src/serializers/note.test.ts +43 -16
- package/src/serializers/note.ts +39 -39
- package/src/serializers/transaction.test.ts +48 -41
- package/src/serializers/transaction.ts +146 -58
- package/src/types.ts +8 -8
- package/src/wallet.test.ts +3 -3
- 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 -103
- package/src/serializers/transaction-utils.ts +0 -174
@@ -0,0 +1,11 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/aztec/rpc-wallet/src/types.ts#L296)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.3.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1**](../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/65bc501d5bed45d0e6d444f53e29595da551d59e/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.1",
|
4
4
|
"description": "",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -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.76.2",
|
25
|
+
"@aztec/circuit-types": "0.76.2",
|
26
|
+
"@aztec/circuits.js": "0.76.2",
|
27
|
+
"@aztec/foundation": "0.76.2",
|
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
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
2
|
-
import { Fr, getContractClassFromArtifact } from '@aztec/aztec.js';
|
2
|
+
import { AztecAddress, Fr, getContractClassFromArtifact } from '@aztec/aztec.js';
|
3
3
|
import type {
|
4
|
-
AztecAddress,
|
5
4
|
TxExecutionRequest,
|
6
5
|
ContractInstanceWithAddress,
|
7
6
|
ContractClassWithId,
|
@@ -163,10 +162,12 @@ describe('AztecRemoteWallet', () => {
|
|
163
162
|
});
|
164
163
|
|
165
164
|
it('adds capsule', async () => {
|
166
|
-
const mockCapsule = [Fr.
|
165
|
+
const mockCapsule = [await Fr.random()]
|
166
|
+
const contract = await AztecAddress.random();
|
167
|
+
const storageSlot = await Fr.random();
|
167
168
|
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
168
|
-
await wallet.addCapsule(mockCapsule);
|
169
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_addCapsule', { capsule: mockCapsule });
|
169
|
+
await wallet.addCapsule(contract, storageSlot, mockCapsule);
|
170
|
+
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_addCapsule', { contract, storageSlot, capsule: mockCapsule });
|
170
171
|
});
|
171
172
|
|
172
173
|
it('registers account', async () => {
|
@@ -202,34 +203,6 @@ describe('AztecRemoteWallet', () => {
|
|
202
203
|
contractClass = await getContractClassFromArtifact(mockContract.artifact);
|
203
204
|
});
|
204
205
|
|
205
|
-
it('gets contract instance', async () => {
|
206
|
-
mockChainBuilder.execute.mockResolvedValueOnce(mockContract.instance);
|
207
|
-
|
208
|
-
const result = await wallet.getContractInstance(mockContract.instance.address);
|
209
|
-
expect(result).toBe(mockContract.instance);
|
210
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractInstance', {
|
211
|
-
address: mockContract.instance.address,
|
212
|
-
});
|
213
|
-
});
|
214
|
-
|
215
|
-
it('gets contract class', async () => {
|
216
|
-
mockChainBuilder.execute.mockResolvedValueOnce(contractClass);
|
217
|
-
|
218
|
-
const result = await wallet.getContractClass(contractClass.id);
|
219
|
-
expect(result).toBe(contractClass);
|
220
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractClass', { id: contractClass.id });
|
221
|
-
});
|
222
|
-
|
223
|
-
it('gets contract artifact', async () => {
|
224
|
-
mockChainBuilder.execute.mockResolvedValueOnce(mockContract.artifact);
|
225
|
-
|
226
|
-
const result = await wallet.getContractArtifact(contractClass.id);
|
227
|
-
expect(result).toBe(mockContract.artifact);
|
228
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractArtifact', {
|
229
|
-
id: contractClass.id,
|
230
|
-
});
|
231
|
-
});
|
232
|
-
|
233
206
|
it('registers contract', async () => {
|
234
207
|
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
235
208
|
await wallet.registerContract({ instance: mockContract.instance, artifact: mockContract.artifact });
|
@@ -255,6 +228,28 @@ describe('AztecRemoteWallet', () => {
|
|
255
228
|
expect(result).toBe(mockContracts);
|
256
229
|
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContracts');
|
257
230
|
});
|
231
|
+
|
232
|
+
it('gets contract metadata', async () => {
|
233
|
+
const mockMetadata = { contractInstance: mockContract.instance };
|
234
|
+
mockChainBuilder.execute.mockResolvedValueOnce(mockMetadata);
|
235
|
+
|
236
|
+
const result = await wallet.getContractMetadata(mockContract.instance.address);
|
237
|
+
expect(result).toBe(mockMetadata);
|
238
|
+
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractMetadata', {
|
239
|
+
address: mockContract.instance.address,
|
240
|
+
});
|
241
|
+
});
|
242
|
+
|
243
|
+
it('gets contract class metadata', async () => {
|
244
|
+
const mockMetadata = { artifact: mockContract.artifact };
|
245
|
+
mockChainBuilder.execute.mockResolvedValueOnce(mockMetadata);
|
246
|
+
|
247
|
+
const result = await wallet.getContractClassMetadata(contractClass.id);
|
248
|
+
expect(result).toBe(mockMetadata);
|
249
|
+
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_getContractClassMetadata', {
|
250
|
+
id: contractClass.id,
|
251
|
+
});
|
252
|
+
});
|
258
253
|
});
|
259
254
|
|
260
255
|
describe('auth witness operations', () => {
|
@@ -392,39 +387,6 @@ describe('AztecRemoteWallet', () => {
|
|
392
387
|
});
|
393
388
|
});
|
394
389
|
|
395
|
-
describe('contract verification operations', () => {
|
396
|
-
it('checks if contract class is publicly registered', async () => {
|
397
|
-
const mockId = Fr.fromString('1');
|
398
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
399
|
-
|
400
|
-
const result = await wallet.isContractClassPubliclyRegistered(mockId);
|
401
|
-
expect(result).toBe(true);
|
402
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractClassPubliclyRegistered', {
|
403
|
-
id: mockId,
|
404
|
-
});
|
405
|
-
});
|
406
|
-
|
407
|
-
it('checks if contract is publicly deployed', async () => {
|
408
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
409
|
-
|
410
|
-
const result = await wallet.isContractPubliclyDeployed(mockAddress);
|
411
|
-
expect(result).toBe(true);
|
412
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractPubliclyDeployed', {
|
413
|
-
address: mockAddress,
|
414
|
-
});
|
415
|
-
});
|
416
|
-
|
417
|
-
it('checks if contract is initialized', async () => {
|
418
|
-
mockChainBuilder.execute.mockResolvedValueOnce(true);
|
419
|
-
|
420
|
-
const result = await wallet.isContractInitialized(mockAddress);
|
421
|
-
expect(result).toBe(true);
|
422
|
-
expect(mockChainBuilder.call).toHaveBeenCalledWith('aztec_isContractInitialized', {
|
423
|
-
address: mockAddress,
|
424
|
-
});
|
425
|
-
});
|
426
|
-
});
|
427
|
-
|
428
390
|
describe('PXE operations', () => {
|
429
391
|
it('gets PXE info', async () => {
|
430
392
|
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,31 +172,24 @@ 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['
|
185
|
+
.call('aztec_getContractClassMetadata', { id, includeArtifact })
|
186
|
+
.execute() as Promise<AztecWalletMethodMap['aztec_getContractClassMetadata']['result']>;
|
186
187
|
}
|
187
188
|
|
188
|
-
async
|
189
|
-
return this._provider
|
190
|
-
.chain(this._providerChainId)
|
191
|
-
.call('aztec_getContractArtifact', { id })
|
192
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_getContractArtifact']['result']>;
|
193
|
-
}
|
194
|
-
|
195
|
-
async addCapsule(capsule: Fr[]): Promise<void> {
|
189
|
+
async addCapsule(contract: AztecAddress, storageSlot: Fr, capsule: Fr[]): Promise<void> {
|
196
190
|
const result = (await this._provider
|
197
191
|
.chain(this._providerChainId)
|
198
|
-
.call('aztec_addCapsule', { capsule })
|
192
|
+
.call('aztec_addCapsule', { contract, storageSlot, capsule })
|
199
193
|
.execute()) as AztecWalletMethodMap['aztec_addCapsule']['result'];
|
200
194
|
if (!result) throw new Error('Failed to add capsule');
|
201
195
|
}
|
@@ -414,27 +408,6 @@ export class AztecRemoteWallet implements Wallet {
|
|
414
408
|
.execute()) as Promise<AztecWalletMethodMap['aztec_getAuthWitness']['result']>;
|
415
409
|
}
|
416
410
|
|
417
|
-
async isContractClassPubliclyRegistered(id: Fr): Promise<boolean> {
|
418
|
-
return this._provider
|
419
|
-
.chain(this._providerChainId)
|
420
|
-
.call('aztec_isContractClassPubliclyRegistered', { id })
|
421
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractClassPubliclyRegistered']['result']>;
|
422
|
-
}
|
423
|
-
|
424
|
-
async isContractPubliclyDeployed(address: AztecAddress): Promise<boolean> {
|
425
|
-
return this._provider
|
426
|
-
.chain(this._providerChainId)
|
427
|
-
.call('aztec_isContractPubliclyDeployed', { address })
|
428
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractPubliclyDeployed']['result']>;
|
429
|
-
}
|
430
|
-
|
431
|
-
async isContractInitialized(address: AztecAddress): Promise<boolean> {
|
432
|
-
return this._provider
|
433
|
-
.chain(this._providerChainId)
|
434
|
-
.call('aztec_isContractInitialized', { address })
|
435
|
-
.execute() as Promise<AztecWalletMethodMap['aztec_isContractInitialized']['result']>;
|
436
|
-
}
|
437
|
-
|
438
411
|
async getPXEInfo(): Promise<PXEInfo> {
|
439
412
|
return this._provider.chain(this._providerChainId).call('aztec_getPXEInfo').execute() as Promise<
|
440
413
|
AztecWalletMethodMap['aztec_getPXEInfo']['result']
|