@zebec-network/zebec-vault-sdk 5.1.1 → 5.1.3
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/service.js +5 -7
- package/package.json +2 -2
package/dist/service.js
CHANGED
|
@@ -247,15 +247,13 @@ class ZebecVaultService {
|
|
|
247
247
|
const decimals = await (0, solana_common_1.getMintDecimals)(this.provider.connection, tokenMint);
|
|
248
248
|
const amount = new anchor_1.BN((0, solana_common_1.parseToken)(params.amount, decimals).toString());
|
|
249
249
|
const instructions = [];
|
|
250
|
-
const
|
|
250
|
+
const withdrawerTokenAccount = (0, solana_common_1.getAssociatedTokenAddressSync)(tokenMint, // mint
|
|
251
251
|
withdrawer, // owner
|
|
252
252
|
true);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
instructions.push(createWsolAccountIx);
|
|
258
|
-
}
|
|
253
|
+
const tokenAccountInfo = await this.connection.getAccountInfo(withdrawerTokenAccount, this.connection.commitment);
|
|
254
|
+
if (!tokenAccountInfo) {
|
|
255
|
+
const createTokenAccountIx = (0, solana_common_1.createAssociatedTokenAccountInstruction)(withdrawer, withdrawerTokenAccount, withdrawer, tokenMint);
|
|
256
|
+
instructions.push(createTokenAccountIx);
|
|
259
257
|
}
|
|
260
258
|
const ix = await this.getWithdrawTokenInstruction(withdrawer, tokenMint, amount, decimals);
|
|
261
259
|
instructions.push(ix);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@zebec-network/solana-common": "^2.3.1",
|
|
10
10
|
"@zebec-network/zebec-card-v2-sdk": "^2.5.4",
|
|
11
11
|
"@zebec-network/zebec-stake-sdk": "^1.2.2",
|
|
12
|
-
"@zebec-network/zebec-stream-sdk": "^2.
|
|
12
|
+
"@zebec-network/zebec-stream-sdk": "^2.1.0",
|
|
13
13
|
"bignumber.js": "^9.3.1",
|
|
14
14
|
"buffer": "^6.0.3"
|
|
15
15
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"test:single": "ts-mocha -p ./tsconfig.json -t 1000000000"
|
|
48
48
|
},
|
|
49
49
|
"types": "dist/index.d.ts",
|
|
50
|
-
"version": "5.1.
|
|
50
|
+
"version": "5.1.3"
|
|
51
51
|
}
|