@binopartner/pay-sdk 0.1.1 → 0.3.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.
- package/README.md +145 -2
- package/dist/core/api-base.d.ts +49 -0
- package/dist/core/api-base.js +196 -0
- package/dist/core/appearance.d.ts +17 -0
- package/dist/core/appearance.js +122 -0
- package/dist/core/auth.d.ts +32 -0
- package/dist/core/auth.js +233 -0
- package/dist/core/client.d.ts +71 -0
- package/dist/core/client.js +307 -0
- package/dist/core/clock.d.ts +7 -0
- package/dist/core/clock.js +17 -0
- package/dist/core/errors.d.ts +29 -0
- package/dist/core/errors.js +87 -0
- package/dist/core/events.d.ts +50 -0
- package/dist/core/events.js +1 -0
- package/dist/core/flows/deposit.d.ts +63 -0
- package/dist/core/flows/deposit.js +502 -0
- package/dist/core/flows/withdraw.d.ts +51 -0
- package/dist/core/flows/withdraw.js +413 -0
- package/dist/core/i18n/ar.d.ts +2 -0
- package/dist/core/i18n/ar.js +314 -0
- package/dist/core/i18n/base.d.ts +14 -0
- package/dist/core/i18n/base.js +86 -0
- package/dist/core/i18n/cs.d.ts +2 -0
- package/dist/core/i18n/cs.js +314 -0
- package/dist/core/i18n/de.d.ts +2 -0
- package/dist/core/i18n/de.js +314 -0
- package/dist/core/i18n/en-ui.d.ts +39 -0
- package/dist/core/i18n/en-ui.js +39 -0
- package/dist/core/i18n/en.d.ts +316 -0
- package/dist/core/i18n/en.js +280 -0
- package/dist/core/i18n/es.d.ts +2 -0
- package/dist/core/i18n/es.js +314 -0
- package/dist/core/i18n/fr.d.ts +2 -0
- package/dist/core/i18n/fr.js +314 -0
- package/dist/core/i18n/hi.d.ts +2 -0
- package/dist/core/i18n/hi.js +314 -0
- package/dist/core/i18n/index.d.ts +16 -0
- package/dist/core/i18n/index.js +39 -0
- package/dist/core/i18n/it.d.ts +2 -0
- package/dist/core/i18n/it.js +314 -0
- package/dist/core/i18n/ru.d.ts +2 -0
- package/dist/core/i18n/ru.js +314 -0
- package/dist/core/i18n/tr.d.ts +2 -0
- package/dist/core/i18n/tr.js +314 -0
- package/dist/core/i18n/ua.d.ts +2 -0
- package/dist/core/i18n/ua.js +314 -0
- package/dist/core/index.d.ts +37 -0
- package/dist/core/index.js +19 -0
- package/dist/core/intent.d.ts +13 -0
- package/dist/core/intent.js +45 -0
- package/dist/core/money.d.ts +22 -0
- package/dist/core/money.js +178 -0
- package/dist/core/poll.d.ts +16 -0
- package/dist/core/poll.js +100 -0
- package/dist/core/requisites-frame.d.ts +32 -0
- package/dist/core/requisites-frame.js +202 -0
- package/dist/core/rules/address.d.ts +3 -0
- package/dist/core/rules/address.js +29 -0
- package/dist/core/rules/limits.d.ts +17 -0
- package/dist/core/rules/limits.js +19 -0
- package/dist/core/rules/paying.d.ts +10 -0
- package/dist/core/rules/paying.js +32 -0
- package/dist/core/rules/receipt.d.ts +6 -0
- package/dist/core/rules/receipt.js +33 -0
- package/dist/core/rules/requisites.d.ts +42 -0
- package/dist/core/rules/requisites.js +68 -0
- package/dist/core/rules/slippage.d.ts +1 -0
- package/dist/core/rules/slippage.js +7 -0
- package/dist/core/store.d.ts +15 -0
- package/dist/core/store.js +53 -0
- package/dist/core/types.d.ts +244 -0
- package/dist/core/types.js +1 -0
- package/dist/core/wire.d.ts +178 -0
- package/dist/core/wire.js +602 -0
- package/dist/elements/Root.d.ts +37 -0
- package/dist/elements/Root.js +143 -0
- package/dist/elements/chains.d.ts +1 -0
- package/dist/elements/chains.js +1 -0
- package/dist/elements/components/Qr.d.ts +17 -0
- package/dist/elements/components/Qr.js +28 -0
- package/dist/elements/components/basic.d.ts +42 -0
- package/dist/elements/components/basic.js +129 -0
- package/dist/elements/components/deposit.d.ts +61 -0
- package/dist/elements/components/deposit.js +272 -0
- package/dist/elements/components/inputs.d.ts +24 -0
- package/dist/elements/components/inputs.js +92 -0
- package/dist/elements/components/pickers.d.ts +32 -0
- package/dist/elements/components/pickers.js +267 -0
- package/dist/elements/components/status.d.ts +25 -0
- package/dist/elements/components/status.js +221 -0
- package/dist/elements/context.d.ts +47 -0
- package/dist/elements/context.js +33 -0
- package/dist/elements/hooks/deposit.d.ts +52 -0
- package/dist/elements/hooks/deposit.js +215 -0
- package/dist/elements/hooks/root.d.ts +70 -0
- package/dist/elements/hooks/root.js +125 -0
- package/dist/elements/hooks/withdraw.d.ts +30 -0
- package/dist/elements/hooks/withdraw.js +145 -0
- package/dist/elements/index.d.ts +28 -0
- package/dist/elements/index.js +14 -0
- package/dist/elements/part.d.ts +2 -0
- package/dist/elements/part.js +1 -0
- package/dist/elements/presets/DepositForm.d.ts +32 -0
- package/dist/elements/presets/DepositForm.js +97 -0
- package/dist/elements/presets/WithdrawForm.d.ts +25 -0
- package/dist/elements/presets/WithdrawForm.js +44 -0
- package/dist/elements/presets/focus.d.ts +2 -0
- package/dist/elements/presets/focus.js +26 -0
- package/dist/elements.css +2777 -0
- package/dist/fonts.css +31 -0
- package/dist/frame.d.ts +1 -0
- package/dist/frame.js +37 -6
- package/dist/types.d.ts +1 -0
- package/dist/ui/chains.d.ts +3 -0
- package/dist/ui/chains.js +42 -0
- package/dist/ui/context.d.ts +51 -0
- package/dist/ui/context.js +63 -0
- package/dist/ui/crypto.d.ts +67 -0
- package/dist/ui/crypto.js +68 -0
- package/dist/ui/entry.d.ts +25 -0
- package/dist/ui/entry.js +26 -0
- package/dist/ui/fiat.d.ts +94 -0
- package/dist/ui/fiat.js +149 -0
- package/dist/ui/fields.d.ts +76 -0
- package/dist/ui/fields.js +71 -0
- package/dist/ui/fonts.d.ts +4 -0
- package/dist/ui/fonts.js +31 -0
- package/dist/ui/icons.d.ts +39 -0
- package/dist/ui/icons.js +116 -0
- package/dist/ui/index.d.ts +31 -0
- package/dist/ui/index.js +17 -0
- package/dist/ui/layout.d.ts +36 -0
- package/dist/ui/layout.js +44 -0
- package/dist/ui/logos.d.ts +14 -0
- package/dist/ui/logos.js +61 -0
- package/dist/ui/part.d.ts +32 -0
- package/dist/ui/part.js +33 -0
- package/dist/ui/pickers.d.ts +71 -0
- package/dist/ui/pickers.js +167 -0
- package/dist/ui/qr-encode.d.ts +30 -0
- package/dist/ui/qr-encode.js +340 -0
- package/dist/ui/summary.d.ts +31 -0
- package/dist/ui/summary.js +36 -0
- package/dist/ui/types.d.ts +67 -0
- package/dist/ui/types.js +1 -0
- package/dist/ui/urls.d.ts +4 -0
- package/dist/ui/urls.js +41 -0
- package/dist/ui/withdraw.d.ts +38 -0
- package/dist/ui/withdraw.js +30 -0
- package/dist/ui.css +2699 -0
- package/dist/widget-url.d.ts +1 -0
- package/dist/widget-url.js +16 -0
- package/package.json +46 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const createStore = (initial) => {
|
|
2
|
+
let state = initial;
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
const notify = () => {
|
|
5
|
+
listeners.forEach((listener) => listener());
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
getSnapshot: () => state,
|
|
9
|
+
subscribe: (listener) => {
|
|
10
|
+
listeners.add(listener);
|
|
11
|
+
return () => {
|
|
12
|
+
listeners.delete(listener);
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
set: (next) => {
|
|
16
|
+
const patch = typeof next === "function" ? next(state) : next;
|
|
17
|
+
const keys = Object.keys(patch);
|
|
18
|
+
if (keys.every((key) => Object.is(state[key], patch[key])))
|
|
19
|
+
return;
|
|
20
|
+
state = { ...state, ...patch };
|
|
21
|
+
notify();
|
|
22
|
+
},
|
|
23
|
+
replace: (next) => {
|
|
24
|
+
if (Object.is(state, next))
|
|
25
|
+
return;
|
|
26
|
+
state = next;
|
|
27
|
+
notify();
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const createEmitter = () => {
|
|
32
|
+
const listeners = new Set();
|
|
33
|
+
return {
|
|
34
|
+
emit: (event) => {
|
|
35
|
+
listeners.forEach((listener) => {
|
|
36
|
+
try {
|
|
37
|
+
listener(event);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
throw error;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
subscribe: (listener) => {
|
|
47
|
+
listeners.add(listener);
|
|
48
|
+
return () => {
|
|
49
|
+
listeners.delete(listener);
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import type { CreateSession, PayMode, PayTheme } from "../types.js";
|
|
2
|
+
export type { CreateSession, CreateSessionContext, PayMode, PayTheme } from "../types.js";
|
|
3
|
+
export type PayRegion = "ru" | "global" | "unknown";
|
|
4
|
+
export type FiatRail = "ru" | "kz" | "ua" | "in";
|
|
5
|
+
export interface Balance {
|
|
6
|
+
available: string | null;
|
|
7
|
+
held: string | null;
|
|
8
|
+
total: string | null;
|
|
9
|
+
withdrawable: string | null;
|
|
10
|
+
currency: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Branding {
|
|
13
|
+
theme: PayTheme | null;
|
|
14
|
+
accentColor: string | null;
|
|
15
|
+
backgroundColor: string | null;
|
|
16
|
+
logoUrl: string | null;
|
|
17
|
+
}
|
|
18
|
+
export type RequisitesDelivery = "raw" | "frame";
|
|
19
|
+
export interface PayContext {
|
|
20
|
+
mode: PayMode;
|
|
21
|
+
serverTime: number;
|
|
22
|
+
tokenExpiresAt: number | null;
|
|
23
|
+
balance: Balance;
|
|
24
|
+
withdrawal: {
|
|
25
|
+
twoFactorRequired: boolean;
|
|
26
|
+
inFlightId: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
requisitesDelivery: RequisitesDelivery;
|
|
29
|
+
branding: Branding;
|
|
30
|
+
}
|
|
31
|
+
export interface CryptoWithdrawalLimits {
|
|
32
|
+
minUsd: string;
|
|
33
|
+
minNative: string | null;
|
|
34
|
+
maxNative: string | null;
|
|
35
|
+
feeUsd: string;
|
|
36
|
+
etaSeconds: number | null;
|
|
37
|
+
maxSlippagePct: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface CryptoMethod {
|
|
40
|
+
id: string;
|
|
41
|
+
kind: "crypto";
|
|
42
|
+
chainId: string;
|
|
43
|
+
currency: string;
|
|
44
|
+
minUsd: string | null;
|
|
45
|
+
maxUsd: string | null;
|
|
46
|
+
minNative: string | null;
|
|
47
|
+
maxNative: string | null;
|
|
48
|
+
feeUsd: string | null;
|
|
49
|
+
etaSeconds: number | null;
|
|
50
|
+
available: boolean;
|
|
51
|
+
withdrawal: CryptoWithdrawalLimits | null;
|
|
52
|
+
}
|
|
53
|
+
export type FiatDelivery = "requisites" | "redirect" | "qr";
|
|
54
|
+
export interface FiatMethod {
|
|
55
|
+
id: string;
|
|
56
|
+
kind: "fiat";
|
|
57
|
+
rail: FiatRail;
|
|
58
|
+
methodId: string;
|
|
59
|
+
label: string | null;
|
|
60
|
+
subtitle: string | null;
|
|
61
|
+
currency: string;
|
|
62
|
+
minAmount: string | null;
|
|
63
|
+
maxAmount: string | null;
|
|
64
|
+
displayedCommissionPct: string | null;
|
|
65
|
+
requiresReceipt: boolean;
|
|
66
|
+
isDefault: boolean;
|
|
67
|
+
delivery: FiatDelivery;
|
|
68
|
+
}
|
|
69
|
+
export interface OnrampMethod {
|
|
70
|
+
id: string;
|
|
71
|
+
kind: "onramp";
|
|
72
|
+
delivery: "embed";
|
|
73
|
+
}
|
|
74
|
+
export type PayMethod = CryptoMethod | FiatMethod | OnrampMethod;
|
|
75
|
+
export interface PayMethods {
|
|
76
|
+
mode: PayMode;
|
|
77
|
+
suggestedCountry: string | null;
|
|
78
|
+
methods: PayMethod[];
|
|
79
|
+
ordering: {
|
|
80
|
+
currencies: string[];
|
|
81
|
+
chains: string[];
|
|
82
|
+
};
|
|
83
|
+
unavailableRails: string[];
|
|
84
|
+
maxWithdrawUsd: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface DepositQuote {
|
|
87
|
+
methodId: string;
|
|
88
|
+
amount: string;
|
|
89
|
+
currency: string;
|
|
90
|
+
estimatedUsd: string | null;
|
|
91
|
+
displayedCommissionPct: string | null;
|
|
92
|
+
minAmount: string | null;
|
|
93
|
+
maxAmount: string | null;
|
|
94
|
+
}
|
|
95
|
+
export type CryptoDepositStatus = "active" | "expired" | "consumed" | "closed";
|
|
96
|
+
export interface CryptoDeposit {
|
|
97
|
+
id: string;
|
|
98
|
+
kind: "crypto";
|
|
99
|
+
chainId: string;
|
|
100
|
+
currency: string;
|
|
101
|
+
address: string;
|
|
102
|
+
status: CryptoDepositStatus;
|
|
103
|
+
expiresAt: number | null;
|
|
104
|
+
createdAt: number;
|
|
105
|
+
}
|
|
106
|
+
export type FiatDepositStatus = "pending" | "completed" | "failed" | "expired" | "disputed";
|
|
107
|
+
export interface Requisites {
|
|
108
|
+
kind: string;
|
|
109
|
+
value: string;
|
|
110
|
+
amount: string;
|
|
111
|
+
recipientName: string | null;
|
|
112
|
+
bank: string | null;
|
|
113
|
+
country: string | null;
|
|
114
|
+
}
|
|
115
|
+
export interface RequisitesFrameRef {
|
|
116
|
+
origins: string[];
|
|
117
|
+
path: string;
|
|
118
|
+
}
|
|
119
|
+
export type NextAction = {
|
|
120
|
+
type: "show_requisites";
|
|
121
|
+
requisites: Requisites | null;
|
|
122
|
+
frame: RequisitesFrameRef | null;
|
|
123
|
+
} | {
|
|
124
|
+
type: "redirect";
|
|
125
|
+
url: string;
|
|
126
|
+
} | {
|
|
127
|
+
type: "qr";
|
|
128
|
+
payload: string | null;
|
|
129
|
+
imageUrl: string | null;
|
|
130
|
+
};
|
|
131
|
+
export interface FiatDeposit {
|
|
132
|
+
id: string;
|
|
133
|
+
kind: "fiat";
|
|
134
|
+
rail: FiatRail;
|
|
135
|
+
methodId: string;
|
|
136
|
+
status: FiatDepositStatus;
|
|
137
|
+
amount: string | null;
|
|
138
|
+
currency: string;
|
|
139
|
+
estimatedUsd: string | null;
|
|
140
|
+
creditedUsd: string | null;
|
|
141
|
+
expiresAt: number | null;
|
|
142
|
+
serverTime: number | null;
|
|
143
|
+
nextAction: NextAction | null | undefined;
|
|
144
|
+
receipt: {
|
|
145
|
+
required: boolean;
|
|
146
|
+
attachedAt: number | null;
|
|
147
|
+
};
|
|
148
|
+
createdAt: number | null;
|
|
149
|
+
updatedAt: number | null;
|
|
150
|
+
}
|
|
151
|
+
export type Deposit = CryptoDeposit | FiatDeposit;
|
|
152
|
+
export interface WithdrawalQuote {
|
|
153
|
+
feeUsd: string | null;
|
|
154
|
+
receiveAmount: string | null;
|
|
155
|
+
receiveAmountUsd: string | null;
|
|
156
|
+
etaSeconds: number | null;
|
|
157
|
+
slippagePct: string | null;
|
|
158
|
+
}
|
|
159
|
+
export interface SlippageWarning {
|
|
160
|
+
slippagePct: string | null;
|
|
161
|
+
maxAllowedPct: string | null;
|
|
162
|
+
receiveAmount: string | null;
|
|
163
|
+
receiveAmountUsd: string | null;
|
|
164
|
+
}
|
|
165
|
+
export type WithdrawalQuoteResult = {
|
|
166
|
+
quote: WithdrawalQuote;
|
|
167
|
+
slippageWarning: null;
|
|
168
|
+
} | {
|
|
169
|
+
quote: null;
|
|
170
|
+
slippageWarning: SlippageWarning;
|
|
171
|
+
};
|
|
172
|
+
export type WithdrawalStatus = "pending" | "processing" | "completed" | "failed" | "cancelled" | "refund_pending" | "refunded";
|
|
173
|
+
export type DisplayStatus = "pending" | "success" | "failed";
|
|
174
|
+
export interface Withdrawal {
|
|
175
|
+
id: string;
|
|
176
|
+
paymentId: number | null;
|
|
177
|
+
status: WithdrawalStatus;
|
|
178
|
+
displayStatus: DisplayStatus;
|
|
179
|
+
amountUsd: string | null;
|
|
180
|
+
feeUsd: string | null;
|
|
181
|
+
receiveAmount: string | null;
|
|
182
|
+
receiveAmountUsd: string | null;
|
|
183
|
+
chainId: string | null;
|
|
184
|
+
currency: string | null;
|
|
185
|
+
address: string | null;
|
|
186
|
+
destinationTxHash: string | null;
|
|
187
|
+
etaSeconds: number | null;
|
|
188
|
+
createdAt: number;
|
|
189
|
+
updatedAt: number;
|
|
190
|
+
}
|
|
191
|
+
export type DepositSource = "crypto" | "card" | "onramp" | "other";
|
|
192
|
+
export interface CreditedDeposit {
|
|
193
|
+
paymentId: number;
|
|
194
|
+
amountUsd: string | null;
|
|
195
|
+
source: DepositSource;
|
|
196
|
+
creditedAt: number;
|
|
197
|
+
}
|
|
198
|
+
export interface WithdrawalActivity {
|
|
199
|
+
paymentId: number;
|
|
200
|
+
id: string;
|
|
201
|
+
status: WithdrawalStatus;
|
|
202
|
+
updatedAt: number;
|
|
203
|
+
}
|
|
204
|
+
export interface PayActivity {
|
|
205
|
+
serverTime: number;
|
|
206
|
+
deposits: CreditedDeposit[];
|
|
207
|
+
withdrawals: WithdrawalActivity[];
|
|
208
|
+
}
|
|
209
|
+
export interface CreateDepositInput {
|
|
210
|
+
methodId: string;
|
|
211
|
+
amount: string;
|
|
212
|
+
customerPhone?: string;
|
|
213
|
+
returnUrl?: string;
|
|
214
|
+
}
|
|
215
|
+
export interface QuoteWithdrawalInput {
|
|
216
|
+
methodId: string;
|
|
217
|
+
address: string;
|
|
218
|
+
amount: string;
|
|
219
|
+
acceptSlippagePct?: number;
|
|
220
|
+
}
|
|
221
|
+
export interface CreateWithdrawalInput extends QuoteWithdrawalInput {
|
|
222
|
+
quote?: WithdrawalQuote;
|
|
223
|
+
twoFactorCode?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface FrameTicket {
|
|
226
|
+
ticket: string;
|
|
227
|
+
expiresIn: number;
|
|
228
|
+
expiresAt: number | null;
|
|
229
|
+
frameOrigins: string[];
|
|
230
|
+
framePath: string | null;
|
|
231
|
+
}
|
|
232
|
+
export interface PaySession {
|
|
233
|
+
session: string;
|
|
234
|
+
expiresIn: number | null;
|
|
235
|
+
apiBases: string[];
|
|
236
|
+
widgetOrigins: string[];
|
|
237
|
+
region: PayRegion | null;
|
|
238
|
+
payApi: boolean | null;
|
|
239
|
+
clientId: string | null;
|
|
240
|
+
}
|
|
241
|
+
export interface SessionSourceOptions {
|
|
242
|
+
sessionEndpoint?: string;
|
|
243
|
+
createSession?: CreateSession;
|
|
244
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { AppearanceSkin } from "./appearance.js";
|
|
2
|
+
import { PayError } from "./errors.js";
|
|
3
|
+
import type { CreateDepositInput, CreateWithdrawalInput, CryptoDeposit, Deposit, DepositQuote, FiatDeposit, FrameTicket, PayActivity, PayContext, PayMethods, PayMode, PayRegion, PayTheme, QuoteWithdrawalInput, Withdrawal, WithdrawalQuoteResult } from "./types.js";
|
|
4
|
+
export declare const PATHS: {
|
|
5
|
+
readonly redeem: "/broker/widget-sessions/redeem";
|
|
6
|
+
readonly ping: "/broker/pay/ping";
|
|
7
|
+
readonly context: "/broker/pay/context";
|
|
8
|
+
readonly methods: "/broker/pay/methods";
|
|
9
|
+
readonly depositQuote: "/broker/pay/deposits/quote";
|
|
10
|
+
readonly cryptoDeposit: "/broker/pay/deposits/crypto";
|
|
11
|
+
readonly deposits: "/broker/pay/deposits";
|
|
12
|
+
readonly deposit: (id: string) => string;
|
|
13
|
+
readonly receipt: (id: string) => string;
|
|
14
|
+
readonly frameTicket: (id: string) => string;
|
|
15
|
+
readonly onramp: "/broker/pay/onramp/session";
|
|
16
|
+
readonly withdrawalQuote: "/broker/pay/withdrawals/quote";
|
|
17
|
+
readonly withdrawals: "/broker/pay/withdrawals";
|
|
18
|
+
readonly withdrawal: (id: string) => string;
|
|
19
|
+
readonly activity: "/broker/pay/activity";
|
|
20
|
+
};
|
|
21
|
+
export declare const IDEMPOTENCY_HEADER = "Idempotency-Key";
|
|
22
|
+
export declare const REQUISITES_FRAME_PATH = "/embed/pay/requisites";
|
|
23
|
+
export declare const safeFramePath: (value: unknown) => string;
|
|
24
|
+
export interface WireSessionResponse {
|
|
25
|
+
session: string;
|
|
26
|
+
expires_in?: number;
|
|
27
|
+
widget_url?: string | null;
|
|
28
|
+
widget_origin?: string | null;
|
|
29
|
+
widget_origins?: string[];
|
|
30
|
+
region?: string;
|
|
31
|
+
geo?: string;
|
|
32
|
+
api_base?: string | null;
|
|
33
|
+
api_bases?: string[];
|
|
34
|
+
pay_api?: boolean;
|
|
35
|
+
client_id?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface WireRedeemRequest {
|
|
38
|
+
session: string;
|
|
39
|
+
origin: string;
|
|
40
|
+
client_id: string;
|
|
41
|
+
mode: PayMode;
|
|
42
|
+
}
|
|
43
|
+
export interface WireRedeemResponse {
|
|
44
|
+
access_token: string;
|
|
45
|
+
token_type?: string;
|
|
46
|
+
expires_in?: number;
|
|
47
|
+
expires_at?: number;
|
|
48
|
+
pay_api?: boolean;
|
|
49
|
+
api_base?: string;
|
|
50
|
+
api_bases?: string[];
|
|
51
|
+
widget_origins?: string[];
|
|
52
|
+
region?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface WirePing {
|
|
55
|
+
ok: true;
|
|
56
|
+
server_time: number;
|
|
57
|
+
}
|
|
58
|
+
export interface WireErrorEnvelope {
|
|
59
|
+
error: {
|
|
60
|
+
message: string;
|
|
61
|
+
details?: {
|
|
62
|
+
code?: string;
|
|
63
|
+
field?: string;
|
|
64
|
+
min?: string | number;
|
|
65
|
+
max?: string | number;
|
|
66
|
+
currency?: string;
|
|
67
|
+
retry_after_seconds?: number;
|
|
68
|
+
withdrawal_id?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export declare const FRAME_TICKET_PREFIX = "wft_";
|
|
73
|
+
export interface WireCreateDepositBody {
|
|
74
|
+
method_id: string;
|
|
75
|
+
amount: string;
|
|
76
|
+
customer_phone?: string;
|
|
77
|
+
return_url?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface WireQuoteWithdrawalBody {
|
|
80
|
+
method_id: string;
|
|
81
|
+
address: string;
|
|
82
|
+
amount: string;
|
|
83
|
+
accept_slippage_pct?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface WireCreateWithdrawalBody extends WireQuoteWithdrawalBody {
|
|
86
|
+
quote?: {
|
|
87
|
+
fee_usd: string | null;
|
|
88
|
+
receive_amount: string | null;
|
|
89
|
+
receive_amount_usd: string | null;
|
|
90
|
+
eta_seconds: number | null;
|
|
91
|
+
slippage_pct: string | null;
|
|
92
|
+
};
|
|
93
|
+
two_factor_code?: string;
|
|
94
|
+
}
|
|
95
|
+
export declare const readSessionExtras: (data: WireSessionResponse) => {
|
|
96
|
+
apiBases: string[];
|
|
97
|
+
widgetOrigins: string[];
|
|
98
|
+
widgetUrl: string | null;
|
|
99
|
+
region: PayRegion | null;
|
|
100
|
+
payApi: boolean | null;
|
|
101
|
+
clientId: string | null;
|
|
102
|
+
};
|
|
103
|
+
export declare const toRedeemBody: (input: {
|
|
104
|
+
session: string;
|
|
105
|
+
origin: string;
|
|
106
|
+
clientId: string;
|
|
107
|
+
mode: PayMode;
|
|
108
|
+
}) => WireRedeemRequest;
|
|
109
|
+
export declare const readRedeem: (value: unknown) => {
|
|
110
|
+
accessToken: string;
|
|
111
|
+
expiresIn: number | null;
|
|
112
|
+
expiresAt: number | null;
|
|
113
|
+
payApi: boolean | null;
|
|
114
|
+
};
|
|
115
|
+
export declare const readPing: (value: unknown) => {
|
|
116
|
+
serverTime: number | null;
|
|
117
|
+
};
|
|
118
|
+
export declare const readError: (status: number, value: unknown) => PayError;
|
|
119
|
+
export declare const readContext: (value: unknown) => PayContext;
|
|
120
|
+
export declare const readMethods: (value: unknown) => PayMethods;
|
|
121
|
+
export declare const toDepositQuoteQuery: (input: {
|
|
122
|
+
methodId: string;
|
|
123
|
+
amount: string;
|
|
124
|
+
}) => Record<string, string>;
|
|
125
|
+
export declare const readDepositQuote: (value: unknown) => DepositQuote;
|
|
126
|
+
export declare const toCryptoDepositBody: (input: {
|
|
127
|
+
chainId: string;
|
|
128
|
+
currency: string;
|
|
129
|
+
}) => {
|
|
130
|
+
chain_id: string;
|
|
131
|
+
currency: string;
|
|
132
|
+
};
|
|
133
|
+
export declare const readCryptoDepositResponse: (value: unknown) => CryptoDeposit;
|
|
134
|
+
export declare const readFiatDepositResponse: (value: unknown) => FiatDeposit;
|
|
135
|
+
export declare const readDeposit: (value: unknown) => Deposit;
|
|
136
|
+
export declare const toCreateDepositBody: (input: CreateDepositInput) => WireCreateDepositBody;
|
|
137
|
+
export declare const toReceiptBody: (dataUrl: string) => {
|
|
138
|
+
file_base64: string;
|
|
139
|
+
};
|
|
140
|
+
export declare const readFrameTicket: (value: unknown) => FrameTicket;
|
|
141
|
+
export declare const toOnrampQuery: (input: {
|
|
142
|
+
theme?: PayTheme;
|
|
143
|
+
}) => Record<string, string>;
|
|
144
|
+
export declare const readOnramp: (value: unknown) => {
|
|
145
|
+
url: string;
|
|
146
|
+
};
|
|
147
|
+
export declare const toQuoteWithdrawalBody: (input: QuoteWithdrawalInput) => WireQuoteWithdrawalBody;
|
|
148
|
+
export declare const toCreateWithdrawalBody: (input: CreateWithdrawalInput) => WireCreateWithdrawalBody;
|
|
149
|
+
export declare const readWithdrawalQuote: (value: unknown) => WithdrawalQuoteResult;
|
|
150
|
+
export declare const readWithdrawal: (value: unknown) => Withdrawal;
|
|
151
|
+
export declare const toActivityQuery: (since: number) => Record<string, string>;
|
|
152
|
+
export declare const readActivity: (value: unknown) => PayActivity;
|
|
153
|
+
export declare const REQUISITES_FRAME_MESSAGES: {
|
|
154
|
+
readonly ready: "binodex-embed:ready";
|
|
155
|
+
readonly resize: "binodex-embed:resize";
|
|
156
|
+
readonly receiptAttached: "binodex-embed:receipt-attached";
|
|
157
|
+
readonly error: "binodex-embed:error";
|
|
158
|
+
readonly init: "binodex-embed:requisites-init";
|
|
159
|
+
};
|
|
160
|
+
export declare const requisitesInitMessage: (input: {
|
|
161
|
+
ticket: string;
|
|
162
|
+
depositId: string;
|
|
163
|
+
channel: string;
|
|
164
|
+
}) => {
|
|
165
|
+
type: string;
|
|
166
|
+
ticket: string;
|
|
167
|
+
deposit_id: string;
|
|
168
|
+
channel: string;
|
|
169
|
+
};
|
|
170
|
+
export declare const requisitesFrameUrl: (input: {
|
|
171
|
+
origin: string;
|
|
172
|
+
path?: string;
|
|
173
|
+
depositId: string;
|
|
174
|
+
channel: string;
|
|
175
|
+
lang?: string;
|
|
176
|
+
theme?: PayTheme;
|
|
177
|
+
skin?: AppearanceSkin;
|
|
178
|
+
}) => string;
|