@heliofi/withdraw-core 0.0.7-alpha.1781007397 → 0.0.8-alpha.1781276921
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.
- package/README.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/sdk/WithdrawalSDK.d.ts +3 -4
- package/dist/types/enums.d.ts +6 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/responses.d.ts +16 -6
- package/dist/withdraw-core.cjs +1 -1
- package/dist/withdraw-core.js +78 -78
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export type { WithdrawalJwtPayload } from './jwt';
|
|
|
3
3
|
export { decodeJwt, isQuoteExpired } from './jwt';
|
|
4
4
|
export type { ApiClientConfig } from './sdk';
|
|
5
5
|
export { WithdrawalSDK } from './sdk';
|
|
6
|
-
export type { BalanceResponse, BaseBlockchain, PolymarketWalletPreparedTransaction, PreparedTransaction, PrepareWithdrawalParams, QuoteResponse, QuoteSummary, RawPreparedTransaction, RoutesResponse, SlimCurrencyWithBlockchain, StatusResponse, SubmitResponse, SubmitWithdrawalParams, UpdateQuoteParams, UserOpPreparedTransaction, WithdrawalConfig, WithdrawalCustomerSwapRoute,
|
|
7
|
-
export { SignedTransactionKind, TERMINAL_STATES, WithdrawalErrorCode, WithdrawalState, } from './types';
|
|
6
|
+
export type { BalanceResponse, BaseBlockchain, PolymarketWalletPreparedTransaction, PreparedTransaction, PrepareWithdrawalParams, QuoteResponse, QuoteSummary, RawPreparedTransaction, RoutesResponse, SlimCurrencyWithBlockchain, StatusResponse, SubmitResponse, SubmitWithdrawalParams, UpdateQuoteParams, UserOpPreparedTransaction, WalletCurrencyBalance, WithdrawalConfig, WithdrawalCustomerSwapRoute, } from './types';
|
|
7
|
+
export { BroadcastAck, SignedTransactionKind, TERMINAL_STATES, WithdrawalErrorCode, WithdrawalState, } from './types';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { QuoteResponse } from '../types/prepared';
|
|
2
2
|
import type { PrepareWithdrawalParams, SubmitWithdrawalParams, UpdateQuoteParams } from '../types/requests';
|
|
3
|
-
import type { BalanceResponse, RoutesResponse, StatusResponse, SubmitResponse, WithdrawalConfig
|
|
3
|
+
import type { BalanceResponse, RoutesResponse, StatusResponse, SubmitResponse, WithdrawalConfig } from '../types/responses';
|
|
4
4
|
import { type ApiClientConfig } from './ApiClient';
|
|
5
5
|
export declare class WithdrawalSDK {
|
|
6
6
|
private readonly api;
|
|
7
7
|
constructor(config: ApiClientConfig);
|
|
8
8
|
getWithdrawalConfig(withdrawalConfigId: string, signal?: AbortSignal): Promise<WithdrawalConfig>;
|
|
9
9
|
getRoutes(withdrawalConfigId: string, signal?: AbortSignal): Promise<RoutesResponse>;
|
|
10
|
-
getBalance(withdrawalConfigId: string,
|
|
10
|
+
getBalance(withdrawalConfigId: string, walletAddress: string, signal?: AbortSignal): Promise<BalanceResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* Calls `POST /withdraw/:withdrawalConfigId/prepare`.
|
|
13
13
|
* `withdrawalConfigId` goes in the path; the remaining fields are the
|
|
@@ -27,6 +27,5 @@ export declare class WithdrawalSDK {
|
|
|
27
27
|
* `{ token, signedTx: { kind, signature } }`.
|
|
28
28
|
*/
|
|
29
29
|
submitWithdrawal(params: SubmitWithdrawalParams, signal?: AbortSignal): Promise<SubmitResponse>;
|
|
30
|
-
|
|
31
|
-
getWithdrawalDetail(withdrawalDetailId: string, signal?: AbortSignal): Promise<WithdrawalDetail>;
|
|
30
|
+
getWithdrawalDetail(withdrawalDetailId: string, signal?: AbortSignal): Promise<StatusResponse>;
|
|
32
31
|
}
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare enum WithdrawalState {
|
|
2
2
|
QUOTED = "QUOTED",
|
|
3
|
+
SUBMITTING = "SUBMITTING",
|
|
3
4
|
SUBMITTED = "SUBMITTED",
|
|
4
5
|
BRIDGING = "BRIDGING",
|
|
5
6
|
COMPLETED = "COMPLETED",
|
|
@@ -28,6 +29,11 @@ export declare enum WithdrawalErrorCode {
|
|
|
28
29
|
BALANCE_FETCH_FAILED = "BALANCE_FETCH_FAILED",
|
|
29
30
|
UNKNOWN = "UNKNOWN"
|
|
30
31
|
}
|
|
32
|
+
export declare enum BroadcastAck {
|
|
33
|
+
ACKNOWLEDGED = "acknowledged",
|
|
34
|
+
UNACKNOWLEDGED = "unacknowledged",
|
|
35
|
+
REJECTED = "rejected"
|
|
36
|
+
}
|
|
31
37
|
export declare enum SignedTransactionKind {
|
|
32
38
|
RAW = "raw",
|
|
33
39
|
USER_OP = "userop",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SignedTransactionKind, TERMINAL_STATES, WithdrawalErrorCode, WithdrawalState, } from './enums';
|
|
1
|
+
export { BroadcastAck, SignedTransactionKind, TERMINAL_STATES, WithdrawalErrorCode, WithdrawalState, } from './enums';
|
|
2
2
|
export type { PolymarketWalletPreparedTransaction, PreparedTransaction, QuoteResponse, QuoteSummary, RawPreparedTransaction, UserOpPreparedTransaction, } from './prepared';
|
|
3
3
|
export type { PrepareWithdrawalParams, SubmitWithdrawalParams, UpdateQuoteParams, } from './requests';
|
|
4
|
-
export type { BalanceResponse, BaseBlockchain, RoutesResponse, SlimCurrencyWithBlockchain, StatusResponse, SubmitResponse, WithdrawalConfig, WithdrawalCustomerSwapRoute,
|
|
4
|
+
export type { BalanceResponse, BaseBlockchain, RoutesResponse, SlimCurrencyWithBlockchain, StatusResponse, SubmitResponse, WalletCurrencyBalance, WithdrawalConfig, WithdrawalCustomerSwapRoute, } from './responses';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WithdrawalState } from './enums';
|
|
1
|
+
import type { BroadcastAck, WithdrawalState } from './enums';
|
|
2
2
|
export type WithdrawalConfig = unknown;
|
|
3
3
|
export interface BaseBlockchain {
|
|
4
4
|
id: string;
|
|
@@ -22,12 +22,22 @@ export interface WithdrawalCustomerSwapRoute {
|
|
|
22
22
|
export interface RoutesResponse {
|
|
23
23
|
routes: WithdrawalCustomerSwapRoute[];
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export interface WalletCurrencyBalance {
|
|
26
|
+
currencyId: string;
|
|
27
|
+
symbol: string;
|
|
28
|
+
mintAddress: string;
|
|
29
|
+
/** Minimal units. */
|
|
30
|
+
balance: string | null;
|
|
31
|
+
uiBalance: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface BalanceResponse {
|
|
34
|
+
balances: WalletCurrencyBalance[];
|
|
35
|
+
}
|
|
26
36
|
export type SubmitResponse = unknown;
|
|
27
37
|
export interface StatusResponse {
|
|
38
|
+
withdrawalDetailId: string;
|
|
28
39
|
state: WithdrawalState;
|
|
29
|
-
txHash
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
txHash: string | null;
|
|
41
|
+
broadcastAck: BroadcastAck | null;
|
|
42
|
+
errorReason: string | null;
|
|
32
43
|
}
|
|
33
|
-
export type WithdrawalDetail = unknown;
|
package/dist/withdraw-core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var W=Object.defineProperty;var u=(e,t,s)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var T=(e,t,s)=>u(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(e=>(e.QUOTED="QUOTED",e.SUBMITTING="SUBMITTING",e.SUBMITTED="SUBMITTED",e.BRIDGING="BRIDGING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.FAILED_EXPIRED="FAILED_EXPIRED",e.EXPIRED="EXPIRED",e.REFUNDED_BY_PROVIDER="REFUNDED_BY_PROVIDER",e))(r||{});const c=new Set(["COMPLETED","FAILED","FAILED_EXPIRED","EXPIRED","REFUNDED_BY_PROVIDER"]);var _=(e=>(e.WITHDRAW_TX_INVALID_SIGNATURE="WITHDRAW_TX_INVALID_SIGNATURE",e.WITHDRAW_TX_BLOCKHASH_EXPIRED="WITHDRAW_TX_BLOCKHASH_EXPIRED",e.WITHDRAW_TX_NONCE_TOO_LOW="WITHDRAW_TX_NONCE_TOO_LOW",e.WITHDRAW_TX_USEROP_EXPIRED="WITHDRAW_TX_USEROP_EXPIRED",e.WITHDRAW_TX_UNDERPRICED="WITHDRAW_TX_UNDERPRICED",e.WITHDRAW_BUNDLER_REJECTED="WITHDRAW_BUNDLER_REJECTED",e.WITHDRAW_TX_BROADCAST_TIMEOUT="WITHDRAW_TX_BROADCAST_TIMEOUT",e.WITHDRAW_TX_ALREADY_KNOWN="WITHDRAW_TX_ALREADY_KNOWN",e.WITHDRAW_QUOTE_EXPIRED="WITHDRAW_QUOTE_EXPIRED",e.WITHDRAW_SANCTIONS_BLOCKED="WITHDRAW_SANCTIONS_BLOCKED",e.WITHDRAW_NO_ROUTE="WITHDRAW_NO_ROUTE",e.WITHDRAW_NOT_FOUND="WITHDRAW_NOT_FOUND",e.WITHDRAW_INSUFFICIENT_BALANCE="WITHDRAW_INSUFFICIENT_BALANCE",e.WITHDRAW_DETAILS_NOT_UPDATABLE="WITHDRAW_DETAILS_NOT_UPDATABLE",e.INVALID_WALLET_ADDRESS="INVALID_WALLET_ADDRESS",e.BALANCE_FETCH_FAILED="BALANCE_FETCH_FAILED",e.UNKNOWN="UNKNOWN",e))(_||{}),A=(e=>(e.ACKNOWLEDGED="acknowledged",e.UNACKNOWLEDGED="unacknowledged",e.REJECTED="rejected",e))(A||{}),i=(e=>(e.RAW="raw",e.USER_OP="userop",e.POLYMARKET_WALLET="polymarket_wallet",e))(i||{});const O=new Set(Object.values(_));class R extends Error{constructor(s,E,D){super(D??E);T(this,"name","WithdrawalApiError");this.status=s,this.code=E,this.detail=D}}const n=e=>e&&O.has(e)?e:_.UNKNOWN,a=e=>{const t=e.split(".");if(t.length!==3)throw new Error("Invalid JWT: expected 3 parts");const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)},o=(e,t=5e3)=>{const{exp:s}=a(e);return s===void 0?!1:Date.now()>=s*1e3-t};class p{constructor(t){T(this,"baseUrl");T(this,"headers");T(this,"fetch");if(!t.publicApiKey)throw new Error("publicApiKey is required");this.baseUrl=t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl,this.headers={"Content-Type":"application/json",Authorization:`Bearer ${t.publicApiKey}`,...t.headers},this.fetch=t.fetch??globalThis.fetch.bind(globalThis)}async get(t,s){return this.request("GET",t,void 0,s)}async post(t,s,E){return this.request("POST",t,s,E)}async patch(t,s,E){return this.request("PATCH",t,s,E)}async request(t,s,E,D){const N=`${this.baseUrl}${s}`,I=await this.fetch(N,{method:t,headers:this.headers,body:E!==void 0?JSON.stringify(E):void 0,signal:D});if(!I.ok)throw await this.buildError(I);return await I.json()}async buildError(t){let s,E;try{const D=await t.json();s=D.message??void 0,E=D.errorCode??D.errorType??void 0}catch{s=t.statusText||void 0}return new R(t.status,n(E),s)}}class L{constructor(t){T(this,"api");this.api=new p(t)}async getWithdrawalConfig(t,s){return this.api.get(`/withdrawal-configs/${t}/public`,s)}async getRoutes(t,s){return this.api.get(`/withdraw/${t}/routes`,s)}async getBalance(t,s,E){return this.api.get(`/withdraw/${t}/balances?walletAddress=${encodeURIComponent(s)}`,E)}async prepare(t,s){const{withdrawalConfigId:E,...D}=t;return this.api.post(`/withdraw/${E}/prepare`,D,s)}async updateQuote(t,s,E){throw new Error("updateQuote is not yet supported by the backend. Create a new quote via prepare() instead.")}async submitWithdrawal(t,s){const{withdrawalDetailId:E,...D}=t;return this.api.post(`/withdraw/${E}/submit`,D,s)}async getWithdrawalDetail(t,s){return this.api.get(`/withdraw-details/${t}`,s)}}exports.BroadcastAck=A;exports.SignedTransactionKind=i;exports.TERMINAL_STATES=c;exports.WithdrawalApiError=R;exports.WithdrawalErrorCode=_;exports.WithdrawalSDK=L;exports.WithdrawalState=r;exports.decodeJwt=a;exports.isQuoteExpired=o;exports.toWithdrawalErrorCode=n;
|
package/dist/withdraw-core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
const
|
|
2
|
+
var n = (e, t, s) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var T = (e, t, s) => n(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
var r = /* @__PURE__ */ ((e) => (e.QUOTED = "QUOTED", e.SUBMITTING = "SUBMITTING", e.SUBMITTED = "SUBMITTED", e.BRIDGING = "BRIDGING", e.COMPLETED = "COMPLETED", e.FAILED = "FAILED", e.FAILED_EXPIRED = "FAILED_EXPIRED", e.EXPIRED = "EXPIRED", e.REFUNDED_BY_PROVIDER = "REFUNDED_BY_PROVIDER", e))(r || {});
|
|
5
|
+
const L = /* @__PURE__ */ new Set([
|
|
6
6
|
"COMPLETED",
|
|
7
7
|
"FAILED",
|
|
8
8
|
"FAILED_EXPIRED",
|
|
@@ -10,90 +10,92 @@ const p = /* @__PURE__ */ new Set([
|
|
|
10
10
|
"REFUNDED_BY_PROVIDER"
|
|
11
11
|
/* REFUNDED_BY_PROVIDER */
|
|
12
12
|
]);
|
|
13
|
-
var I = /* @__PURE__ */ ((
|
|
14
|
-
const
|
|
15
|
-
class
|
|
16
|
-
constructor(s, D,
|
|
17
|
-
super(
|
|
18
|
-
|
|
19
|
-
this.status = s, this.code = D, this.detail =
|
|
13
|
+
var I = /* @__PURE__ */ ((e) => (e.WITHDRAW_TX_INVALID_SIGNATURE = "WITHDRAW_TX_INVALID_SIGNATURE", e.WITHDRAW_TX_BLOCKHASH_EXPIRED = "WITHDRAW_TX_BLOCKHASH_EXPIRED", e.WITHDRAW_TX_NONCE_TOO_LOW = "WITHDRAW_TX_NONCE_TOO_LOW", e.WITHDRAW_TX_USEROP_EXPIRED = "WITHDRAW_TX_USEROP_EXPIRED", e.WITHDRAW_TX_UNDERPRICED = "WITHDRAW_TX_UNDERPRICED", e.WITHDRAW_BUNDLER_REJECTED = "WITHDRAW_BUNDLER_REJECTED", e.WITHDRAW_TX_BROADCAST_TIMEOUT = "WITHDRAW_TX_BROADCAST_TIMEOUT", e.WITHDRAW_TX_ALREADY_KNOWN = "WITHDRAW_TX_ALREADY_KNOWN", e.WITHDRAW_QUOTE_EXPIRED = "WITHDRAW_QUOTE_EXPIRED", e.WITHDRAW_SANCTIONS_BLOCKED = "WITHDRAW_SANCTIONS_BLOCKED", e.WITHDRAW_NO_ROUTE = "WITHDRAW_NO_ROUTE", e.WITHDRAW_NOT_FOUND = "WITHDRAW_NOT_FOUND", e.WITHDRAW_INSUFFICIENT_BALANCE = "WITHDRAW_INSUFFICIENT_BALANCE", e.WITHDRAW_DETAILS_NOT_UPDATABLE = "WITHDRAW_DETAILS_NOT_UPDATABLE", e.INVALID_WALLET_ADDRESS = "INVALID_WALLET_ADDRESS", e.BALANCE_FETCH_FAILED = "BALANCE_FETCH_FAILED", e.UNKNOWN = "UNKNOWN", e))(I || {}), i = /* @__PURE__ */ ((e) => (e.ACKNOWLEDGED = "acknowledged", e.UNACKNOWLEDGED = "unacknowledged", e.REJECTED = "rejected", e))(i || {}), N = /* @__PURE__ */ ((e) => (e.RAW = "raw", e.USER_OP = "userop", e.POLYMARKET_WALLET = "polymarket_wallet", e))(N || {});
|
|
14
|
+
const a = new Set(Object.values(I));
|
|
15
|
+
class O extends Error {
|
|
16
|
+
constructor(s, D, E) {
|
|
17
|
+
super(E ?? D);
|
|
18
|
+
T(this, "name", "WithdrawalApiError");
|
|
19
|
+
this.status = s, this.code = D, this.detail = E;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
22
|
+
const W = (e) => e && a.has(e) ? e : I.UNKNOWN, u = (e) => {
|
|
23
|
+
const t = e.split(".");
|
|
24
|
+
if (t.length !== 3)
|
|
25
25
|
throw new Error("Invalid JWT: expected 3 parts");
|
|
26
|
-
const s = atob(
|
|
26
|
+
const s = atob(t[1].replace(/-/g, "+").replace(/_/g, "/"));
|
|
27
27
|
return JSON.parse(s);
|
|
28
|
-
},
|
|
29
|
-
const { exp: s } =
|
|
30
|
-
return s === void 0 ? !1 : Date.now() >= s * 1e3 -
|
|
28
|
+
}, o = (e, t = 5e3) => {
|
|
29
|
+
const { exp: s } = u(e);
|
|
30
|
+
return s === void 0 ? !1 : Date.now() >= s * 1e3 - t;
|
|
31
31
|
};
|
|
32
|
-
class
|
|
33
|
-
constructor(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!
|
|
32
|
+
class c {
|
|
33
|
+
constructor(t) {
|
|
34
|
+
T(this, "baseUrl");
|
|
35
|
+
T(this, "headers");
|
|
36
|
+
T(this, "fetch");
|
|
37
|
+
if (!t.publicApiKey)
|
|
38
38
|
throw new Error("publicApiKey is required");
|
|
39
|
-
this.baseUrl =
|
|
39
|
+
this.baseUrl = t.baseUrl.endsWith("/") ? t.baseUrl.slice(0, -1) : t.baseUrl, this.headers = {
|
|
40
40
|
"Content-Type": "application/json",
|
|
41
|
-
Authorization: `Bearer ${
|
|
42
|
-
...
|
|
43
|
-
}, this.fetch =
|
|
41
|
+
Authorization: `Bearer ${t.publicApiKey}`,
|
|
42
|
+
...t.headers
|
|
43
|
+
}, this.fetch = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
44
44
|
}
|
|
45
|
-
async get(
|
|
46
|
-
return this.request("GET",
|
|
45
|
+
async get(t, s) {
|
|
46
|
+
return this.request("GET", t, void 0, s);
|
|
47
47
|
}
|
|
48
|
-
async post(
|
|
49
|
-
return this.request("POST",
|
|
48
|
+
async post(t, s, D) {
|
|
49
|
+
return this.request("POST", t, s, D);
|
|
50
50
|
}
|
|
51
|
-
async patch(
|
|
52
|
-
return this.request("PATCH",
|
|
51
|
+
async patch(t, s, D) {
|
|
52
|
+
return this.request("PATCH", t, s, D);
|
|
53
53
|
}
|
|
54
|
-
async request(
|
|
55
|
-
const A = `${this.baseUrl}${s}`,
|
|
56
|
-
method:
|
|
54
|
+
async request(t, s, D, E) {
|
|
55
|
+
const A = `${this.baseUrl}${s}`, _ = await this.fetch(A, {
|
|
56
|
+
method: t,
|
|
57
57
|
headers: this.headers,
|
|
58
58
|
body: D !== void 0 ? JSON.stringify(D) : void 0,
|
|
59
|
-
signal:
|
|
59
|
+
signal: E
|
|
60
60
|
});
|
|
61
|
-
if (!
|
|
62
|
-
throw await this.buildError(
|
|
63
|
-
return await
|
|
61
|
+
if (!_.ok)
|
|
62
|
+
throw await this.buildError(_);
|
|
63
|
+
return await _.json();
|
|
64
64
|
}
|
|
65
|
-
async buildError(
|
|
65
|
+
async buildError(t) {
|
|
66
66
|
let s, D;
|
|
67
67
|
try {
|
|
68
|
-
const
|
|
69
|
-
s =
|
|
68
|
+
const E = await t.json();
|
|
69
|
+
s = E.message ?? void 0, D = E.errorCode ?? E.errorType ?? void 0;
|
|
70
70
|
} catch {
|
|
71
|
-
s =
|
|
71
|
+
s = t.statusText || void 0;
|
|
72
72
|
}
|
|
73
|
-
return new
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
return new O(
|
|
74
|
+
t.status,
|
|
75
|
+
W(D),
|
|
76
76
|
s
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
class
|
|
81
|
-
constructor(
|
|
82
|
-
|
|
83
|
-
this.api = new
|
|
80
|
+
class U {
|
|
81
|
+
constructor(t) {
|
|
82
|
+
T(this, "api");
|
|
83
|
+
this.api = new c(t);
|
|
84
84
|
}
|
|
85
|
-
async getWithdrawalConfig(
|
|
85
|
+
async getWithdrawalConfig(t, s) {
|
|
86
86
|
return this.api.get(
|
|
87
|
-
`/withdrawal-configs/${
|
|
87
|
+
`/withdrawal-configs/${t}/public`,
|
|
88
88
|
s
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
async getRoutes(
|
|
92
|
-
return this.api.get(`/withdraw/${
|
|
91
|
+
async getRoutes(t, s) {
|
|
92
|
+
return this.api.get(`/withdraw/${t}/routes`, s);
|
|
93
93
|
}
|
|
94
|
-
async getBalance(
|
|
94
|
+
async getBalance(t, s, D) {
|
|
95
95
|
return this.api.get(
|
|
96
|
-
`/withdraw/${
|
|
96
|
+
`/withdraw/${t}/balances?walletAddress=${encodeURIComponent(
|
|
97
|
+
s
|
|
98
|
+
)}`,
|
|
97
99
|
D
|
|
98
100
|
);
|
|
99
101
|
}
|
|
@@ -102,11 +104,11 @@ class h {
|
|
|
102
104
|
* `withdrawalConfigId` goes in the path; the remaining fields are the
|
|
103
105
|
* request body matching the backend `PreparedWithdrawalDto`.
|
|
104
106
|
*/
|
|
105
|
-
async prepare(
|
|
106
|
-
const { withdrawalConfigId: D, ...
|
|
107
|
+
async prepare(t, s) {
|
|
108
|
+
const { withdrawalConfigId: D, ...E } = t;
|
|
107
109
|
return this.api.post(
|
|
108
110
|
`/withdraw/${D}/prepare`,
|
|
109
|
-
|
|
111
|
+
E,
|
|
110
112
|
s
|
|
111
113
|
);
|
|
112
114
|
}
|
|
@@ -117,7 +119,7 @@ class h {
|
|
|
117
119
|
* This stub is kept for forward compatibility. It will throw until
|
|
118
120
|
* the backend ships the handler.
|
|
119
121
|
*/
|
|
120
|
-
async updateQuote(
|
|
122
|
+
async updateQuote(t, s, D) {
|
|
121
123
|
throw new Error(
|
|
122
124
|
"updateQuote is not yet supported by the backend. Create a new quote via prepare() instead."
|
|
123
125
|
);
|
|
@@ -126,29 +128,27 @@ class h {
|
|
|
126
128
|
* Body matches the backend `SubmitWithdrawalDto`:
|
|
127
129
|
* `{ token, signedTx: { kind, signature } }`.
|
|
128
130
|
*/
|
|
129
|
-
async submitWithdrawal(
|
|
130
|
-
const { withdrawalDetailId: D, ...
|
|
131
|
+
async submitWithdrawal(t, s) {
|
|
132
|
+
const { withdrawalDetailId: D, ...E } = t;
|
|
131
133
|
return this.api.post(
|
|
132
134
|
`/withdraw/${D}/submit`,
|
|
133
|
-
|
|
135
|
+
E,
|
|
134
136
|
s
|
|
135
137
|
);
|
|
136
138
|
}
|
|
137
|
-
async
|
|
138
|
-
return this.api.get(`/withdraw/${
|
|
139
|
-
}
|
|
140
|
-
async getWithdrawalDetail(e, s) {
|
|
141
|
-
return this.api.get(`/withdraw/${e}`, s);
|
|
139
|
+
async getWithdrawalDetail(t, s) {
|
|
140
|
+
return this.api.get(`/withdraw-details/${t}`, s);
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
export {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
i as BroadcastAck,
|
|
145
|
+
N as SignedTransactionKind,
|
|
146
|
+
L as TERMINAL_STATES,
|
|
147
|
+
O as WithdrawalApiError,
|
|
148
148
|
I as WithdrawalErrorCode,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
U as WithdrawalSDK,
|
|
150
|
+
r as WithdrawalState,
|
|
151
|
+
u as decodeJwt,
|
|
152
|
+
o as isQuoteExpired,
|
|
153
|
+
W as toWithdrawalErrorCode
|
|
154
154
|
};
|