@zebec-network/exchange-card-sdk 1.7.0 → 1.8.0

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.
@@ -4,6 +4,7 @@ export declare const NEAR_RPC_URL: Record<"Production" | "Sandbox", string>;
4
4
  export declare const XRPL_RPC_URL: Record<"Production" | "Sandbox", string>;
5
5
  export declare const STELLAR_RPC_URL: Record<"Production" | "Sandbox", string>;
6
6
  export declare const XDB_RPC_URL: Record<"Production" | "Sandbox", string>;
7
+ export declare const ALGORAND_RPC_URL: Record<"Production" | "Sandbox", string>;
7
8
  export declare const XDB_NETWORK: {
8
9
  readonly PUBLIC: "LiveNet Global XDBChain Network ; November 2023";
9
10
  readonly TESTNET: "Futurenet XDBChain Network ; October 2023";
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const CARD_API_URL = {
2
- Production: "https://cex.card.zebec.io",
3
- Sandbox: "https://cex.card.zebec.io",
2
+ Production: "https://api.superapp.zebec.io",
3
+ Sandbox: "https://dev-super.api.zebec.io",
4
4
  };
5
5
  export const NEAR_RPC_URL = {
6
6
  Production: process.env.NEAR_RPC_URL ? process.env.NEAR_RPC_URL : "https://rpc.mainnet.near.org",
@@ -18,6 +18,10 @@ export const XDB_RPC_URL = {
18
18
  Production: "https://horizon.livenet.xdbchain.com/",
19
19
  Sandbox: "https://horizon.futurenet.xdbchain.com/",
20
20
  };
21
+ export const ALGORAND_RPC_URL = {
22
+ Production: "https://mainnet-api.algonode.cloud",
23
+ Sandbox: "https://testnet-api.algonode.cloud",
24
+ };
21
25
  export const XDB_NETWORK = {
22
26
  PUBLIC: "LiveNet Global XDBChain Network ; November 2023",
23
27
  TESTNET: "Futurenet XDBChain Network ; October 2023",
@@ -1,28 +1,8 @@
1
- import { Quote } from "../types";
2
- export type APIConfig = {
3
- apiKey: string;
4
- encryptionKey: string;
5
- };
6
1
  export declare class ZebecCardAPIService {
7
- readonly apiConfig: APIConfig & {
8
- apiUrl: string;
9
- };
10
- private readonly sdkVersion;
2
+ readonly apiUrl: string;
11
3
  private readonly api;
12
- constructor(apiConfig: APIConfig, sandbox?: boolean);
13
- private generateSignature;
14
- generateRequestHeaders(method: string, path: string, body?: any): {
15
- "X-API-Key": string;
16
- "X-Timestamp": string;
17
- "X-Nonce": string;
18
- "X-Signature": string;
19
- "X-SDK-Version": string;
20
- "Content-Type": string;
21
- };
22
- encryptSensitiveData(data: any): string;
4
+ constructor(sandbox?: boolean);
23
5
  ping(): Promise<boolean>;
24
- purchaseCard(data: any): Promise<import("axios").AxiosResponse<any, any>>;
25
- fetchQuote(symbol: string): Promise<Quote>;
26
6
  fetchVault(symbol: string): Promise<{
27
7
  address: string;
28
8
  tag?: string;
@@ -1,85 +1,24 @@
1
1
  import axios from "axios";
2
- import crypto from "crypto";
3
2
  import { CARD_API_URL } from "../constants";
4
3
  export class ZebecCardAPIService {
5
- apiConfig;
6
- sdkVersion = "1.0.0";
4
+ apiUrl;
7
5
  api;
8
- constructor(apiConfig, sandbox) {
9
- this.apiConfig = {
10
- ...apiConfig,
11
- apiUrl: sandbox ? CARD_API_URL.Sandbox : CARD_API_URL.Production,
12
- };
13
- this.api = axios.create({ baseURL: this.apiConfig.apiUrl });
14
- }
15
- // Generate request signature
16
- generateSignature(method, path, timestamp, body) {
17
- const stringToSign = [
18
- method.toUpperCase(),
19
- path,
20
- timestamp,
21
- this.apiConfig.apiKey,
22
- body ? JSON.stringify(body) : "",
23
- ].join("");
24
- return crypto
25
- .createHmac("sha256", this.apiConfig.encryptionKey)
26
- .update(stringToSign)
27
- .digest("hex");
28
- }
29
- // Generate request headers
30
- generateRequestHeaders(method, path, body) {
31
- const timestamp = Math.floor(Date.now() / 1000);
32
- const nonce = crypto.randomBytes(16).toString("hex");
33
- return {
34
- "X-API-Key": this.apiConfig.apiKey,
35
- "X-Timestamp": timestamp.toString(),
36
- "X-Nonce": nonce,
37
- "X-Signature": this.generateSignature(method, path, timestamp, body),
38
- "X-SDK-Version": this.sdkVersion,
39
- "Content-Type": "application/json",
40
- };
41
- }
42
- // Encrypt sensitive data fields
43
- encryptSensitiveData(data) {
44
- const iv = crypto.randomBytes(16);
45
- const key = crypto.pbkdf2Sync(this.apiConfig.encryptionKey, iv, 1000, 32, "sha256");
46
- const cipher = crypto.createCipheriv("aes-256-gcm", key, iv);
47
- let encrypted = cipher.update(JSON.stringify(data), "utf8", "base64");
48
- encrypted += cipher.final("base64");
49
- const authTag = cipher.getAuthTag();
50
- return `${iv.toString("base64")}:${encrypted}:${authTag.toString("base64")}`;
6
+ constructor(sandbox) {
7
+ this.apiUrl = sandbox ? CARD_API_URL.Sandbox : CARD_API_URL.Production;
8
+ this.api = axios.create({ baseURL: this.apiUrl });
51
9
  }
52
10
  // Ping API status
53
11
  async ping() {
54
12
  try {
55
- await this.api.get("/ping");
13
+ await this.api.get("/health");
56
14
  return true;
57
15
  }
58
16
  catch (error) {
59
17
  throw new Error("Card service is down. Please try again later.");
60
18
  }
61
19
  }
62
- // Purchase Card
63
- async purchaseCard(data) {
64
- console.debug("Payload data:", data);
65
- const encryptedData = this.encryptSensitiveData(data);
66
- console.debug("Encrypted Data: %s \n", encryptedData);
67
- const method = "POST";
68
- const path = "/orders/create";
69
- const url = this.apiConfig.apiUrl + path;
70
- const payload = { data: encryptedData };
71
- const headers = this.generateRequestHeaders(method, path, payload);
72
- const response = await axios.post(url, payload, { headers });
73
- return response;
74
- }
75
- // Fetch quote
76
- async fetchQuote(symbol) {
77
- const response = await this.api.get("/exchange/price", { params: { symbol } });
78
- const data = response.data;
79
- return data.data;
80
- }
81
20
  async fetchVault(symbol) {
82
- const { data } = await this.api.get(`/exchange/deposit-address`, { params: { symbol } });
21
+ const { data } = await this.api.get(`/tokens/deposit-address`, { params: { symbol } });
83
22
  return data.data;
84
23
  }
85
24
  }
@@ -1,7 +1,4 @@
1
1
  import algosdk from "algosdk";
2
- import { AlgorandClient } from "@algorandfoundation/algokit-utils";
3
- import { APIConfig } from "../helpers/apiHelpers";
4
- import { Quote } from "../types";
5
2
  /**
6
3
  * Configuration interface for algo transfers
7
4
  * */
@@ -24,20 +21,11 @@ export interface AlgorandWallet {
24
21
  }
25
22
  export declare class AlgorandService {
26
23
  readonly wallet: AlgorandWallet;
27
- readonly apiConfig: APIConfig;
28
24
  readonly algodClient: algosdk.Algodv2;
29
- readonly algorandClient: AlgorandClient;
30
25
  private apiService;
31
- private readonly network;
32
- constructor(wallet: AlgorandWallet, apiConfig: APIConfig, sdkOptions?: {
26
+ constructor(wallet: AlgorandWallet, sdkOptions?: {
33
27
  sandbox?: boolean;
34
28
  });
35
- /**
36
- * Fetches a quote for Bitcoin transfer.
37
- *
38
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
39
- */
40
- fetchQuote(symbol?: string): Promise<Quote>;
41
29
  /**
42
30
  * Fetches the Bitcoin vault address.
43
31
  *
@@ -1,33 +1,16 @@
1
1
  import algosdk from "algosdk";
2
- import { AlgorandClient } from "@algorandfoundation/algokit-utils";
3
- import { ClientManager } from "@algorandfoundation/algokit-utils/types/client-manager";
2
+ import { ALGORAND_RPC_URL } from "../constants";
4
3
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
5
4
  import { formatAlgo, formatAlgorandAsset, getAssetDecimals, parseAlgo, parseAlgorandAsset, } from "../utils";
6
5
  export class AlgorandService {
7
6
  wallet;
8
- apiConfig;
9
7
  algodClient;
10
- algorandClient;
11
8
  apiService;
12
- network;
13
- constructor(wallet, apiConfig, sdkOptions) {
9
+ constructor(wallet, sdkOptions) {
14
10
  this.wallet = wallet;
15
- this.apiConfig = apiConfig;
16
- this.network = sdkOptions?.sandbox ? "testnet" : "mainnet";
17
- this.algodClient = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig(this.network, "algod"));
18
- this.algorandClient = AlgorandClient.fromClients({
19
- algod: this.algodClient,
20
- });
21
- this.apiService = new ZebecCardAPIService(apiConfig, sdkOptions?.sandbox || false);
22
- }
23
- /**
24
- * Fetches a quote for Bitcoin transfer.
25
- *
26
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
27
- */
28
- async fetchQuote(symbol = "ALGO") {
29
- const res = await this.apiService.fetchQuote(symbol);
30
- return res;
11
+ const rpcUrl = ALGORAND_RPC_URL[sdkOptions?.sandbox ? "Sandbox" : "Production"];
12
+ this.algodClient = new algosdk.Algodv2({}, rpcUrl, 443);
13
+ this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
31
14
  }
32
15
  /**
33
16
  * Fetches the Bitcoin vault address.
@@ -1,6 +1,4 @@
1
1
  import * as bitcoin from "bitcoinjs-lib";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
4
2
  interface BitcoinWallet {
5
3
  address: string;
6
4
  signTransaction: (psbt: bitcoin.Psbt) => Promise<bitcoin.Psbt>;
@@ -11,16 +9,10 @@ export declare class BitcoinService {
11
9
  private apiService;
12
10
  private network;
13
11
  private apiEndpoint;
14
- constructor(wallet: BitcoinWallet, apiConfig: APIConfig, sdkOptions?: {
12
+ constructor(wallet: BitcoinWallet, sdkOptions?: {
15
13
  sandbox?: boolean;
16
14
  apiKey?: string;
17
15
  });
18
- /**
19
- * Fetches a quote for Bitcoin transfer.
20
- *
21
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
22
- */
23
- fetchQuote(): Promise<Quote>;
24
16
  /**
25
17
  * Fetches the Bitcoin vault address.
26
18
  *
@@ -7,22 +7,13 @@ export class BitcoinService {
7
7
  apiService;
8
8
  network;
9
9
  apiEndpoint;
10
- constructor(wallet, apiConfig, sdkOptions) {
10
+ constructor(wallet, sdkOptions) {
11
11
  this.wallet = wallet;
12
12
  const sandbox = sdkOptions?.sandbox ?? false;
13
- this.apiService = new ZebecCardAPIService(apiConfig, sandbox);
13
+ this.apiService = new ZebecCardAPIService(sandbox);
14
14
  this.network = sandbox ? bitcoin.networks.testnet : bitcoin.networks.bitcoin;
15
15
  this.apiEndpoint = sandbox ? BITCOIN_ENDPOINTS.Sandbox : BITCOIN_ENDPOINTS.Production;
16
16
  }
17
- /**
18
- * Fetches a quote for Bitcoin transfer.
19
- *
20
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
21
- */
22
- async fetchQuote() {
23
- const res = await this.apiService.fetchQuote("BTC");
24
- return res;
25
- }
26
17
  /**
27
18
  * Fetches the Bitcoin vault address.
28
19
  *
@@ -1,6 +1,5 @@
1
1
  import { ethers } from "ethers";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { BobaChainId, Quote } from "../types";
2
+ import { BobaChainId } from "../types";
4
3
  export type TransferBobaParams = {
5
4
  amount: string | number;
6
5
  overrides?: Omit<ethers.Overrides, "from" | "value" | "chainId">;
@@ -13,19 +12,12 @@ export type TransferTokenParams = {
13
12
  };
14
13
  export declare class BobaService {
15
14
  readonly signer: ethers.Signer;
16
- readonly apiConfig: APIConfig;
17
15
  readonly network: "mainnet" | "testnet";
18
16
  readonly chainId: BobaChainId;
19
17
  private readonly apiService;
20
- constructor(signer: ethers.Signer, apiConfig: APIConfig, sdkOptions?: {
18
+ constructor(signer: ethers.Signer, sdkOptions?: {
21
19
  sandbox?: boolean;
22
20
  });
23
- /**
24
- * Fetches a quote for Bitcoin transfer.
25
- *
26
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
27
- */
28
- fetchQuote(symbol: string): Promise<Quote>;
29
21
  /**
30
22
  * Fetches the Bitcoin vault address.
31
23
  *
@@ -4,25 +4,14 @@ import { BOBA_CHAIN_ID, DEFAULT_EVM_GAS_LIMIT } from "../constants";
4
4
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
5
5
  export class BobaService {
6
6
  signer;
7
- apiConfig;
8
7
  network;
9
8
  chainId;
10
9
  apiService;
11
- constructor(signer, apiConfig, sdkOptions) {
10
+ constructor(signer, sdkOptions) {
12
11
  this.signer = signer;
13
- this.apiConfig = apiConfig;
14
12
  this.network = sdkOptions?.sandbox ? "testnet" : "mainnet";
15
13
  this.chainId = BOBA_CHAIN_ID[this.network];
16
- this.apiService = new ZebecCardAPIService(apiConfig, sdkOptions?.sandbox || false);
17
- }
18
- /**
19
- * Fetches a quote for Bitcoin transfer.
20
- *
21
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
22
- */
23
- async fetchQuote(symbol) {
24
- const res = await this.apiService.fetchQuote(symbol);
25
- return res;
14
+ this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
26
15
  }
27
16
  /**
28
17
  * Fetches the Bitcoin vault address.
@@ -1,4 +1,3 @@
1
- // export * from "./bitcoinService";
2
1
  export * from "./stellarService";
3
2
  export * from "./xrplService";
4
3
  export * from "./nearService";
@@ -1,7 +1,5 @@
1
1
  import { Provider } from "@near-js/providers";
2
2
  import { FinalExecutionOutcome } from "@near-js/types";
3
- import { APIConfig } from "../helpers/apiHelpers";
4
- import { Quote } from "../types";
5
3
  export interface CreateAccountAction {
6
4
  type: "CreateAccount";
7
5
  }
@@ -83,15 +81,9 @@ export declare class NearService {
83
81
  readonly wallet: NearWallet;
84
82
  private apiService;
85
83
  readonly provider: Provider;
86
- constructor(wallet: NearWallet, apiConfig: APIConfig, options?: {
84
+ constructor(wallet: NearWallet, options?: {
87
85
  sandbox?: boolean;
88
86
  });
89
- /**
90
- * Fetches a quote for Bitcoin transfer.
91
- *
92
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
93
- */
94
- fetchQuote(symbol?: string): Promise<Quote>;
95
87
  /**
96
88
  * Fetches the Bitcoin vault address.
97
89
  *
@@ -26,22 +26,13 @@ export class NearService {
26
26
  wallet;
27
27
  apiService;
28
28
  provider;
29
- constructor(wallet, apiConfig, options) {
29
+ constructor(wallet, options) {
30
30
  this.wallet = wallet;
31
31
  const sandbox = options?.sandbox ? options.sandbox : false;
32
- this.apiService = new ZebecCardAPIService(apiConfig, sandbox);
32
+ this.apiService = new ZebecCardAPIService(sandbox);
33
33
  const url = sandbox ? NEAR_RPC_URL.Sandbox : NEAR_RPC_URL.Production;
34
34
  this.provider = new JsonRpcProvider({ url });
35
35
  }
36
- /**
37
- * Fetches a quote for Bitcoin transfer.
38
- *
39
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
40
- */
41
- async fetchQuote(symbol = "NEAR") {
42
- const res = await this.apiService.fetchQuote(symbol);
43
- return res;
44
- }
45
36
  /**
46
37
  * Fetches the Bitcoin vault address.
47
38
  *
@@ -1,23 +1,14 @@
1
1
  import { ethers } from "ethers";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
4
2
  export type TransferOctaParams = {
5
3
  amount: string | number;
6
4
  overrides?: Omit<ethers.Overrides, "from" | "value" | "chainId">;
7
5
  };
8
6
  export declare class OctaService {
9
7
  readonly signer: ethers.Signer;
10
- readonly apiConfig: APIConfig;
11
8
  private apiService;
12
- constructor(signer: ethers.Signer, apiConfig: APIConfig, sdkOptions?: {
9
+ constructor(signer: ethers.Signer, sdkOptions?: {
13
10
  sandbox?: boolean;
14
11
  });
15
- /**
16
- * Fetches a quote for Bitcoin transfer.
17
- *
18
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
19
- */
20
- fetchQuote(symbol?: string): Promise<Quote>;
21
12
  /**
22
13
  * Fetches the Bitcoin vault address.
23
14
  *
@@ -3,21 +3,10 @@ import { DEFAULT_EVM_GAS_LIMIT } from "../constants";
3
3
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
4
4
  export class OctaService {
5
5
  signer;
6
- apiConfig;
7
6
  apiService;
8
- constructor(signer, apiConfig, sdkOptions) {
7
+ constructor(signer, sdkOptions) {
9
8
  this.signer = signer;
10
- this.apiConfig = apiConfig;
11
- this.apiService = new ZebecCardAPIService(apiConfig, sdkOptions?.sandbox || false);
12
- }
13
- /**
14
- * Fetches a quote for Bitcoin transfer.
15
- *
16
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
17
- */
18
- async fetchQuote(symbol = "OCTA") {
19
- const res = await this.apiService.fetchQuote(symbol);
20
- return res;
9
+ this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
21
10
  }
22
11
  /**
23
12
  * Fetches the Bitcoin vault address.
@@ -1,6 +1,4 @@
1
1
  import { QuaiTransactionRequest } from "quais/providers";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
4
2
  export type TransferQuaiParams = {
5
3
  amount: string | number;
6
4
  overrides?: Omit<QuaiTransactionRequest, "from" | "value" | "chainId">;
@@ -11,17 +9,10 @@ export type QuaiWallet = {
11
9
  };
12
10
  export declare class QuaiService {
13
11
  readonly signer: QuaiWallet;
14
- readonly apiConfig: APIConfig;
15
12
  private apiService;
16
- constructor(signer: QuaiWallet, apiConfig: APIConfig, sdkOptions?: {
13
+ constructor(signer: QuaiWallet, sdkOptions?: {
17
14
  sandbox?: boolean;
18
15
  });
19
- /**
20
- * Fetches a quote for Bitcoin transfer.
21
- *
22
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
23
- */
24
- fetchQuote(symbol: string): Promise<Quote>;
25
16
  /**
26
17
  * Fetches the Bitcoin vault address.
27
18
  *
@@ -3,21 +3,10 @@ import { DEFAULT_QUAI_GAS_LIMIT } from "../constants";
3
3
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
4
4
  export class QuaiService {
5
5
  signer;
6
- apiConfig;
7
6
  apiService;
8
- constructor(signer, apiConfig, sdkOptions) {
7
+ constructor(signer, sdkOptions) {
9
8
  this.signer = signer;
10
- this.apiConfig = apiConfig;
11
- this.apiService = new ZebecCardAPIService(apiConfig, sdkOptions?.sandbox || false);
12
- }
13
- /**
14
- * Fetches a quote for Bitcoin transfer.
15
- *
16
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
17
- */
18
- async fetchQuote(symbol) {
19
- const res = await this.apiService.fetchQuote(symbol);
20
- return res;
9
+ this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
21
10
  }
22
11
  /**
23
12
  * Fetches the Bitcoin vault address.
@@ -1,6 +1,4 @@
1
1
  import { Asset, Horizon } from "@stellar/stellar-sdk";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
4
2
  export interface StellarWallet {
5
3
  address: string;
6
4
  signTransaction: (txXdr: string) => Promise<string>;
@@ -17,17 +15,10 @@ export declare class StellarService {
17
15
  * @param {APIConfig} apiConfig - The configuration object for the API.
18
16
  * @param sdkOptions - Optional configuration for the SDK.
19
17
  */
20
- constructor(wallet: StellarWallet, apiConfig: APIConfig, sdkOptions?: {
18
+ constructor(wallet: StellarWallet, sdkOptions?: {
21
19
  sandbox?: boolean;
22
20
  apiKey?: string;
23
21
  });
24
- /**
25
- * Fetches a quote for the given amount.
26
- *
27
- * @param {string | number} amount - The amount for which to fetch the quote.
28
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
29
- */
30
- fetchQuote(): Promise<Quote>;
31
22
  /**
32
23
  * Fetches the Vault address.
33
24
  *
@@ -13,23 +13,13 @@ export class StellarService {
13
13
  * @param {APIConfig} apiConfig - The configuration object for the API.
14
14
  * @param sdkOptions - Optional configuration for the SDK.
15
15
  */
16
- constructor(wallet, apiConfig, sdkOptions) {
16
+ constructor(wallet, sdkOptions) {
17
17
  this.wallet = wallet;
18
18
  const sandbox = sdkOptions?.sandbox ? sdkOptions.sandbox : false;
19
- this.apiService = new ZebecCardAPIService(apiConfig, sandbox);
19
+ this.apiService = new ZebecCardAPIService(sandbox);
20
20
  this.server = new Horizon.Server(sandbox ? STELLAR_RPC_URL.Sandbox : STELLAR_RPC_URL.Production);
21
21
  this.sandbox = sandbox;
22
22
  }
23
- /**
24
- * Fetches a quote for the given amount.
25
- *
26
- * @param {string | number} amount - The amount for which to fetch the quote.
27
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
28
- */
29
- async fetchQuote() {
30
- const res = await this.apiService.fetchQuote("XLM");
31
- return res;
32
- }
33
23
  /**
34
24
  * Fetches the Vault address.
35
25
  *
@@ -1,6 +1,5 @@
1
1
  import { Asset, Horizon } from "@stellar/stellar-sdk";
2
- import { APIConfig, ZebecCardAPIService } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
2
+ import { ZebecCardAPIService } from "../helpers/apiHelpers";
4
3
  export interface XDBWalletInterface {
5
4
  address: string;
6
5
  signTransaction: (txXdr: string) => Promise<string>;
@@ -17,16 +16,10 @@ export declare class XDBService {
17
16
  * @param {APIConfig} apiConfig - The configuration object for the API.
18
17
  * @param sdkOptions - Optional configuration for the SDK.
19
18
  */
20
- constructor(wallet: XDBWalletInterface, apiConfig: APIConfig, sdkOptions?: {
19
+ constructor(wallet: XDBWalletInterface, sdkOptions?: {
21
20
  sandbox?: boolean;
22
21
  apiKey?: string;
23
22
  });
24
- /**
25
- * Fetches a quote for the given amount.
26
- *
27
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
28
- */
29
- fetchQuote(symbol?: string): Promise<Quote>;
30
23
  /**
31
24
  * Fetches the Vault address.
32
25
  *
@@ -13,22 +13,13 @@ export class XDBService {
13
13
  * @param {APIConfig} apiConfig - The configuration object for the API.
14
14
  * @param sdkOptions - Optional configuration for the SDK.
15
15
  */
16
- constructor(wallet, apiConfig, sdkOptions) {
16
+ constructor(wallet, sdkOptions) {
17
17
  this.wallet = wallet;
18
18
  const sandbox = sdkOptions?.sandbox ? sdkOptions.sandbox : false;
19
- this.apiService = new ZebecCardAPIService(apiConfig, sandbox);
19
+ this.apiService = new ZebecCardAPIService(sandbox);
20
20
  this.server = new Horizon.Server(sandbox ? XDB_RPC_URL.Sandbox : XDB_RPC_URL.Production);
21
21
  this.sandbox = sandbox;
22
22
  }
23
- /**
24
- * Fetches a quote for the given amount.
25
- *
26
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
27
- */
28
- async fetchQuote(symbol = "XDB") {
29
- const res = await this.apiService.fetchQuote(symbol);
30
- return res;
31
- }
32
23
  /**
33
24
  * Fetches the Vault address.
34
25
  *
@@ -1,6 +1,4 @@
1
1
  import { BaseTransaction, Client, SubmittableTransaction, Transaction, TxResponse } from "xrpl";
2
- import { APIConfig } from "../helpers/apiHelpers";
3
- import { Quote } from "../types";
4
2
  export interface XRPLWallet {
5
3
  address: string;
6
4
  signTransaction: (transaction: SubmittableTransaction | BaseTransaction) => Promise<string>;
@@ -9,15 +7,9 @@ export declare class XRPLService {
9
7
  readonly wallet: XRPLWallet;
10
8
  private apiService;
11
9
  readonly client: Client;
12
- constructor(wallet: XRPLWallet, apiConfig: APIConfig, options?: {
10
+ constructor(wallet: XRPLWallet, options?: {
13
11
  sandbox?: boolean;
14
12
  });
15
- /**
16
- * Fetches a quote for Bitcoin transfer.
17
- *
18
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
19
- */
20
- fetchQuote(symbol?: string): Promise<Quote>;
21
13
  /**
22
14
  * Fetches the Bitcoin vault address.
23
15
  *
@@ -5,22 +5,13 @@ export class XRPLService {
5
5
  wallet;
6
6
  apiService;
7
7
  client;
8
- constructor(wallet, apiConfig, options) {
8
+ constructor(wallet, options) {
9
9
  this.wallet = wallet;
10
10
  const sandbox = options?.sandbox ? options.sandbox : false;
11
- this.apiService = new ZebecCardAPIService(apiConfig, sandbox);
11
+ this.apiService = new ZebecCardAPIService(sandbox);
12
12
  const xrplNetwork = sandbox ? XRPL_RPC_URL.Sandbox : XRPL_RPC_URL.Production;
13
13
  this.client = new Client(xrplNetwork);
14
14
  }
15
- /**
16
- * Fetches a quote for Bitcoin transfer.
17
- *
18
- * @returns {Promise<Quote>} A promise that resolves to a Quote object.
19
- */
20
- async fetchQuote(symbol = "XRP") {
21
- const res = await this.apiService.fetchQuote(symbol);
22
- return res;
23
- }
24
15
  /**
25
16
  * Fetches the Bitcoin vault address.
26
17
  *
package/dist/types.d.ts CHANGED
@@ -1,7 +1,2 @@
1
- export type Quote = {
2
- price: number;
3
- fluctuationPercentage: number;
4
- token: string;
5
- };
6
1
  export type BobaChainId = 288 | 28882;
7
2
  export type QuaiChainId = 9 | 15000;
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import algosdk from "algosdk";
2
- export declare function hashSHA256(input: string): string;
3
2
  /**
4
3
  * Convert ALGO to microAlgos
5
4
  * @param algos Amount in ALGO
package/dist/utils.js CHANGED
@@ -1,11 +1,4 @@
1
1
  import { BigNumber } from "bignumber.js";
2
- import crypto from "crypto";
3
- export function hashSHA256(input) {
4
- const hash = crypto.createHash("sha256");
5
- hash.update(input);
6
- const hex = hash.digest("hex");
7
- return hex;
8
- }
9
2
  /**
10
3
  * Convert ALGO to microAlgos
11
4
  * @param algos Amount in ALGO
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/exchange-card-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "An sdk for purchasing silver card in zebec",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "gen:typechain": "typechain --target ethers-v6 --out-dir \"src/artifacts/typechain-types\" \"src/artifacts/abi/*.json\""
18
18
  },
19
19
  "devDependencies": {
20
+ "@algorandfoundation/algokit-utils": "^9.1.2",
20
21
  "@near-js/accounts": "^2.3.0",
21
22
  "@near-js/keystores": "^2.3.0",
22
23
  "@near-js/signers": "^2.3.0",
@@ -33,7 +34,6 @@
33
34
  "typescript": "^5.9.2"
34
35
  },
35
36
  "dependencies": {
36
- "@algorandfoundation/algokit-utils": "^9.1.2",
37
37
  "@near-js/crypto": "^2.3.0",
38
38
  "@near-js/providers": "^2.3.0",
39
39
  "@near-js/transactions": "^2.3.0",