@atomiqlabs/chain-solana 13.5.7 → 13.5.10
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/dist/solana/SolanaChains.js +4 -0
- package/dist/solana/chain/SolanaChainInterface.d.ts +4 -0
- package/dist/solana/chain/SolanaChainInterface.js +7 -0
- package/dist/solana/connection/ConnectionWithRetries.js +1 -1
- package/dist/solana/swaps/modules/SolanaDataAccount.js +3 -1
- package/package.json +2 -2
- package/src/solana/SolanaChains.ts +4 -0
- package/src/solana/chain/SolanaChainInterface.ts +8 -0
- package/src/solana/connection/ConnectionWithRetries.ts +1 -1
- package/src/solana/swaps/modules/SolanaDataAccount.ts +3 -1
- package/src/solana/swaps/v2/programIdl.json +951 -951
- package/src/solana/swaps/v2/programTypes.ts +1899 -1899
|
@@ -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"
|
|
@@ -117,6 +117,10 @@ export declare class SolanaChainInterface implements ChainInterface<SolanaTx, Si
|
|
|
117
117
|
* @inheritDoc
|
|
118
118
|
*/
|
|
119
119
|
getNativeCurrencyAddress(): string;
|
|
120
|
+
/**
|
|
121
|
+
* @inheritDoc
|
|
122
|
+
*/
|
|
123
|
+
shouldGetNativeTokenDrop(tokenAddress: string): boolean;
|
|
120
124
|
/**
|
|
121
125
|
* @inheritDoc
|
|
122
126
|
*/
|
|
@@ -90,6 +90,13 @@ class SolanaChainInterface {
|
|
|
90
90
|
getNativeCurrencyAddress() {
|
|
91
91
|
return this.Tokens.getNativeCurrencyAddress().toString();
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* @inheritDoc
|
|
95
|
+
*/
|
|
96
|
+
shouldGetNativeTokenDrop(tokenAddress) {
|
|
97
|
+
// True for all the tokens, because the contracts don't support native SOL handling yet
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
93
100
|
/**
|
|
94
101
|
* @inheritDoc
|
|
95
102
|
*/
|
|
@@ -63,7 +63,7 @@ class ConnectionWithRetries extends web3_js_1.Connection {
|
|
|
63
63
|
e?.message !== "Network request timed out" &&
|
|
64
64
|
e?.message !== "Too many requests (429)", init?.signal ?? undefined);
|
|
65
65
|
config.disableRetryOnRateLimit = true;
|
|
66
|
-
super(endpoint,
|
|
66
|
+
super(endpoint, config);
|
|
67
67
|
this.retryPolicy = config?.retryPolicy;
|
|
68
68
|
this.requestTimeout = config?.requestTimeout ?? 15 * 1000;
|
|
69
69
|
}
|
|
@@ -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 =
|
|
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({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/chain-solana",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.10",
|
|
4
4
|
"description": "Solana specific base implementation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types:": "./dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"author": "adambor",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@atomiqlabs/base": "^13.5.
|
|
29
|
+
"@atomiqlabs/base": "^13.5.2",
|
|
30
30
|
"@coral-xyz/anchor": "0.29.0",
|
|
31
31
|
"@noble/hashes": "^1.7.1",
|
|
32
32
|
"@solana/spl-token": "0.4.14",
|
|
@@ -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"
|
|
@@ -173,6 +173,14 @@ export class SolanaChainInterface implements ChainInterface<
|
|
|
173
173
|
return this.Tokens.getNativeCurrencyAddress().toString();
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @inheritDoc
|
|
178
|
+
*/
|
|
179
|
+
shouldGetNativeTokenDrop(tokenAddress: string): boolean {
|
|
180
|
+
// True for all the tokens, because the contracts don't support native SOL handling yet
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
|
|
176
184
|
/**
|
|
177
185
|
* @inheritDoc
|
|
178
186
|
*/
|
|
@@ -88,7 +88,7 @@ export class ConnectionWithRetries extends Connection {
|
|
|
88
88
|
);
|
|
89
89
|
config.disableRetryOnRateLimit = true;
|
|
90
90
|
|
|
91
|
-
super(endpoint,
|
|
91
|
+
super(endpoint, config);
|
|
92
92
|
this.retryPolicy = config?.retryPolicy;
|
|
93
93
|
this.requestTimeout = config?.requestTimeout ?? 15*1000;
|
|
94
94
|
}
|
|
@@ -64,7 +64,9 @@ export class SolanaDataAccount extends SolanaSwapModule {
|
|
|
64
64
|
accountKey: Signer,
|
|
65
65
|
dataLength: number
|
|
66
66
|
): Promise<SolanaAction> {
|
|
67
|
-
const accountSize =
|
|
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, [
|