@coinlist-co/react 0.10.0 → 0.11.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 +32 -0
- package/dist/{chunk-GSSAB4K5.js → chunk-B2HCVPCQ.js} +225 -247
- package/dist/chunk-B2HCVPCQ.js.map +1 -0
- package/dist/chunk-KDGNDAHA.js +146 -0
- package/dist/chunk-KDGNDAHA.js.map +1 -0
- package/dist/chunk-UIIXXLA7.js +1863 -0
- package/dist/chunk-UIIXXLA7.js.map +1 -0
- package/dist/client/index.cjs +10559 -3442
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +4219 -862
- package/dist/client/index.d.ts +4219 -862
- package/dist/client/index.js +8729 -2370
- package/dist/client/index.js.map +1 -1
- package/dist/collections-BhDkYmzV.d.cts +65 -0
- package/dist/collections-CZhHoQHr.d.ts +65 -0
- package/dist/config-B5mwS_2l.d.cts +1926 -0
- package/dist/config-B5mwS_2l.d.ts +1926 -0
- package/dist/server/index.cjs +981 -464
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +190 -163
- package/dist/server/index.d.ts +190 -163
- package/dist/server/index.js +151 -156
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +1810 -907
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +243 -132
- package/dist/shared/index.d.ts +243 -132
- package/dist/shared/index.js +102 -114
- package/dist/shared/index.js.map +1 -1
- package/package.json +10 -7
- package/dist/chunk-7BJ2HAG7.js +0 -442
- package/dist/chunk-7BJ2HAG7.js.map +0 -1
- package/dist/chunk-AAER5LOL.js +0 -22
- package/dist/chunk-AAER5LOL.js.map +0 -1
- package/dist/chunk-GSSAB4K5.js.map +0 -1
- package/dist/chunk-TUZKKFNW.js +0 -836
- package/dist/chunk-TUZKKFNW.js.map +0 -1
- package/dist/collections-CJ24dOda.d.cts +0 -28
- package/dist/collections-ZYLKp8JB.d.ts +0 -28
- package/dist/requirement-CDi5NJI8.d.cts +0 -1036
- package/dist/requirement-CDi5NJI8.d.ts +0 -1036
|
@@ -1,1036 +0,0 @@
|
|
|
1
|
-
import { Hex } from 'viem';
|
|
2
|
-
|
|
3
|
-
declare const __brand: unique symbol;
|
|
4
|
-
type Newtype<Base, Branding> = Base & {
|
|
5
|
-
readonly [__brand]: Branding;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
type EthereumChain = 'ethereum_mainnet' | 'ethereum_sepolia';
|
|
9
|
-
/**
|
|
10
|
-
* Protocol a wallet binding is scoped to. EVM-only for now: an EVM address
|
|
11
|
-
* binds once per option regardless of which EVM chain proved ownership.
|
|
12
|
-
* Frontline's enum also has `:solana`, but we don't handle Solana bindings yet,
|
|
13
|
-
* so this stays `'ethereum'` until Solana support lands.
|
|
14
|
-
*/
|
|
15
|
-
type WalletProtocol = 'ethereum';
|
|
16
|
-
/**
|
|
17
|
-
* EVM addresses keep a `0x${string}` base so they stay assignable to the
|
|
18
|
-
* `0x${string}` shapes that on-chain libraries (viem/wagmi) expect. We only
|
|
19
|
-
* drop the runtime `0x` narrowing: values are trusted at the boundary and
|
|
20
|
-
* branded via the constructor.
|
|
21
|
-
*/
|
|
22
|
-
type EvmWalletAddress = Newtype<`0x${string}`, 'EvmWalletAddress'>;
|
|
23
|
-
declare const EvmWalletAddress: (value: string) => EvmWalletAddress;
|
|
24
|
-
type EvmContractAddress = Newtype<`0x${string}`, 'EvmContractAddress'>;
|
|
25
|
-
declare const EvmContractAddress: (value: string) => EvmContractAddress;
|
|
26
|
-
type HexEncodedTransactionData = Newtype<`0x${string}`, 'HexEncodedTransactionData'>;
|
|
27
|
-
declare const HexEncodedTransactionData: (value: string) => HexEncodedTransactionData;
|
|
28
|
-
type AssetDecimals = Newtype<number, 'AssetDecimals'>;
|
|
29
|
-
declare const AssetDecimals: (value: number) => AssetDecimals;
|
|
30
|
-
declare const MAX_UINT_256: bigint;
|
|
31
|
-
/**
|
|
32
|
-
* A non-negative integer within uint256 bounds. Kept unbranded (a plain
|
|
33
|
-
* `bigint`) so raw on-chain amounts flow in without ceremony; bounds are
|
|
34
|
-
* enforced where it matters (see {@link combineAmounts}).
|
|
35
|
-
*/
|
|
36
|
-
type Uint256 = bigint;
|
|
37
|
-
/**
|
|
38
|
-
* Asserts a raw bigint falls within uint256 bounds, throwing otherwise. Use at
|
|
39
|
-
* on-chain arithmetic boundaries (bps math, price computation) where a computed
|
|
40
|
-
* value could underflow below zero or overflow above 2^256-1.
|
|
41
|
-
*/
|
|
42
|
-
declare const assertUint256: (value: bigint) => Uint256;
|
|
43
|
-
type BlockchainAmount = Newtype<{
|
|
44
|
-
raw: Uint256;
|
|
45
|
-
decimals: AssetDecimals;
|
|
46
|
-
}, 'BlockchainAmount'>;
|
|
47
|
-
/**
|
|
48
|
-
* Constructs a {@link BlockchainAmount} and exposes arithmetic helpers.
|
|
49
|
-
* TypeScript has no operator overloading, so use `BlockchainAmount.add(a, b)`
|
|
50
|
-
* instead of `+`/`-` on the objects directly.
|
|
51
|
-
*/
|
|
52
|
-
declare const BlockchainAmount: ((value: {
|
|
53
|
-
raw: Uint256;
|
|
54
|
-
decimals: AssetDecimals;
|
|
55
|
-
}) => BlockchainAmount) & {
|
|
56
|
-
add: (a: BlockchainAmount, b: BlockchainAmount) => BlockchainAmount;
|
|
57
|
-
sub: (a: BlockchainAmount, b: BlockchainAmount) => BlockchainAmount;
|
|
58
|
-
};
|
|
59
|
-
type AssetSymbol = Newtype<string, 'AssetSymbol'>;
|
|
60
|
-
declare const AssetSymbol: (value: string) => AssetSymbol;
|
|
61
|
-
/**
|
|
62
|
-
* A stablecoin symbol is an {@link AssetSymbol} narrowed to the coins we
|
|
63
|
-
* support. It shares the `AssetSymbol` brand so it stays assignable to it.
|
|
64
|
-
*/
|
|
65
|
-
type StablecoinSymbol = Newtype<'USDC' | 'USDT', 'AssetSymbol'>;
|
|
66
|
-
declare const StablecoinSymbol: (value: "USDC" | "USDT") => StablecoinSymbol;
|
|
67
|
-
type KnownAssetSymbol = StablecoinSymbol;
|
|
68
|
-
declare const KnownAssetSymbol: (value: "USDC" | "USDT") => StablecoinSymbol;
|
|
69
|
-
type Erc20Asset = {
|
|
70
|
-
name: string;
|
|
71
|
-
symbol: AssetSymbol;
|
|
72
|
-
decimals: AssetDecimals;
|
|
73
|
-
};
|
|
74
|
-
type Bps = Newtype<bigint, 'Bps'>;
|
|
75
|
-
declare const Bps: (value: bigint) => Bps;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Raw JSON models for the on-chain swap endpoints. uint256 values are encoded
|
|
79
|
-
* as decimal strings because they can exceed the safe integer range of JSON
|
|
80
|
-
* consumers.
|
|
81
|
-
*/
|
|
82
|
-
type WalletAuthorizationDto = {
|
|
83
|
-
object: 'wallet_authorization';
|
|
84
|
-
authorized: boolean;
|
|
85
|
-
};
|
|
86
|
-
type SwapPreviewDto = {
|
|
87
|
-
object: 'swap_preview';
|
|
88
|
-
pay_input_amount: string;
|
|
89
|
-
fee: string;
|
|
90
|
-
receive_output_amount: string;
|
|
91
|
-
};
|
|
92
|
-
type SwapStatusDto = {
|
|
93
|
-
object: 'swap_status';
|
|
94
|
-
stopped: string;
|
|
95
|
-
swap_level: string;
|
|
96
|
-
};
|
|
97
|
-
type TokenAllowanceDto = {
|
|
98
|
-
object: 'token_allowance';
|
|
99
|
-
allowance: string;
|
|
100
|
-
};
|
|
101
|
-
type TokenBalanceDto = {
|
|
102
|
-
object: 'token_balance';
|
|
103
|
-
balance: string;
|
|
104
|
-
};
|
|
105
|
-
type AllowWalletResponseDto = {
|
|
106
|
-
action: 'broadcast_transaction';
|
|
107
|
-
to: string;
|
|
108
|
-
data: string;
|
|
109
|
-
} | {
|
|
110
|
-
action: 'none';
|
|
111
|
-
already_allowed: boolean;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Whether a wallet is authorized to interact with a given swap contract.
|
|
116
|
-
*/
|
|
117
|
-
type SwapAuthorization = {
|
|
118
|
-
authorized: boolean;
|
|
119
|
-
};
|
|
120
|
-
declare const SwapAuthorization: {
|
|
121
|
-
fromDto: (dto: WalletAuthorizationDto) => SwapAuthorization;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* A read-only quote for a swap: how much goes in, the protocol fee, and how
|
|
125
|
-
* much would come out. All amounts are raw on-chain integers (uint256).
|
|
126
|
-
*/
|
|
127
|
-
type SwapPreview = {
|
|
128
|
-
inputAmount: Uint256;
|
|
129
|
-
fee: Uint256;
|
|
130
|
-
outputAmount: Uint256;
|
|
131
|
-
};
|
|
132
|
-
declare const SwapPreview: {
|
|
133
|
-
fromDto: (dto: SwapPreviewDto) => SwapPreview;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* The on-chain state of a swap contract.
|
|
137
|
-
*
|
|
138
|
-
* - `stopped`: non-zero when the contract is paused/halted.
|
|
139
|
-
* - `swapLevel`: the current swap level/tier.
|
|
140
|
-
*/
|
|
141
|
-
type SwapStatus = {
|
|
142
|
-
stopped: Uint256;
|
|
143
|
-
swapLevel: Uint256;
|
|
144
|
-
};
|
|
145
|
-
declare const SwapStatus: {
|
|
146
|
-
fromDto: (dto: SwapStatusDto) => SwapStatus;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* The ERC-20 allowance an owner has granted a spender for a token.
|
|
150
|
-
*/
|
|
151
|
-
type TokenAllowance = {
|
|
152
|
-
allowance: Uint256;
|
|
153
|
-
};
|
|
154
|
-
declare const TokenAllowance: {
|
|
155
|
-
fromDto: (dto: TokenAllowanceDto) => TokenAllowance;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* The raw ERC-20 balance an owner holds of a token (uint256).
|
|
159
|
-
*/
|
|
160
|
-
type TokenBalance = {
|
|
161
|
-
balance: Uint256;
|
|
162
|
-
};
|
|
163
|
-
declare const TokenBalance: {
|
|
164
|
-
fromDto: (dto: TokenBalanceDto) => TokenBalance;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* The backend's response to an allow-wallet request. Either the caller must
|
|
168
|
-
* broadcast an on-chain transaction to complete allow-listing, or nothing is
|
|
169
|
-
* required because the wallet is already allowed.
|
|
170
|
-
*/
|
|
171
|
-
type AllowWalletResponse = {
|
|
172
|
-
action: 'broadcast_transaction';
|
|
173
|
-
to: EvmContractAddress;
|
|
174
|
-
data: HexEncodedTransactionData;
|
|
175
|
-
} | {
|
|
176
|
-
action: 'none';
|
|
177
|
-
alreadyAllowed: boolean;
|
|
178
|
-
};
|
|
179
|
-
declare const AllowWalletResponse: {
|
|
180
|
-
fromDto: (dto: AllowWalletResponseDto) => AllowWalletResponse;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* OAuth 2.0 token response (RFC 6749 §5.1).
|
|
185
|
-
* Maps to OpenAPI schema OauthToken.
|
|
186
|
-
*/
|
|
187
|
-
type OAuthSessionDto = {
|
|
188
|
-
access_token: string;
|
|
189
|
-
expires_in: number;
|
|
190
|
-
refresh_token?: string;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
type ClientCredentialsOAuth = Newtype<OAuthAccessToken, 'ClientCredentialsOAuth'>;
|
|
194
|
-
declare const ClientCredentialsOAuth: (value: OAuthAccessToken) => ClientCredentialsOAuth;
|
|
195
|
-
type OAuthAccessToken = {
|
|
196
|
-
value: string;
|
|
197
|
-
expiresAt: Date;
|
|
198
|
-
};
|
|
199
|
-
type OAuthRefreshToken = Newtype<string, 'OAuthRefreshToken'>;
|
|
200
|
-
declare const OAuthRefreshToken: (value: string) => OAuthRefreshToken;
|
|
201
|
-
type OAuthSession = {
|
|
202
|
-
accessToken: OAuthAccessToken;
|
|
203
|
-
refreshToken?: OAuthRefreshToken;
|
|
204
|
-
};
|
|
205
|
-
declare const OAuthSession: {
|
|
206
|
-
fromDto: (dto: OAuthSessionDto) => OAuthSession;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
type HttpRequestAttributes = {
|
|
210
|
-
protected?: boolean;
|
|
211
|
-
userAgent?: boolean;
|
|
212
|
-
idempotencyKey?: boolean;
|
|
213
|
-
/** Zero-based attempt index: 0 = first request, 1 = first retry, etc. */
|
|
214
|
-
retryAttempt?: number;
|
|
215
|
-
renewAttempted?: boolean;
|
|
216
|
-
clientCredentials?: ClientCredentialsOAuth;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
type QueryParamValue = string | number | boolean | null | undefined;
|
|
220
|
-
type QueryParamValues = QueryParamValue | QueryParamValue[];
|
|
221
|
-
type HttpRequest<TBody = unknown> = {
|
|
222
|
-
method: 'GET';
|
|
223
|
-
url: string;
|
|
224
|
-
queryParams?: Record<string, QueryParamValues>;
|
|
225
|
-
headers?: Record<string, string>;
|
|
226
|
-
attributes?: HttpRequestAttributes;
|
|
227
|
-
redirect?: RequestRedirect;
|
|
228
|
-
} | {
|
|
229
|
-
method: 'POST';
|
|
230
|
-
url: string;
|
|
231
|
-
queryParams?: Record<string, QueryParamValues>;
|
|
232
|
-
headers?: Record<string, string>;
|
|
233
|
-
body: TBody;
|
|
234
|
-
attributes?: HttpRequestAttributes;
|
|
235
|
-
redirect?: RequestRedirect;
|
|
236
|
-
} | {
|
|
237
|
-
method: 'DELETE';
|
|
238
|
-
url: string;
|
|
239
|
-
queryParams?: Record<string, QueryParamValues>;
|
|
240
|
-
headers?: Record<string, string>;
|
|
241
|
-
attributes?: HttpRequestAttributes;
|
|
242
|
-
redirect?: RequestRedirect;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Structural interface satisfied by both {@link AuthenticatedApiClient} and
|
|
247
|
-
* {@link ApiClient}. Used by the shared frontline API functions so they can
|
|
248
|
-
* be called from either the client or server without any browser dependencies.
|
|
249
|
-
*/
|
|
250
|
-
interface Sender {
|
|
251
|
-
send<T>(request: HttpRequest): Promise<T>;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
interface SharedNamespaceContext {
|
|
255
|
-
readonly api: Sender;
|
|
256
|
-
ensureUserAuthenticated(): Promise<void>;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
type GetTokenAllowanceParams = {
|
|
260
|
-
tokenAddress: EvmContractAddress;
|
|
261
|
-
owner: EvmWalletAddress;
|
|
262
|
-
spender: EvmContractAddress;
|
|
263
|
-
chain: EthereumChain;
|
|
264
|
-
};
|
|
265
|
-
type GetTokenBalanceParams = {
|
|
266
|
-
tokenAddress: EvmContractAddress;
|
|
267
|
-
owner: EvmWalletAddress;
|
|
268
|
-
chain: EthereumChain;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Generic ERC-20 reads shared across on-chain flows (swap, token sale): the
|
|
272
|
-
* allowance an owner has granted a spender, and the raw token balance an owner
|
|
273
|
-
* holds. These are plain token reads, not tied to any single product flow.
|
|
274
|
-
*/
|
|
275
|
-
interface CoinListErc20Namespace {
|
|
276
|
-
/**
|
|
277
|
-
* Reads the ERC-20 allowance an `owner` has granted a `spender`.
|
|
278
|
-
*/
|
|
279
|
-
getTokenAllowance(params: GetTokenAllowanceParams): Promise<TokenAllowance>;
|
|
280
|
-
/**
|
|
281
|
-
* Reads the raw ERC-20 balance an `owner` holds of a token.
|
|
282
|
-
*/
|
|
283
|
-
getTokenBalance(params: GetTokenBalanceParams): Promise<TokenBalance>;
|
|
284
|
-
}
|
|
285
|
-
declare class Erc20NamespaceImpl implements CoinListErc20Namespace {
|
|
286
|
-
private readonly ctx;
|
|
287
|
-
constructor(ctx: SharedNamespaceContext);
|
|
288
|
-
getTokenAllowance(params: GetTokenAllowanceParams): Promise<TokenAllowance>;
|
|
289
|
-
getTokenBalance(params: GetTokenBalanceParams): Promise<TokenBalance>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
type OfferTypeDto = 'sale' | 'swap';
|
|
293
|
-
type OfferDto = {
|
|
294
|
-
id: string;
|
|
295
|
-
slug: string;
|
|
296
|
-
type: OfferTypeDto;
|
|
297
|
-
tagline: string;
|
|
298
|
-
banner_url: string;
|
|
299
|
-
logo_url: string;
|
|
300
|
-
starts_at: string;
|
|
301
|
-
ends_at: string | null;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
type OfferId = Newtype<string, 'OfferId'>;
|
|
305
|
-
declare const OfferId: (value: string) => OfferId;
|
|
306
|
-
type OfferSlug = Newtype<string, 'OfferSlug'>;
|
|
307
|
-
declare const OfferSlug: (value: string) => OfferSlug;
|
|
308
|
-
type OfferType = OfferTypeDto;
|
|
309
|
-
type Offer = {
|
|
310
|
-
id: OfferId;
|
|
311
|
-
slug: OfferSlug;
|
|
312
|
-
type: OfferType;
|
|
313
|
-
tagline: string;
|
|
314
|
-
bannerUrl: string;
|
|
315
|
-
logoUrl: string;
|
|
316
|
-
startsAt: Date;
|
|
317
|
-
endsAt: Date | null;
|
|
318
|
-
};
|
|
319
|
-
declare const Offer: {
|
|
320
|
-
fromDto: (dto: OfferDto) => Offer;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
/** Challenge kinds accepted by `POST /v1/wallet-ownership`. */
|
|
324
|
-
type WalletOwnershipChallengeTypeDto = 'plain' | 'siwe';
|
|
325
|
-
/**
|
|
326
|
-
* Request body for `POST /v1/wallet-ownership`. `challenge_type` defaults to
|
|
327
|
-
* `plain` on the backend; the SIWE fields (`domain`, `uri`, `statement`) are
|
|
328
|
-
* required only when `challenge_type` is `siwe` and must be absent otherwise.
|
|
329
|
-
*/
|
|
330
|
-
type CreateWalletOwnershipChallengeDto = {
|
|
331
|
-
wallet_address: string;
|
|
332
|
-
chain: string;
|
|
333
|
-
challenge_type?: WalletOwnershipChallengeTypeDto;
|
|
334
|
-
domain?: string;
|
|
335
|
-
uri?: string;
|
|
336
|
-
statement?: string;
|
|
337
|
-
};
|
|
338
|
-
/** Response body for `POST /v1/wallet-ownership`. */
|
|
339
|
-
type WalletOwnershipChallengeDto = {
|
|
340
|
-
message: string;
|
|
341
|
-
expires_at: string;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
/** Fields common to every wallet-ownership challenge request. */
|
|
345
|
-
type WalletOwnershipChallengeParamsBase = {
|
|
346
|
-
/** Wallet address to prove ownership of. */
|
|
347
|
-
walletAddress: EvmWalletAddress;
|
|
348
|
-
/** Chain the wallet belongs to. */
|
|
349
|
-
chain: EthereumChain;
|
|
350
|
-
};
|
|
351
|
-
/**
|
|
352
|
-
* How the ownership challenge is framed: a plain message or a Sign-In With
|
|
353
|
-
* Ethereum challenge. Extracted as its own type so SDK consumers can pass it as
|
|
354
|
-
* a standalone param without reaching into the {@link CreateWalletOwnershipChallengeParams}
|
|
355
|
-
* union.
|
|
356
|
-
*/
|
|
357
|
-
type WalletChallengeType = CreateWalletOwnershipChallengeParams['challengeType'];
|
|
358
|
-
/**
|
|
359
|
-
* A single-use ownership challenge returned by `POST /v1/wallet-ownership`.
|
|
360
|
-
* The consumer signs {@link message} with their wallet, then submits the
|
|
361
|
-
* signature to connect the wallet to an offer option.
|
|
362
|
-
*/
|
|
363
|
-
type WalletOwnershipChallenge = {
|
|
364
|
-
/** The message the wallet must sign. */
|
|
365
|
-
message: string;
|
|
366
|
-
/** When the challenge expires and can no longer be consumed. */
|
|
367
|
-
expiresAt: Date;
|
|
368
|
-
};
|
|
369
|
-
declare const WalletOwnershipChallenge: {
|
|
370
|
-
/** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
|
|
371
|
-
fromDto: (dto: WalletOwnershipChallengeDto) => WalletOwnershipChallenge;
|
|
372
|
-
};
|
|
373
|
-
/**
|
|
374
|
-
* Parameters for requesting a wallet-ownership challenge. Modeled as a
|
|
375
|
-
* discriminated union on `challengeType` so a `siwe` challenge must carry
|
|
376
|
-
* `domain`/`uri`/`statement`, matching the backend contract at compile time.
|
|
377
|
-
*/
|
|
378
|
-
type CreateWalletOwnershipChallengeParams = (WalletOwnershipChallengeParamsBase & {
|
|
379
|
-
/** A bare message the wallet signs. */
|
|
380
|
-
challengeType: 'plain';
|
|
381
|
-
}) | (WalletOwnershipChallengeParamsBase & {
|
|
382
|
-
/** Marks this as a Sign-In With Ethereum challenge. */
|
|
383
|
-
challengeType: 'siwe';
|
|
384
|
-
/** The requesting site's hostname (e.g. `example.com`). */
|
|
385
|
-
domain: string;
|
|
386
|
-
/** The requesting site's URI. */
|
|
387
|
-
uri: string;
|
|
388
|
-
/** Human-readable statement shown in the signing prompt. */
|
|
389
|
-
statement: string;
|
|
390
|
-
});
|
|
391
|
-
declare const CreateWalletOwnershipChallengeParams: {
|
|
392
|
-
/**
|
|
393
|
-
* Maps challenge-request params into the API DTO payload. The discriminated
|
|
394
|
-
* union guarantees SIWE fields are present exactly when `challengeType` is
|
|
395
|
-
* `siwe`, so the mapping narrows on the discriminant.
|
|
396
|
-
*/
|
|
397
|
-
toDto: (params: CreateWalletOwnershipChallengeParams) => CreateWalletOwnershipChallengeDto;
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/** Parameters shared by contract reads scoped to a chain. */
|
|
401
|
-
type SwapContractRef = {
|
|
402
|
-
contractAddress: EvmContractAddress;
|
|
403
|
-
chain: EthereumChain;
|
|
404
|
-
};
|
|
405
|
-
type GetSwapAuthorizationParams = SwapContractRef & {
|
|
406
|
-
walletAddress: EvmWalletAddress;
|
|
407
|
-
};
|
|
408
|
-
type GetSwapPreviewParams = SwapContractRef & {
|
|
409
|
-
inputToken: EvmContractAddress;
|
|
410
|
-
amount: bigint;
|
|
411
|
-
};
|
|
412
|
-
type AllowWalletParams = {
|
|
413
|
-
offerId: OfferId;
|
|
414
|
-
walletAddress: EvmWalletAddress;
|
|
415
|
-
chain: EthereumChain;
|
|
416
|
-
signature: string;
|
|
417
|
-
};
|
|
418
|
-
/**
|
|
419
|
-
* Read/write operations for the on-chain swap flow: quoting a swap, inspecting
|
|
420
|
-
* contract state, checking token allowances, and proving/allow-listing wallet
|
|
421
|
-
* ownership.
|
|
422
|
-
*/
|
|
423
|
-
interface CoinListSwapNamespace {
|
|
424
|
-
/**
|
|
425
|
-
* Checks whether a wallet is authorized to swap against the given contract.
|
|
426
|
-
*/
|
|
427
|
-
getAuthorization(params: GetSwapAuthorizationParams): Promise<SwapAuthorization>;
|
|
428
|
-
/**
|
|
429
|
-
* Fetches a read-only quote for swapping `amount` of `inputToken`.
|
|
430
|
-
*/
|
|
431
|
-
getPreview(params: GetSwapPreviewParams): Promise<SwapPreview>;
|
|
432
|
-
/**
|
|
433
|
-
* Reads the current on-chain state of a swap contract.
|
|
434
|
-
*/
|
|
435
|
-
getStatus(params: SwapContractRef): Promise<SwapStatus>;
|
|
436
|
-
/**
|
|
437
|
-
* Reads the ERC-20 output token a swap contract pays out.
|
|
438
|
-
*/
|
|
439
|
-
getOutputToken(params: SwapContractRef): Promise<Erc20Asset>;
|
|
440
|
-
/**
|
|
441
|
-
* Requests a single-use challenge the user must sign to prove wallet
|
|
442
|
-
* ownership, via `POST /v1/wallet-ownership`. Supports both `plain` and
|
|
443
|
-
* `siwe` challenges. This is the same operation as the top-level
|
|
444
|
-
* `createWalletOwnershipChallenge`, scoped under the swap namespace for the
|
|
445
|
-
* allow-wallet flow.
|
|
446
|
-
*/
|
|
447
|
-
requestWalletOwnershipChallenge(params: CreateWalletOwnershipChallengeParams): Promise<WalletOwnershipChallenge>;
|
|
448
|
-
/**
|
|
449
|
-
* Submits a signed wallet-ownership challenge to allow-list the wallet for
|
|
450
|
-
* an offer, identified by its offer id.
|
|
451
|
-
*/
|
|
452
|
-
allowWallet(params: AllowWalletParams): Promise<AllowWalletResponse>;
|
|
453
|
-
}
|
|
454
|
-
declare class SwapNamespaceImpl implements CoinListSwapNamespace {
|
|
455
|
-
private readonly ctx;
|
|
456
|
-
constructor(ctx: SharedNamespaceContext);
|
|
457
|
-
getAuthorization(params: GetSwapAuthorizationParams): Promise<SwapAuthorization>;
|
|
458
|
-
getPreview(params: GetSwapPreviewParams): Promise<SwapPreview>;
|
|
459
|
-
getStatus(params: SwapContractRef): Promise<SwapStatus>;
|
|
460
|
-
getOutputToken(params: SwapContractRef): Promise<Erc20Asset>;
|
|
461
|
-
requestWalletOwnershipChallenge(params: CreateWalletOwnershipChallengeParams): Promise<WalletOwnershipChallenge>;
|
|
462
|
-
allowWallet(params: AllowWalletParams): Promise<AllowWalletResponse>;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
type Cursor = Newtype<string, 'Cursor'>;
|
|
466
|
-
declare const Cursor: (value: string) => Cursor;
|
|
467
|
-
interface PaginatedResponseDto<T> {
|
|
468
|
-
data: T[];
|
|
469
|
-
starting_after?: string;
|
|
470
|
-
starting_before?: string;
|
|
471
|
-
}
|
|
472
|
-
declare function fetchAllPages<A, P extends PaginationParams = PaginationParams>(fetchPage: (params: P) => Promise<PaginatedResponse<A>>, baseParams?: Omit<P, keyof PaginationParams>): Promise<A[]>;
|
|
473
|
-
interface PaginatedResponse<T> {
|
|
474
|
-
data: T[];
|
|
475
|
-
startingAfter: Cursor | null;
|
|
476
|
-
startingBefore: Cursor | null;
|
|
477
|
-
}
|
|
478
|
-
declare const PaginatedResponse: {
|
|
479
|
-
fromDto: <A, B>(dto: PaginatedResponseDto<A>, itemMapper: (item: A) => B) => PaginatedResponse<B>;
|
|
480
|
-
};
|
|
481
|
-
/**
|
|
482
|
-
* Cursor-based pagination input used when requesting paginated API resources.
|
|
483
|
-
* Set `after` or `before` to navigate relative to a known cursor, and `limit`
|
|
484
|
-
* to control the maximum number of returned items.
|
|
485
|
-
*/
|
|
486
|
-
interface PaginationParams {
|
|
487
|
-
before?: Cursor;
|
|
488
|
-
after?: Cursor;
|
|
489
|
-
limit?: number;
|
|
490
|
-
}
|
|
491
|
-
declare const PaginationParams: {
|
|
492
|
-
toQueryParams: (params: PaginationParams) => Record<string, QueryParamValue>;
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
type AssetDto = {
|
|
496
|
-
code: string;
|
|
497
|
-
fractional_digits: number;
|
|
498
|
-
id: string;
|
|
499
|
-
name: string;
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
type AssetId = Newtype<string, 'AssetId'>;
|
|
503
|
-
declare const AssetId: (value: string) => AssetId;
|
|
504
|
-
type AssetCode = Newtype<string, 'AssetCode'>;
|
|
505
|
-
declare const AssetCode: (value: string) => AssetCode;
|
|
506
|
-
type Asset = {
|
|
507
|
-
id: AssetId;
|
|
508
|
-
code: AssetCode;
|
|
509
|
-
name: string;
|
|
510
|
-
fractionalDigits: number;
|
|
511
|
-
};
|
|
512
|
-
declare const Asset: {
|
|
513
|
-
fromDto: (dto: AssetDto) => Asset;
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
type ParticipationStatusDto = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
|
|
517
|
-
type ParticipationDto = {
|
|
518
|
-
object: 'participation';
|
|
519
|
-
id: string;
|
|
520
|
-
offer_id: string;
|
|
521
|
-
offer_option_id: string;
|
|
522
|
-
status: ParticipationStatusDto;
|
|
523
|
-
amount: string;
|
|
524
|
-
amount_string: string;
|
|
525
|
-
asset: AssetDto;
|
|
526
|
-
chain: string;
|
|
527
|
-
inserted_at: string | null | undefined;
|
|
528
|
-
updated_at: string | null | undefined;
|
|
529
|
-
wallet_address: string | null | undefined;
|
|
530
|
-
};
|
|
531
|
-
type CreateParticipationDto = {
|
|
532
|
-
offer_id: string;
|
|
533
|
-
offer_option_id: string;
|
|
534
|
-
chain: string;
|
|
535
|
-
wallet_address: string;
|
|
536
|
-
amount: string;
|
|
537
|
-
asset_id: string;
|
|
538
|
-
approval_transaction_hash: string | null | undefined;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
type OfferDetailDto = {
|
|
542
|
-
asset: AssetDto;
|
|
543
|
-
faqs: OfferDetailFaqDto[];
|
|
544
|
-
funding_assets: AssetDto[];
|
|
545
|
-
id: string;
|
|
546
|
-
links: OfferDetailLinkDto[];
|
|
547
|
-
milestones: OfferDetailMilestoneDto[];
|
|
548
|
-
name: string;
|
|
549
|
-
object: 'offer_details';
|
|
550
|
-
options: OfferDetailOptionDto[];
|
|
551
|
-
slug: string;
|
|
552
|
-
type: OfferTypeDto;
|
|
553
|
-
terms: OfferDetailTermDto[];
|
|
554
|
-
about: string | null | undefined;
|
|
555
|
-
banner_url: string;
|
|
556
|
-
category: string;
|
|
557
|
-
ends_at: string | null;
|
|
558
|
-
logo_url: string;
|
|
559
|
-
starts_at: string;
|
|
560
|
-
tagline: string;
|
|
561
|
-
};
|
|
562
|
-
type OfferDetailFaqDto = {
|
|
563
|
-
answer: string | null;
|
|
564
|
-
question: string | null;
|
|
565
|
-
};
|
|
566
|
-
type OfferDetailLinkDto = {
|
|
567
|
-
label: string | null;
|
|
568
|
-
url: string | null;
|
|
569
|
-
};
|
|
570
|
-
type OfferDetailMilestoneDto = {
|
|
571
|
-
name: string | null;
|
|
572
|
-
schedule: string | null;
|
|
573
|
-
status: 'completed' | 'active' | 'upcoming';
|
|
574
|
-
};
|
|
575
|
-
type OfferDetailOptionDto = {
|
|
576
|
-
bid_increment: number | null;
|
|
577
|
-
floor_price_usd: number | null;
|
|
578
|
-
id: string;
|
|
579
|
-
minimum_purchase_usd: number | null;
|
|
580
|
-
price_usd: string | null;
|
|
581
|
-
sale_agreement_url: string | null;
|
|
582
|
-
slug: string;
|
|
583
|
-
total_token_supply: number | null;
|
|
584
|
-
};
|
|
585
|
-
type OfferDetailTermDto = {
|
|
586
|
-
key: string | null;
|
|
587
|
-
value: string | null;
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
type OfferOptionId = Newtype<string, 'OfferOptionId'>;
|
|
591
|
-
declare const OfferOptionId: (value: string) => OfferOptionId;
|
|
592
|
-
type OfferOptionSlug = Newtype<string, 'OfferOptionSlug'>;
|
|
593
|
-
declare const OfferOptionSlug: (value: string) => OfferOptionSlug;
|
|
594
|
-
type OfferDetail = {
|
|
595
|
-
id: OfferId;
|
|
596
|
-
slug: OfferSlug;
|
|
597
|
-
type: OfferType;
|
|
598
|
-
name: string;
|
|
599
|
-
asset: Asset;
|
|
600
|
-
fundingAssets: Asset[];
|
|
601
|
-
about: string | null;
|
|
602
|
-
tagline: string;
|
|
603
|
-
bannerUrl: string;
|
|
604
|
-
logoUrl: string;
|
|
605
|
-
category: string;
|
|
606
|
-
startsAt: Date;
|
|
607
|
-
endsAt: Date | null;
|
|
608
|
-
faqs: FaqItem[];
|
|
609
|
-
links: Link[];
|
|
610
|
-
milestones: Milestone[];
|
|
611
|
-
options: OfferOption[];
|
|
612
|
-
terms: TermItem[];
|
|
613
|
-
};
|
|
614
|
-
declare const OfferDetail: {
|
|
615
|
-
fromDto: (dto: OfferDetailDto) => OfferDetail;
|
|
616
|
-
};
|
|
617
|
-
type OfferOption = {
|
|
618
|
-
id: OfferOptionId;
|
|
619
|
-
slug: OfferOptionSlug;
|
|
620
|
-
bidIncrement: number | null;
|
|
621
|
-
floorPriceUsd: number | null;
|
|
622
|
-
minimumPurchaseUsd: number | null;
|
|
623
|
-
priceUsd: string | null;
|
|
624
|
-
saleAgreementUrl: string | null;
|
|
625
|
-
totalTokenSupply: number | null;
|
|
626
|
-
};
|
|
627
|
-
declare const OfferOption: {
|
|
628
|
-
fromDto: (dto: OfferDetailOptionDto) => OfferOption;
|
|
629
|
-
};
|
|
630
|
-
type FaqItem = {
|
|
631
|
-
question: string | null;
|
|
632
|
-
answer: string | null;
|
|
633
|
-
};
|
|
634
|
-
declare const FaqItem: {
|
|
635
|
-
fromDto: (dto: OfferDetailFaqDto) => FaqItem;
|
|
636
|
-
};
|
|
637
|
-
type Link = {
|
|
638
|
-
label: string | null;
|
|
639
|
-
url: string | null;
|
|
640
|
-
};
|
|
641
|
-
declare const Link: {
|
|
642
|
-
fromDto: (dto: OfferDetailLinkDto) => Link;
|
|
643
|
-
};
|
|
644
|
-
type TermItem = {
|
|
645
|
-
key: string | null;
|
|
646
|
-
value: string | null;
|
|
647
|
-
};
|
|
648
|
-
declare const TermItem: {
|
|
649
|
-
fromDto: (dto: OfferDetailTermDto) => TermItem;
|
|
650
|
-
};
|
|
651
|
-
type Milestone = {
|
|
652
|
-
name: string | null;
|
|
653
|
-
schedule: string | null;
|
|
654
|
-
status: 'completed' | 'active' | 'upcoming';
|
|
655
|
-
};
|
|
656
|
-
declare const Milestone: {
|
|
657
|
-
fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
/** Unique identifier for a participation. */
|
|
661
|
-
type ParticipationId = Newtype<string, 'ParticipationId'>;
|
|
662
|
-
/** Casts a string into a typed {@link ParticipationId}. */
|
|
663
|
-
declare const ParticipationId: (value: string) => ParticipationId;
|
|
664
|
-
/** Blockchain identifier for where a participation is funded. */
|
|
665
|
-
type Blockchain = Newtype<string, 'Blockchain'>;
|
|
666
|
-
/** Casts a string into a typed {@link Blockchain}. */
|
|
667
|
-
declare const Blockchain: (value: string) => Blockchain;
|
|
668
|
-
/** Wallet address used for a participation. */
|
|
669
|
-
type WalletAddress = Newtype<`0x${string}`, 'WalletAddress'>;
|
|
670
|
-
/** Casts a `0x`-prefixed string into a typed {@link WalletAddress}. */
|
|
671
|
-
declare const WalletAddress: (value: `0x${string}`) => WalletAddress;
|
|
672
|
-
/** Possible participation lifecycle states returned by the API. */
|
|
673
|
-
type ParticipationStatus = ParticipationStatusDto;
|
|
674
|
-
/** Pagination params for listing participations, with an optional offer filter. */
|
|
675
|
-
interface ParticipationsPaginationParams extends PaginationParams {
|
|
676
|
-
offerId?: OfferId;
|
|
677
|
-
}
|
|
678
|
-
declare const ParticipationsPaginationParams: {
|
|
679
|
-
toQueryParams: (params: ParticipationsPaginationParams) => Record<string, QueryParamValue>;
|
|
680
|
-
};
|
|
681
|
-
/** Domain model for a participation returned by CoinList APIs. */
|
|
682
|
-
type Participation = {
|
|
683
|
-
/** Unique participation id. */
|
|
684
|
-
id: ParticipationId;
|
|
685
|
-
/** Parent offer id. */
|
|
686
|
-
offerId: OfferId;
|
|
687
|
-
/** Selected offer option id. */
|
|
688
|
-
offerOptionId: OfferOptionId;
|
|
689
|
-
/** Current processing status. */
|
|
690
|
-
status: ParticipationStatus;
|
|
691
|
-
/** Raw participation amount from API. */
|
|
692
|
-
amount: string;
|
|
693
|
-
/** Human-readable formatted amount from API. */
|
|
694
|
-
displayAmount: string;
|
|
695
|
-
/** Asset metadata for the participation amount. */
|
|
696
|
-
asset: Asset;
|
|
697
|
-
/** Funding chain identifier. */
|
|
698
|
-
chain: Blockchain;
|
|
699
|
-
/** Creation timestamp, if returned by API. */
|
|
700
|
-
insertedAt: Date | null;
|
|
701
|
-
/** Last update timestamp, if returned by API. */
|
|
702
|
-
updatedAt: Date | null;
|
|
703
|
-
/** Wallet used for participation, blank values normalized to null. */
|
|
704
|
-
walletAddress: WalletAddress | null;
|
|
705
|
-
};
|
|
706
|
-
declare const Participation: {
|
|
707
|
-
/** Maps API DTO shape into the SDK participation domain model. */
|
|
708
|
-
fromDto: (dto: ParticipationDto) => Participation;
|
|
709
|
-
};
|
|
710
|
-
/** Parameters required to create a new participation. */
|
|
711
|
-
type CreateParticipationParams = {
|
|
712
|
-
/** Offer to participate in. */
|
|
713
|
-
offerId: OfferId;
|
|
714
|
-
/** Offer option selected for participation. */
|
|
715
|
-
offerOptionId: OfferOptionId;
|
|
716
|
-
/** Blockchain for funding. */
|
|
717
|
-
chain: Blockchain;
|
|
718
|
-
/** Wallet address that funds the participation. */
|
|
719
|
-
walletAddress: WalletAddress;
|
|
720
|
-
/** Raw base-unit amount to participate with (e.g. `"100000000"` for 100 USDC with 6 decimals). */
|
|
721
|
-
amount: string;
|
|
722
|
-
/** Funding asset id. */
|
|
723
|
-
assetId: AssetId;
|
|
724
|
-
/**
|
|
725
|
-
* Hash of the ERC-20 `approve()` transaction covering this participation.
|
|
726
|
-
* Required: the backend verifies it on-chain (sender, token, spender, and
|
|
727
|
-
* approved amount) before confirming the participation.
|
|
728
|
-
*/
|
|
729
|
-
approvalTransactionHash: string;
|
|
730
|
-
};
|
|
731
|
-
declare const CreateParticipationParams: {
|
|
732
|
-
/** Maps participation creation params into API DTO payload. */
|
|
733
|
-
toDto: (params: CreateParticipationParams) => CreateParticipationDto;
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
/**
|
|
737
|
-
* Read/write operations for token sales: listing and reading the current user's
|
|
738
|
-
* participations, and recording a new one. The on-chain execution flow
|
|
739
|
-
* (`executeTokenSale`) is layered on top of this in the client-side namespace.
|
|
740
|
-
*/
|
|
741
|
-
interface CoinListTokenSaleNamespace {
|
|
742
|
-
/**
|
|
743
|
-
* Fetches all participations by iterating through every paginated response,
|
|
744
|
-
* optionally filtered by offer.
|
|
745
|
-
*
|
|
746
|
-
* Requires an authenticated user; throws {@link NotAuthenticatedError}
|
|
747
|
-
* otherwise.
|
|
748
|
-
*/
|
|
749
|
-
fetchParticipations(offerId?: OfferId): Promise<Participation[]>;
|
|
750
|
-
/**
|
|
751
|
-
* Fetches a single page of participations, optionally filtered by offer.
|
|
752
|
-
*
|
|
753
|
-
* Requires an authenticated user; throws {@link NotAuthenticatedError}
|
|
754
|
-
* otherwise.
|
|
755
|
-
*/
|
|
756
|
-
fetchParticipationsPage(params: ParticipationsPaginationParams): Promise<PaginatedResponse<Participation>>;
|
|
757
|
-
/**
|
|
758
|
-
* Fetches a participation by id.
|
|
759
|
-
*
|
|
760
|
-
* Requires an authenticated user; throws {@link NotAuthenticatedError}
|
|
761
|
-
* otherwise.
|
|
762
|
-
*/
|
|
763
|
-
fetchParticipation(id: ParticipationId): Promise<Participation>;
|
|
764
|
-
/**
|
|
765
|
-
* Records a participation with CoinList.
|
|
766
|
-
*
|
|
767
|
-
* Requires an authenticated user; throws {@link NotAuthenticatedError}
|
|
768
|
-
* otherwise.
|
|
769
|
-
*/
|
|
770
|
-
createParticipation(params: CreateParticipationParams): Promise<Participation>;
|
|
771
|
-
}
|
|
772
|
-
declare class TokenSaleNamespaceImpl implements CoinListTokenSaleNamespace {
|
|
773
|
-
private readonly ctx;
|
|
774
|
-
constructor(ctx: SharedNamespaceContext);
|
|
775
|
-
fetchParticipations(offerId?: OfferId): Promise<Participation[]>;
|
|
776
|
-
fetchParticipationsPage(params: ParticipationsPaginationParams): Promise<PaginatedResponse<Participation>>;
|
|
777
|
-
fetchParticipation(id: ParticipationId): Promise<Participation>;
|
|
778
|
-
createParticipation(params: CreateParticipationParams): Promise<Participation>;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;
|
|
782
|
-
declare const AuthorizationCode: (value: string) => AuthorizationCode;
|
|
783
|
-
type CodeVerifier = Newtype<string, 'CodeVerifier'>;
|
|
784
|
-
declare const CodeVerifier: (value: string) => CodeVerifier;
|
|
785
|
-
type CodeChallenge = Newtype<string, 'CodeChallenge'>;
|
|
786
|
-
declare const CodeChallenge: (value: string) => CodeChallenge;
|
|
787
|
-
type PKCEState = Newtype<string, 'PKCEState'>;
|
|
788
|
-
declare const PKCEState: (value: string) => PKCEState;
|
|
789
|
-
type RedirectUri = Newtype<string, 'RedirectUri'>;
|
|
790
|
-
declare const RedirectUri: (value: string) => RedirectUri;
|
|
791
|
-
type ClientId = Newtype<string, 'ClientId'>;
|
|
792
|
-
declare const ClientId: (value: string) => ClientId;
|
|
793
|
-
type ClientSecret = Newtype<string, 'ClientSecret'>;
|
|
794
|
-
declare const ClientSecret: (value: string) => ClientSecret;
|
|
795
|
-
|
|
796
|
-
interface Config {
|
|
797
|
-
/** OAuth2 public identifier. */
|
|
798
|
-
readonly clientId: ClientId;
|
|
799
|
-
/**
|
|
800
|
-
* OAuth2 redirect URI. Recommended to point to a frontend page where
|
|
801
|
-
* {@link CoinListClient#completeOauth} can be called to complete the PKCE
|
|
802
|
-
* flow on the client side.
|
|
803
|
-
*/
|
|
804
|
-
readonly redirectUri: RedirectUri;
|
|
805
|
-
/**
|
|
806
|
-
* Recommended to leave undefined. Used to change the CoinList environment;
|
|
807
|
-
* default is production.
|
|
808
|
-
*/
|
|
809
|
-
readonly baseUrl?: string;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
type DocumentSubmissionStatusDto = 'INITIALIZED' | 'SENT' | 'VIEWED' | 'COMPLETED' | 'DECLINED' | 'EXPIRED';
|
|
813
|
-
type DocumentFormTypeDto = 'w8_ben' | 'w8_ben_e';
|
|
814
|
-
type DocumentSubmissionDto = {
|
|
815
|
-
object: 'document_submission';
|
|
816
|
-
status: DocumentSubmissionStatusDto;
|
|
817
|
-
form_type: DocumentFormTypeDto;
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
/** Document types that can be signed via {@link CoinListClient.submitDocument}. */
|
|
821
|
-
type DocumentType = 'tax_certification';
|
|
822
|
-
/** Signing-state machine status for a document submission. */
|
|
823
|
-
type DocumentSubmissionStatus = DocumentSubmissionStatusDto;
|
|
824
|
-
/** The tax form derived from the entity's kind (individual vs company/trust). */
|
|
825
|
-
type DocumentFormType = DocumentFormTypeDto;
|
|
826
|
-
/** Result of starting (or resuming) a document signing submission. */
|
|
827
|
-
type DocumentSubmission = {
|
|
828
|
-
status: DocumentSubmissionStatus;
|
|
829
|
-
formType: DocumentFormType;
|
|
830
|
-
};
|
|
831
|
-
declare const DocumentSubmission: {
|
|
832
|
-
fromDto: (dto: DocumentSubmissionDto) => DocumentSubmission;
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
type KycTokenDto = {
|
|
836
|
-
object: 'kyc_token';
|
|
837
|
-
token: string;
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Sumsub verification level name. Determines which screens the Sumsub WebSDK
|
|
842
|
-
* shows (levels are configured in the Sumsub dashboard). The backend
|
|
843
|
-
* prescribes the level (and whether the applicant must be reset first) in the
|
|
844
|
-
* requirement statuses response — clients never compute levels themselves.
|
|
845
|
-
*/
|
|
846
|
-
type KycLevelName = string;
|
|
847
|
-
/** Short-lived Sumsub WebSDK access token scoped to the current user. */
|
|
848
|
-
type KycToken = {
|
|
849
|
-
token: string;
|
|
850
|
-
};
|
|
851
|
-
declare const KycToken: {
|
|
852
|
-
fromDto: (dto: KycTokenDto) => KycToken;
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
/** Request body for `POST /v1/offers/:offer_id/addresses`. */
|
|
856
|
-
type CreateOfferOptionAddressDto = {
|
|
857
|
-
offer_option_id: string;
|
|
858
|
-
wallet_address: string;
|
|
859
|
-
chain: string;
|
|
860
|
-
signature: string;
|
|
861
|
-
};
|
|
862
|
-
/** Binding object returned by the `/v1/offers/:offer_id/addresses` resource. */
|
|
863
|
-
type OfferOptionAddressDto = {
|
|
864
|
-
id: string;
|
|
865
|
-
offer_option_id: string;
|
|
866
|
-
address: string;
|
|
867
|
-
protocol: WalletProtocol;
|
|
868
|
-
created_at: string;
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
/** Unique identifier for a proven wallet binding on an offer option. */
|
|
872
|
-
type OfferOptionAddressId = Newtype<string, 'OfferOptionAddressId'>;
|
|
873
|
-
/** Casts a string into a typed {@link OfferOptionAddressId}. */
|
|
874
|
-
declare const OfferOptionAddressId: (value: string) => OfferOptionAddressId;
|
|
875
|
-
/**
|
|
876
|
-
* A user's external wallet, proven via a wallet-ownership challenge and bound
|
|
877
|
-
* to an offer option. Returned by the `/v1/offers/:offer_id/addresses` resource.
|
|
878
|
-
*/
|
|
879
|
-
type OfferOptionAddress = {
|
|
880
|
-
/** Unique binding id. */
|
|
881
|
-
id: OfferOptionAddressId;
|
|
882
|
-
/** Offer option the wallet is bound to. */
|
|
883
|
-
offerOptionId: OfferOptionId;
|
|
884
|
-
/** The connected external wallet address. */
|
|
885
|
-
address: EvmWalletAddress;
|
|
886
|
-
/**
|
|
887
|
-
* Protocol the binding is scoped to. An EVM address binds once per option
|
|
888
|
-
* regardless of which EVM chain proved ownership.
|
|
889
|
-
*/
|
|
890
|
-
protocol: WalletProtocol;
|
|
891
|
-
/** When the binding was created. */
|
|
892
|
-
createdAt: Date;
|
|
893
|
-
};
|
|
894
|
-
declare const OfferOptionAddress: {
|
|
895
|
-
/** Maps the API DTO into the SDK offer-option-address domain model. */
|
|
896
|
-
fromDto: (dto: OfferOptionAddressDto) => OfferOptionAddress;
|
|
897
|
-
};
|
|
898
|
-
/** Parameters required to connect a proven external wallet to an offer option. */
|
|
899
|
-
type ConnectExternalWalletParams = {
|
|
900
|
-
/** Offer option to bind the wallet to. */
|
|
901
|
-
offerOptionId: OfferOptionId;
|
|
902
|
-
/** External wallet address that was proven. */
|
|
903
|
-
walletAddress: EvmWalletAddress;
|
|
904
|
-
/** Chain the ownership was proven on. */
|
|
905
|
-
chain: EthereumChain;
|
|
906
|
-
/** Signature of the wallet-ownership challenge message. */
|
|
907
|
-
signature: Hex;
|
|
908
|
-
};
|
|
909
|
-
declare const ConnectExternalWalletParams: {
|
|
910
|
-
/** Maps connect-wallet params into the API DTO payload. */
|
|
911
|
-
toDto: (params: ConnectExternalWalletParams) => CreateOfferOptionAddressDto;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
type PiiKindDto = 'person' | 'company';
|
|
915
|
-
type PiiJurisdictionDto = {
|
|
916
|
-
iso_2: string;
|
|
917
|
-
name: string | null;
|
|
918
|
-
};
|
|
919
|
-
type PiiAddressDto = {
|
|
920
|
-
street: string | null;
|
|
921
|
-
city: string | null;
|
|
922
|
-
state: string | null;
|
|
923
|
-
postal_code: string | null;
|
|
924
|
-
country: string | null;
|
|
925
|
-
};
|
|
926
|
-
type PiiDto = {
|
|
927
|
-
object: 'user_pii';
|
|
928
|
-
kind: PiiKindDto;
|
|
929
|
-
full_legal_name: string | null;
|
|
930
|
-
date_of_birth: string | null;
|
|
931
|
-
jurisdiction: PiiJurisdictionDto | null;
|
|
932
|
-
tax_id: string | null;
|
|
933
|
-
permanent_address: PiiAddressDto;
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
/** Whether the PII belongs to an individual or a company/trust entity. */
|
|
937
|
-
type PiiKind = PiiKindDto;
|
|
938
|
-
/** ISO 3166-1 alpha-2 country code (e.g. `'US'`). */
|
|
939
|
-
type Iso2CountryCode = Newtype<string, 'Iso2CountryCode'>;
|
|
940
|
-
declare const Iso2CountryCode: (value: string) => Iso2CountryCode;
|
|
941
|
-
/** Jurisdiction derived from the entity's address country. */
|
|
942
|
-
type PiiJurisdiction = {
|
|
943
|
-
iso2: Iso2CountryCode;
|
|
944
|
-
name: string | null;
|
|
945
|
-
};
|
|
946
|
-
declare const PiiJurisdiction: {
|
|
947
|
-
fromDto: (dto: PiiJurisdictionDto) => PiiJurisdiction;
|
|
948
|
-
};
|
|
949
|
-
/** Permanent address on file for the entity. */
|
|
950
|
-
type PiiAddress = {
|
|
951
|
-
street: string | null;
|
|
952
|
-
city: string | null;
|
|
953
|
-
state: string | null;
|
|
954
|
-
postalCode: string | null;
|
|
955
|
-
country: string | null;
|
|
956
|
-
};
|
|
957
|
-
declare const PiiAddress: {
|
|
958
|
-
fromDto: (dto: PiiAddressDto) => PiiAddress;
|
|
959
|
-
};
|
|
960
|
-
/**
|
|
961
|
-
* The current user's PII, used to pre-fill tax forms such as the W-8BEN.
|
|
962
|
-
* Fields the entity hasn't provided are `null`.
|
|
963
|
-
*/
|
|
964
|
-
type Pii = {
|
|
965
|
-
kind: PiiKind;
|
|
966
|
-
fullLegalName: string | null;
|
|
967
|
-
dateOfBirth: string | null;
|
|
968
|
-
jurisdiction: PiiJurisdiction | null;
|
|
969
|
-
taxId: string | null;
|
|
970
|
-
permanentAddress: PiiAddress;
|
|
971
|
-
};
|
|
972
|
-
declare const Pii: {
|
|
973
|
-
fromDto: (dto: PiiDto) => Pii;
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
type RequirementTypeDto = 'kyc_approved' | 'identity_verified' | 'proof_of_address' | 'source_of_funds' | 'external_wallet' | 'whitelisted_wallet' | 'jurisdiction' | 'accreditation' | 'document';
|
|
977
|
-
type RequirementDto = {
|
|
978
|
-
object: 'requirement';
|
|
979
|
-
id: string;
|
|
980
|
-
type: RequirementTypeDto;
|
|
981
|
-
details: Record<string, unknown> | null;
|
|
982
|
-
};
|
|
983
|
-
type RequirementStatusValueDto = 'not_started' | 'in_progress' | 'action_needed' | 'completed' | 'rejected';
|
|
984
|
-
type RequirementActionNeededReasonDto = 'kyc_not_verified' | 'update_pii_data';
|
|
985
|
-
/**
|
|
986
|
-
* Object form of a requirement status, used when the status carries extra
|
|
987
|
-
* data: the action-needed reason and/or the Sumsub flow that resolves the
|
|
988
|
-
* requirement (kyc_level + kyc_reset, forwarded to the kyc-token endpoint).
|
|
989
|
-
*/
|
|
990
|
-
type RequirementStatusObjectDto = {
|
|
991
|
-
status: RequirementStatusValueDto;
|
|
992
|
-
action?: RequirementActionNeededReasonDto;
|
|
993
|
-
kyc_level?: string;
|
|
994
|
-
kyc_reset?: boolean;
|
|
995
|
-
};
|
|
996
|
-
type RequirementStatusesDto = {
|
|
997
|
-
object: 'requirement_statuses';
|
|
998
|
-
offer_id: string;
|
|
999
|
-
statuses: Record<string, RequirementStatusValueDto | RequirementStatusObjectDto>;
|
|
1000
|
-
};
|
|
1001
|
-
|
|
1002
|
-
type RequirementId = Newtype<string, 'RequirementId'>;
|
|
1003
|
-
declare const RequirementId: (value: string) => RequirementId;
|
|
1004
|
-
type RequirementType = RequirementTypeDto;
|
|
1005
|
-
type RequirementStatusValue = RequirementStatusValueDto;
|
|
1006
|
-
type RequirementActionNeededReason = RequirementActionNeededReasonDto;
|
|
1007
|
-
type Requirement = {
|
|
1008
|
-
id: RequirementId;
|
|
1009
|
-
type: RequirementType;
|
|
1010
|
-
details: Record<string, unknown> | null;
|
|
1011
|
-
};
|
|
1012
|
-
declare const Requirement: {
|
|
1013
|
-
fromDto: (dto: RequirementDto) => Requirement;
|
|
1014
|
-
};
|
|
1015
|
-
type RequirementStatusInfo = {
|
|
1016
|
-
id: RequirementId;
|
|
1017
|
-
status: RequirementStatusValue;
|
|
1018
|
-
/** Why the requirement needs action (KYC-backed requirements only). */
|
|
1019
|
-
action: RequirementActionNeededReason | null;
|
|
1020
|
-
/**
|
|
1021
|
-
* The Sumsub verification level that resolves this requirement, prescribed
|
|
1022
|
-
* by the backend. Present exactly when an inline Sumsub flow can be started.
|
|
1023
|
-
*/
|
|
1024
|
-
kycLevel?: KycLevelName;
|
|
1025
|
-
/**
|
|
1026
|
-
* Whether the Sumsub applicant must be reset before starting the flow
|
|
1027
|
-
* (redoing an already-approved level, e.g. to update stale PII). Forward to
|
|
1028
|
-
* the kyc-token request as-is.
|
|
1029
|
-
*/
|
|
1030
|
-
kycReset?: boolean;
|
|
1031
|
-
};
|
|
1032
|
-
declare const RequirementStatusInfo: {
|
|
1033
|
-
fromStatusesDto: (dto: RequirementStatusesDto) => RequirementStatusInfo[];
|
|
1034
|
-
};
|
|
1035
|
-
|
|
1036
|
-
export { type AllowWalletParams as $, AssetId as A, Bps as B, type CoinListSwapNamespace as C, type DocumentType as D, EvmWalletAddress as E, type Erc20Asset as F, AssetDecimals as G, StablecoinSymbol as H, OAuthSession as I, ClientCredentialsOAuth as J, type KycLevelName as K, ClientSecret as L, AssetSymbol as M, type Newtype as N, OfferId as O, Participation as P, SwapStatus as Q, Requirement as R, SwapNamespaceImpl as S, TokenSaleNamespaceImpl as T, type Uint256 as U, KnownAssetSymbol as V, WalletOwnershipChallenge as W, ClientId as X, RedirectUri as Y, CodeChallenge as Z, PKCEState as _, type EthereumChain as a, AllowWalletResponse as a0, Asset as a1, AssetCode as a2, Blockchain as a3, CreateParticipationParams as a4, Cursor as a5, type DocumentFormType as a6, type DocumentSubmissionStatus as a7, Erc20NamespaceImpl as a8, FaqItem as a9, TermItem as aA, TokenAllowance as aB, TokenBalance as aC, WalletAddress as aD, type WalletProtocol as aE, assertUint256 as aF, fetchAllPages as aG, type GetSwapAuthorizationParams as aa, type GetSwapPreviewParams as ab, type GetTokenAllowanceParams as ac, type GetTokenBalanceParams as ad, HexEncodedTransactionData as ae, Iso2CountryCode as af, Link as ag, MAX_UINT_256 as ah, Milestone as ai, OAuthRefreshToken as aj, OfferOption as ak, OfferOptionSlug as al, OfferSlug as am, type OfferType as an, type PaginatedResponseDto as ao, ParticipationId as ap, type ParticipationStatus as aq, ParticipationsPaginationParams as ar, PiiAddress as as, PiiJurisdiction as at, type PiiKind as au, type RequirementActionNeededReason as av, RequirementId as aw, SwapAuthorization as ax, type SwapContractRef as ay, SwapPreview as az, EvmContractAddress as b, type CoinListErc20Namespace as c, BlockchainAmount as d, type SharedNamespaceContext as e, type CoinListTokenSaleNamespace as f, OfferOptionId as g, AuthorizationCode as h, CodeVerifier as i, type Config as j, type OAuthAccessToken as k, Offer as l, PaginationParams as m, PaginatedResponse as n, OfferDetail as o, CreateWalletOwnershipChallengeParams as p, ConnectExternalWalletParams as q, OfferOptionAddress as r, OfferOptionAddressId as s, RequirementStatusInfo as t, Pii as u, DocumentSubmission as v, KycToken as w, type WalletChallengeType as x, type RequirementType as y, type RequirementStatusValue as z };
|