@zebec-network/exchange-card-sdk 1.6.0 → 1.6.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.
|
@@ -8,6 +8,7 @@ export type TransferBobaParams = {
|
|
|
8
8
|
export type TransferTokenParams = {
|
|
9
9
|
amount: string | number;
|
|
10
10
|
tokenAddress: string;
|
|
11
|
+
symbol: string;
|
|
11
12
|
overrides?: Omit<ethers.Overrides, "from" | "value" | "chainId">;
|
|
12
13
|
};
|
|
13
14
|
export declare class BobaService {
|
|
@@ -24,13 +25,13 @@ export declare class BobaService {
|
|
|
24
25
|
*
|
|
25
26
|
* @returns {Promise<Quote>} A promise that resolves to a Quote object.
|
|
26
27
|
*/
|
|
27
|
-
fetchQuote(symbol
|
|
28
|
+
fetchQuote(symbol: string): Promise<Quote>;
|
|
28
29
|
/**
|
|
29
30
|
* Fetches the Bitcoin vault address.
|
|
30
31
|
*
|
|
31
32
|
* @returns {Promise<{ address: string }>} A promise that resolves to the vault address.
|
|
32
33
|
*/
|
|
33
|
-
fetchVault(symbol
|
|
34
|
+
fetchVault(symbol: string): Promise<{
|
|
34
35
|
address: string;
|
|
35
36
|
tag?: string;
|
|
36
37
|
}>;
|
|
@@ -20,7 +20,7 @@ export class BobaService {
|
|
|
20
20
|
*
|
|
21
21
|
* @returns {Promise<Quote>} A promise that resolves to a Quote object.
|
|
22
22
|
*/
|
|
23
|
-
async fetchQuote(symbol
|
|
23
|
+
async fetchQuote(symbol) {
|
|
24
24
|
const res = await this.apiService.fetchQuote(symbol);
|
|
25
25
|
return res;
|
|
26
26
|
}
|
|
@@ -29,14 +29,14 @@ export class BobaService {
|
|
|
29
29
|
*
|
|
30
30
|
* @returns {Promise<{ address: string }>} A promise that resolves to the vault address.
|
|
31
31
|
*/
|
|
32
|
-
async fetchVault(symbol
|
|
32
|
+
async fetchVault(symbol) {
|
|
33
33
|
const data = await this.apiService.fetchVault(symbol);
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
36
|
async transferBobaEth(params) {
|
|
37
37
|
const parsedAmount = ethers.parseEther(params.amount.toString());
|
|
38
38
|
const provider = this.signer.provider;
|
|
39
|
-
const vault = await this.fetchVault();
|
|
39
|
+
const vault = await this.fetchVault("BOBA-ETH");
|
|
40
40
|
const recipientAddress = vault.address;
|
|
41
41
|
if (!provider) {
|
|
42
42
|
throw new Error("There is no provider in signer instance.");
|
|
@@ -64,7 +64,7 @@ export class BobaService {
|
|
|
64
64
|
const tokenContract = ERC20__factory.connect(params.tokenAddress, this.signer);
|
|
65
65
|
const tokenDecimals = await tokenContract.decimals();
|
|
66
66
|
const parsedAmount = ethers.parseUnits(params.amount.toString(), tokenDecimals);
|
|
67
|
-
const vault = await this.fetchVault();
|
|
67
|
+
const vault = await this.fetchVault(params.symbol);
|
|
68
68
|
const recipientAddress = vault.address;
|
|
69
69
|
const senderBalance = await tokenContract.balanceOf(this.signer);
|
|
70
70
|
if (senderBalance < parsedAmount) {
|
package/dist/services/index.d.ts
CHANGED
package/dist/services/index.js
CHANGED