@zebec-network/exchange-card-sdk 1.1.2 → 1.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.
@@ -41,7 +41,7 @@ export declare class StellarService {
41
41
  * @throws {InvalidEmailError} If the recipient's email address is invalid.
42
42
  * @throws {Error} If the quote is invalid or expired, if there is not enough balance, or if the transaction fails.
43
43
  */
44
- transferXDB(amount: number): Promise<string>;
44
+ transferXDB(amount: string): Promise<string>;
45
45
  /**
46
46
  * Retrieves the balance of the specified wallet.
47
47
  *
@@ -53,18 +53,14 @@ class StellarService {
53
53
  async transferXDB(amount) {
54
54
  // Fetch deposit address
55
55
  const vault = await this.fetchVault();
56
- console.log("depositAddress", vault.address);
57
- console.log("tag", vault.tag);
58
56
  const accountAddress = await this.kit.getAddress();
59
57
  // Prepare transaction
60
58
  const account = await this.server.loadAccount(accountAddress.address);
61
59
  const fee = await this.server.fetchBaseFee();
62
- const platform_fee = (amount * constants_1.PLATFORM_FEE) / 10000;
63
- const totalAmount = (amount + platform_fee).toString();
64
60
  const memo = stellar_sdk_1.Memo.id(vault.tag?.toString() || "");
65
61
  // Check Wallet balance
66
62
  const balance = await this.getWalletBalance(accountAddress.address);
67
- if (Number(balance) < Number(totalAmount)) {
63
+ if (Number(balance) < Number(amount)) {
68
64
  throw new Error("Insufficient balance");
69
65
  }
70
66
  // Build and submit transaction
@@ -75,14 +71,14 @@ class StellarService {
75
71
  .addOperation(stellar_sdk_1.Operation.payment({
76
72
  destination: vault.address,
77
73
  asset: stellar_sdk_1.Asset.native(),
78
- amount: totalAmount,
74
+ amount,
79
75
  }))
80
76
  .addMemo(memo)
81
77
  .setTimeout(stellar_sdk_1.TimeoutInfinite)
82
78
  .build();
83
79
  // Sign the transaction
84
80
  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);
81
+ const tx = stellar_sdk_1.TransactionBuilder.fromXDR(signedTxXdr, this.sandbox ? constants_1.XDB_PASSPHRASE.Sandbox : constants_1.XDB_PASSPHRASE.Production);
86
82
  let retries = 0;
87
83
  const maxRetries = 5;
88
84
  let delay = 1000;
@@ -41,7 +41,7 @@ export declare class StellarService {
41
41
  * @throws {InvalidEmailError} If the recipient's email address is invalid.
42
42
  * @throws {Error} If the quote is invalid or expired, if there is not enough balance, or if the transaction fails.
43
43
  */
44
- transferXLM(amount: number): Promise<string>;
44
+ transferXLM(amount: string): Promise<string>;
45
45
  /**
46
46
  * Retrieves the balance of the specified wallet.
47
47
  *
@@ -53,18 +53,14 @@ class StellarService {
53
53
  async transferXLM(amount) {
54
54
  // Fetch deposit address
55
55
  const vault = await this.fetchVault();
56
- console.log("depositAddress", vault.address);
57
- console.log("tag", vault.tag);
58
56
  const accountAddress = await this.kit.getAddress();
59
57
  // Prepare transaction
60
58
  const account = await this.server.loadAccount(accountAddress.address);
61
59
  const fee = await this.server.fetchBaseFee();
62
- const platform_fee = (amount * constants_1.PLATFORM_FEE) / 10000;
63
- const totalAmount = (amount + platform_fee).toString();
64
60
  const memo = stellar_sdk_1.Memo.id(vault.tag?.toString() || "");
65
61
  // Check Wallet balance
66
62
  const balance = await this.getWalletBalance(accountAddress.address);
67
- if (Number(balance) < Number(totalAmount)) {
63
+ if (Number(balance) < Number(amount)) {
68
64
  throw new Error("Insufficient balance");
69
65
  }
70
66
  // Build and submit transaction
@@ -75,7 +71,7 @@ class StellarService {
75
71
  .addOperation(stellar_sdk_1.Operation.payment({
76
72
  destination: vault.address,
77
73
  asset: stellar_sdk_1.Asset.native(),
78
- amount: totalAmount,
74
+ amount,
79
75
  }))
80
76
  .addMemo(memo)
81
77
  .setTimeout(stellar_sdk_1.TimeoutInfinite)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/exchange-card-sdk",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "An sdk for purchasing silver card in zebec",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",