@dynamic-labs-wallet/svm 0.0.32 → 0.0.34

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.js CHANGED
@@ -3,66 +3,25 @@
3
3
  var browser = require('@dynamic-labs-wallet/browser');
4
4
  var bs58 = require('bs58');
5
5
  var web3_js = require('@solana/web3.js');
6
- var core = require('@dynamic-labs-wallet/core');
6
+ require('@dynamic-labs-wallet/core');
7
7
 
8
- async function getBalance({ address, rpcUrl = core.SOLANA_RPC_URL }) {
8
+ const addSignatureToTransaction = ({ transaction, signature })=>{
9
9
  try {
10
- const connection = new web3_js.Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
11
- const balance = await connection.getBalance(new web3_js.PublicKey(address));
12
- return balance;
13
- } catch (error) {
14
- console.error('Error in getting balance:', error);
15
- throw error;
16
- }
17
- }
18
- async function createSolanaTransaction({ senderSolanaAddress, amount, to, rpcUrl = 'https://api.devnet.solana.com' }) {
19
- try {
20
- const connection = new web3_js.Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
21
- const balance = await getBalance({
22
- address: senderSolanaAddress,
23
- rpcUrl
24
- });
25
- if (balance < amount * 1e9) {
26
- throw new Error('Insufficient balance');
10
+ if (transaction instanceof web3_js.Transaction) {
11
+ transaction.addSignature(transaction.feePayer, Buffer.from(signature));
12
+ } else {
13
+ // For versioned transactions, we should add the signature to the fee payer
14
+ // which is always the first account in the static account keys
15
+ // TODO: see if this works for sponsored transactions
16
+ const feePayer = transaction.message.staticAccountKeys[0];
17
+ transaction.addSignature(feePayer, Buffer.from(signature));
27
18
  }
28
- const fromPubkey = new web3_js.PublicKey(senderSolanaAddress);
29
- const transaction = new web3_js.Transaction().add(web3_js.SystemProgram.transfer({
30
- fromPubkey: fromPubkey,
31
- toPubkey: new web3_js.PublicKey(to),
32
- lamports: amount * 1e9
33
- }));
34
- const { blockhash } = await connection.getLatestBlockhash();
35
- transaction.recentBlockhash = blockhash;
36
- transaction.feePayer = fromPubkey;
37
- const serializedTransaction = transaction.serializeMessage();
38
- return {
39
- transaction,
40
- serializedTransaction
41
- };
42
- } catch (error) {
43
- console.error('Error in creating transaction:', error);
44
- throw error;
45
- }
46
- }
47
- function finalizeTransaction({ transaction, signature }) {
48
- try {
49
- transaction.addSignature(transaction.feePayer, Buffer.from(signature));
50
- return new Uint8Array(transaction.serialize());
19
+ return transaction;
51
20
  } catch (error) {
52
21
  console.error('Error in finalizing transaction:', error);
53
22
  throw error;
54
23
  }
55
- }
56
- async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet.solana.com' }) {
57
- try {
58
- const connection = new web3_js.Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
59
- const txid = await connection.sendRawTransaction(Buffer.from(signedTransaction));
60
- return txid;
61
- } catch (error) {
62
- console.error('Error in sending transaction:', error);
63
- throw error;
64
- }
65
- }
24
+ };
66
25
 
