@miden-sdk/miden-wallet-adapter-base 0.15.1 → 0.15.3
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/__tests__/signer.test.ts +20 -0
- package/dist/__tests__/signer.test.d.ts +1 -0
- package/dist/__tests__/signer.test.js +18 -0
- package/dist/__tests__/signer.test.js.map +1 -0
- package/dist/signer.d.ts +3 -1
- package/dist/signer.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/docs/README.md +1 -0
- package/docs/classes/BaseMessageSignerWalletAdapter.md +14 -0
- package/docs/interfaces/GuardianInfo.md +31 -0
- package/docs/interfaces/MessageSignerWalletAdapterProps.md +10 -0
- package/package.json +1 -1
- package/signer.ts +3 -1
- package/types.ts +12 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import type { GuardianInfo } from '../types';
|
|
3
|
+
|
|
4
|
+
describe('GuardianInfo', () => {
|
|
5
|
+
it('has the agreed shape', () => {
|
|
6
|
+
const g: GuardianInfo = {
|
|
7
|
+
isGuardianAccount: false,
|
|
8
|
+
guardianEndpoint: null,
|
|
9
|
+
guardianProvider: null,
|
|
10
|
+
guardianSyncStatus: null,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
expect(Object.keys(g).sort()).toEqual([
|
|
14
|
+
'guardianEndpoint',
|
|
15
|
+
'guardianProvider',
|
|
16
|
+
'guardianSyncStatus',
|
|
17
|
+
'isGuardianAccount',
|
|
18
|
+
]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
describe('GuardianInfo', () => {
|
|
3
|
+
it('has the agreed shape', () => {
|
|
4
|
+
const g = {
|
|
5
|
+
isGuardianAccount: false,
|
|
6
|
+
guardianEndpoint: null,
|
|
7
|
+
guardianProvider: null,
|
|
8
|
+
guardianSyncStatus: null,
|
|
9
|
+
};
|
|
10
|
+
expect(Object.keys(g).sort()).toEqual([
|
|
11
|
+
'guardianEndpoint',
|
|
12
|
+
'guardianProvider',
|
|
13
|
+
'guardianSyncStatus',
|
|
14
|
+
'isGuardianAccount',
|
|
15
|
+
]);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=signer.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.test.js","sourceRoot":"","sources":["../../__tests__/signer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,GAAiB;YACtB,iBAAiB,EAAE,KAAK;YACxB,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE,IAAI;YACtB,kBAAkB,EAAE,IAAI;SACzB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;YACpC,kBAAkB;YAClB,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;SACpB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/signer.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { NoteFilterTypes } from '@miden-sdk/miden-sdk';
|
|
|
2
2
|
import type { WalletAdapter, WalletAdapterProps } from './adapter';
|
|
3
3
|
import { BaseWalletAdapter } from './adapter';
|
|
4
4
|
import { MidenConsumeTransaction, MidenSendTransaction, MidenTransaction } from './transaction';
|
|
5
|
-
import { Asset, CreateAccountParams, InputNoteDetails, SignKind, TransactionOutput } from './types';
|
|
5
|
+
import { Asset, CreateAccountParams, GuardianInfo, InputNoteDetails, SignKind, TransactionOutput } from './types';
|
|
6
6
|
export type Adapter = WalletAdapter | SignerWalletAdapter | MessageSignerWalletAdapter;
|
|
7
7
|
export interface SignerWalletAdapterProps<Name extends string = string> extends WalletAdapterProps<Name> {
|
|
8
8
|
}
|
|
@@ -12,6 +12,7 @@ export declare abstract class BaseSignerWalletAdapter<Name extends string = stri
|
|
|
12
12
|
export interface MessageSignerWalletAdapterProps<Name extends string = string> extends WalletAdapterProps<Name> {
|
|
13
13
|
requestTransaction(transaction: MidenTransaction): Promise<string>;
|
|
14
14
|
requestAssets(): Promise<Asset[]>;
|
|
15
|
+
requestGuardianInfo(): Promise<GuardianInfo>;
|
|
15
16
|
requestPrivateNotes(noteFilterType: NoteFilterTypes, noteIds?: string[]): Promise<InputNoteDetails[]>;
|
|
16
17
|
signBytes(data: Uint8Array, kind: SignKind): Promise<Uint8Array>;
|
|
17
18
|
importPrivateNote(note: Uint8Array): Promise<string>;
|
|
@@ -27,6 +28,7 @@ export declare abstract class BaseMessageSignerWalletAdapter<Name extends string
|
|
|
27
28
|
abstract requestConsume(transaction: MidenConsumeTransaction): Promise<string>;
|
|
28
29
|
abstract requestTransaction(transaction: MidenTransaction): Promise<string>;
|
|
29
30
|
abstract requestAssets(): Promise<Asset[]>;
|
|
31
|
+
abstract requestGuardianInfo(): Promise<GuardianInfo>;
|
|
30
32
|
abstract requestPrivateNotes(noteFilterType: NoteFilterTypes, noteIds?: string[]): Promise<InputNoteDetails[]>;
|
|
31
33
|
abstract signBytes(data: Uint8Array, kind: SignKind): Promise<Uint8Array>;
|
|
32
34
|
abstract importPrivateNote(note: Uint8Array): Promise<string>;
|
package/dist/signer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../signer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAmB9C,MAAM,OAAgB,uBACpB,SAAQ,iBAAuB;CACQ;
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../signer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAmB9C,MAAM,OAAgB,uBACpB,SAAQ,iBAAuB;CACQ;AA0BzC,MAAM,OAAgB,8BAGpB,SAAQ,uBAA6B;CAsBtC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface Asset {
|
|
|
22
22
|
faucetId: string;
|
|
23
23
|
amount: string;
|
|
24
24
|
}
|
|
25
|
+
export interface GuardianInfo {
|
|
26
|
+
isGuardianAccount: boolean;
|
|
27
|
+
guardianEndpoint: string | null;
|
|
28
|
+
guardianProvider: 'open-zeppelin' | 'gateway' | 'lambda-class' | 'custom' | null;
|
|
29
|
+
guardianSyncStatus: 'in-sync' | 'out-of-sync' | null;
|
|
30
|
+
}
|
|
25
31
|
export type InputNoteDetails = {
|
|
26
32
|
noteId: string;
|
|
27
33
|
senderAccountId: string | undefined;
|
package/docs/README.md
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
- [Asset](interfaces/Asset.md)
|
|
56
56
|
- [CreateAccountParams](interfaces/CreateAccountParams.md)
|
|
57
|
+
- [GuardianInfo](interfaces/GuardianInfo.md)
|
|
57
58
|
- [IFailedTransactionOutput](interfaces/IFailedTransactionOutput.md)
|
|
58
59
|
- [MessageSignerWalletAdapterProps](interfaces/MessageSignerWalletAdapterProps.md)
|
|
59
60
|
- [MidenConsumeTransaction](interfaces/MidenConsumeTransaction.md)
|
|
@@ -664,6 +664,20 @@ Remove the listeners of a given event.
|
|
|
664
664
|
|
|
665
665
|
***
|
|
666
666
|
|
|
667
|
+
### requestGuardianInfo()
|
|
668
|
+
|
|
669
|
+
> `abstract` **requestGuardianInfo**(): `Promise`\<[`GuardianInfo`](../interfaces/GuardianInfo.md)\>
|
|
670
|
+
|
|
671
|
+
#### Returns
|
|
672
|
+
|
|
673
|
+
`Promise`\<[`GuardianInfo`](../interfaces/GuardianInfo.md)\>
|
|
674
|
+
|
|
675
|
+
#### Implementation of
|
|
676
|
+
|
|
677
|
+
`MessageSignerWalletAdapter.requestGuardianInfo`
|
|
678
|
+
|
|
679
|
+
***
|
|
680
|
+
|
|
667
681
|
### requestPrivateNotes()
|
|
668
682
|
|
|
669
683
|
> `abstract` **requestPrivateNotes**(`noteFilterType`, `noteIds?`): `Promise`\<[`InputNoteDetails`](../type-aliases/InputNoteDetails.md)[]\>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[**@miden-sdk/miden-wallet-adapter-base**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@miden-sdk/miden-wallet-adapter-base](../README.md) / GuardianInfo
|
|
6
|
+
|
|
7
|
+
# Interface: GuardianInfo
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### guardianEndpoint
|
|
12
|
+
|
|
13
|
+
> **guardianEndpoint**: `string`
|
|
14
|
+
|
|
15
|
+
***
|
|
16
|
+
|
|
17
|
+
### guardianProvider
|
|
18
|
+
|
|
19
|
+
> **guardianProvider**: `"open-zeppelin"` \| `"gateway"` \| `"lambda-class"` \| `"custom"`
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### guardianSyncStatus
|
|
24
|
+
|
|
25
|
+
> **guardianSyncStatus**: `"in-sync"` \| `"out-of-sync"`
|
|
26
|
+
|
|
27
|
+
***
|
|
28
|
+
|
|
29
|
+
### isGuardianAccount
|
|
30
|
+
|
|
31
|
+
> **isGuardianAccount**: `boolean`
|
|
@@ -218,6 +218,16 @@
|
|
|
218
218
|
|
|
219
219
|
***
|
|
220
220
|
|
|
221
|
+
### requestGuardianInfo()
|
|
222
|
+
|
|
223
|
+
> **requestGuardianInfo**(): `Promise`\<[`GuardianInfo`](GuardianInfo.md)\>
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
`Promise`\<[`GuardianInfo`](GuardianInfo.md)\>
|
|
228
|
+
|
|
229
|
+
***
|
|
230
|
+
|
|
221
231
|
### requestPrivateNotes()
|
|
222
232
|
|
|
223
233
|
> **requestPrivateNotes**(`noteFilterType`, `noteIds?`): `Promise`\<[`InputNoteDetails`](../type-aliases/InputNoteDetails.md)[]\>
|
package/package.json
CHANGED
package/signer.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
MidenSendTransaction,
|
|
7
7
|
MidenTransaction,
|
|
8
8
|
} from './transaction';
|
|
9
|
-
import { Asset, CreateAccountParams, InputNoteDetails, SignKind, TransactionOutput } from './types';
|
|
9
|
+
import { Asset, CreateAccountParams, GuardianInfo, InputNoteDetails, SignKind, TransactionOutput } from './types';
|
|
10
10
|
|
|
11
11
|
export type Adapter =
|
|
12
12
|
| WalletAdapter
|
|
@@ -27,6 +27,7 @@ export interface MessageSignerWalletAdapterProps<Name extends string = string>
|
|
|
27
27
|
extends WalletAdapterProps<Name> {
|
|
28
28
|
requestTransaction(transaction: MidenTransaction): Promise<string>;
|
|
29
29
|
requestAssets(): Promise<Asset[]>;
|
|
30
|
+
requestGuardianInfo(): Promise<GuardianInfo>;
|
|
30
31
|
requestPrivateNotes(
|
|
31
32
|
noteFilterType: NoteFilterTypes,
|
|
32
33
|
noteIds?: string[]
|
|
@@ -58,6 +59,7 @@ export abstract class BaseMessageSignerWalletAdapter<
|
|
|
58
59
|
): Promise<string>;
|
|
59
60
|
abstract requestTransaction(transaction: MidenTransaction): Promise<string>;
|
|
60
61
|
abstract requestAssets(): Promise<Asset[]>;
|
|
62
|
+
abstract requestGuardianInfo(): Promise<GuardianInfo>;
|
|
61
63
|
abstract requestPrivateNotes(
|
|
62
64
|
noteFilterType: NoteFilterTypes,
|
|
63
65
|
noteIds?: string[]
|
package/types.ts
CHANGED
|
@@ -32,6 +32,18 @@ export interface Asset {
|
|
|
32
32
|
amount: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export interface GuardianInfo {
|
|
36
|
+
isGuardianAccount: boolean;
|
|
37
|
+
guardianEndpoint: string | null;
|
|
38
|
+
guardianProvider:
|
|
39
|
+
| 'open-zeppelin'
|
|
40
|
+
| 'gateway'
|
|
41
|
+
| 'lambda-class'
|
|
42
|
+
| 'custom'
|
|
43
|
+
| null;
|
|
44
|
+
guardianSyncStatus: 'in-sync' | 'out-of-sync' | null;
|
|
45
|
+
}
|
|
46
|
+
|
|
35
47
|
export type InputNoteDetails = {
|
|
36
48
|
noteId: string;
|
|
37
49
|
senderAccountId: string | undefined;
|