@dynamic-labs-wallet/svm 0.0.0-beta.146.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/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,256 @@
1
+ 'use strict';
2
+
3
+ var browser = require('@dynamic-labs-wallet/browser');
4
+ var bs58 = require('bs58');
5
+ var web3_js = require('@solana/web3.js');
6
+
7
+ function _extends() {
8
+ _extends = Object.assign || function assign(target) {
9
+ for(var i = 1; i < arguments.length; i++){
10
+ var source = arguments[i];
11
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
12
+ }
13
+ return target;
14
+ };
15
+ return _extends.apply(this, arguments);
16
+ }
17
+
18
+ const ERROR_CREATE_WALLET_ACCOUNT = 'Error creating svm wallet account';
19
+
20
+ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
21
+ /**
22
+ * Creates a wallet account on the Solana chain
23
+ *
24
+ * @param thresholdSignatureScheme The threshold signature scheme to use
25
+ * @returns The account address, public key hex, raw public key, and client key shares
26
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
27
+ try {
28
+ const { rawPublicKey, clientKeyShares } = await this.keyGen({
29
+ chainName: this.chainName,
30
+ thresholdSignatureScheme,
31
+ onCeremonyComplete: (accountAddress, walletId)=>{
32
+ // update wallet map
33
+ this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
34
+ accountAddress,
35
+ walletId,
36
+ chainName: this.chainName,
37
+ thresholdSignatureScheme,
38
+ clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
39
+ });
40
+ }
41
+ });
42
+ if (!rawPublicKey || !(rawPublicKey instanceof Uint8Array)) {
43
+ throw new Error('Raw public key is not a Uint8Array');
44
+ }
45
+ if (!clientKeyShares) {
46
+ throw new Error('Error creating wallet account');
47
+ }
48
+ const { accountAddress } = await this.deriveAccountAddress(rawPublicKey);
49
+ // Update client key shares in wallet map
50
+ await this.setClientKeySharesToLocalStorage({
51
+ accountAddress,
52
+ clientKeyShares,
53
+ overwriteOrMerge: 'overwrite'
54
+ });
55
+ // Backup the new wallet without waiting for the promise to resolve
56
+ void this.storeEncryptedBackupByWalletWithRetry({
57
+ accountAddress,
58
+ clientKeyShares,
59
+ password
60
+ });
61
+ return {
62
+ accountAddress,
63
+ rawPublicKey,
64
+ clientKeyShares
65
+ };
66
+ } catch (error) {
67
+ this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
68
+ throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
69
+ }
70
+ }
71
+ // Function to properly derive account address
72
+ async deriveAccountAddress(rawPublicKey) {
73
+ const accountAddress = bs58.encode(rawPublicKey);
74
+ return {
75
+ accountAddress
76
+ };
77
+ }
78
+ /**
79
+ * This function takes a message and returns it after being signed with MPC
80
+ *
81
+ * @param message The message to sign (Uint8Array)
82
+ * @param accountAddress Solana address (base58 encoded)
83
+ * @param password The password for encrypted backup shares
84
+ */ async signMessage({ message, accountAddress, password = undefined }) {
85
+ await this.verifyPassword({
86
+ accountAddress,
87
+ password,
88
+ walletOperation: browser.WalletOperation.SIGN_MESSAGE
89
+ });
90
+ if (!accountAddress) {
91
+ throw new Error('Account address is required');
92
+ }
93
+ try {
94
+ const signatureEd25519 = await this.sign({
95
+ message,
96
+ accountAddress: accountAddress,
97
+ chainName: this.chainName,
98
+ password
99
+ });
100
+ const base58Signature = bs58.encode(signatureEd25519);
101
+ return base58Signature;
102
+ } catch (error) {
103
+ this.logger.error('Error signing message:', error);
104
+ throw error;
105
+ }
106
+ }
107
+ async signTransaction({ senderAddress, transaction, password = undefined }) {
108
+ await this.verifyPassword({
109
+ accountAddress: senderAddress,
110
+ password,
111
+ walletOperation: browser.WalletOperation.SIGN_TRANSACTION
112
+ });
113
+ try {
114
+ const signatureEd25519 = await this.sign({
115
+ message: transaction,
116
+ accountAddress: senderAddress,
117
+ chainName: this.chainName,
118
+ password
119
+ });
120
+ if (!signatureEd25519) {
121
+ throw new Error('Signature is undefined');
122
+ }
123
+ return Buffer.from(signatureEd25519).toString('hex');
124
+ } catch (error) {
125
+ this.logger.error('Error in signTransaction:', error);
126
+ if (error instanceof Error) {
127
+ this.logger.error('Error details:', error);
128
+ }
129
+ throw error;
130
+ }
131
+ }
132
+ /**
133
+ * Exports the private key for a given account address
134
+ *
135
+ * @param accountAddress The account address to export the private key for
136
+ * @param password The password for encrypted backup shares
137
+ * @returns The private key
138
+ */ async exportPrivateKey({ accountAddress, password = undefined }) {
139
+ await this.verifyPassword({
140
+ accountAddress,
141
+ password,
142
+ walletOperation: browser.WalletOperation.EXPORT_PRIVATE_KEY
143
+ });
144
+ const { derivedPrivateKey } = await this.exportKey({
145
+ accountAddress,
146
+ chainName: this.chainName,
147
+ password
148
+ });
149
+ if (!derivedPrivateKey) {
150
+ throw new Error('Derived private key is undefined');
151
+ }
152
+ const encodedPrivateKey = bs58.encode(Buffer.from(derivedPrivateKey));
153
+ return encodedPrivateKey;
154
+ }
155
+ /**
156
+ * Exports the private key for a given account address
157
+ *
158
+ * @param keyShares The key shares to export the private key for
159
+ * @returns The private key
160
+ */ async offlineExportPrivateKey({ keyShares, derivationPath }) {
161
+ const { derivedPrivateKey } = await this.offlineExportKey({
162
+ chainName: this.chainName,
163
+ keyShares,
164
+ derivationPath
165
+ });
166
+ return {
167
+ derivedPrivateKey
168
+ };
169
+ }
170
+ /**
171
+ * Converts the private key to a hex string
172
+ *
173
+ * @param privateKey The private key to convert
174
+ * @returns The hex string
175
+ */ decodePrivateKeyForSolana(privateKey) {
176
+ const decoded = bs58.decode(privateKey);
177
+ const slicedBytes = decoded.slice(0, 32);
178
+ return Buffer.from(slicedBytes).toString('hex');
179
+ }
180
+ getPublicKeyFromPrivateKey(privateKey) {
181
+ const privateKeyBytes = bs58.decode(privateKey);
182
+ const keypair = web3_js.Keypair.fromSecretKey(privateKeyBytes);
183
+ const publicKeyBase58 = keypair.publicKey.toBase58();
184
+ return publicKeyBase58;
185
+ }
186
+ encodePublicKey(publicKey) {
187
+ return bs58.encode(publicKey);
188
+ }
189
+ /**
190
+ * Imports the private key for a given account address
191
+ *
192
+ * @param privateKey The private key to import
193
+ * @param chainName The chain name to import the private key for
194
+ * @param thresholdSignatureScheme The threshold signature scheme to use
195
+ * @param password The password for encrypted backup shares
196
+ * @returns The account address, raw public key, and client key shares
197
+ */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
198
+ //get public key from private key
199
+ const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
200
+ const formattedPrivateKey = this.decodePrivateKeyForSolana(privateKey);
201
+ const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
202
+ chainName,
203
+ privateKey: formattedPrivateKey,
204
+ thresholdSignatureScheme,
205
+ onError,
206
+ onCeremonyComplete: (accountAddress, walletId)=>{
207
+ // update wallet map
208
+ this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
209
+ accountAddress,
210
+ walletId,
211
+ chainName: this.chainName,
212
+ thresholdSignatureScheme,
213
+ clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
214
+ });
215
+ }
216
+ });
217
+ if (!rawPublicKey || !clientKeyShares) {
218
+ throw new Error('Error creating wallet account');
219
+ }
220
+ const { accountAddress } = await this.deriveAccountAddress(rawPublicKey);
221
+ if (accountAddress !== publicKey) {
222
+ throw new Error(`Public key mismatch: derived address ${accountAddress} !== public key ${publicKey}`);
223
+ }
224
+ // Update client key shares in wallet map
225
+ await this.setClientKeySharesToLocalStorage({
226
+ accountAddress,
227
+ clientKeyShares,
228
+ overwriteOrMerge: 'overwrite'
229
+ });
230
+ // Backup the new wallet without waiting for the promise to resolve
231
+ void this.storeEncryptedBackupByWalletWithRetry({
232
+ accountAddress,
233
+ clientKeyShares,
234
+ password
235
+ });
236
+ return {
237
+ accountAddress,
238
+ rawPublicKey: rawPublicKey
239
+ };
240
+ }
241
+ async getSvmWallets() {
242
+ const wallets = await this.getWallets();
243
+ const svmWallets = wallets.filter((wallet)=>wallet.chainName === 'solana');
244
+ return svmWallets;
245
+ }
246
+ constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl }){
247
+ super({
248
+ environmentId,
249
+ authToken,
250
+ baseApiUrl,
251
+ baseMPCRelayApiUrl
252
+ }), this.chainName = 'SOL';
253
+ }
254
+ }
255
+
256
+ exports.DynamicSvmWalletClient = DynamicSvmWalletClient;
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.esm.js ADDED
@@ -0,0 +1,254 @@
1
+ import { DynamicWalletClient, getClientKeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/browser';
2
+ import bs58 from 'bs58';
3
+ import { Keypair } from '@solana/web3.js';
4
+
5
+ function _extends() {
6
+ _extends = Object.assign || function assign(target) {
7
+ for(var i = 1; i < arguments.length; i++){
8
+ var source = arguments[i];
9
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+
16
+ const ERROR_CREATE_WALLET_ACCOUNT = 'Error creating svm wallet account';
17
+
18
+ class DynamicSvmWalletClient extends DynamicWalletClient {
19
+ /**
20
+ * Creates a wallet account on the Solana chain
21
+ *
22
+ * @param thresholdSignatureScheme The threshold signature scheme to use
23
+ * @returns The account address, public key hex, raw public key, and client key shares
24
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
25
+ try {
26
+ const { rawPublicKey, clientKeyShares } = await this.keyGen({
27
+ chainName: this.chainName,
28
+ thresholdSignatureScheme,
29
+ onCeremonyComplete: (accountAddress, walletId)=>{
30
+ // update wallet map
31
+ this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
32
+ accountAddress,
33
+ walletId,
34
+ chainName: this.chainName,
35
+ thresholdSignatureScheme,
36
+ clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
37
+ });
38
+ }
39
+ });
40
+ if (!rawPublicKey || !(rawPublicKey instanceof Uint8Array)) {
41
+ throw new Error('Raw public key is not a Uint8Array');
42
+ }
43
+ if (!clientKeyShares) {
44
+ throw new Error('Error creating wallet account');
45
+ }
46
+ const { accountAddress } = await this.deriveAccountAddress(rawPublicKey);
47
+ // Update client key shares in wallet map
48
+ await this.setClientKeySharesToLocalStorage({
49
+ accountAddress,
50
+ clientKeyShares,
51
+ overwriteOrMerge: 'overwrite'
52
+ });
53
+ // Backup the new wallet without waiting for the promise to resolve
54
+ void this.storeEncryptedBackupByWalletWithRetry({
55
+ accountAddress,
56
+ clientKeyShares,
57
+ password
58
+ });
59
+ return {
60
+ accountAddress,
61
+ rawPublicKey,
62
+ clientKeyShares
63
+ };
64
+ } catch (error) {
65
+ this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
66
+ throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
67
+ }
68
+ }
69
+ // Function to properly derive account address
70
+ async deriveAccountAddress(rawPublicKey) {
71
+ const accountAddress = bs58.encode(rawPublicKey);
72
+ return {
73
+ accountAddress
74
+ };
75
+ }
76
+ /**
77
+ * This function takes a message and returns it after being signed with MPC
78
+ *
79
+ * @param message The message to sign (Uint8Array)
80
+ * @param accountAddress Solana address (base58 encoded)
81
+ * @param password The password for encrypted backup shares
82
+ */ async signMessage({ message, accountAddress, password = undefined }) {
83
+ await this.verifyPassword({
84
+ accountAddress,
85
+ password,
86
+ walletOperation: WalletOperation.SIGN_MESSAGE
87
+ });
88
+ if (!accountAddress) {
89
+ throw new Error('Account address is required');
90
+ }
91
+ try {
92
+ const signatureEd25519 = await this.sign({
93
+ message,
94
+ accountAddress: accountAddress,
95
+ chainName: this.chainName,
96
+ password
97
+ });
98
+ const base58Signature = bs58.encode(signatureEd25519);
99
+ return base58Signature;
100
+ } catch (error) {
101
+ this.logger.error('Error signing message:', error);
102
+ throw error;
103
+ }
104
+ }
105
+ async signTransaction({ senderAddress, transaction, password = undefined }) {
106
+ await this.verifyPassword({
107
+ accountAddress: senderAddress,
108
+ password,
109
+ walletOperation: WalletOperation.SIGN_TRANSACTION
110
+ });
111
+ try {
112
+ const signatureEd25519 = await this.sign({
113
+ message: transaction,
114
+ accountAddress: senderAddress,
115
+ chainName: this.chainName,
116
+ password
117
+ });
118
+ if (!signatureEd25519) {
119
+ throw new Error('Signature is undefined');
120
+ }
121
+ return Buffer.from(signatureEd25519).toString('hex');
122
+ } catch (error) {
123
+ this.logger.error('Error in signTransaction:', error);
124
+ if (error instanceof Error) {
125
+ this.logger.error('Error details:', error);
126
+ }
127
+ throw error;
128
+ }
129
+ }
130
+ /**
131
+ * Exports the private key for a given account address
132
+ *
133
+ * @param accountAddress The account address to export the private key for
134
+ * @param password The password for encrypted backup shares
135
+ * @returns The private key
136
+ */ async exportPrivateKey({ accountAddress, password = undefined }) {
137
+ await this.verifyPassword({
138
+ accountAddress,
139
+ password,
140
+ walletOperation: WalletOperation.EXPORT_PRIVATE_KEY
141
+ });
142
+ const { derivedPrivateKey } = await this.exportKey({
143
+ accountAddress,
144
+ chainName: this.chainName,
145
+ password
146
+ });
147
+ if (!derivedPrivateKey) {
148
+ throw new Error('Derived private key is undefined');
149
+ }
150
+ const encodedPrivateKey = bs58.encode(Buffer.from(derivedPrivateKey));
151
+ return encodedPrivateKey;
152
+ }
153
+ /**
154
+ * Exports the private key for a given account address
155
+ *
156
+ * @param keyShares The key shares to export the private key for
157
+ * @returns The private key
158
+ */ async offlineExportPrivateKey({ keyShares, derivationPath }) {
159
+ const { derivedPrivateKey } = await this.offlineExportKey({
160
+ chainName: this.chainName,
161
+ keyShares,
162
+ derivationPath
163
+ });
164
+ return {
165
+ derivedPrivateKey
166
+ };
167
+ }
168
+ /**
169
+ * Converts the private key to a hex string
170
+ *
171
+ * @param privateKey The private key to convert
172
+ * @returns The hex string
173
+ */ decodePrivateKeyForSolana(privateKey) {
174
+ const decoded = bs58.decode(privateKey);
175
+ const slicedBytes = decoded.slice(0, 32);
176
+ return Buffer.from(slicedBytes).toString('hex');
177
+ }
178
+ getPublicKeyFromPrivateKey(privateKey) {
179
+ const privateKeyBytes = bs58.decode(privateKey);
180
+ const keypair = Keypair.fromSecretKey(privateKeyBytes);
181
+ const publicKeyBase58 = keypair.publicKey.toBase58();
182
+ return publicKeyBase58;
183
+ }
184
+ encodePublicKey(publicKey) {
185
+ return bs58.encode(publicKey);
186
+ }
187
+ /**
188
+ * Imports the private key for a given account address
189
+ *
190
+ * @param privateKey The private key to import
191
+ * @param chainName The chain name to import the private key for
192
+ * @param thresholdSignatureScheme The threshold signature scheme to use
193
+ * @param password The password for encrypted backup shares
194
+ * @returns The account address, raw public key, and client key shares
195
+ */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
196
+ //get public key from private key
197
+ const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
198
+ const formattedPrivateKey = this.decodePrivateKeyForSolana(privateKey);
199
+ const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
200
+ chainName,
201
+ privateKey: formattedPrivateKey,
202
+ thresholdSignatureScheme,
203
+ onError,
204
+ onCeremonyComplete: (accountAddress, walletId)=>{
205
+ // update wallet map
206
+ this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
207
+ accountAddress,
208
+ walletId,
209
+ chainName: this.chainName,
210
+ thresholdSignatureScheme,
211
+ clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
212
+ });
213
+ }
214
+ });
215
+ if (!rawPublicKey || !clientKeyShares) {
216
+ throw new Error('Error creating wallet account');
217
+ }
218
+ const { accountAddress } = await this.deriveAccountAddress(rawPublicKey);
219
+ if (accountAddress !== publicKey) {
220
+ throw new Error(`Public key mismatch: derived address ${accountAddress} !== public key ${publicKey}`);
221
+ }
222
+ // Update client key shares in wallet map
223
+ await this.setClientKeySharesToLocalStorage({
224
+ accountAddress,
225
+ clientKeyShares,
226
+ overwriteOrMerge: 'overwrite'
227
+ });
228
+ // Backup the new wallet without waiting for the promise to resolve
229
+ void this.storeEncryptedBackupByWalletWithRetry({
230
+ accountAddress,
231
+ clientKeyShares,
232
+ password
233
+ });
234
+ return {
235
+ accountAddress,
236
+ rawPublicKey: rawPublicKey
237
+ };
238
+ }
239
+ async getSvmWallets() {
240
+ const wallets = await this.getWallets();
241
+ const svmWallets = wallets.filter((wallet)=>wallet.chainName === 'solana');
242
+ return svmWallets;
243
+ }
244
+ constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl }){
245
+ super({
246
+ environmentId,
247
+ authToken,
248
+ baseApiUrl,
249
+ baseMPCRelayApiUrl
250
+ }), this.chainName = 'SOL';
251
+ }
252
+ }
253
+
254
+ export { DynamicSvmWalletClient };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@dynamic-labs-wallet/svm",
3
+ "version": "0.0.0-beta.146.1",
4
+ "license": "MIT",
5
+ "dependencies": {
6
+ "@dynamic-labs-wallet/browser": "0.0.0-beta.146.1",
7
+ "@solana/web3.js": "^1.98.2",
8
+ "bs58": "^6.0.0"
9
+ },
10
+ "nx": {
11
+ "sourceRoot": "packages/svm/src",
12
+ "projectType": "library",
13
+ "name": "svm",
14
+ "targets": {
15
+ "build": {}
16
+ }
17
+ },
18
+ "main": "./index.cjs.js",
19
+ "module": "./index.esm.js",
20
+ "types": "./index.esm.d.ts",
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ ".": {
24
+ "types": "./index.esm.d.ts",
25
+ "import": "./index.esm.js",
26
+ "require": "./index.cjs.js",
27
+ "default": "./index.cjs.js"
28
+ }
29
+ }
30
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './svm/index';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { ClientKeyShare, DynamicWalletClient, Ed25519KeygenResult, ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser';
2
+ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
3
+ readonly chainName = "SOL";
4
+ accountAddress?: string;
5
+ constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, }: {
6
+ environmentId: string;
7
+ authToken: string;
8
+ baseApiUrl?: string;
9
+ baseMPCRelayApiUrl?: string;
10
+ });
11
+ /**
12
+ * Creates a wallet account on the Solana chain
13
+ *
14
+ * @param thresholdSignatureScheme The threshold signature scheme to use
15
+ * @returns The account address, public key hex, raw public key, and client key shares
16
+ */
17
+ createWalletAccount({ thresholdSignatureScheme, password, }: {
18
+ thresholdSignatureScheme: ThresholdSignatureScheme;
19
+ password?: string;
20
+ }): Promise<{
21
+ accountAddress: string;
22
+ rawPublicKey: Uint8Array;
23
+ clientKeyShares: ClientKeyShare[];
24
+ }>;
25
+ deriveAccountAddress(rawPublicKey: Uint8Array): Promise<{
26
+ accountAddress: string;
27
+ }>;
28
+ /**
29
+ * This function takes a message and returns it after being signed with MPC
30
+ *
31
+ * @param message The message to sign (Uint8Array)
32
+ * @param accountAddress Solana address (base58 encoded)
33
+ * @param password The password for encrypted backup shares
34
+ */
35
+ signMessage({ message, accountAddress, password, }: {
36
+ message: string;
37
+ accountAddress: string;
38
+ password?: string;
39
+ }): Promise<string>;
40
+ signTransaction({ senderAddress, transaction, password, }: {
41
+ senderAddress: string;
42
+ transaction: string;
43
+ password?: string;
44
+ }): Promise<string>;
45
+ /**
46
+ * Exports the private key for a given account address
47
+ *
48
+ * @param accountAddress The account address to export the private key for
49
+ * @param password The password for encrypted backup shares
50
+ * @returns The private key
51
+ */
52
+ exportPrivateKey({ accountAddress, password, }: {
53
+ accountAddress: string;
54
+ password?: string;
55
+ }): Promise<string>;
56
+ /**
57
+ * Exports the private key for a given account address
58
+ *
59
+ * @param keyShares The key shares to export the private key for
60
+ * @returns The private key
61
+ */
62
+ offlineExportPrivateKey({ keyShares, derivationPath, }: {
63
+ keyShares: Ed25519KeygenResult[];
64
+ derivationPath?: string;
65
+ }): Promise<{
66
+ derivedPrivateKey: string | undefined;
67
+ }>;
68
+ /**
69
+ * Converts the private key to a hex string
70
+ *
71
+ * @param privateKey The private key to convert
72
+ * @returns The hex string
73
+ */
74
+ decodePrivateKeyForSolana(privateKey: string): string;
75
+ getPublicKeyFromPrivateKey(privateKey: string): string;
76
+ encodePublicKey(publicKey: Uint8Array): string;
77
+ /**
78
+ * Imports the private key for a given account address
79
+ *
80
+ * @param privateKey The private key to import
81
+ * @param chainName The chain name to import the private key for
82
+ * @param thresholdSignatureScheme The threshold signature scheme to use
83
+ * @param password The password for encrypted backup shares
84
+ * @returns The account address, raw public key, and client key shares
85
+ */
86
+ importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
87
+ privateKey: string;
88
+ chainName: string;
89
+ thresholdSignatureScheme: ThresholdSignatureScheme;
90
+ password?: string;
91
+ onError?: (error: Error) => void;
92
+ }): Promise<{
93
+ accountAddress: string;
94
+ rawPublicKey: Uint8Array | undefined;
95
+ }>;
96
+ getSvmWallets(): Promise<any>;
97
+ }
98
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAKtC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,GACnB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B;IASD;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,GACrB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,CAAC;QACzB,eAAe,EAAE,cAAc,EAAE,CAAC;KACnC,CAAC;IAsDI,oBAAoB,CAAC,YAAY,EAAE,UAAU;;;IAOnD;;;;;;OAMG;IACG,WAAW,CAAC,EAChB,OAAO,EACP,cAAc,EACd,QAAoB,GACrB,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IA2BK,eAAe,CAAC,EACpB,aAAa,EACb,WAAW,EACX,QAAoB,GACrB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,MAAM,CAAC;IA6BnB;;;;;;OAMG;IACG,gBAAgB,CAAC,EACrB,cAAc,EACd,QAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBnB;;;;;OAKG;IACG,uBAAuB,CAAC,EAC5B,SAAS,EACT,cAAc,GACf,EAAE;QACD,SAAS,EAAE,mBAAmB,EAAE,CAAC;QACjC,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;;;IASD;;;;;OAKG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM;IAM5C,0BAA0B,CAAC,UAAU,EAAE,MAAM;IAQ7C,eAAe,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM;IAI9C;;;;;;;;OAQG;IACG,gBAAgB,CAAC,EACrB,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,QAAoB,EACpB,OAAO,GACR,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC;KACtC,CAAC;IAwDI,aAAa;CAOpB"}
@@ -0,0 +1,2 @@
1
+ export declare const ERROR_CREATE_WALLET_ACCOUNT = "Error creating svm wallet account";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/svm/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,sCAAsC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svm/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
2
+ export declare function getBalance({ address, rpcUrl, }: {
3
+ address: string;
4
+ rpcUrl?: string;
5
+ }): Promise<number>;
6
+ export declare function createSolanaTransaction({ senderSolanaAddress, amount, to, rpcUrl, }: {
7
+ senderSolanaAddress: string;
8
+ amount: number;
9
+ to: string;
10
+ rpcUrl?: string;
11
+ }): Promise<{
12
+ transaction: Transaction;
13
+ serializedTransaction: Buffer;
14
+ }>;
15
+ export declare const addSignatureToTransaction: ({ transaction, signature, signerPublicKey, }: {
16
+ transaction: Transaction | VersionedTransaction;
17
+ signature: Uint8Array;
18
+ signerPublicKey: PublicKey;
19
+ }) => VersionedTransaction | Transaction;
20
+ export declare function sendTransaction({ signedTransaction, rpcUrl, }: {
21
+ signedTransaction: Uint8Array;
22
+ rpcUrl?: string;
23
+ }): Promise<string>;
24
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/svm/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAET,WAAW,EACX,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,wBAAsB,UAAU,CAAC,EAC/B,OAAO,EACP,MAAuB,GACxB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,mBAIA;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,mBAAmB,EACnB,MAAM,EACN,EAAE,EACF,MAAwC,GACzC,EAAE;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;GAwBA;AAED,eAAO,MAAM,yBAAyB,iDAInC;IACD,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAC;IAChD,SAAS,EAAE,UAAU,CAAC;IACtB,eAAe,EAAE,SAAS,CAAC;CAC5B,KAAG,oBAAoB,GAAG,WAG1B,CAAC;AAEF,wBAAsB,eAAe,CAAC,EACpC,iBAAiB,EACjB,MAAwC,GACzC,EAAE;IACD,iBAAiB,EAAE,UAAU,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,mBAMA"}