67
26
  class DynamicSvmWalletClient extends browser.DynamicWalletClient {
68
27
  /**
@@ -70,7 +29,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
70
29
  *
71
30
  * @param thresholdSignatureScheme The threshold signature scheme to use
72
31
  * @returns The account address, public key hex, raw public key, and client key shares
73
- */ async createWalletAccount({ thresholdSignatureScheme }) {
32
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
74
33
  try {
75
34
  const { rawPublicKey, clientKeyShares } = await this.keyGen({
76
35
  chainName: this.chainName,
@@ -93,11 +52,12 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
93
52
  walletId: newWalletId,
94
53
  chainName: this.chainName,
95
54
  clientKeyShares: clientKeyShares,
96
- thresholdSignatureScheme
55
+ thresholdSignatureScheme,
56
+ clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
97
57
  };
98
58
  await this.storeEncryptedBackupByWallet({
99
59
  accountAddress,
100
- password: undefined
60
+ password
101
61
  });
102
62
  return {
103
63
  accountAddress,
@@ -120,8 +80,14 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
120
80
  * This function takes a message and returns it after being signed with MPC
121
81
  *
122
82
  * @param message The message to sign (Uint8Array)
123
- * @param fromAddress Solana address (base58 encoded)
124
- */ async signMessage({ message, accountAddress }) {
83
+ * @param accountAddress Solana address (base58 encoded)
84
+ * @param password The password for encrypted backup shares
85
+ */ async signMessage({ message, accountAddress, password = undefined }) {
86
+ await this.verifyPassword({
87
+ accountAddress,
88
+ password,
89
+ walletOperation: browser.WalletOperation.SIGN_MESSAGE
90
+ });
125
91
  if (!accountAddress) {
126
92
  throw new Error('Account address is required');
127
93
  }
@@ -129,7 +95,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
129
95
  const signatureEd25519 = await this.sign({
130
96
  message,
131
97
  accountAddress: accountAddress,
132
- chainName: this.chainName
98
+ chainName: this.chainName,
99
+ password
133
100
  });
134
101
  const base58Signature = bs58.encode(signatureEd25519);
135
102
  return base58Signature;
@@ -158,48 +125,39 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
158
125
  // console.log('verified', verified);
159
126
  // return verified;
160
127
  // }
161
- async signTransaction({ senderAddress, toAddress, value, rpcUrl = `https://api.devnet.solana.com` }) {
128
+ async signTransaction({ senderAddress, transaction, password = undefined }) {
129
+ await this.verifyPassword({
130
+ accountAddress: senderAddress,
131
+ password,
132
+ walletOperation: browser.WalletOperation.SIGN_TRANSACTION
133
+ });
162
134
  try {
163
- const { transaction, serializedTransaction } = await createSolanaTransaction({
164
- senderSolanaAddress: senderAddress,
165
- amount: value,
166
- to: toAddress,
167
- rpcUrl
168
- });
169
- if (!serializedTransaction || !transaction) {
170
- throw new Error('Serialized transaction is undefined');
135
+ let messageToSign;
136
+ if (transaction instanceof web3_js.VersionedTransaction) {
137
+ // For versioned transactions, we need to sign the message directly
138
+ const messageBytes = transaction.message.serialize();
139
+ messageToSign = Buffer.from(messageBytes).toString('hex');
140
+ } else {
141
+ // For legacy transactions, serialize the message
142
+ const messageBytes = transaction.serializeMessage();
143
+ messageToSign = Buffer.from(messageBytes).toString('hex');
171
144
  }
172
- const rawMessageToSign = new Uint8Array(serializedTransaction);
173
- //convert raw bites to hex to send to server
174
- const messageToSign = Buffer.from(rawMessageToSign).toString('hex');
175
145
  const signatureEd25519 = await this.sign({
176
146
  message: messageToSign,
177
147
  accountAddress: senderAddress,
178
- chainName: this.chainName
148
+ chainName: this.chainName,
149
+ password
179
150
  });
180
151
  if (!signatureEd25519) {
181
152
  throw new Error('Signature is undefined');
182
153
  }
183
- const signedTransaction = finalizeTransaction({
154
+ const signedTransaction = addSignatureToTransaction({
184
155
  transaction,
185
156
  signature: signatureEd25519
186
157
  });
187
- if (!signedTransaction) {
188
- throw new Error('Signed transaction is undefined');
189
- }
190
- const txid = await sendTransaction({
191
- signedTransaction,
192
- rpcUrl
193
- });
194
- if (!txid) {
195
- throw new Error('Transaction hash is undefined');
196
- }
197
- return {
198
- txHash: txid,
199
- signedTx: serializedTransaction
200
- };
158
+ return signedTransaction;
201
159
  } catch (error) {
202
- this.logger.error('Error in signing and broadcasting transaction:', error);
160
+ this.logger.error('Error in signTransaction:', error);
203
161
  if (error instanceof Error) {
204
162
  this.logger.error('Error details:', error);
205
163
  }
@@ -210,11 +168,13 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
210
168
  * Exports the private key for a given account address
211
169
  *
212
170
  * @param accountAddress The account address to export the private key for
171
+ * @param password The password for encrypted backup shares
213
172
  * @returns The private key
214
- */ async exportPrivateKey({ accountAddress }) {
173
+ */ async exportPrivateKey({ accountAddress, password = undefined }) {
215
174
  const { derivedPrivateKey } = await this.exportKey({
216
175
  accountAddress,
217
- chainName: this.chainName
176
+ chainName: this.chainName,
177
+ password
218
178
  });
219
179
  if (!derivedPrivateKey) {
220
180
  throw new Error('Derived private key is undefined');
@@ -289,7 +249,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
289
249
  walletId: newWalletId,
290
250
  chainName: this.chainName,
291
251
  clientKeyShares,
292
- thresholdSignatureScheme
252
+ thresholdSignatureScheme,
253
+ clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
293
254
  };
294
255
  await this.storeEncryptedBackupByWallet({
295
256
  accountAddress
package/index.esm.js CHANGED
@@ -1,66 +1,25 @@
1
- import { DynamicWalletClient } from '@dynamic-labs-wallet/browser';
1
+ import { DynamicWalletClient, getClientKeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/browser';
2
2
  import bs58 from 'bs58';
3
- import { Connection, PublicKey, Transaction, SystemProgram, Keypair } from '@solana/web3.js';
4
- import { SOLANA_RPC_URL } from '@dynamic-labs-wallet/core';
3
+ import { Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
4
+ import '@dynamic-labs-wallet/core';
5
5
 
6
- async function getBalance({ address, rpcUrl = SOLANA_RPC_URL }) {
6
+ const addSignatureToTransaction = ({ transaction, signature })=>{
7
7
  try {
8
- const connection = new Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
9
- const balance = await connection.getBalance(new PublicKey(address));
10
- return balance;
11
- } catch (error) {
12
- console.error('Error in getting balance:', error);
13
- throw error;
14
- }
15
- }
16
- async function createSolanaTransaction({ senderSolanaAddress, amount, to, rpcUrl = 'https://api.devnet.solana.com' }) {
17
- try {
18
- const connection = new Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
19
- const balance = await getBalance({
20
- address: senderSolanaAddress,
21
- rpcUrl
22
- });
23
- if (balance < amount * 1e9) {
24
- throw new Error('Insufficient balance');
8
+ if (transaction instanceof Transaction) {
9
+ transaction.addSignature(transaction.feePayer, Buffer.from(signature));
10
+ } else {
11
+ // For versioned transactions, we should add the signature to the fee payer
12
+ // which is always the first account in the static account keys
13
+ // TODO: see if this works for sponsored transactions
14
+ const feePayer = transaction.message.staticAccountKeys[0];
15
+ transaction.addSignature(feePayer, Buffer.from(signature));
25
16
  }
26
- const fromPubkey = new PublicKey(senderSolanaAddress);
27
- const transaction = new Transaction().add(SystemProgram.transfer({
28
- fromPubkey: fromPubkey,
29
- toPubkey: new PublicKey(to),
30
- lamports: amount * 1e9
31
- }));
32
- const { blockhash } = await connection.getLatestBlockhash();
33
- transaction.recentBlockhash = blockhash;
34
- transaction.feePayer = fromPubkey;
35
- const serializedTransaction = transaction.serializeMessage();
36
- return {
37
- transaction,
38
- serializedTransaction
39
- };
40
- } catch (error) {
41
- console.error('Error in creating transaction:', error);
42
- throw error;
43
- }
44
- }
45
- function finalizeTransaction({ transaction, signature }) {
46
- try {
47
- transaction.addSignature(transaction.feePayer, Buffer.from(signature));
48
- return new Uint8Array(transaction.serialize());
17
+ return transaction;
49
18
  } catch (error) {
50
19
  console.error('Error in finalizing transaction:', error);
51
20
  throw error;
52
21
  }
53
- }
54
- async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet.solana.com' }) {
55
- try {
56
- const connection = new Connection(rpcUrl != null ? rpcUrl : 'https://api.devnet.solana.com');
57
- const txid = await connection.sendRawTransaction(Buffer.from(signedTransaction));
58
- return txid;
59
- } catch (error) {
60
- console.error('Error in sending transaction:', error);
61
- throw error;
62
- }
63
- }
22
+ };
64
23
 
65
24
  class DynamicSvmWalletClient extends DynamicWalletClient {
66
25
  /**
@@ -68,7 +27,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
68
27
  *
69
28
  * @param thresholdSignatureScheme The threshold signature scheme to use
70
29
  * @returns The account address, public key hex, raw public key, and client key shares
71
- */ async createWalletAccount({ thresholdSignatureScheme }) {
30
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
72
31
  try {
73
32
  const { rawPublicKey, clientKeyShares } = await this.keyGen({
74
33
  chainName: this.chainName,
@@ -91,11 +50,12 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
91
50
  walletId: newWalletId,
92
51
  chainName: this.chainName,
93
52
  clientKeyShares: clientKeyShares,
94
- thresholdSignatureScheme
53
+ thresholdSignatureScheme,
54
+ clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
95
55
  };
96
56
  await this.storeEncryptedBackupByWallet({
97
57
  accountAddress,
98
- password: undefined
58
+ password
99
59
  });
100
60
  return {
101
61
  accountAddress,
@@ -118,8 +78,14 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
118
78
  * This function takes a message and returns it after being signed with MPC
119
79
  *
120
80
  * @param message The message to sign (Uint8Array)
121
- * @param fromAddress Solana address (base58 encoded)
122
- */ async signMessage({ message, accountAddress }) {
81
+ * @param accountAddress Solana address (base58 encoded)
82
+ * @param password The password for encrypted backup shares
83
+ */ async signMessage({ message, accountAddress, password = undefined }) {
84
+ await this.verifyPassword({
85
+ accountAddress,
86
+ password,
87
+ walletOperation: WalletOperation.SIGN_MESSAGE
88
+ });
123
89
  if (!accountAddress) {
124
90
  throw new Error('Account address is required');
125
91
  }
@@ -127,7 +93,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
127
93
  const signatureEd25519 = await this.sign({
128
94
  message,
129
95
  accountAddress: accountAddress,
130
- chainName: this.chainName
96
+ chainName: this.chainName,
97
+ password
131
98
  });
132
99
  const base58Signature = bs58.encode(signatureEd25519);
133
100
  return base58Signature;
@@ -156,48 +123,39 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
156
123
  // console.log('verified', verified);
157
124
  // return verified;
158
125
  // }
159
- async signTransaction({ senderAddress, toAddress, value, rpcUrl = `https://api.devnet.solana.com` }) {
126
+ async signTransaction({ senderAddress, transaction, password = undefined }) {
127
+ await this.verifyPassword({
128
+ accountAddress: senderAddress,
129
+ password,
130
+ walletOperation: WalletOperation.SIGN_TRANSACTION
131
+ });
160
132
  try {
161
- const { transaction, serializedTransaction } = await createSolanaTransaction({
162
- senderSolanaAddress: senderAddress,
163
- amount: value,
164
- to: toAddress,
165
- rpcUrl
166
- });
167
- if (!serializedTransaction || !transaction) {
168
- throw new Error('Serialized transaction is undefined');
133
+ let messageToSign;
134
+ if (transaction instanceof VersionedTransaction) {
135
+ // For versioned transactions, we need to sign the message directly
136
+ const messageBytes = transaction.message.serialize();
137
+ messageToSign = Buffer.from(messageBytes).toString('hex');
138
+ } else {
139
+ // For legacy transactions, serialize the message
140
+ const messageBytes = transaction.serializeMessage();
141
+ messageToSign = Buffer.from(messageBytes).toString('hex');
169
142
  }
170
- const rawMessageToSign = new Uint8Array(serializedTransaction);
171
- //convert raw bites to hex to send to server
172
- const messageToSign = Buffer.from(rawMessageToSign).toString('hex');
173
143
  const signatureEd25519 = await this.sign({
174
144
  message: messageToSign,
175
145
  accountAddress: senderAddress,
176
- chainName: this.chainName
146
+ chainName: this.chainName,
147
+ password
177
148
  });
178
149
  if (!signatureEd25519) {
179
150
  throw new Error('Signature is undefined');
180
151
  }
181
- const signedTransaction = finalizeTransaction({
152
+ const signedTransaction = addSignatureToTransaction({
182
153
  transaction,
183
154
  signature: signatureEd25519
184
155
  });
185
- if (!signedTransaction) {
186
- throw new Error('Signed transaction is undefined');
187
- }
188
- const txid = await sendTransaction({
189
- signedTransaction,
190
- rpcUrl
191
- });
192
- if (!txid) {
193
- throw new Error('Transaction hash is undefined');
194
- }
195
- return {
196
- txHash: txid,
197
- signedTx: serializedTransaction
198
- };
156
+ return signedTransaction;
199
157
  } catch (error) {
200
- this.logger.error('Error in signing and broadcasting transaction:', error);
158
+ this.logger.error('Error in signTransaction:', error);
201
159
  if (error instanceof Error) {
202
160
  this.logger.error('Error details:', error);
203
161
  }
@@ -208,11 +166,13 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
208
166
  * Exports the private key for a given account address
209
167
  *
210
168
  * @param accountAddress The account address to export the private key for
169
+ * @param password The password for encrypted backup shares
211
170
  * @returns The private key
212
- */ async exportPrivateKey({ accountAddress }) {
171
+ */ async exportPrivateKey({ accountAddress, password = undefined }) {
213
172
  const { derivedPrivateKey } = await this.exportKey({
214
173
  accountAddress,
215
- chainName: this.chainName
174
+ chainName: this.chainName,
175
+ password
216
176
  });
217
177
  if (!derivedPrivateKey) {
218
178
  throw new Error('Derived private key is undefined');
@@ -287,7 +247,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
287
247
  walletId: newWalletId,
288
248
  chainName: this.chainName,
289
249
  clientKeyShares,
290
- thresholdSignatureScheme
250
+ thresholdSignatureScheme,
251
+ clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
291
252
  };
292
253
  await this.storeEncryptedBackupByWallet({
293
254
  accountAddress
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/svm",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "dependencies": {
5
- "@dynamic-labs-wallet/browser": "0.0.32",
6
- "@dynamic-labs-wallet/core": "0.0.32",
5
+ "@dynamic-labs-wallet/browser": "0.0.34",
6
+ "@dynamic-labs-wallet/core": "0.0.34",
7
7
  "@solana/web3.js": "^1.98.0",
8
8
  "bs58": "^6.0.0"
9
9
  },
package/src/svm/svm.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ClientKeyShare, DynamicWalletClient, Ed25519KeygenResult, ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser';
2
+ import { Transaction, VersionedTransaction } from '@solana/web3.js';
2
3
  export declare class DynamicSvmWalletClient extends DynamicWalletClient {
3
4
  readonly chainName = "SOL";
4
5
  accountAddress?: string;
@@ -14,8 +15,9 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
14
15
  * @param thresholdSignatureScheme The threshold signature scheme to use
15
16
  * @returns The account address, public key hex, raw public key, and client key shares
16
17
  */
17
- createWalletAccount({ thresholdSignatureScheme, }: {
18
+ createWalletAccount({ thresholdSignatureScheme, password, }: {
18
19
  thresholdSignatureScheme: ThresholdSignatureScheme;
20
+ password?: string;
19
21
  }): Promise<{
20
22
  accountAddress: string;
21
23
  rawPublicKey: Uint8Array;
@@ -28,29 +30,29 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
28
30
  * This function takes a message and returns it after being signed with MPC
29
31
  *
30
32
  * @param message The message to sign (Uint8Array)
31
- * @param fromAddress Solana address (base58 encoded)
33
+ * @param accountAddress Solana address (base58 encoded)
34
+ * @param password The password for encrypted backup shares
32
35
  */
33
- signMessage({ message, accountAddress, }: {
36
+ signMessage({ message, accountAddress, password, }: {
34
37
  message: string;
35
- accountAddress?: string;
38
+ accountAddress: string;
39
+ password?: string;
36
40
  }): Promise<string>;
37
- signTransaction({ senderAddress, toAddress, value, rpcUrl, }: {
41
+ signTransaction({ senderAddress, transaction, password, }: {
38
42
  senderAddress: string;
39
- toAddress: string;
40
- value: number;
41
- rpcUrl: string;
42
- }): Promise<{
43
- txHash?: string;
44
- signedTx: Uint8Array;
45
- }>;
43
+ transaction: VersionedTransaction | Transaction;
44
+ password?: string;
45
+ }): Promise<VersionedTransaction | Transaction>;
46
46
  /**
47
47
  * Exports the private key for a given account address
48
48
  *
49
49
  * @param accountAddress The account address to export the private key for
50
+ * @param password The password for encrypted backup shares
50
51
  * @returns The private key
51
52
  */
52
- exportPrivateKey({ accountAddress }: {
53
+ exportPrivateKey({ accountAddress, password, }: {
53
54
  accountAddress: string;
55
+ password?: string;
54
56
  }): Promise<{
55
57
  derivedPrivateKey: string;
56
58
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"svm.d.ts","sourceRoot":"","sources":["../../src/svm/svm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAStC,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;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E,MAAM,CAAC;KACnB;IA6CK,eAAe,CAAC,EACpB,aAAa,EACb,WAAW,EACX,QAAoB,GACrB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,oBAAoB,GAAG,WAAW,CAAC;QAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,oBAAoB,GAAG,WAAW,CAAC;IA0C/C;;;;;;OAMG;IACG,gBAAgB,CAAC,EACrB,cAAc,EACd,QAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;;;IAaD;;;;;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;;;;;;;OAOG;IACG,gBAAgB,CAAC,EACrB,UAAU,EACV,SAAS,EACT,wBAAwB,GACzB,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC;QACrC,eAAe,EAAE,cAAc,EAAE,CAAC;KACnC,CAAC;IAmDI,aAAa;CAOpB"}
@@ -1,4 +1,4 @@
1
- import { Transaction } from '@solana/web3.js';
1
+ import { Transaction, VersionedTransaction } from '@solana/web3.js';
2
2
  export declare function getBalance({ address, rpcUrl, }: {
3
3
  address: string;
4
4
  rpcUrl?: string;
@@ -12,10 +12,10 @@ export declare function createSolanaTransaction({ senderSolanaAddress, amount, t
12
12
  transaction: Transaction;
13
13
  serializedTransaction: Buffer;
14
14
  }>;
15
- export declare function finalizeTransaction({ transaction, signature, }: {
16
- transaction: Transaction;
15
+ export declare const addSignatureToTransaction: ({ transaction, signature, }: {
16
+ transaction: Transaction | VersionedTransaction;
17
17
  signature: Uint8Array;
18
- }): Uint8Array;
18
+ }) => VersionedTransaction | Transaction;
19
19
  export declare function sendTransaction({ signedTransaction, rpcUrl, }: {
20
20
  signedTransaction: Uint8Array;
21
21
  rpcUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/svm/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,WAAW,EACZ,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,mBAWA;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;;;GA+BA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,SAAS,GACV,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,UAAU,CAAC;CACvB,cAWA;AAED,wBAAsB,eAAe,CAAC,EACpC,iBAAiB,EACjB,MAAwC,GACzC,EAAE;IACD,iBAAiB,EAAE,UAAU,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,mBAaA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/svm/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,WAAW,EACX,oBAAoB,EAC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