@spritz-finance/service-client 0.30.0 → 0.31.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as BridgeClient from "./bridgeServiceClient";
|
|
2
2
|
import { ExternalPayment } from "../lib/graphClient/generated";
|
|
3
3
|
import { BridgeUser } from "../onramp/types";
|
|
4
|
-
import { BridgeExternalAccount, BridgeNetwork, BridgeTransfer, BridgeTransferOffRampPaymentRail, CreateBridgeAccountParams } from "./types";
|
|
4
|
+
import { BridgeCurrency, BridgeExchangeRates, BridgeExternalAccount, BridgeNetwork, BridgeTransfer, BridgeTransferOffRampPaymentRail, CreateBridgeAccountParams } from "./types";
|
|
5
5
|
export declare function getTransferHashes(externalPaymentIds: string[]): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<{
|
|
6
6
|
externalPaymentId: string;
|
|
7
7
|
hash: string | null;
|
|
@@ -23,4 +23,5 @@ export declare function createBridgeTransfer(userId: string, input: {
|
|
|
23
23
|
accountId: string;
|
|
24
24
|
paymentRail: BridgeTransferOffRampPaymentRail;
|
|
25
25
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeTransfer>>;
|
|
26
|
+
export declare function getExchangeRates(from: BridgeCurrency, to: BridgeCurrency): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeExchangeRates>>;
|
|
26
27
|
export declare function getExternalPayments(paymentIds: string[]): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ExternalPayment[]>>;
|
|
@@ -39,6 +39,7 @@ exports.createBridgeBankAccount = createBridgeBankAccount;
|
|
|
39
39
|
exports.getBridgeUser = getBridgeUser;
|
|
40
40
|
exports.validateTransfer = validateTransfer;
|
|
41
41
|
exports.createBridgeTransfer = createBridgeTransfer;
|
|
42
|
+
exports.getExchangeRates = getExchangeRates;
|
|
42
43
|
exports.getExternalPayments = getExternalPayments;
|
|
43
44
|
exports.BridgeClient = __importStar(require("./bridgeServiceClient"));
|
|
44
45
|
const restClient_1 = require("../restClient");
|
|
@@ -75,6 +76,13 @@ async function createBridgeTransfer(userId, input) {
|
|
|
75
76
|
.post(`${ONRAMP_ROUTER_ENDPOINT}/off-ramps/users/${userId}/transfers`, input)
|
|
76
77
|
.then((res) => res.data);
|
|
77
78
|
}
|
|
79
|
+
async function getExchangeRates(from, to) {
|
|
80
|
+
return baseClient
|
|
81
|
+
.get(`${ONRAMP_ROUTER_ENDPOINT}/exchange-rates`, {
|
|
82
|
+
params: { from, to },
|
|
83
|
+
})
|
|
84
|
+
.then((res) => res.data);
|
|
85
|
+
}
|
|
78
86
|
async function getExternalPayments(paymentIds) {
|
|
79
87
|
return baseClient
|
|
80
88
|
.get(`${ONRAMP_ENDPOINT}/external-payments?paymentIds=${paymentIds.join(",")}`)
|
package/lib/bridge/types.d.ts
CHANGED
|
@@ -45,6 +45,25 @@ export declare enum BridgeNetwork {
|
|
|
45
45
|
STELLAR = "stellar",
|
|
46
46
|
TRON = "tron"
|
|
47
47
|
}
|
|
48
|
+
/** Currencies the bridge service quotes (`GET /api/exchange-rates`). */
|
|
49
|
+
export declare enum BridgeCurrency {
|
|
50
|
+
BRL = "brl",
|
|
51
|
+
BTC = "btc",
|
|
52
|
+
ETH = "eth",
|
|
53
|
+
EUR = "eur",
|
|
54
|
+
GBP = "gbp",
|
|
55
|
+
MXN = "mxn",
|
|
56
|
+
SOL = "sol",
|
|
57
|
+
USD = "usd",
|
|
58
|
+
USDT = "usdt",
|
|
59
|
+
USDC = "usdc"
|
|
60
|
+
}
|
|
61
|
+
/** Bridge's quote for one `from` unit, in `to` units. Decimal strings, as Bridge returns them. */
|
|
62
|
+
export type BridgeExchangeRates = {
|
|
63
|
+
midmarket_rate: string;
|
|
64
|
+
buy_rate: string;
|
|
65
|
+
sell_rate: string;
|
|
66
|
+
};
|
|
48
67
|
export declare enum BridgeTransferOffRampPaymentRail {
|
|
49
68
|
ACH = "ach",
|
|
50
69
|
ACH_SAME_DAY = "ach_same_day",
|
package/lib/bridge/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BridgeTransferOffRampPaymentRail = exports.BridgeNetwork = void 0;
|
|
3
|
+
exports.BridgeTransferOffRampPaymentRail = exports.BridgeCurrency = exports.BridgeNetwork = void 0;
|
|
4
4
|
var BridgeNetwork;
|
|
5
5
|
(function (BridgeNetwork) {
|
|
6
6
|
BridgeNetwork["ETHEREUM"] = "ethereum";
|
|
@@ -13,6 +13,20 @@ var BridgeNetwork;
|
|
|
13
13
|
BridgeNetwork["STELLAR"] = "stellar";
|
|
14
14
|
BridgeNetwork["TRON"] = "tron";
|
|
15
15
|
})(BridgeNetwork || (exports.BridgeNetwork = BridgeNetwork = {}));
|
|
16
|
+
/** Currencies the bridge service quotes (`GET /api/exchange-rates`). */
|
|
17
|
+
var BridgeCurrency;
|
|
18
|
+
(function (BridgeCurrency) {
|
|
19
|
+
BridgeCurrency["BRL"] = "brl";
|
|
20
|
+
BridgeCurrency["BTC"] = "btc";
|
|
21
|
+
BridgeCurrency["ETH"] = "eth";
|
|
22
|
+
BridgeCurrency["EUR"] = "eur";
|
|
23
|
+
BridgeCurrency["GBP"] = "gbp";
|
|
24
|
+
BridgeCurrency["MXN"] = "mxn";
|
|
25
|
+
BridgeCurrency["SOL"] = "sol";
|
|
26
|
+
BridgeCurrency["USD"] = "usd";
|
|
27
|
+
BridgeCurrency["USDT"] = "usdt";
|
|
28
|
+
BridgeCurrency["USDC"] = "usdc";
|
|
29
|
+
})(BridgeCurrency || (exports.BridgeCurrency = BridgeCurrency = {}));
|
|
16
30
|
var BridgeTransferOffRampPaymentRail;
|
|
17
31
|
(function (BridgeTransferOffRampPaymentRail) {
|
|
18
32
|
BridgeTransferOffRampPaymentRail["ACH"] = "ach";
|