@dynamic-labs-wallet/node-ton 0.0.354 → 0.1.0-request-signing
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/index.cjs +172 -149
- package/index.esm.js +172 -149
- package/package.json +2 -2
- package/src/client/client.d.ts +41 -27
- package/src/client/client.d.ts.map +1 -1
package/src/client/client.d.ts
CHANGED
|
@@ -1,73 +1,75 @@
|
|
|
1
|
-
import { DynamicWalletClient, type DynamicWalletClientProps, type Ed25519KeygenResult, type ServerKeyShare, type ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';
|
|
1
|
+
import { DynamicWalletClient, type DynamicWalletClientProps, type Ed25519KeygenResult, type ServerKeyShare, type ThresholdSignatureScheme, type WalletMetadata, type WalletApiKeyCreationResult, type SignMessageContext } from '@dynamic-labs-wallet/node';
|
|
2
2
|
export declare class DynamicTonWalletClient extends DynamicWalletClient {
|
|
3
3
|
readonly chainName = "TON";
|
|
4
|
-
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, enableMPCAccelerator, logger, }: DynamicWalletClientProps);
|
|
4
|
+
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, enableMPCAccelerator, logger, requestSigning, }: DynamicWalletClientProps);
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
7
7
|
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
8
8
|
* @param password - The password to use for the wallet.
|
|
9
9
|
* @param onError - The function to call if an error occurs.
|
|
10
|
-
* @param
|
|
11
|
-
* @returns The
|
|
10
|
+
* @param backUpToDynamic - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
11
|
+
* @returns The walletMetadata, public key hex, raw public key, and external server key shares.
|
|
12
12
|
*/
|
|
13
|
-
createWalletAccount({ thresholdSignatureScheme, password, onError,
|
|
13
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToDynamic, }: {
|
|
14
14
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
15
15
|
password?: string;
|
|
16
16
|
onError?: (error: Error) => void;
|
|
17
|
-
|
|
17
|
+
backUpToDynamic?: boolean;
|
|
18
18
|
}): Promise<{
|
|
19
|
-
|
|
19
|
+
walletMetadata: WalletMetadata;
|
|
20
20
|
publicKeyHex: string;
|
|
21
21
|
rawPublicKey: Uint8Array | string;
|
|
22
|
-
walletId: string;
|
|
23
|
-
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
24
22
|
externalServerKeyShares: ServerKeyShare[];
|
|
25
23
|
externalKeySharesWithBackupStatus: Array<{
|
|
26
24
|
share: ServerKeyShare;
|
|
27
25
|
backedUpToClientKeyShareService: boolean;
|
|
28
26
|
}>;
|
|
29
|
-
}>;
|
|
27
|
+
} & WalletApiKeyCreationResult>;
|
|
30
28
|
/**
|
|
31
29
|
* Signs a message using MPC
|
|
32
30
|
* @param message - The message to sign
|
|
33
|
-
* @param
|
|
31
|
+
* @param walletMetadata - Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
34
32
|
* @param password - The password for encrypted backup shares
|
|
35
33
|
* @param externalServerKeyShares - The external server key shares
|
|
34
|
+
* @param context - Policy signing context. Defaults to the signed message.
|
|
36
35
|
* @param onError - The function to call if an error occurs
|
|
37
36
|
* @returns The signature as a base64 string
|
|
38
37
|
*/
|
|
39
|
-
signMessage({ message,
|
|
38
|
+
signMessage({ message, walletMetadata, password, externalServerKeyShares, context, onError, }: {
|
|
40
39
|
message: string;
|
|
41
|
-
|
|
40
|
+
walletMetadata: WalletMetadata;
|
|
42
41
|
password?: string;
|
|
43
42
|
externalServerKeyShares?: ServerKeyShare[];
|
|
43
|
+
context?: SignMessageContext;
|
|
44
44
|
onError?: (error: Error) => void;
|
|
45
45
|
}): Promise<string>;
|
|
46
46
|
/**
|
|
47
47
|
* Signs a transaction using MPC
|
|
48
|
-
* @param
|
|
48
|
+
* @param walletMetadata - Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
49
49
|
* @param transaction - The serialized transaction to sign
|
|
50
50
|
* @param password - The password for encrypted backup shares
|
|
51
51
|
* @param externalServerKeyShares - The external server key shares
|
|
52
|
+
* @param context - Policy signing context. Defaults to the serialized transaction.
|
|
52
53
|
* @param onError - The function to call if an error occurs
|
|
53
54
|
* @returns The signature as a base64 string
|
|
54
55
|
*/
|
|
55
|
-
signTransaction({
|
|
56
|
-
|
|
56
|
+
signTransaction({ walletMetadata, transaction, password, externalServerKeyShares, context, onError, }: {
|
|
57
|
+
walletMetadata: WalletMetadata;
|
|
57
58
|
transaction: string;
|
|
58
59
|
password?: string;
|
|
59
60
|
externalServerKeyShares?: ServerKeyShare[];
|
|
61
|
+
context?: SignMessageContext;
|
|
60
62
|
onError?: (error: Error) => void;
|
|
61
63
|
}): Promise<string>;
|
|
62
64
|
/**
|
|
63
|
-
* Exports the private key for a given
|
|
64
|
-
* @param
|
|
65
|
+
* Exports the private key for a given wallet
|
|
66
|
+
* @param walletMetadata - Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
65
67
|
* @param password - The password for encrypted backup shares
|
|
66
68
|
* @param externalServerKeyShares - The external server key shares
|
|
67
69
|
* @returns The private key as a hex string
|
|
68
70
|
*/
|
|
69
|
-
exportPrivateKey({
|
|
70
|
-
|
|
71
|
+
exportPrivateKey({ walletMetadata, password, externalServerKeyShares, }: {
|
|
72
|
+
walletMetadata: WalletMetadata;
|
|
71
73
|
password?: string;
|
|
72
74
|
externalServerKeyShares?: ServerKeyShare[];
|
|
73
75
|
}): Promise<string>;
|
|
@@ -76,6 +78,11 @@ export declare class DynamicTonWalletClient extends DynamicWalletClient {
|
|
|
76
78
|
* @param keyShares - The key shares to export the private key for
|
|
77
79
|
* @param derivationPath - The derivation path
|
|
78
80
|
* @returns The derived private key
|
|
81
|
+
*
|
|
82
|
+
* `derivationPath` is the JSON-serialized index map that
|
|
83
|
+
* `walletMetadata.derivationPath` carries (e.g. `'{"0":44,"1":60,"2":0,"3":0,"4":0}'`
|
|
84
|
+
* or `'[44,60,0,0,0]'`). BIP-32 strings such as `"m/44'/60'/0'/0/0"` are rejected.
|
|
85
|
+
* Omit it to export without path derivation.
|
|
79
86
|
*/
|
|
80
87
|
offlineExportPrivateKey({ keyShares, derivationPath, }: {
|
|
81
88
|
keyShares: Ed25519KeygenResult[];
|
|
@@ -90,23 +97,22 @@ export declare class DynamicTonWalletClient extends DynamicWalletClient {
|
|
|
90
97
|
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
91
98
|
* @param password - The password to use for the wallet.
|
|
92
99
|
* @param onError - The function to call if an error occurs.
|
|
93
|
-
* @param
|
|
100
|
+
* @param backUpToDynamic - Whether to back up the external server key shares to the client share service.
|
|
94
101
|
* @param publicAddressCheck - Optional public address to verify against the derived address.
|
|
95
|
-
* @returns The
|
|
102
|
+
* @returns The walletMetadata, public key hex, raw public key, and external server key shares.
|
|
96
103
|
*/
|
|
97
|
-
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError,
|
|
104
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, backUpToDynamic, publicAddressCheck, }: {
|
|
98
105
|
privateKey: string;
|
|
99
106
|
chainName: string;
|
|
100
107
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
101
108
|
password?: string;
|
|
102
109
|
onError?: (error: Error) => void;
|
|
103
|
-
|
|
110
|
+
backUpToDynamic?: boolean;
|
|
104
111
|
publicAddressCheck?: string;
|
|
105
112
|
}): Promise<{
|
|
106
|
-
|
|
113
|
+
walletMetadata: WalletMetadata;
|
|
107
114
|
publicKeyHex: string;
|
|
108
115
|
rawPublicKey: Uint8Array | string | undefined;
|
|
109
|
-
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
110
116
|
externalServerKeyShares: ServerKeyShare[];
|
|
111
117
|
externalKeySharesWithBackupStatus: Array<{
|
|
112
118
|
share: ServerKeyShare;
|
|
@@ -131,6 +137,14 @@ export declare class DynamicTonWalletClient extends DynamicWalletClient {
|
|
|
131
137
|
* Gets all TON wallets
|
|
132
138
|
* @returns Array of TON wallets
|
|
133
139
|
*/
|
|
134
|
-
getTonWallets(): Promise<
|
|
140
|
+
getTonWallets(): Promise<{
|
|
141
|
+
walletId: string;
|
|
142
|
+
chainName: string;
|
|
143
|
+
accountAddress: string;
|
|
144
|
+
externalServerKeySharesBackupInfo: import("packages/core/src/types.js").KeyShareBackupInfo;
|
|
145
|
+
externalServerKeyShares: never[];
|
|
146
|
+
derivationPath: string | undefined;
|
|
147
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
148
|
+
}[]>;
|
|
135
149
|
}
|
|
136
150
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAG/B,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AAiBnC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,KAAK,EACL,oBAAoB,EACpB,MAAM,EACN,cAAc,GACf,EAAE,wBAAwB;IAY3B;;;;;;;OAO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