@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.8a0d02a
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/dist/{chunk-DCW7NQXH.js → chunk-3WW5FLT7.js} +52 -19
- package/dist/chunk-3WW5FLT7.js.map +1 -0
- package/dist/{chunk-MOE5S6CE.js → chunk-C6GF7MDF.js} +915 -458
- package/dist/chunk-C6GF7MDF.js.map +1 -0
- package/dist/{chunk-VH34YC3Q.js → chunk-IZJ4JSSC.js} +78 -4
- package/dist/chunk-IZJ4JSSC.js.map +1 -0
- package/dist/client/index.cjs +12103 -8452
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1640 -37
- package/dist/client/index.d.ts +1640 -37
- package/dist/client/index.js +7923 -4800
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +789 -142
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +69 -41
- package/dist/server/index.d.ts +69 -41
- package/dist/server/index.js +323 -65
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → time-CVZpAkGY.d.cts} +878 -192
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → time-CVZpAkGY.d.ts} +878 -192
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +74 -8
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-bR14QehS.d.cts} +74 -8
- package/dist/universal/index.cjs +982 -448
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +91 -5
- package/dist/universal/index.d.ts +91 -5
- package/dist/universal/index.js +44 -2
- package/package.json +1 -1
- package/dist/chunk-DCW7NQXH.js.map +0 -1
- package/dist/chunk-MOE5S6CE.js.map +0 -1
- package/dist/chunk-VH34YC3Q.js.map +0 -1
|
@@ -412,7 +412,7 @@ type PinoLoggerOptions = {
|
|
|
412
412
|
* - an operation, a flow, a hook - is a {@link LogBinding} and appears as its
|
|
413
413
|
* own field.
|
|
414
414
|
*/
|
|
415
|
-
type LogScope = 'HTTP' | 'RPC' | 'AUTH' | 'OFFERS' | 'REQUIREMENTS' | 'WALLETS' | 'ERC20' | 'TOKEN_SALE' | 'SUPERSTATE' | 'ONDO' | 'TOKENS' | 'SUPPORT' | 'HOOKS';
|
|
415
|
+
type LogScope = 'HTTP' | 'RPC' | 'AUTH' | 'OFFERS' | 'REQUIREMENTS' | 'WALLETS' | 'ERC20' | 'TOKEN_SALE' | 'SUPERSTATE' | 'ONDO' | 'CENTRIFUGE' | 'TOKENS' | 'SUPPORT' | 'HOOKS';
|
|
416
416
|
/**
|
|
417
417
|
* Correlates every line one logical request produces. The first attempt, each
|
|
418
418
|
* retry, and the re-send after a session renewal all carry the same id, so a
|
|
@@ -873,6 +873,19 @@ type HttpRequestAttributes = {
|
|
|
873
873
|
/** Zero-based attempt index: 0 = first request, 1 = first retry, etc. */
|
|
874
874
|
retryAttempt?: number;
|
|
875
875
|
renewAttempted?: boolean;
|
|
876
|
+
/**
|
|
877
|
+
* `false` opts a request out of `requestRetryMiddleware`. For exchanges
|
|
878
|
+
* that must never be replayed: a refresh token is single-use, so re-sending
|
|
879
|
+
* one whose first attempt reached the server presents a token that has
|
|
880
|
+
* already been rotated away.
|
|
881
|
+
*/
|
|
882
|
+
retryable?: boolean;
|
|
883
|
+
/**
|
|
884
|
+
* The user access token `attachSessionMiddleware` put on this request, so
|
|
885
|
+
* that a 401 can say *which* token was refused. Absent when the request
|
|
886
|
+
* went out with no user token.
|
|
887
|
+
*/
|
|
888
|
+
sentWith?: OAuthAccessToken;
|
|
876
889
|
clientCredentials?: ClientCredentialsOAuth;
|
|
877
890
|
};
|
|
878
891
|
|
|
@@ -1061,6 +1074,45 @@ interface Config {
|
|
|
1061
1074
|
* See {@link RpcConfig}.
|
|
1062
1075
|
*/
|
|
1063
1076
|
readonly rpc?: RpcConfig;
|
|
1077
|
+
/**
|
|
1078
|
+
* Called when the SDK has **confirmed** that the user's CoinList session is
|
|
1079
|
+
* gone - its refresh token expired or was revoked - so you can clear your
|
|
1080
|
+
* own state and show a sign-in entry point.
|
|
1081
|
+
*
|
|
1082
|
+
* Confirmed, because the backend answers "rotated a moment ago by a
|
|
1083
|
+
* concurrent request" and "dead" identically. A single rejection is only a
|
|
1084
|
+
* suspicion: the SDK acts on it only once the same session is rejected again
|
|
1085
|
+
* after a settle window, so a lost refresh race never signs a user out.
|
|
1086
|
+
*
|
|
1087
|
+
* Each environment reports what it confirmed itself, so it fires in the
|
|
1088
|
+
* one that drove the confirmation:
|
|
1089
|
+
*
|
|
1090
|
+
* - **`CoinListClient`**: fires when the SDK moves from `'logged-in'` to
|
|
1091
|
+
* `'logged-out'` because your `getAccessToken` answered `null` (or the
|
|
1092
|
+
* very token the API just refused) twice, a second apart.
|
|
1093
|
+
* - **`CoinListServer`**: fires when the same process sees a refresh token
|
|
1094
|
+
* rejected twice, 5 to 60 seconds apart, or an expired session that
|
|
1095
|
+
* carries no refresh token. The SDK clears the session from your
|
|
1096
|
+
* `SessionStore` just before. The browser's confirmation, through your
|
|
1097
|
+
* `getAccessToken` endpoint, comes a second after the first rejection, so
|
|
1098
|
+
* it does not reach this verdict: when the browser drives renewal, expect
|
|
1099
|
+
* the `CoinListClient` callback, and this one only if a later request
|
|
1100
|
+
* presents the dead session 5 to 60 seconds on.
|
|
1101
|
+
*
|
|
1102
|
+
* It never fires on `auth.logout()`, on a 5xx, a timeout or a network
|
|
1103
|
+
* failure - those mean the SDK could not find out, not that the session
|
|
1104
|
+
* ended. Per environment it fires at most once per session, within a
|
|
1105
|
+
* 60-second memory: the server remembers a verdict for 60 seconds per
|
|
1106
|
+
* process (per JavaScript module instance, so Next.js middleware and route
|
|
1107
|
+
* handlers count separately). The same dead session presented again after
|
|
1108
|
+
* that, or to another instance, can be reported again, so make your handler
|
|
1109
|
+
* idempotent.
|
|
1110
|
+
*
|
|
1111
|
+
* It is called on the next microtask and not awaited. A rejection is
|
|
1112
|
+
* logged and dropped, so it cannot fail or delay the request that
|
|
1113
|
+
* discovered the expiry. A synchronous handler is written `async () => {}`.
|
|
1114
|
+
*/
|
|
1115
|
+
readonly onSessionExpired?: () => Promise<void>;
|
|
1064
1116
|
}
|
|
1065
1117
|
|
|
1066
1118
|
/**
|
|
@@ -1127,6 +1179,39 @@ declare class Erc20NamespaceImpl implements Erc20Namespace {
|
|
|
1127
1179
|
getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
|
|
1128
1180
|
}
|
|
1129
1181
|
|
|
1182
|
+
type GetCentrifugeVaultStatusParams = {
|
|
1183
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
1184
|
+
symbol: AssetSymbol;
|
|
1185
|
+
/**
|
|
1186
|
+
* The chain whose proxy answers. Only chains this offer has a proxy on
|
|
1187
|
+
* are accepted; the offer's `vault_contracts` lists them.
|
|
1188
|
+
*/
|
|
1189
|
+
chain: EthereumChain;
|
|
1190
|
+
};
|
|
1191
|
+
/**
|
|
1192
|
+
* One wallet on one vault: what every position read and every claim is keyed
|
|
1193
|
+
* by. There is no order id - a wallet has one pooled position per vault per
|
|
1194
|
+
* direction.
|
|
1195
|
+
*/
|
|
1196
|
+
type CentrifugeWalletParams = GetCentrifugeVaultStatusParams & {
|
|
1197
|
+
/**
|
|
1198
|
+
* The wallet whose position is read, or claimed for. A claim must then be
|
|
1199
|
+
* broadcast from this same wallet: the proxy credits the sender.
|
|
1200
|
+
*/
|
|
1201
|
+
walletAddress: EvmWalletAddress;
|
|
1202
|
+
};
|
|
1203
|
+
/**
|
|
1204
|
+
* What `POST /v1/centrifuge/vault/invest` is asked for: the wallet that will
|
|
1205
|
+
* broadcast the request and fund it, plus the deposit.
|
|
1206
|
+
*
|
|
1207
|
+
* Built once, when the user confirms an amount. Broadcasting the result places
|
|
1208
|
+
* a request; it does not buy shares.
|
|
1209
|
+
*/
|
|
1210
|
+
type BuildCentrifugeVaultBuyParams = CentrifugeWalletParams & {
|
|
1211
|
+
/** How much of the funding token to deposit, in its base units. */
|
|
1212
|
+
amount: BlockchainAmount;
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1130
1215
|
/**
|
|
1131
1216
|
* The logging surface SDK code uses. Never exported to hosts: they implement
|
|
1132
1217
|
* {@link Logger}, which is deliberately smaller.
|
|
@@ -1205,256 +1290,563 @@ type InternalDebugEvent = {
|
|
|
1205
1290
|
};
|
|
1206
1291
|
|
|
1207
1292
|
/**
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
* `coinlist::token_sale`; there is no `coinlist::sale` and no
|
|
1212
|
-
* `coinlist_token_sale`.
|
|
1293
|
+
* Wire shapes for frontline's `/v1/centrifuge/vault/*` endpoints, as published
|
|
1294
|
+
* in frontline's OpenAPI schema (ENG-1936). Every uint256 crosses as a decimal
|
|
1295
|
+
* string, every price as a decimal string, every timestamp as ISO 8601.
|
|
1213
1296
|
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1297
|
+
* **A vault deposit does not settle in the transaction that places it.** The
|
|
1298
|
+
* fund fulfils requests on its own epoch, in whole or in part, at a price set
|
|
1299
|
+
* then, and the user claims the resulting shares in a second transaction. So
|
|
1300
|
+
* every share figure before a fill is an estimate.
|
|
1301
|
+
*
|
|
1302
|
+
* The GETs are free to poll. The two POSTs return calldata to broadcast:
|
|
1303
|
+
* `invest` is signed for one wallet and called once on confirmation, `claim`
|
|
1304
|
+
* collects everything claimable and carries no amount.
|
|
1217
1305
|
*/
|
|
1218
|
-
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap';
|
|
1219
1306
|
/**
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1307
|
+
* Why a deposit cannot be placed right now. A closed set, so a client can
|
|
1308
|
+
* branch on every value. `vault_unlinked` is terminal for the offer's proxy on
|
|
1309
|
+
* that chain; the rest clear on their own or by hand.
|
|
1310
|
+
*
|
|
1311
|
+
* `below_minimum` depends on an amount, so a vault status never reports it —
|
|
1312
|
+
* see {@link CentrifugeVaultReasonDto}.
|
|
1223
1313
|
*/
|
|
1224
|
-
type
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
slug: string;
|
|
1228
|
-
ends_at: string | null;
|
|
1229
|
-
tokens: OfferTokenDto[];
|
|
1230
|
-
};
|
|
1314
|
+
type CentrifugeOrderReasonDto = 'vault_unlinked' | 'vault_halted' | 'proxy_not_permissioned' | 'price_unavailable' | 'below_minimum';
|
|
1315
|
+
/** What a vault status can report: every reason but the amount-dependent one. */
|
|
1316
|
+
type CentrifugeVaultReasonDto = Exclude<CentrifugeOrderReasonDto, 'below_minimum'>;
|
|
1231
1317
|
/**
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1318
|
+
* Where a wallet stands on a vault, derived from its amounts rather than
|
|
1319
|
+
* stored. Not a lifecycle: a new request moves any of these back to `pending`
|
|
1320
|
+
* while earlier shares stay claimed.
|
|
1234
1321
|
*/
|
|
1235
|
-
type
|
|
1236
|
-
tagline: string;
|
|
1237
|
-
banner_url: string;
|
|
1238
|
-
starts_at: string;
|
|
1239
|
-
};
|
|
1322
|
+
type CentrifugePositionStatusDto = 'none' | 'pending' | 'partially_filled' | 'filled' | 'claimed';
|
|
1240
1323
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1244
|
-
* reads them.
|
|
1324
|
+
* `GET /v1/centrifuge/vault/status?symbol&chain`. The vault's own state, read
|
|
1325
|
+
* from the chain on every call; the gate to poll, because Centrifuge announces
|
|
1326
|
+
* none of these changes.
|
|
1245
1327
|
*/
|
|
1246
|
-
type
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1328
|
+
type CentrifugeVaultStatusDto = {
|
|
1329
|
+
object: 'centrifuge_vault_status';
|
|
1330
|
+
symbol: string;
|
|
1331
|
+
chain: string;
|
|
1332
|
+
/** Centrifuge's vault, read from the proxy. Fixed for the proxy's life. */
|
|
1333
|
+
vault_address: string;
|
|
1334
|
+
/** False is terminal for this proxy: a replacement has to be deployed. */
|
|
1335
|
+
linked: boolean;
|
|
1336
|
+
/** Whether the proxy is on the share token's memberlist. */
|
|
1337
|
+
permissioned: boolean;
|
|
1338
|
+
membership_valid_until: string | null;
|
|
1339
|
+
/** Set by the proxy after a force-cancel; cleared only by hand. */
|
|
1340
|
+
halted: boolean;
|
|
1341
|
+
price_updated_at: string | null;
|
|
1342
|
+
can_order: boolean;
|
|
1343
|
+
reasons: CentrifugeVaultReasonDto[];
|
|
1344
|
+
as_of: string;
|
|
1345
|
+
};
|
|
1346
|
+
/**
|
|
1347
|
+
* What both POSTs return: calldata for the wallet to broadcast verbatim.
|
|
1348
|
+
* Unlike Ondo's, `expires_at` is nullable - a claim carries no signature, so
|
|
1349
|
+
* it is always null there.
|
|
1350
|
+
*/
|
|
1351
|
+
type CentrifugeBroadcastDto = {
|
|
1352
|
+
action: 'broadcast_transaction';
|
|
1353
|
+
/** The offer's proxy on the chain. Lower case: compare case-insensitively. */
|
|
1354
|
+
to: string;
|
|
1355
|
+
data: string;
|
|
1356
|
+
expires_at: string | null;
|
|
1250
1357
|
};
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1358
|
+
/**
|
|
1359
|
+
* `POST /v1/centrifuge/vault/invest` with `{ symbol, chain, wallet_address,
|
|
1360
|
+
* amount }`. Broadcasting it places a request in the vault's queue and buys
|
|
1361
|
+
* nothing yet.
|
|
1362
|
+
*/
|
|
1363
|
+
type CentrifugeVaultBuyDto = CentrifugeBroadcastDto & {
|
|
1364
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1365
|
+
spend_input_amount: string;
|
|
1366
|
+
spend_input_decimals: number;
|
|
1254
1367
|
};
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1368
|
+
/**
|
|
1369
|
+
* `GET /v1/centrifuge/vault/position?symbol&chain&wallet_address`. The six
|
|
1370
|
+
* amounts are independent: a wallet can hold a pending request, a claimable
|
|
1371
|
+
* balance and claimed shares at once. There is no per-fulfilment breakdown;
|
|
1372
|
+
* settlement pools every fulfilment into one rate.
|
|
1373
|
+
*/
|
|
1374
|
+
type CentrifugeVaultPositionDto = {
|
|
1375
|
+
object: 'centrifuge_vault_position';
|
|
1376
|
+
symbol: string;
|
|
1377
|
+
chain: string;
|
|
1378
|
+
wallet_address: string;
|
|
1379
|
+
status: CentrifugePositionStatusDto;
|
|
1380
|
+
/** Funding token ever requested, in `asset_decimals`. */
|
|
1381
|
+
requested: string;
|
|
1382
|
+
/** Of that, still queued. */
|
|
1383
|
+
pending: string;
|
|
1384
|
+
/** Of that, fulfilled. */
|
|
1385
|
+
filled_assets: string;
|
|
1386
|
+
/** Shares the fulfilments earned, in `share_decimals`. Held by the proxy until claimed. */
|
|
1387
|
+
earned_shares: string;
|
|
1388
|
+
claimed_shares: string;
|
|
1389
|
+
/** Non-zero means the claim endpoint will return calldata. */
|
|
1390
|
+
claimable_shares: string;
|
|
1391
|
+
/** Read from the share token; can exceed `claimed_shares`. */
|
|
1392
|
+
share_balance: string;
|
|
1393
|
+
asset_decimals: number;
|
|
1394
|
+
share_decimals: number;
|
|
1395
|
+
/** Null before the first claim. */
|
|
1396
|
+
average_price: string | null;
|
|
1397
|
+
/** Centrifuge froze the wallet on the share token; blocks claiming. */
|
|
1398
|
+
frozen: boolean;
|
|
1399
|
+
as_of: string;
|
|
1259
1400
|
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1401
|
+
/**
|
|
1402
|
+
* `POST /v1/centrifuge/vault/claim` with `{ symbol, chain, wallet_address }`.
|
|
1403
|
+
* The wallet named must be the one that broadcasts: the proxy credits the
|
|
1404
|
+
* sender.
|
|
1405
|
+
*/
|
|
1406
|
+
type CentrifugeVaultClaimDto = CentrifugeBroadcastDto & {
|
|
1407
|
+
/** A floor: a fill landing before the broadcast raises it. */
|
|
1408
|
+
claimable_shares: string;
|
|
1409
|
+
share_decimals: number;
|
|
1264
1410
|
};
|
|
1265
|
-
|
|
1266
|
-
|
|
1411
|
+
/**
|
|
1412
|
+
* `GET /v1/centrifuge/vault/redeem-position?symbol&chain&wallet_address`. The
|
|
1413
|
+
* redeem side of {@link CentrifugeVaultPositionDto}, with the units swapped:
|
|
1414
|
+
* what is queued is shares, and what a fill makes claimable is the funding
|
|
1415
|
+
* token.
|
|
1416
|
+
*
|
|
1417
|
+
* TODO(frontline, ENG-1909): guessed. Frontline publishes no redeem endpoint
|
|
1418
|
+
* yet; this mirrors the invest position field for field so the SDK can be
|
|
1419
|
+
* built against it. Replace with the published schema when it lands.
|
|
1420
|
+
*/
|
|
1421
|
+
type CentrifugeVaultRedeemPositionDto = {
|
|
1422
|
+
object: 'centrifuge_vault_redeem_position';
|
|
1423
|
+
symbol: string;
|
|
1267
1424
|
chain: string;
|
|
1268
|
-
|
|
1425
|
+
wallet_address: string;
|
|
1426
|
+
status: CentrifugePositionStatusDto;
|
|
1427
|
+
/** Shares still queued for redemption, in `share_decimals`. */
|
|
1428
|
+
pending: string;
|
|
1429
|
+
/**
|
|
1430
|
+
* Funding token a claim would pay out now, in `asset_decimals`. An
|
|
1431
|
+
* estimate: the vault holds the claimable amount in shares and prices it
|
|
1432
|
+
* at the claim.
|
|
1433
|
+
*/
|
|
1434
|
+
claimable_assets: string;
|
|
1435
|
+
asset_decimals: number;
|
|
1436
|
+
share_decimals: number;
|
|
1437
|
+
/** Centrifuge froze the wallet on the share token. */
|
|
1438
|
+
frozen: boolean;
|
|
1439
|
+
as_of: string;
|
|
1440
|
+
};
|
|
1441
|
+
/**
|
|
1442
|
+
* `POST /v1/centrifuge/vault/claim-proceeds` with `{ symbol, chain,
|
|
1443
|
+
* wallet_address }`. Collects everything claimable on the redeem side; the
|
|
1444
|
+
* proxy pays the sender.
|
|
1445
|
+
*
|
|
1446
|
+
* TODO(frontline, ENG-1909): guessed, as {@link CentrifugeVaultRedeemPositionDto}.
|
|
1447
|
+
*/
|
|
1448
|
+
type CentrifugeVaultClaimProceedsDto = CentrifugeBroadcastDto & {
|
|
1449
|
+
/** An estimate read when the calldata was built, in `asset_decimals`. */
|
|
1450
|
+
claimable_assets: string;
|
|
1451
|
+
asset_decimals: number;
|
|
1269
1452
|
};
|
|
1270
1453
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1454
|
+
/**
|
|
1455
|
+
* Which leg of a vault trade: `invest` turns the funding token into shares,
|
|
1456
|
+
* `redeem` turns shares back into the funding token. Each wallet holds one
|
|
1457
|
+
* pooled position per vault per direction, and a claim settles one of them.
|
|
1458
|
+
*/
|
|
1459
|
+
type CentrifugeClaimDirection = 'invest' | 'redeem';
|
|
1460
|
+
/**
|
|
1461
|
+
* Why a deposit cannot be placed on a vault right now. Kept verbatim from the
|
|
1462
|
+
* wire: frontline publishes it as a closed set for clients to branch on.
|
|
1463
|
+
*/
|
|
1464
|
+
type CentrifugeOrderReason = CentrifugeOrderReasonDto;
|
|
1465
|
+
/** The reasons a vault status can report - all but `below_minimum`. */
|
|
1466
|
+
type CentrifugeVaultReason = CentrifugeVaultReasonDto;
|
|
1467
|
+
/**
|
|
1468
|
+
* Where a wallet stands on a vault. Not a lifecycle - see
|
|
1469
|
+
* {@link CentrifugeVaultPosition.status}.
|
|
1470
|
+
*/
|
|
1471
|
+
type CentrifugePositionStatus = CentrifugePositionStatusDto;
|
|
1472
|
+
/**
|
|
1473
|
+
* Whether a deposit can be placed, as one union rather than the wire's
|
|
1474
|
+
* `can_order` beside `reasons`: a blocked answer always says why, and an
|
|
1475
|
+
* orderable one has nothing to say. The wire pair can contradict itself; this
|
|
1476
|
+
* cannot, because `fromDto` refuses the payloads that do.
|
|
1477
|
+
*/
|
|
1478
|
+
type CentrifugeOrderability<R extends CentrifugeOrderReason> = {
|
|
1479
|
+
type: 'orderable';
|
|
1480
|
+
} | {
|
|
1481
|
+
type: 'blocked';
|
|
1482
|
+
reasons: [R, ...R[]];
|
|
1282
1483
|
};
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1484
|
+
/**
|
|
1485
|
+
* A vault's own state, independent of any wallet or amount: the gate to poll.
|
|
1486
|
+
* Centrifuge announces none of these changes, and an unlinked vault leaves the
|
|
1487
|
+
* offer's proxy permanently dead, so a cached answer goes wrong silently.
|
|
1488
|
+
*/
|
|
1489
|
+
type CentrifugeVaultStatus = {
|
|
1490
|
+
chain: EthereumChain;
|
|
1491
|
+
symbol: AssetSymbol;
|
|
1492
|
+
/** Centrifuge's vault behind the proxy. Fixed for the proxy's life. */
|
|
1493
|
+
vaultAddress: EvmContractAddress;
|
|
1494
|
+
/**
|
|
1495
|
+
* Whether Centrifuge still links the vault to its pool. False is terminal
|
|
1496
|
+
* for this proxy: no request or claim succeeds until a new one is deployed.
|
|
1497
|
+
*/
|
|
1498
|
+
linked: boolean;
|
|
1499
|
+
/**
|
|
1500
|
+
* Whether the proxy is on the share token's memberlist. It holds shares for
|
|
1501
|
+
* every wallet, so one expired entry stops the whole offer.
|
|
1502
|
+
*/
|
|
1503
|
+
permissioned: boolean;
|
|
1504
|
+
/** Watch it: {@link permissioned} goes false the moment it passes. */
|
|
1505
|
+
membershipValidUntil: Date | null;
|
|
1506
|
+
/** The proxy halted itself after a force-cancel; cleared only by hand. */
|
|
1507
|
+
halted: boolean;
|
|
1508
|
+
/** When the vault last published a price. A stale value means the price is old. */
|
|
1509
|
+
priceUpdatedAt: Date | null;
|
|
1510
|
+
orderability: CentrifugeOrderability<CentrifugeVaultReason>;
|
|
1511
|
+
/** When the chain was read: how old everything above is. */
|
|
1512
|
+
asOf: Date;
|
|
1286
1513
|
};
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
1290
|
-
logoUrl: string | null;
|
|
1514
|
+
declare const CentrifugeVaultStatus: {
|
|
1515
|
+
fromDto: (dto: CentrifugeVaultStatusDto) => CentrifugeVaultStatus;
|
|
1291
1516
|
};
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1517
|
+
/**
|
|
1518
|
+
* What both vault transactions share: calldata to broadcast verbatim, and the
|
|
1519
|
+
* deadline on it.
|
|
1520
|
+
*/
|
|
1521
|
+
type CentrifugeVaultTransactionCore = {
|
|
1522
|
+
/** The `to` is the offer's proxy: the spender the deposit was approved to. */
|
|
1523
|
+
tx: Tx;
|
|
1524
|
+
/**
|
|
1525
|
+
* When the calldata stops being accepted, or null when it carries no
|
|
1526
|
+
* deadline - always the case for a claim, which nobody signs.
|
|
1527
|
+
*/
|
|
1528
|
+
expiresAt: Date | null;
|
|
1296
1529
|
};
|
|
1297
1530
|
/**
|
|
1298
|
-
* A
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1531
|
+
* A signed deposit request, ready to broadcast.
|
|
1532
|
+
*
|
|
1533
|
+
* **Broadcasting it buys nothing yet.** It places a request in the vault's
|
|
1534
|
+
* queue; the fund fulfils it later at a price set then, and the user comes
|
|
1535
|
+
* back to claim. Single-use: built once on confirmation, never on a timer.
|
|
1301
1536
|
*/
|
|
1302
|
-
type
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
startsAt: Date;
|
|
1537
|
+
type CentrifugeVaultBuyTransaction = CentrifugeVaultTransactionCore & {
|
|
1538
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1539
|
+
spendInputAmount: BlockchainAmount;
|
|
1306
1540
|
};
|
|
1307
|
-
declare const
|
|
1541
|
+
declare const CentrifugeVaultBuyTransaction: {
|
|
1542
|
+
fromDto: (dto: CentrifugeVaultBuyDto) => CentrifugeVaultBuyTransaction;
|
|
1543
|
+
};
|
|
1544
|
+
/**
|
|
1545
|
+
* The claim that moves fulfilled shares from the proxy to the wallet: the
|
|
1546
|
+
* second transaction every vault purchase needs. The wallet that broadcasts it
|
|
1547
|
+
* is the one credited.
|
|
1548
|
+
*/
|
|
1549
|
+
type CentrifugeVaultClaimTransaction = CentrifugeVaultTransactionCore & {
|
|
1308
1550
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1551
|
+
* Read when the calldata was built. A floor: a fill landing before the
|
|
1552
|
+
* broadcast raises it, and the claim still collects everything.
|
|
1311
1553
|
*/
|
|
1312
|
-
|
|
1554
|
+
claimableShares: BlockchainAmount;
|
|
1555
|
+
};
|
|
1556
|
+
declare const CentrifugeVaultClaimTransaction: {
|
|
1557
|
+
fromDto: (dto: CentrifugeVaultClaimDto) => CentrifugeVaultClaimTransaction;
|
|
1313
1558
|
};
|
|
1314
1559
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1560
|
+
* One wallet's standing on one vault: what it put in, what has settled, and
|
|
1561
|
+
* what it can claim. The endpoint a returning user lands on, and the one that
|
|
1562
|
+
* says whether to offer the claim.
|
|
1563
|
+
*
|
|
1564
|
+
* The amounts are independent of each other: each piece of a request settles
|
|
1565
|
+
* and is claimed on its own, so a wallet can be pending, claimable and claimed
|
|
1566
|
+
* at once. There is no per-fulfilment breakdown; settlement pools every
|
|
1567
|
+
* fulfilment into one {@link averagePrice}.
|
|
1319
1568
|
*/
|
|
1320
|
-
type
|
|
1321
|
-
|
|
1322
|
-
|
|
1569
|
+
type CentrifugeVaultPosition = {
|
|
1570
|
+
chain: EthereumChain;
|
|
1571
|
+
symbol: AssetSymbol;
|
|
1572
|
+
walletAddress: EvmWalletAddress;
|
|
1323
1573
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1574
|
+
* Derived by frontline from the amounts. Not a lifecycle: a new request
|
|
1575
|
+
* moves it back to `pending` while earlier shares stay claimed.
|
|
1576
|
+
*/
|
|
1577
|
+
status: CentrifugePositionStatus;
|
|
1578
|
+
/** Funding token ever requested. */
|
|
1579
|
+
requested: BlockchainAmount;
|
|
1580
|
+
/** Of {@link requested}, what is still queued. */
|
|
1581
|
+
pending: BlockchainAmount;
|
|
1582
|
+
/** Of {@link requested}, what has been fulfilled. */
|
|
1583
|
+
filledAssets: BlockchainAmount;
|
|
1584
|
+
/** Shares the fulfilments earned. Held by the proxy until claimed. */
|
|
1585
|
+
earnedShares: BlockchainAmount;
|
|
1586
|
+
claimedShares: BlockchainAmount;
|
|
1587
|
+
/** Non-zero means a claim will return calldata. */
|
|
1588
|
+
claimableShares: BlockchainAmount;
|
|
1589
|
+
/**
|
|
1590
|
+
* What the wallet holds on the share token. Can exceed
|
|
1591
|
+
* {@link claimedShares}: shares acquired any other way count here.
|
|
1592
|
+
*/
|
|
1593
|
+
shareBalance: BlockchainAmount;
|
|
1594
|
+
/** Pooled rate over everything claimed. Null before the first claim. */
|
|
1595
|
+
averagePrice: DecimalString | null;
|
|
1596
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1597
|
+
frozen: boolean;
|
|
1598
|
+
asOf: Date;
|
|
1599
|
+
};
|
|
1600
|
+
declare const CentrifugeVaultPosition: {
|
|
1601
|
+
fromDto: (dto: CentrifugeVaultPositionDto) => CentrifugeVaultPosition;
|
|
1602
|
+
};
|
|
1603
|
+
/**
|
|
1604
|
+
* One wallet's standing on the redeem side of a vault: shares queued to sell,
|
|
1605
|
+
* and the funding token a fill has made claimable. The mirror of
|
|
1606
|
+
* {@link CentrifugeVaultPosition}, and as independent of it: a wallet can be
|
|
1607
|
+
* investing and redeeming on the same vault at once.
|
|
1608
|
+
*
|
|
1609
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1610
|
+
* `CentrifugeVaultRedeemPositionDto`.
|
|
1611
|
+
*/
|
|
1612
|
+
type CentrifugeVaultRedeemPosition = {
|
|
1613
|
+
chain: EthereumChain;
|
|
1614
|
+
symbol: AssetSymbol;
|
|
1615
|
+
walletAddress: EvmWalletAddress;
|
|
1616
|
+
status: CentrifugePositionStatus;
|
|
1617
|
+
/** Shares still queued for redemption. */
|
|
1618
|
+
pending: BlockchainAmount;
|
|
1619
|
+
/**
|
|
1620
|
+
* Funding token a claim would pay out now. An estimate: the vault prices the
|
|
1621
|
+
* claimable shares at the claim. Non-zero means a claim returns calldata.
|
|
1330
1622
|
*/
|
|
1331
|
-
|
|
1623
|
+
claimableAssets: BlockchainAmount;
|
|
1624
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1625
|
+
frozen: boolean;
|
|
1626
|
+
asOf: Date;
|
|
1332
1627
|
};
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
role: TokenRole;
|
|
1336
|
-
chain: Chain;
|
|
1337
|
-
address: EvmContractAddress;
|
|
1628
|
+
declare const CentrifugeVaultRedeemPosition: {
|
|
1629
|
+
fromDto: (dto: CentrifugeVaultRedeemPositionDto) => CentrifugeVaultRedeemPosition;
|
|
1338
1630
|
};
|
|
1339
|
-
|
|
1340
|
-
|
|
1631
|
+
/**
|
|
1632
|
+
* One wallet's position on one leg of a vault trade, tagged with the leg. The
|
|
1633
|
+
* two legs are read from two endpoints and settle in opposite units - the
|
|
1634
|
+
* invest leg queues the funding token and pays out shares, the redeem leg the
|
|
1635
|
+
* reverse - so the tag is what says which unit each figure is in.
|
|
1636
|
+
*/
|
|
1637
|
+
type CentrifugeVaultLeg = {
|
|
1638
|
+
direction: 'invest';
|
|
1639
|
+
position: CentrifugeVaultPosition;
|
|
1640
|
+
} | {
|
|
1641
|
+
direction: 'redeem';
|
|
1642
|
+
position: CentrifugeVaultRedeemPosition;
|
|
1643
|
+
};
|
|
1644
|
+
declare const CentrifugeVaultLeg: {
|
|
1341
1645
|
/**
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1344
|
-
* plain `.map` would throw out of `Offer.fromDto` and, through
|
|
1345
|
-
* `PaginatedResponse.fromDto`, reject the whole offers page - which is how
|
|
1346
|
-
* one Base token blanked production's offers list. Dropping costs that
|
|
1347
|
-
* token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
|
|
1348
|
-
* so nobody could have looked it up anyway.
|
|
1349
|
-
*
|
|
1350
|
-
* Same shape as `TokenMetadata.fromRegistryDto`.
|
|
1646
|
+
* What a claim on the leg would collect: shares for `invest`, the funding
|
|
1647
|
+
* token for `redeem`.
|
|
1351
1648
|
*/
|
|
1352
|
-
|
|
1649
|
+
claimable: (leg: CentrifugeVaultLeg) => BlockchainAmount;
|
|
1650
|
+
/** Whether the leg has anything queued or anything ready to claim. */
|
|
1651
|
+
isActive: (leg: CentrifugeVaultLeg) => boolean;
|
|
1353
1652
|
};
|
|
1354
|
-
|
|
1355
1653
|
/**
|
|
1356
|
-
*
|
|
1654
|
+
* One wallet's position on one leg of one vault: what a claim targets. A
|
|
1655
|
+
* wallet holds at most one per direction per chain, so the three together
|
|
1656
|
+
* name it.
|
|
1657
|
+
*/
|
|
1658
|
+
type CentrifugeVaultLegId = Newtype<string, 'CentrifugeVaultLegId'>;
|
|
1659
|
+
declare const CentrifugeVaultLegId: {
|
|
1660
|
+
/** Addresses compare case-insensitively: frontline echoes them lower case. */
|
|
1661
|
+
of: (leg: CentrifugeVaultLeg) => CentrifugeVaultLegId;
|
|
1662
|
+
};
|
|
1663
|
+
/**
|
|
1664
|
+
* The claim that pays a filled redemption out in the funding token: the
|
|
1665
|
+
* second transaction every vault sale needs. The wallet that broadcasts it is
|
|
1666
|
+
* the one paid.
|
|
1357
1667
|
*
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1668
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1669
|
+
* `CentrifugeVaultClaimProceedsDto`.
|
|
1360
1670
|
*/
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1671
|
+
type CentrifugeVaultClaimProceedsTransaction = CentrifugeVaultTransactionCore & {
|
|
1672
|
+
/** An estimate read when the calldata was built; the claim pays it all. */
|
|
1673
|
+
claimableAssets: BlockchainAmount;
|
|
1674
|
+
};
|
|
1675
|
+
declare const CentrifugeVaultClaimProceedsTransaction: {
|
|
1676
|
+
fromDto: (dto: CentrifugeVaultClaimProceedsDto) => CentrifugeVaultClaimProceedsTransaction;
|
|
1677
|
+
};
|
|
1366
1678
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1679
|
+
/**
|
|
1680
|
+
* Centrifuge vault reads and claims: the vault-wide ordering gate, each
|
|
1681
|
+
* wallet's position per direction, and the calldata that claims a filled
|
|
1682
|
+
* request.
|
|
1683
|
+
*
|
|
1684
|
+
* The reads are free to poll - none spends an attestation, so a client may
|
|
1685
|
+
* call them while the user sizes a deposit or waits on a fill.
|
|
1686
|
+
*
|
|
1687
|
+
* A vault trade settles in two legs: a request the fund fills on its own
|
|
1688
|
+
* schedule, then a claim. There is no order id - each wallet has one pooled
|
|
1689
|
+
* position per vault per direction - so the claims take a wallet, not an
|
|
1690
|
+
* order, and collect everything claimable.
|
|
1691
|
+
*
|
|
1692
|
+
* The calldata builders are the exception: {@link CentrifugeNamespace.buildBuyTransaction}
|
|
1693
|
+
* and the claims are each called once, when the user confirms, and never on a
|
|
1694
|
+
* timer. Broadcasting the buy calldata places a request. It does not buy
|
|
1695
|
+
* shares.
|
|
1696
|
+
*
|
|
1697
|
+
* Every method requires `AuthState === 'logged-in'` and throws
|
|
1698
|
+
* {@link NotAuthenticatedError} otherwise.
|
|
1699
|
+
*/
|
|
1700
|
+
interface CentrifugeNamespace {
|
|
1701
|
+
getVaultStatus(params: GetCentrifugeVaultStatusParams): Promise<CentrifugeVaultStatus>;
|
|
1702
|
+
/** The wallet's invest position: funding queued, shares claimable. */
|
|
1703
|
+
getPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultPosition>;
|
|
1376
1704
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
* page holds, not where the next page starts.
|
|
1705
|
+
* The wallet's redeem position: shares queued, funding claimable.
|
|
1706
|
+
*
|
|
1707
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1381
1708
|
*/
|
|
1382
|
-
|
|
1709
|
+
getRedeemPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultRedeemPosition>;
|
|
1710
|
+
/**
|
|
1711
|
+
* Calldata claiming every claimable share. Broadcast it from
|
|
1712
|
+
* `params.walletAddress`: the proxy credits the sender.
|
|
1713
|
+
*/
|
|
1714
|
+
createClaim(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimTransaction>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Calldata paying out every claimable redemption in the funding token.
|
|
1717
|
+
* Broadcast it from `params.walletAddress`.
|
|
1718
|
+
*
|
|
1719
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1720
|
+
*/
|
|
1721
|
+
createClaimProceeds(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimProceedsTransaction>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Builds the calldata that places a deposit request.
|
|
1724
|
+
*
|
|
1725
|
+
* Called once on confirmation. The reads above are the ones a checkout polls.
|
|
1726
|
+
*/
|
|
1727
|
+
buildBuyTransaction(params: BuildCentrifugeVaultBuyParams): Promise<CentrifugeVaultBuyTransaction>;
|
|
1728
|
+
}
|
|
1729
|
+
declare class CentrifugeNamespaceImpl implements CentrifugeNamespace {
|
|
1730
|
+
private readonly ctx;
|
|
1731
|
+
protected readonly log: InternalLogger;
|
|
1732
|
+
constructor(ctx: UniversalNamespaceContext);
|
|
1733
|
+
getVaultStatus(params: GetCentrifugeVaultStatusParams): Promise<CentrifugeVaultStatus>;
|
|
1734
|
+
getPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultPosition>;
|
|
1735
|
+
getRedeemPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultRedeemPosition>;
|
|
1736
|
+
createClaim(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimTransaction>;
|
|
1737
|
+
createClaimProceeds(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimProceedsTransaction>;
|
|
1738
|
+
buildBuyTransaction(params: BuildCentrifugeVaultBuyParams): Promise<CentrifugeVaultBuyTransaction>;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
type AssetDto = {
|
|
1742
|
+
code: string;
|
|
1743
|
+
fractional_digits: number;
|
|
1744
|
+
id: string;
|
|
1745
|
+
name: string;
|
|
1383
1746
|
};
|
|
1747
|
+
|
|
1748
|
+
type AssetId = Newtype<string, 'AssetId'>;
|
|
1749
|
+
declare const AssetId: (value: string) => AssetId;
|
|
1750
|
+
type AssetCode = Newtype<string, 'AssetCode'>;
|
|
1751
|
+
declare const AssetCode: (value: string) => AssetCode;
|
|
1752
|
+
type Asset = {
|
|
1753
|
+
id: AssetId;
|
|
1754
|
+
code: AssetCode;
|
|
1755
|
+
name: string;
|
|
1756
|
+
fractionalDigits: number;
|
|
1757
|
+
};
|
|
1758
|
+
declare const Asset: {
|
|
1759
|
+
fromDto: (dto: AssetDto) => Asset;
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1384
1762
|
/**
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1763
|
+
* The product an offer is checked out through. The backend sends one compound
|
|
1764
|
+
* `{supplier}::{saleType}` string, verbatim as spelled below: a double colon
|
|
1765
|
+
* between the two halves, `snake_case` within each. CoinList's token sale is
|
|
1766
|
+
* `coinlist::token_sale`; there is no `coinlist::sale` and no
|
|
1767
|
+
* `coinlist_token_sale`.
|
|
1768
|
+
*
|
|
1769
|
+
* Kept flat rather than split into a supplier and a sale type, because a flat
|
|
1770
|
+
* union makes a `switch` over it exhaustive: adding a provider without
|
|
1771
|
+
* handling it becomes a compile error.
|
|
1388
1772
|
*/
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1773
|
+
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap' | 'centrifuge::vault';
|
|
1774
|
+
/**
|
|
1775
|
+
* One variant per {@link OfferTypeDto}, mirroring frontline#1365, which keys
|
|
1776
|
+
* `GET /v1/offers` on `type`. Read `type` first: it decides which of the
|
|
1777
|
+
* fields below mean anything.
|
|
1778
|
+
*/
|
|
1779
|
+
type OfferDto = CoinListTokenSaleOfferDto | SuperstateSwapOfferDto | OndoSwapOfferDto | CentrifugeVaultOfferDto;
|
|
1780
|
+
type OfferBaseDto = {
|
|
1781
|
+
id: string;
|
|
1782
|
+
slug: string;
|
|
1783
|
+
ends_at: string | null;
|
|
1784
|
+
tokens: OfferTokenDto[];
|
|
1785
|
+
};
|
|
1786
|
+
/**
|
|
1787
|
+
* A curated sale window and the hand-authored copy that goes with it. Required
|
|
1788
|
+
* on every variant that runs such a campaign, which is every one but Ondo.
|
|
1789
|
+
*/
|
|
1790
|
+
type OfferEditorialDto = {
|
|
1791
|
+
tagline: string;
|
|
1792
|
+
banner_url: string;
|
|
1793
|
+
starts_at: string;
|
|
1794
|
+
};
|
|
1795
|
+
/**
|
|
1796
|
+
* What an Ondo swap or a Centrifuge vault sends in place of
|
|
1797
|
+
* {@link OfferEditorialDto}. Neither runs a campaign, so the keys arrive as
|
|
1798
|
+
* `null` and carry nothing, and the backend may stop sending them at all.
|
|
1799
|
+
* Declared so a fixture can describe the real payload; no `fromDto` reads
|
|
1800
|
+
* them.
|
|
1801
|
+
*/
|
|
1802
|
+
type OfferNoEditorialDto = {
|
|
1803
|
+
tagline?: null;
|
|
1804
|
+
banner_url?: null;
|
|
1805
|
+
starts_at?: null;
|
|
1396
1806
|
};
|
|
1397
|
-
|
|
1398
|
-
type
|
|
1399
|
-
|
|
1400
|
-
fractional_digits: number;
|
|
1401
|
-
id: string;
|
|
1402
|
-
name: string;
|
|
1807
|
+
type CoinListTokenSaleOfferDto = OfferBaseDto & OfferEditorialDto & {
|
|
1808
|
+
type: 'coinlist::token_sale';
|
|
1809
|
+
logo_url: string;
|
|
1403
1810
|
};
|
|
1404
|
-
|
|
1405
|
-
type
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
declare const AssetCode: (value: string) => AssetCode;
|
|
1409
|
-
type Asset = {
|
|
1410
|
-
id: AssetId;
|
|
1411
|
-
code: AssetCode;
|
|
1412
|
-
name: string;
|
|
1413
|
-
fractionalDigits: number;
|
|
1811
|
+
type SuperstateSwapOfferDto = OfferBaseDto & OfferEditorialDto & {
|
|
1812
|
+
type: 'superstate::swap';
|
|
1813
|
+
/** Publishing a swap does not require anyone to upload artwork for it. */
|
|
1814
|
+
logo_url: string | null;
|
|
1414
1815
|
};
|
|
1415
|
-
|
|
1416
|
-
|
|
1816
|
+
type OndoSwapOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
1817
|
+
type: 'ondo::swap';
|
|
1818
|
+
/** Publishing a swap does not require anyone to upload artwork for it. */
|
|
1819
|
+
logo_url: string | null;
|
|
1417
1820
|
};
|
|
1418
|
-
|
|
1419
|
-
type
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
id: string;
|
|
1423
|
-
offer_id: string;
|
|
1424
|
-
offer_option_id: string;
|
|
1425
|
-
status: ParticipationStatusDto;
|
|
1426
|
-
amount: string;
|
|
1427
|
-
amount_string: string;
|
|
1428
|
-
asset: AssetDto;
|
|
1429
|
-
chain: string;
|
|
1430
|
-
inserted_at: string | null | undefined;
|
|
1431
|
-
updated_at: string | null | undefined;
|
|
1432
|
-
wallet_address: string | null | undefined;
|
|
1821
|
+
type CentrifugeVaultOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
1822
|
+
type: 'centrifuge::vault';
|
|
1823
|
+
/** Publishing a vault does not require anyone to upload artwork for it. */
|
|
1824
|
+
logo_url: string | null;
|
|
1433
1825
|
};
|
|
1434
|
-
type
|
|
1435
|
-
|
|
1436
|
-
|
|
1826
|
+
type OfferTokenDto = {
|
|
1827
|
+
/**
|
|
1828
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for
|
|
1829
|
+
* deposits, as `swap` is the token a swap offer trades into.
|
|
1830
|
+
*/
|
|
1831
|
+
role: 'funding' | 'distribution' | 'swap' | 'vault';
|
|
1437
1832
|
chain: string;
|
|
1438
|
-
|
|
1439
|
-
amount: string;
|
|
1440
|
-
asset_id: string;
|
|
1441
|
-
approval_transaction_hash: string | null | undefined;
|
|
1833
|
+
address: string;
|
|
1442
1834
|
};
|
|
1443
1835
|
|
|
1444
1836
|
/**
|
|
1445
1837
|
* One variant per `OfferTypeDto`, the same split as `OfferDto` with what
|
|
1446
1838
|
* `GET /v1/offers/:id` adds on top. Read `type` first.
|
|
1447
1839
|
*/
|
|
1448
|
-
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto;
|
|
1449
|
-
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1840
|
+
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto | CentrifugeVaultOfferDetailDto;
|
|
1841
|
+
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1450
1842
|
type: 'coinlist::token_sale';
|
|
1451
1843
|
logo_url: string;
|
|
1452
1844
|
};
|
|
1453
|
-
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1845
|
+
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1454
1846
|
type: 'superstate::swap';
|
|
1455
1847
|
logo_url: string | null;
|
|
1456
1848
|
};
|
|
1457
|
-
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
1849
|
+
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoVaultContractsDto & {
|
|
1458
1850
|
type: 'ondo::swap';
|
|
1459
1851
|
logo_url: string | null;
|
|
1460
1852
|
/**
|
|
@@ -1463,6 +1855,19 @@ type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
|
1463
1855
|
*/
|
|
1464
1856
|
swap_contracts: OfferDetailSwapContractDto[];
|
|
1465
1857
|
};
|
|
1858
|
+
type CentrifugeVaultOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1859
|
+
type: 'centrifuge::vault';
|
|
1860
|
+
logo_url: string | null;
|
|
1861
|
+
/**
|
|
1862
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
1863
|
+
* request goes through. `[]` is an answer - "deposits nowhere", which is
|
|
1864
|
+
* every vault until a proxy is deployed - and a missing key is not.
|
|
1865
|
+
*/
|
|
1866
|
+
vault_contracts: OfferDetailVaultContractDto[];
|
|
1867
|
+
};
|
|
1868
|
+
type OfferDetailNoVaultContractsDto = {
|
|
1869
|
+
vault_contracts?: OfferDetailVaultContractDto[];
|
|
1870
|
+
};
|
|
1466
1871
|
/**
|
|
1467
1872
|
* An offer that does not settle through a CoinList swap contract sends `[]`
|
|
1468
1873
|
* or no key at all, and either way there is nothing to read. Declared so a
|
|
@@ -1529,6 +1934,104 @@ type OfferDetailSwapContractDto = {
|
|
|
1529
1934
|
chain: string;
|
|
1530
1935
|
address: string;
|
|
1531
1936
|
};
|
|
1937
|
+
type OfferDetailVaultContractDto = {
|
|
1938
|
+
chain: string;
|
|
1939
|
+
address: string;
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
type OfferId = Newtype<string, 'OfferId'>;
|
|
1943
|
+
declare const OfferId: (value: string) => OfferId;
|
|
1944
|
+
type OfferSlug = Newtype<string, 'OfferSlug'>;
|
|
1945
|
+
declare const OfferSlug: (value: string) => OfferSlug;
|
|
1946
|
+
type OfferType = OfferTypeDto;
|
|
1947
|
+
declare const isOfferType: (value: string) => value is OfferType;
|
|
1948
|
+
type OfferBase = {
|
|
1949
|
+
id: OfferId;
|
|
1950
|
+
slug: OfferSlug;
|
|
1951
|
+
endsAt: Date | null;
|
|
1952
|
+
tokens: OfferToken[];
|
|
1953
|
+
};
|
|
1954
|
+
type CoinListTokenSaleOffer = OfferBase & OfferEditorial & {
|
|
1955
|
+
type: 'coinlist::token_sale';
|
|
1956
|
+
logoUrl: string;
|
|
1957
|
+
};
|
|
1958
|
+
type SuperstateSwapOffer = OfferBase & OfferEditorial & {
|
|
1959
|
+
type: 'superstate::swap';
|
|
1960
|
+
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
1961
|
+
logoUrl: string | null;
|
|
1962
|
+
};
|
|
1963
|
+
type OndoSwapOffer = OfferBase & {
|
|
1964
|
+
type: 'ondo::swap';
|
|
1965
|
+
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
1966
|
+
logoUrl: string | null;
|
|
1967
|
+
};
|
|
1968
|
+
type CentrifugeVaultOffer = OfferBase & {
|
|
1969
|
+
type: 'centrifuge::vault';
|
|
1970
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
1971
|
+
logoUrl: string | null;
|
|
1972
|
+
};
|
|
1973
|
+
/**
|
|
1974
|
+
* A curated sale window and the hand-authored copy that goes with it. Every
|
|
1975
|
+
* variant that runs such a campaign carries all three, validated; an Ondo swap
|
|
1976
|
+
* trades continuously and a Centrifuge vault takes deposits continuously, so
|
|
1977
|
+
* neither runs one and neither carries any.
|
|
1978
|
+
*/
|
|
1979
|
+
type OfferEditorial = {
|
|
1980
|
+
tagline: string;
|
|
1981
|
+
bannerUrl: string;
|
|
1982
|
+
startsAt: Date;
|
|
1983
|
+
};
|
|
1984
|
+
declare const OfferEditorial: {
|
|
1985
|
+
/**
|
|
1986
|
+
* `model` prefixes the field in the error (`'Offer'`, `'OfferDetail'`), so
|
|
1987
|
+
* the same three checks name the payload that failed them.
|
|
1988
|
+
*/
|
|
1989
|
+
fromDto: (dto: OfferEditorialDto, model: string) => OfferEditorial;
|
|
1990
|
+
};
|
|
1991
|
+
/**
|
|
1992
|
+
* An offer as `GET /v1/offers` lists it: a union on {@link OfferType}, each
|
|
1993
|
+
* variant carrying only the fields that mean something for it. Narrow on
|
|
1994
|
+
* `type` before reading anything beyond {@link OfferBase} - an Ondo swap has
|
|
1995
|
+
* no `startsAt` to read, and the compiler says so.
|
|
1996
|
+
*/
|
|
1997
|
+
type Offer = CoinListTokenSaleOffer | SuperstateSwapOffer | OndoSwapOffer | CentrifugeVaultOffer;
|
|
1998
|
+
declare const Offer: {
|
|
1999
|
+
fromDto: (dto: OfferDto) => Offer;
|
|
2000
|
+
/**
|
|
2001
|
+
* Maps a page of offers, dropping every offer whose `type` this SDK does not
|
|
2002
|
+
* name. The same reasoning as {@link OfferToken.listFromDto}: a plain `.map`
|
|
2003
|
+
* would throw out of `fromDto` and, through `PaginatedResponse.fromDto`,
|
|
2004
|
+
* reject the whole page, so one offer of an unknown type would blank the
|
|
2005
|
+
* grid for every offer beside it. A single offer fetched by id still
|
|
2006
|
+
* throws, because there is nothing beside it to keep.
|
|
2007
|
+
*/
|
|
2008
|
+
listFromDto: (dtos: OfferDto[]) => Offer[];
|
|
2009
|
+
};
|
|
2010
|
+
/**
|
|
2011
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for deposits,
|
|
2012
|
+
* as `swap` is the token a swap offer trades into.
|
|
2013
|
+
*/
|
|
2014
|
+
type TokenRole = 'funding' | 'distribution' | 'swap' | 'vault';
|
|
2015
|
+
type OfferToken = {
|
|
2016
|
+
role: TokenRole;
|
|
2017
|
+
chain: Chain;
|
|
2018
|
+
address: EvmContractAddress;
|
|
2019
|
+
};
|
|
2020
|
+
declare const OfferToken: {
|
|
2021
|
+
fromDto: (dto: OfferTokenDto) => OfferToken;
|
|
2022
|
+
/**
|
|
2023
|
+
* Maps an offer's token list, dropping every token on a chain this SDK does
|
|
2024
|
+
* not name. Frontline's chain registry runs ahead of {@link Chain}, and a
|
|
2025
|
+
* plain `.map` would throw out of `Offer.fromDto` and, through
|
|
2026
|
+
* `PaginatedResponse.fromDto`, reject the whole offers page - which is how
|
|
2027
|
+
* one Base token blanked production's offers list. Dropping costs that
|
|
2028
|
+
* token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
|
|
2029
|
+
* so nobody could have looked it up anyway.
|
|
2030
|
+
*
|
|
2031
|
+
* Same shape as `TokenMetadata.fromRegistryDto`.
|
|
2032
|
+
*/
|
|
2033
|
+
listFromDto: (dtos: OfferTokenDto[]) => OfferToken[];
|
|
2034
|
+
};
|
|
1532
2035
|
|
|
1533
2036
|
type Ticker = Newtype<string, 'Ticker'>;
|
|
1534
2037
|
declare const Ticker: (value: string) => Ticker;
|
|
@@ -1547,6 +2050,28 @@ type Isin = Newtype<string, 'Isin'>;
|
|
|
1547
2050
|
declare const Isin: (value: string) => Isin;
|
|
1548
2051
|
type OrderBookSide = 'buy' | 'sell';
|
|
1549
2052
|
|
|
2053
|
+
/** The `type` of every {@link AsyncOfferDetail}. */
|
|
2054
|
+
type AsyncOfferType = AsyncOfferDetail['type'];
|
|
2055
|
+
/**
|
|
2056
|
+
* An offer whose trade settles later: the user places a request, the fund
|
|
2057
|
+
* fills it on its own schedule, and the user comes back to claim the result.
|
|
2058
|
+
* Only these have a second leg for `ClaimContainer` to show.
|
|
2059
|
+
*
|
|
2060
|
+
* A subset of {@link OfferDetail} picked by `type`, so it narrows like any
|
|
2061
|
+
* other variant and a new async provider is one more member here.
|
|
2062
|
+
*/
|
|
2063
|
+
type AsyncOfferDetail = CentrifugeVaultOfferDetail;
|
|
2064
|
+
declare const AsyncOfferDetail: {
|
|
2065
|
+
/**
|
|
2066
|
+
* Narrows an offer fetched generically, e.g. on an offer page, to one with
|
|
2067
|
+
* something to claim.
|
|
2068
|
+
*
|
|
2069
|
+
* An exhaustive `switch` rather than a list of async types, so a new offer
|
|
2070
|
+
* type is a compile error here until someone decides whether it settles
|
|
2071
|
+
* later.
|
|
2072
|
+
*/
|
|
2073
|
+
is: (offer: OfferDetail) => offer is AsyncOfferDetail;
|
|
2074
|
+
};
|
|
1550
2075
|
type CoinListTokenSaleOfferDetail = OfferDetailBase & OfferEditorial & {
|
|
1551
2076
|
type: 'coinlist::token_sale';
|
|
1552
2077
|
logoUrl: string;
|
|
@@ -1566,6 +2091,16 @@ type OndoSwapOfferDetail = OfferDetailBase & {
|
|
|
1566
2091
|
*/
|
|
1567
2092
|
swapContracts: OfferSwapContract[];
|
|
1568
2093
|
};
|
|
2094
|
+
type CentrifugeVaultOfferDetail = OfferDetailBase & {
|
|
2095
|
+
type: 'centrifuge::vault';
|
|
2096
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
2097
|
+
logoUrl: string | null;
|
|
2098
|
+
/**
|
|
2099
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
2100
|
+
* request goes through. Empty means it takes deposits nowhere yet.
|
|
2101
|
+
*/
|
|
2102
|
+
vaultContracts: OfferVaultContract[];
|
|
2103
|
+
};
|
|
1569
2104
|
type OfferDetailBase = {
|
|
1570
2105
|
id: OfferId;
|
|
1571
2106
|
slug: OfferSlug;
|
|
@@ -1643,13 +2178,38 @@ type OfferSwapContract = {
|
|
|
1643
2178
|
declare const OfferSwapContract: {
|
|
1644
2179
|
fromDto: (dto: OfferDetailSwapContractDto) => OfferSwapContract;
|
|
1645
2180
|
};
|
|
2181
|
+
/**
|
|
2182
|
+
* A chain a Centrifuge vault takes deposits on, with the CoinList proxy the
|
|
2183
|
+
* request goes through. Not a token, so the token registry knows nothing about
|
|
2184
|
+
* it: it is the spender the user approves the funding token to, and the `to`
|
|
2185
|
+
* the buy and claim transactions are sent to.
|
|
2186
|
+
*
|
|
2187
|
+
* Its own type rather than an {@link OfferSwapContract}, although the shape is
|
|
2188
|
+
* the same, because the meaning is not: a swap contract serves every Ondo
|
|
2189
|
+
* asset on its chain, while a proxy belongs to one offer on one chain, so the
|
|
2190
|
+
* same chain carries a different address on every vault.
|
|
2191
|
+
*/
|
|
2192
|
+
type OfferVaultContract = {
|
|
2193
|
+
chain: Chain;
|
|
2194
|
+
address: EvmContractAddress;
|
|
2195
|
+
};
|
|
2196
|
+
declare const OfferVaultContract: {
|
|
2197
|
+
fromDto: (dto: OfferDetailVaultContractDto) => OfferVaultContract;
|
|
2198
|
+
/**
|
|
2199
|
+
* Drops every proxy on a chain this SDK does not name, as
|
|
2200
|
+
* `OfferToken.listFromDto` does: frontline publishes the full offer-token
|
|
2201
|
+
* chain list, which runs ahead of {@link Chain}, and one unmodelled chain
|
|
2202
|
+
* should not throw away the proxies the SDK can use.
|
|
2203
|
+
*/
|
|
2204
|
+
listFromDto: (dtos: OfferDetailVaultContractDto[]) => OfferVaultContract[];
|
|
2205
|
+
};
|
|
1646
2206
|
/**
|
|
1647
2207
|
* An offer as `GET /v1/offers/:id` serves it: the same union on `type` as
|
|
1648
2208
|
* {@link Offer}, each variant carrying only the fields that mean something
|
|
1649
2209
|
* for it. Narrow on `type` before reading anything beyond
|
|
1650
2210
|
* {@link OfferDetailBase}.
|
|
1651
2211
|
*/
|
|
1652
|
-
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail;
|
|
2212
|
+
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail | CentrifugeVaultOfferDetail;
|
|
1653
2213
|
declare const OfferDetail: {
|
|
1654
2214
|
fromDto: (dto: OfferDetailDto) => OfferDetail;
|
|
1655
2215
|
};
|
|
@@ -1696,6 +2256,74 @@ declare const Milestone: {
|
|
|
1696
2256
|
fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
|
|
1697
2257
|
};
|
|
1698
2258
|
|
|
2259
|
+
/**
|
|
2260
|
+
* The cursor-paginated envelope every list endpoint returns.
|
|
2261
|
+
*
|
|
2262
|
+
* Generic in its item type, so each resource pairs it with its own item DTO
|
|
2263
|
+
* rather than declaring an envelope of its own.
|
|
2264
|
+
*/
|
|
2265
|
+
interface PaginatedResponseDto<T> {
|
|
2266
|
+
data: T[];
|
|
2267
|
+
starting_after?: string;
|
|
2268
|
+
starting_before?: string;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
type Cursor = Newtype<string, 'Cursor'>;
|
|
2272
|
+
declare const Cursor: (value: string) => Cursor;
|
|
2273
|
+
interface PaginatedResponse<T> {
|
|
2274
|
+
data: T[];
|
|
2275
|
+
startingAfter: Cursor | null;
|
|
2276
|
+
startingBefore: Cursor | null;
|
|
2277
|
+
}
|
|
2278
|
+
declare const PaginatedResponse: {
|
|
2279
|
+
fromDto: <A, B>(dto: PaginatedResponseDto<A>, itemMapper: (item: A) => B) => PaginatedResponse<B>;
|
|
2280
|
+
/**
|
|
2281
|
+
* For a mapper that decides the page as a whole - one that drops items it
|
|
2282
|
+
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
2283
|
+
* cursors are the wire's either way: dropping an item changes what the
|
|
2284
|
+
* page holds, not where the next page starts.
|
|
2285
|
+
*/
|
|
2286
|
+
fromDtoPage: <A, B>(dto: PaginatedResponseDto<A>, pageMapper: (items: A[]) => B[]) => PaginatedResponse<B>;
|
|
2287
|
+
};
|
|
2288
|
+
/**
|
|
2289
|
+
* Cursor-based pagination input used when requesting paginated API resources.
|
|
2290
|
+
* Set `after` or `before` to navigate relative to a known cursor, and `limit`
|
|
2291
|
+
* to control the maximum number of returned items.
|
|
2292
|
+
*/
|
|
2293
|
+
interface PaginationParams {
|
|
2294
|
+
before?: Cursor;
|
|
2295
|
+
after?: Cursor;
|
|
2296
|
+
limit?: number;
|
|
2297
|
+
}
|
|
2298
|
+
declare const PaginationParams: {
|
|
2299
|
+
toQueryParams: (params: PaginationParams) => Record<string, QueryParamValue>;
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
type ParticipationStatusDto = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
|
|
2303
|
+
type ParticipationDto = {
|
|
2304
|
+
object: 'participation';
|
|
2305
|
+
id: string;
|
|
2306
|
+
offer_id: string;
|
|
2307
|
+
offer_option_id: string;
|
|
2308
|
+
status: ParticipationStatusDto;
|
|
2309
|
+
amount: string;
|
|
2310
|
+
amount_string: string;
|
|
2311
|
+
asset: AssetDto;
|
|
2312
|
+
chain: string;
|
|
2313
|
+
inserted_at: string | null | undefined;
|
|
2314
|
+
updated_at: string | null | undefined;
|
|
2315
|
+
wallet_address: string | null | undefined;
|
|
2316
|
+
};
|
|
2317
|
+
type CreateParticipationDto = {
|
|
2318
|
+
offer_id: string;
|
|
2319
|
+
offer_option_id: string;
|
|
2320
|
+
chain: string;
|
|
2321
|
+
wallet_address: string;
|
|
2322
|
+
amount: string;
|
|
2323
|
+
asset_id: string;
|
|
2324
|
+
approval_transaction_hash: string | null | undefined;
|
|
2325
|
+
};
|
|
2326
|
+
|
|
1699
2327
|
/** Unique identifier for a participation. */
|
|
1700
2328
|
type ParticipationId = Newtype<string, 'ParticipationId'>;
|
|
1701
2329
|
/** Casts a string into a typed {@link ParticipationId}. */
|
|
@@ -2436,6 +3064,17 @@ declare const OndoSellTransaction: {
|
|
|
2436
3064
|
*/
|
|
2437
3065
|
interface OndoNamespace {
|
|
2438
3066
|
getTradingStatus(params: GetOndoTradingStatusParams): Promise<OndoTradingStatus>;
|
|
3067
|
+
/**
|
|
3068
|
+
* An indicative price for `params`' size, from Ondo's live market.
|
|
3069
|
+
*
|
|
3070
|
+
* Ondo refuses to quote while the market is closed or paused, or the asset
|
|
3071
|
+
* is paused or closed for the session - including for about a minute at
|
|
3072
|
+
* every US session change, when `getTradingStatus` may still have reported
|
|
3073
|
+
* the asset tradable. The request then rejects with a 409 carrying
|
|
3074
|
+
* `code: "not_tradable"`; tell it apart from a failure with
|
|
3075
|
+
* {@link isOndoNotTradableError}. Retrying before the market opens fails the
|
|
3076
|
+
* same way.
|
|
3077
|
+
*/
|
|
2439
3078
|
getQuote(params: GetOndoQuoteParams): Promise<OndoQuote>;
|
|
2440
3079
|
/**
|
|
2441
3080
|
* Builds a purchase for a specific wallet and deposit: spends an attestation
|
|
@@ -3298,4 +3937,51 @@ declare class TokensNamespaceImpl implements TokensNamespace {
|
|
|
3298
3937
|
list(chain?: EthereumChain): Promise<TokenMetadata[]>;
|
|
3299
3938
|
}
|
|
3300
3939
|
|
|
3301
|
-
|
|
3940
|
+
/**
|
|
3941
|
+
* An instant: milliseconds since the Unix epoch, as `Date.now()` reads it.
|
|
3942
|
+
* Distinct from {@link Millis}, a duration, so an instant cannot be passed
|
|
3943
|
+
* where a timeout is expected or the other way round.
|
|
3944
|
+
*/
|
|
3945
|
+
type EpochMillis = Newtype<number, 'EpochMillis'>;
|
|
3946
|
+
declare const EpochMillis: {
|
|
3947
|
+
/**
|
|
3948
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
3949
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
3950
|
+
*/
|
|
3951
|
+
of: (value: number) => EpochMillis;
|
|
3952
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
3953
|
+
now: () => EpochMillis;
|
|
3954
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
3955
|
+
fromDate: (date: Date) => EpochMillis;
|
|
3956
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
3957
|
+
elapsed: (from: EpochMillis, to: EpochMillis) => Millis;
|
|
3958
|
+
plus: (at: EpochMillis, duration: Millis) => EpochMillis;
|
|
3959
|
+
};
|
|
3960
|
+
/**
|
|
3961
|
+
* A duration in milliseconds. May be negative: the gap between two instants
|
|
3962
|
+
* read off a wall clock that stepped back in between.
|
|
3963
|
+
*/
|
|
3964
|
+
type Millis = Newtype<number, 'Millis'>;
|
|
3965
|
+
declare const Millis: {
|
|
3966
|
+
of: (value: number) => Millis;
|
|
3967
|
+
};
|
|
3968
|
+
/** A duration in whole, non-negative seconds. */
|
|
3969
|
+
type Seconds = Newtype<number, 'Seconds'>;
|
|
3970
|
+
declare const Seconds: {
|
|
3971
|
+
/**
|
|
3972
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
3973
|
+
*/
|
|
3974
|
+
of: (value: number) => Seconds;
|
|
3975
|
+
toMillis: (value: Seconds) => Millis;
|
|
3976
|
+
};
|
|
3977
|
+
/**
|
|
3978
|
+
* Whether `expiresAt` has passed at `now`, counting it as passed `buffer`
|
|
3979
|
+
* early. The boundary instant itself counts as expired.
|
|
3980
|
+
*/
|
|
3981
|
+
declare function isExpired({ expiresAt, now, buffer, }: {
|
|
3982
|
+
expiresAt: EpochMillis;
|
|
3983
|
+
now: EpochMillis;
|
|
3984
|
+
buffer?: Millis;
|
|
3985
|
+
}): boolean;
|
|
3986
|
+
|
|
3987
|
+
export { Offer as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, type OAuthAccessToken as D, type Erc20Namespace as E, type OffersNamespace as F, StablecoinSymbol as G, type Erc20Asset as H, OfferDetail as I, TokenMetadata as J, type CentrifugeVaultOfferDetail as K, type Logger as L, type OfferType as M, type OndoSwapOfferDetail as N, OfferVaultContract as O, Participation as P, type CoinListTokenSaleOfferDetail as Q, type RequirementsNamespace as R, type SuperstateSwapNamespace as S, type TokensNamespace as T, type UniversalNamespaceContext as U, type SuperstateSwapOfferDetail as V, type WalletError as W, CentrifugeVaultLegId as X, Seconds as Y, type AsyncOfferType as Z, AsyncOfferDetail as _, EthereumChain as a, CentrifugeVaultPosition as a$, RequirementStatusInfo as a0, type RequirementType as a1, type RequirementStatusValue as a2, OfferOptionAddress as a3, RequirementId as a4, type KycLevelName as a5, DocumentSubmission as a6, type WalletChallengeType as a7, type PinoLoggerOptions as a8, AssetDecimals as a9, type RequestId as aA, type RpcFailureReason as aB, type SafeEvent as aC, type SafeFields as aD, type UnredactedFields as aE, OAuthSession as aF, ClientCredentialsOAuth as aG, type Sender as aH, PaginationParams as aI, PaginatedResponse as aJ, ClientSecret as aK, OfferToken as aL, DecimalString as aM, SwapStatus as aN, type Uint256 as aO, KnownAssetSymbol as aP, type Newtype as aQ, type AllowWalletParams as aR, AllowWalletResponse as aS, Asset as aT, AssetCode as aU, Blockchain as aV, type BuildOndoSwapParamsCore as aW, type CentrifugePositionStatus as aX, CentrifugeVaultClaimProceedsTransaction as aY, CentrifugeVaultClaimTransaction as aZ, type CentrifugeVaultOffer as a_, type BuildCentrifugeVaultBuyParams as aa, type CentrifugeOrderReason as ab, type CentrifugeOrderability as ac, OndoTradingStatus as ad, type BuildOndoBuyParams as ae, type BuildOndoSellParams as af, OndoQuote as ag, type OndoQuoteSize as ah, type TokenIdentifier as ai, CentrifugeVaultLeg as aj, OfferOptionAddressId as ak, CentrifugeVaultStatus as al, TokenLogo as am, type DebugEvent as an, type FrontlineEventId as ao, HttpError as ap, type HttpResponse as aq, KycToken as ar, type LogBinding as as, type LogBindings as at, type LogCause as au, type LogLevel as av, type LogScope as aw, type LogValue as ax, type ProductionLogLevel as ay, RedactedWalletError as az, EvmContractAddress as b, SOLANA_CHAINS as b$, type CentrifugeVaultReason as b0, CentrifugeVaultRedeemPosition as b1, type CentrifugeVaultTransactionCore as b2, type CentrifugeWalletParams as b3, Chain as b4, ClientId as b5, CodeChallenge as b6, type CoinListTokenSaleOffer as b7, ConnectExternalWalletParams as b8, type CreateKycTokenParams as b9, OAuthRefreshToken as bA, type OfferBase as bB, type OfferDetailBase as bC, OfferEditorial as bD, OfferOption as bE, OfferOptionSlug as bF, OfferSlug as bG, OffersNamespaceImpl as bH, type OndoQuoteDuration as bI, type OndoSellOutcome as bJ, type OndoSwapOffer as bK, PKCEState as bL, type PaginatedResponseDto as bM, ParticipationId as bN, type ParticipationStatus as bO, ParticipationsPaginationParams as bP, PauseFlags as bQ, Pii as bR, PiiAddress as bS, PiiJurisdiction as bT, type PiiKind as bU, type QueryParamValue as bV, type QueryParamValues as bW, RedirectUri as bX, type RemoveOptionAddressParams as bY, type RequirementActionNeededReason as bZ, type RpcConfig as b_, CreateParticipationParams as ba, CreateWalletOwnershipChallengeParams as bb, Cursor as bc, type DocumentFormType as bd, type DocumentSubmissionStatus as be, type DocumentType as bf, ETHEREUM_CHAINS as bg, EpochMillis as bh, Erc20NamespaceImpl as bi, FaqItem as bj, type GetCentrifugeVaultStatusParams as bk, type GetOndoQuoteParams as bl, type GetOndoTradingStatusParams as bm, type GetSwapAuthorizationParams as bn, type GetSwapPreviewParams as bo, type GetTokenAllowanceParams as bp, type GetTokenBalanceParams as bq, HexEncodedTransactionData as br, Isin as bs, Iso2CountryCode as bt, Link as bu, type ListOptionAddressesParams as bv, MAX_ASSET_DECIMALS as bw, MAX_UINT_256 as bx, Milestone as by, Millis as bz, type CentrifugeNamespace as c, STABLE_DECIMALS as c0, SolanaChain as c1, type SubmitDocumentParams as c2, type SuperstateSwapOffer as c3, type SwapContractRef as c4, SwapPreview as c5, TermItem as c6, Ticker as c7, type TokenLogoImage as c8, TokenLogoUrl as c9, type TokenRole as ca, TokensNamespaceImpl as cb, type Tx as cc, WalletAddress as cd, WalletOwnershipChallenge as ce, type WalletProtocol as cf, WalletsNamespaceImpl as cg, apiErrorCode as ch, assertUint256 as ci, isChain as cj, isExpired as ck, isOfferType as cl, parseUint256 as cm, AssetSymbol as d, CentrifugeVaultBuyTransaction as e, type CentrifugeClaimDirection as f, CentrifugeNamespaceImpl as g, type CoinListTokenSaleNamespace as h, OfferId as i, OfferOptionId as j, AssetId as k, CoinListTokenSaleNamespaceImpl as l, type OndoNamespace as m, OfferSwapContract as n, OndoBuyTransaction as o, OndoSellTransaction as p, type OndoSwapTransactionCore as q, type OrderBookSide as r, OndoNamespaceImpl as s, type WalletsNamespace as t, Bps as u, EvmWalletAddress as v, SuperstateSwapNamespaceImpl as w, Requirement as x, RequirementsNamespaceImpl as y, type Config as z };
|