@zebec-network/exchange-card-sdk 1.1.0 → 1.1.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/README.md +339 -339
- package/dist/artifacts/typechain-types/ERC20.d.ts +7 -40
- package/dist/artifacts/typechain-types/ZebecCard.d.ts +21 -103
- package/dist/artifacts/typechain-types/common.d.ts +1 -5
- package/dist/artifacts/typechain-types/index.js +17 -7
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +5 -1
- package/dist/helpers/apiHelpers.d.ts +1 -1
- package/dist/helpers/apiHelpers.js +2 -2
- package/dist/services/TaoService.js +1 -1
- package/dist/services/TonService.d.ts +1 -1
- package/dist/services/TonService.js +1 -1
- package/dist/services/XdbService.d.ts +11 -17
- package/dist/services/XdbService.js +38 -56
- package/dist/services/stellarService.d.ts +1 -1
- package/dist/services/stellarService.js +8 -5
- package/package.json +1 -1
|
@@ -52,14 +52,16 @@ class StellarService {
|
|
|
52
52
|
*/
|
|
53
53
|
async transferXLM(amount) {
|
|
54
54
|
// Fetch deposit address
|
|
55
|
-
const
|
|
55
|
+
const vault = await this.fetchVault();
|
|
56
|
+
console.log("depositAddress", vault.address);
|
|
57
|
+
console.log("tag", vault.tag);
|
|
56
58
|
const accountAddress = await this.kit.getAddress();
|
|
57
59
|
// Prepare transaction
|
|
58
60
|
const account = await this.server.loadAccount(accountAddress.address);
|
|
59
61
|
const fee = await this.server.fetchBaseFee();
|
|
60
62
|
const platform_fee = (amount * constants_1.PLATFORM_FEE) / 10000;
|
|
61
63
|
const totalAmount = (amount + platform_fee).toString();
|
|
62
|
-
const memo = stellar_sdk_1.Memo.id(tag?.toString() || "");
|
|
64
|
+
const memo = stellar_sdk_1.Memo.id(vault.tag?.toString() || "");
|
|
63
65
|
// Check Wallet balance
|
|
64
66
|
const balance = await this.getWalletBalance(accountAddress.address);
|
|
65
67
|
if (Number(balance) < Number(totalAmount)) {
|
|
@@ -71,7 +73,7 @@ class StellarService {
|
|
|
71
73
|
networkPassphrase: this.sandbox ? stellar_sdk_1.Networks.TESTNET : stellar_sdk_1.Networks.PUBLIC,
|
|
72
74
|
})
|
|
73
75
|
.addOperation(stellar_sdk_1.Operation.payment({
|
|
74
|
-
destination:
|
|
76
|
+
destination: vault.address,
|
|
75
77
|
asset: stellar_sdk_1.Asset.native(),
|
|
76
78
|
amount: totalAmount,
|
|
77
79
|
}))
|
|
@@ -79,13 +81,14 @@ class StellarService {
|
|
|
79
81
|
.setTimeout(stellar_sdk_1.TimeoutInfinite)
|
|
80
82
|
.build();
|
|
81
83
|
// Sign the transaction
|
|
82
|
-
this.kit.signTransaction(transaction.toXDR());
|
|
84
|
+
const { signedTxXdr } = await this.kit.signTransaction(transaction.toXDR());
|
|
85
|
+
const tx = stellar_sdk_1.TransactionBuilder.fromXDR(signedTxXdr, this.sandbox ? stellar_sdk_1.Networks.TESTNET : stellar_sdk_1.Networks.PUBLIC);
|
|
83
86
|
let retries = 0;
|
|
84
87
|
const maxRetries = 5;
|
|
85
88
|
let delay = 1000;
|
|
86
89
|
while (retries < maxRetries) {
|
|
87
90
|
try {
|
|
88
|
-
const transactionResult = await this.server.submitTransaction(
|
|
91
|
+
const transactionResult = await this.server.submitTransaction(tx, {
|
|
89
92
|
skipMemoRequiredCheck: false,
|
|
90
93
|
});
|
|
91
94
|
const txHash = transactionResult.hash;
|