@spritz-finance/service-client 0.8.3 → 0.8.5
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,5 +1,5 @@
|
|
|
1
1
|
export * as PayoutsClient from "./payoutsServiceClient";
|
|
2
|
-
import { CryptoPayout, CryptoPayoutInput } from "./types";
|
|
2
|
+
import { CryptoPayout, CryptoPayoutInput, TreasuryBalances } from "./types";
|
|
3
3
|
export declare function requestCryptoPayout({ userId, type, network, amountFiat, referenceId, toAddress, tokenSymbol, currencyFiat, fromDispatchWallet, }: CryptoPayoutInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CryptoPayout>>;
|
|
4
4
|
export declare function getPayoutFromHash({ userId, transactionHash, }: {
|
|
5
5
|
userId?: string;
|
|
@@ -22,3 +22,4 @@ export declare function submit7702Message(input: {
|
|
|
22
22
|
to: `0x${string}`;
|
|
23
23
|
chainId: number;
|
|
24
24
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<string>>;
|
|
25
|
+
export declare function getTreasuryBalances(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TreasuryBalances>>;
|
|
@@ -38,6 +38,7 @@ exports.requestCryptoPayout = requestCryptoPayout;
|
|
|
38
38
|
exports.getPayoutFromHash = getPayoutFromHash;
|
|
39
39
|
exports.requestWithdrawlSignature = requestWithdrawlSignature;
|
|
40
40
|
exports.submit7702Message = submit7702Message;
|
|
41
|
+
exports.getTreasuryBalances = getTreasuryBalances;
|
|
41
42
|
exports.PayoutsClient = __importStar(require("./payoutsServiceClient"));
|
|
42
43
|
const serviceClient_1 = require("../serviceClient");
|
|
43
44
|
const PAYOUTS_ENDPOINT = "/bridgebot";
|
|
@@ -74,3 +75,11 @@ async function submit7702Message(input) {
|
|
|
74
75
|
.post(`${PAYOUTS_ENDPOINT}/signers/7702`, input)
|
|
75
76
|
.then((res) => res.data);
|
|
76
77
|
}
|
|
78
|
+
// Served by bridgebot's Hono /api surface; reached through the same gateway
|
|
79
|
+
// host via the /v2/bridgebot base path (the bare /bridgebot base path maps to
|
|
80
|
+
// bridgebot's legacy REST API, which does not carry this route).
|
|
81
|
+
async function getTreasuryBalances() {
|
|
82
|
+
return serviceClient_1.baseClient
|
|
83
|
+
.get(`/v2${PAYOUTS_ENDPOINT}/api/treasury/balances`)
|
|
84
|
+
.then((res) => res.data);
|
|
85
|
+
}
|
package/lib/payouts/types.d.ts
CHANGED
|
@@ -32,3 +32,36 @@ export type CryptoPayout = {
|
|
|
32
32
|
createdAt: string;
|
|
33
33
|
updatedAt: string;
|
|
34
34
|
};
|
|
35
|
+
export type TreasuryWalletBalance = {
|
|
36
|
+
payoutType: "BRIDGE_TRANSFER" | "RAIN_CARD_DEPOSIT" | "ONRAMP_PURCHASE";
|
|
37
|
+
network: string;
|
|
38
|
+
address: string;
|
|
39
|
+
tokenSymbol: string;
|
|
40
|
+
currentBalanceUsd: string;
|
|
41
|
+
reservedUsd: string;
|
|
42
|
+
availableUsd: string;
|
|
43
|
+
floatTargetUsd: string;
|
|
44
|
+
errored: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type TreasuryQueueSummary = {
|
|
47
|
+
queuedUsd: string;
|
|
48
|
+
queuedCount: number;
|
|
49
|
+
processingUsd: string;
|
|
50
|
+
processingCount: number;
|
|
51
|
+
failedUsd: string;
|
|
52
|
+
failedCount: number;
|
|
53
|
+
totalOwedUsd: string;
|
|
54
|
+
totalOwedCount: number;
|
|
55
|
+
};
|
|
56
|
+
export type TreasuryBalances = {
|
|
57
|
+
asOf: string;
|
|
58
|
+
wallets: TreasuryWalletBalance[];
|
|
59
|
+
/** All undelivered payouts across payout types. */
|
|
60
|
+
queue: TreasuryQueueSummary;
|
|
61
|
+
/**
|
|
62
|
+
* Per-payout-type breakdown — consumers tracking one provider's wallet
|
|
63
|
+
* (e.g. the Rain dispatch float) must read their own type here, not the
|
|
64
|
+
* combined queue.
|
|
65
|
+
*/
|
|
66
|
+
queueByType: Partial<Record<TreasuryWalletBalance["payoutType"], TreasuryQueueSummary>>;
|
|
67
|
+
};
|
package/lib/platform/types.d.ts
CHANGED
|
@@ -67,6 +67,11 @@ export interface MTAccount {
|
|
|
67
67
|
name: string;
|
|
68
68
|
currency: string;
|
|
69
69
|
balances: MTAccountBalance[];
|
|
70
|
+
/**
|
|
71
|
+
* Outstanding liabilities-payout amount committed but not yet reflected in the
|
|
72
|
+
* available balance, as decimal dollars (e.g. "1234.56").
|
|
73
|
+
*/
|
|
74
|
+
liability: string;
|
|
70
75
|
}
|
|
71
76
|
export interface MTBalancesData {
|
|
72
77
|
accounts: MTAccount[];
|