@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.
@@ -52,14 +52,16 @@ class StellarService {
52
52
  */
53
53
  async transferXLM(amount) {
54
54
  // Fetch deposit address
55
- const { depositVault: depositAddress, tag } = await this.fetchVault();
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: depositAddress,
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(transaction, {
91
+ const transactionResult = await this.server.submitTransaction(tx, {
89
92
  skipMemoRequiredCheck: false,
90
93
  });
91
94
  const txHash = transactionResult.hash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/exchange-card-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "An sdk for purchasing silver card in zebec",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",