@atomiqlabs/chain-solana 13.5.8 → 13.5.11

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.
@@ -21,6 +21,10 @@ exports.SolanaChains = {
21
21
  v1: {
22
22
  swapContract: "4hfUykhqmD7ZRvNh1HuzVKEY7ToENixtdUKZspNDCrEM",
23
23
  btcRelayContract: "3KHSHFpEK6bsjg3bqcxQ9qssJYtRCMi2S9TYVe4q6CQc"
24
+ },
25
+ v2: {
26
+ swapContract: "atq2FYuvww5EF6qeB28gj9tkao6Ld9mEGUzF4M93cCC",
27
+ btcRelayContract: "btc2WHkrjoZU9xzFJupDCmMaUTRHyYTzJE25LvEi9Ls"
24
28
  }
25
29
  },
26
30
  clusterName: "devnet"
@@ -35,7 +35,9 @@ class SolanaDataAccount extends SolanaSwapModule_1.SolanaSwapModule {
35
35
  * @private
36
36
  */
37
37
  async InitDataAccount(signer, accountKey, dataLength) {
38
- const accountSize = 32 + dataLength;
38
+ const accountSize = this.program.version === "v2"
39
+ ? 40 + dataLength
40
+ : 32 + dataLength;
39
41
  const lamportsDeposit = await this.connection.getMinimumBalanceForRentExemption(accountSize);
40
42
  return new SolanaAction_1.SolanaAction(signer, this.root, [
41
43
  web3_js_1.SystemProgram.createAccount({
@@ -137,7 +139,7 @@ class SolanaDataAccount extends SolanaSwapModule_1.SolanaSwapModule {
137
139
  continue;
138
140
  try {
139
141
  const fetchedDataAccount = await this.connection.getAccountInfo(accountKey);
140
- if (fetchedDataAccount == null) {
142
+ if (fetchedDataAccount == null || fetchedDataAccount.lamports === 0 || fetchedDataAccount.data.length === 0) {
141
143
  await this.removeDataAccount(accountKey);
142
144
  continue;
143
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-solana",
3
- "version": "13.5.8",
3
+ "version": "13.5.11",
4
4
  "description": "Solana specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -22,6 +22,10 @@ export const SolanaChains: {[key in BitcoinNetwork]?: {
22
22
  v1: {
23
23
  swapContract: "4hfUykhqmD7ZRvNh1HuzVKEY7ToENixtdUKZspNDCrEM",
24
24
  btcRelayContract: "3KHSHFpEK6bsjg3bqcxQ9qssJYtRCMi2S9TYVe4q6CQc"
25
+ },
26
+ v2: {
27
+ swapContract: "atq2FYuvww5EF6qeB28gj9tkao6Ld9mEGUzF4M93cCC",
28
+ btcRelayContract: "btc2WHkrjoZU9xzFJupDCmMaUTRHyYTzJE25LvEi9Ls"
25
29
  }
26
30
  },
27
31
  clusterName: "devnet"
@@ -64,7 +64,9 @@ export class SolanaDataAccount extends SolanaSwapModule {
64
64
  accountKey: Signer,
65
65
  dataLength: number
66
66
  ): Promise<SolanaAction> {
67
- const accountSize = 32+dataLength;
67
+ const accountSize = this.program.version==="v2"
68
+ ? 40+dataLength
69
+ : 32+dataLength;
68
70
  const lamportsDeposit = await this.connection.getMinimumBalanceForRentExemption(accountSize);
69
71
 
70
72
  return new SolanaAction(signer, this.root, [
@@ -189,7 +191,7 @@ export class SolanaDataAccount extends SolanaSwapModule {
189
191
 
190
192
  try {
191
193
  const fetchedDataAccount = await this.connection.getAccountInfo(accountKey);
192
- if(fetchedDataAccount==null) {
194
+ if(fetchedDataAccount==null || fetchedDataAccount.lamports===0 || fetchedDataAccount.data.length===0) {
193
195
  await this.removeDataAccount(accountKey);
194
196
  continue;
195
197
  }