@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.818bed6
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-2HCSM3FB.js} +52 -19
- package/dist/chunk-2HCSM3FB.js.map +1 -0
- package/dist/{chunk-VH34YC3Q.js → chunk-OUFI3D3Q.js} +84 -4
- package/dist/chunk-OUFI3D3Q.js.map +1 -0
- package/dist/{chunk-MOE5S6CE.js → chunk-YMDYLYL3.js} +954 -441
- package/dist/chunk-YMDYLYL3.js.map +1 -0
- package/dist/client/index.cjs +12477 -8512
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1965 -229
- package/dist/client/index.d.ts +1965 -229
- package/dist/client/index.js +9118 -5742
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +844 -142
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +72 -41
- package/dist/server/index.d.ts +72 -41
- package/dist/server/index.js +323 -65
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → time-DJU6E8KK.d.cts} +943 -192
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → time-DJU6E8KK.d.ts} +943 -192
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-B0xCp3GD.d.cts} +74 -8
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-DGG5N27C.d.ts} +74 -8
- package/dist/universal/index.cjs +1036 -439
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +105 -5
- package/dist/universal/index.d.ts +105 -5
- package/dist/universal/index.js +48 -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,49 @@ 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
|
+
type GetCentrifugeVaultQuoteParams = GetCentrifugeVaultStatusParams & {
|
|
1192
|
+
/**
|
|
1193
|
+
* Amount to price, in the base units of the funding token. Must be greater
|
|
1194
|
+
* than zero. No fee is deducted; this product charges none.
|
|
1195
|
+
*
|
|
1196
|
+
* Sized by `amount` alone: the quote is a free read of one spend, not a
|
|
1197
|
+
* dollar figure converted later.
|
|
1198
|
+
*/
|
|
1199
|
+
amount: BlockchainAmount;
|
|
1200
|
+
};
|
|
1201
|
+
/**
|
|
1202
|
+
* One wallet on one vault: what every position read and every claim is keyed
|
|
1203
|
+
* by. There is no order id - a wallet has one pooled position per vault per
|
|
1204
|
+
* direction.
|
|
1205
|
+
*/
|
|
1206
|
+
type CentrifugeWalletParams = GetCentrifugeVaultStatusParams & {
|
|
1207
|
+
/**
|
|
1208
|
+
* The wallet whose position is read, or claimed for. A claim must then be
|
|
1209
|
+
* broadcast from this same wallet: the proxy credits the sender.
|
|
1210
|
+
*/
|
|
1211
|
+
walletAddress: EvmWalletAddress;
|
|
1212
|
+
};
|
|
1213
|
+
/**
|
|
1214
|
+
* What `POST /v1/centrifuge/vault/invest` is asked for: the wallet that will
|
|
1215
|
+
* broadcast the request and fund it, plus the deposit.
|
|
1216
|
+
*
|
|
1217
|
+
* Built once, when the user confirms an amount. Broadcasting the result places
|
|
1218
|
+
* a request; it does not buy shares.
|
|
1219
|
+
*/
|
|
1220
|
+
type BuildCentrifugeVaultBuyParams = CentrifugeWalletParams & {
|
|
1221
|
+
/** How much of the funding token to deposit, in its base units. */
|
|
1222
|
+
amount: BlockchainAmount;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1130
1225
|
/**
|
|
1131
1226
|
* The logging surface SDK code uses. Never exported to hosts: they implement
|
|
1132
1227
|
* {@link Logger}, which is deliberately smaller.
|
|
@@ -1205,256 +1300,618 @@ type InternalDebugEvent = {
|
|
|
1205
1300
|
};
|
|
1206
1301
|
|
|
1207
1302
|
/**
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
* `coinlist::token_sale`; there is no `coinlist::sale` and no
|
|
1212
|
-
* `coinlist_token_sale`.
|
|
1303
|
+
* Wire shapes for frontline's `/v1/centrifuge/vault/*` endpoints, as published
|
|
1304
|
+
* in frontline's OpenAPI schema (ENG-1936). Every uint256 crosses as a decimal
|
|
1305
|
+
* string, every price as a decimal string, every timestamp as ISO 8601.
|
|
1213
1306
|
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1307
|
+
* **A vault deposit does not settle in the transaction that places it.** The
|
|
1308
|
+
* fund fulfils requests on its own epoch, in whole or in part, at a price set
|
|
1309
|
+
* then, and the user claims the resulting shares in a second transaction. So
|
|
1310
|
+
* every share figure before a fill is an estimate.
|
|
1311
|
+
*
|
|
1312
|
+
* The three GETs are free to poll. The two POSTs return calldata to broadcast:
|
|
1313
|
+
* `invest` is signed for one wallet and called once on confirmation, `claim`
|
|
1314
|
+
* collects everything claimable and carries no amount.
|
|
1217
1315
|
*/
|
|
1218
|
-
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap';
|
|
1219
1316
|
/**
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1317
|
+
* Why a deposit cannot be placed right now. A closed set, so a client can
|
|
1318
|
+
* branch on every value. `vault_unlinked` is terminal for the offer's proxy on
|
|
1319
|
+
* that chain; the rest clear on their own or by hand.
|
|
1320
|
+
*
|
|
1321
|
+
* `below_minimum` is the one reason that depends on an amount, so only a quote
|
|
1322
|
+
* can report it - see {@link CentrifugeVaultReasonDto}.
|
|
1223
1323
|
*/
|
|
1224
|
-
type
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
slug: string;
|
|
1228
|
-
ends_at: string | null;
|
|
1229
|
-
tokens: OfferTokenDto[];
|
|
1230
|
-
};
|
|
1324
|
+
type CentrifugeOrderReasonDto = 'vault_unlinked' | 'vault_halted' | 'proxy_not_permissioned' | 'price_unavailable' | 'below_minimum';
|
|
1325
|
+
/** What a vault status can report: every reason but the amount-dependent one. */
|
|
1326
|
+
type CentrifugeVaultReasonDto = Exclude<CentrifugeOrderReasonDto, 'below_minimum'>;
|
|
1231
1327
|
/**
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1328
|
+
* Where a wallet stands on a vault, derived from its amounts rather than
|
|
1329
|
+
* stored. Not a lifecycle: a new request moves any of these back to `pending`
|
|
1330
|
+
* while earlier shares stay claimed.
|
|
1234
1331
|
*/
|
|
1235
|
-
type
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1332
|
+
type CentrifugePositionStatusDto = 'none' | 'pending' | 'partially_filled' | 'filled' | 'claimed';
|
|
1333
|
+
/** `GET /v1/centrifuge/vault/quote?symbol&chain&amount`. Indicative only. */
|
|
1334
|
+
type CentrifugeVaultQuoteDto = {
|
|
1335
|
+
object: 'centrifuge_vault_quote';
|
|
1336
|
+
/** The vault's share token symbol, e.g. `deJTRSY`. */
|
|
1337
|
+
symbol: string;
|
|
1338
|
+
chain: string;
|
|
1339
|
+
/** The amount priced, echoed back, in `spend_input_decimals`. No fee. */
|
|
1340
|
+
spend_input_amount: string;
|
|
1341
|
+
spend_input_decimals: number;
|
|
1342
|
+
/** An estimate, not a floor: the fill can price either side of it. */
|
|
1343
|
+
estimated_shares: string;
|
|
1344
|
+
share_decimals: number;
|
|
1345
|
+
/** Funding token per whole share. Null when the vault has no price. */
|
|
1346
|
+
indicative_price: string | null;
|
|
1347
|
+
/** In `spend_input_decimals`. Null when the offer sets no minimum. */
|
|
1348
|
+
minimum_input_amount: string | null;
|
|
1349
|
+
can_order: boolean;
|
|
1350
|
+
/** Empty exactly when `can_order` is true. */
|
|
1351
|
+
reasons: CentrifugeOrderReasonDto[];
|
|
1352
|
+
};
|
|
1353
|
+
/**
|
|
1354
|
+
* `GET /v1/centrifuge/vault/status?symbol&chain`. The vault's own state, read
|
|
1355
|
+
* from the chain on every call; the gate to poll, because Centrifuge announces
|
|
1356
|
+
* none of these changes.
|
|
1357
|
+
*/
|
|
1358
|
+
type CentrifugeVaultStatusDto = {
|
|
1359
|
+
object: 'centrifuge_vault_status';
|
|
1360
|
+
symbol: string;
|
|
1361
|
+
chain: string;
|
|
1362
|
+
/** Centrifuge's vault, read from the proxy. Fixed for the proxy's life. */
|
|
1363
|
+
vault_address: string;
|
|
1364
|
+
/** False is terminal for this proxy: a replacement has to be deployed. */
|
|
1365
|
+
linked: boolean;
|
|
1366
|
+
/** Whether the proxy is on the share token's memberlist. */
|
|
1367
|
+
permissioned: boolean;
|
|
1368
|
+
membership_valid_until: string | null;
|
|
1369
|
+
/** Set by the proxy after a force-cancel; cleared only by hand. */
|
|
1370
|
+
halted: boolean;
|
|
1371
|
+
price_updated_at: string | null;
|
|
1372
|
+
can_order: boolean;
|
|
1373
|
+
reasons: CentrifugeVaultReasonDto[];
|
|
1374
|
+
as_of: string;
|
|
1375
|
+
};
|
|
1376
|
+
/**
|
|
1377
|
+
* What both POSTs return: calldata for the wallet to broadcast verbatim.
|
|
1378
|
+
* Unlike Ondo's, `expires_at` is nullable - a claim carries no signature, so
|
|
1379
|
+
* it is always null there.
|
|
1380
|
+
*/
|
|
1381
|
+
type CentrifugeBroadcastDto = {
|
|
1382
|
+
action: 'broadcast_transaction';
|
|
1383
|
+
/** The offer's proxy on the chain. Lower case: compare case-insensitively. */
|
|
1384
|
+
to: string;
|
|
1385
|
+
data: string;
|
|
1386
|
+
expires_at: string | null;
|
|
1239
1387
|
};
|
|
1240
1388
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
* nothing.
|
|
1244
|
-
* reads them.
|
|
1389
|
+
* `POST /v1/centrifuge/vault/invest` with `{ symbol, chain, wallet_address,
|
|
1390
|
+
* amount }`. Broadcasting it places a request in the vault's queue and buys
|
|
1391
|
+
* nothing yet.
|
|
1245
1392
|
*/
|
|
1246
|
-
type
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
logo_url: string;
|
|
1393
|
+
type CentrifugeVaultBuyDto = CentrifugeBroadcastDto & {
|
|
1394
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1395
|
+
spend_input_amount: string;
|
|
1396
|
+
spend_input_decimals: number;
|
|
1397
|
+
/** Not a quantity purchased: the fill prices later. */
|
|
1398
|
+
estimated_shares: string;
|
|
1399
|
+
share_decimals: number;
|
|
1254
1400
|
};
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1401
|
+
/**
|
|
1402
|
+
* `GET /v1/centrifuge/vault/position?symbol&chain&wallet_address`. The six
|
|
1403
|
+
* amounts are independent: a wallet can hold a pending request, a claimable
|
|
1404
|
+
* balance and claimed shares at once. There is no per-fulfilment breakdown;
|
|
1405
|
+
* settlement pools every fulfilment into one rate.
|
|
1406
|
+
*/
|
|
1407
|
+
type CentrifugeVaultPositionDto = {
|
|
1408
|
+
object: 'centrifuge_vault_position';
|
|
1409
|
+
symbol: string;
|
|
1410
|
+
chain: string;
|
|
1411
|
+
wallet_address: string;
|
|
1412
|
+
status: CentrifugePositionStatusDto;
|
|
1413
|
+
/** Funding token ever requested, in `asset_decimals`. */
|
|
1414
|
+
requested: string;
|
|
1415
|
+
/** Of that, still queued. */
|
|
1416
|
+
pending: string;
|
|
1417
|
+
/** Of that, fulfilled. */
|
|
1418
|
+
filled_assets: string;
|
|
1419
|
+
/** Shares the fulfilments earned, in `share_decimals`. Held by the proxy until claimed. */
|
|
1420
|
+
earned_shares: string;
|
|
1421
|
+
claimed_shares: string;
|
|
1422
|
+
/** Non-zero means the claim endpoint will return calldata. */
|
|
1423
|
+
claimable_shares: string;
|
|
1424
|
+
/** Read from the share token; can exceed `claimed_shares`. */
|
|
1425
|
+
share_balance: string;
|
|
1426
|
+
asset_decimals: number;
|
|
1427
|
+
share_decimals: number;
|
|
1428
|
+
/** Null before the first claim. */
|
|
1429
|
+
average_price: string | null;
|
|
1430
|
+
/** Centrifuge froze the wallet on the share token; blocks claiming. */
|
|
1431
|
+
frozen: boolean;
|
|
1432
|
+
as_of: string;
|
|
1259
1433
|
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1434
|
+
/**
|
|
1435
|
+
* `POST /v1/centrifuge/vault/claim` with `{ symbol, chain, wallet_address }`.
|
|
1436
|
+
* The wallet named must be the one that broadcasts: the proxy credits the
|
|
1437
|
+
* sender.
|
|
1438
|
+
*/
|
|
1439
|
+
type CentrifugeVaultClaimDto = CentrifugeBroadcastDto & {
|
|
1440
|
+
/** A floor: a fill landing before the broadcast raises it. */
|
|
1441
|
+
claimable_shares: string;
|
|
1442
|
+
share_decimals: number;
|
|
1264
1443
|
};
|
|
1265
|
-
|
|
1266
|
-
|
|
1444
|
+
/**
|
|
1445
|
+
* `GET /v1/centrifuge/vault/redeem-position?symbol&chain&wallet_address`. The
|
|
1446
|
+
* redeem side of {@link CentrifugeVaultPositionDto}, with the units swapped:
|
|
1447
|
+
* what is queued is shares, and what a fill makes claimable is the funding
|
|
1448
|
+
* token.
|
|
1449
|
+
*
|
|
1450
|
+
* TODO(frontline, ENG-1909): guessed. Frontline publishes no redeem endpoint
|
|
1451
|
+
* yet; this mirrors the invest position field for field so the SDK can be
|
|
1452
|
+
* built against it. Replace with the published schema when it lands.
|
|
1453
|
+
*/
|
|
1454
|
+
type CentrifugeVaultRedeemPositionDto = {
|
|
1455
|
+
object: 'centrifuge_vault_redeem_position';
|
|
1456
|
+
symbol: string;
|
|
1267
1457
|
chain: string;
|
|
1268
|
-
|
|
1458
|
+
wallet_address: string;
|
|
1459
|
+
status: CentrifugePositionStatusDto;
|
|
1460
|
+
/** Shares still queued for redemption, in `share_decimals`. */
|
|
1461
|
+
pending: string;
|
|
1462
|
+
/**
|
|
1463
|
+
* Funding token a claim would pay out now, in `asset_decimals`. An
|
|
1464
|
+
* estimate: the vault holds the claimable amount in shares and prices it
|
|
1465
|
+
* at the claim.
|
|
1466
|
+
*/
|
|
1467
|
+
claimable_assets: string;
|
|
1468
|
+
asset_decimals: number;
|
|
1469
|
+
share_decimals: number;
|
|
1470
|
+
/** Centrifuge froze the wallet on the share token. */
|
|
1471
|
+
frozen: boolean;
|
|
1472
|
+
as_of: string;
|
|
1473
|
+
};
|
|
1474
|
+
/**
|
|
1475
|
+
* `POST /v1/centrifuge/vault/claim-proceeds` with `{ symbol, chain,
|
|
1476
|
+
* wallet_address }`. Collects everything claimable on the redeem side; the
|
|
1477
|
+
* proxy pays the sender.
|
|
1478
|
+
*
|
|
1479
|
+
* TODO(frontline, ENG-1909): guessed, as {@link CentrifugeVaultRedeemPositionDto}.
|
|
1480
|
+
*/
|
|
1481
|
+
type CentrifugeVaultClaimProceedsDto = CentrifugeBroadcastDto & {
|
|
1482
|
+
/** An estimate read when the calldata was built, in `asset_decimals`. */
|
|
1483
|
+
claimable_assets: string;
|
|
1484
|
+
asset_decimals: number;
|
|
1269
1485
|
};
|
|
1270
1486
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1487
|
+
/**
|
|
1488
|
+
* Which leg of a vault trade: `invest` turns the funding token into shares,
|
|
1489
|
+
* `redeem` turns shares back into the funding token. Each wallet holds one
|
|
1490
|
+
* pooled position per vault per direction, and a claim settles one of them.
|
|
1491
|
+
*/
|
|
1492
|
+
type CentrifugeClaimDirection = 'invest' | 'redeem';
|
|
1493
|
+
/**
|
|
1494
|
+
* Why a deposit cannot be placed on a vault right now. Kept verbatim from the
|
|
1495
|
+
* wire: frontline publishes it as a closed set for clients to branch on.
|
|
1496
|
+
*/
|
|
1497
|
+
type CentrifugeOrderReason = CentrifugeOrderReasonDto;
|
|
1498
|
+
/** The reasons a vault status can report - all but `below_minimum`. */
|
|
1499
|
+
type CentrifugeVaultReason = CentrifugeVaultReasonDto;
|
|
1500
|
+
/**
|
|
1501
|
+
* Where a wallet stands on a vault. Not a lifecycle - see
|
|
1502
|
+
* {@link CentrifugeVaultPosition.status}.
|
|
1503
|
+
*/
|
|
1504
|
+
type CentrifugePositionStatus = CentrifugePositionStatusDto;
|
|
1505
|
+
/**
|
|
1506
|
+
* Whether a deposit can be placed, as one union rather than the wire's
|
|
1507
|
+
* `can_order` beside `reasons`: a blocked answer always says why, and an
|
|
1508
|
+
* orderable one has nothing to say. The wire pair can contradict itself; this
|
|
1509
|
+
* cannot, because `fromDto` refuses the payloads that do.
|
|
1510
|
+
*/
|
|
1511
|
+
type CentrifugeOrderability<R extends CentrifugeOrderReason> = {
|
|
1512
|
+
type: 'orderable';
|
|
1513
|
+
} | {
|
|
1514
|
+
type: 'blocked';
|
|
1515
|
+
reasons: [R, ...R[]];
|
|
1282
1516
|
};
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1517
|
+
/**
|
|
1518
|
+
* What a deposit of a given size would buy, and whether it can be placed.
|
|
1519
|
+
*
|
|
1520
|
+
* **Indicative only.** The price is read from the vault now and the fund
|
|
1521
|
+
* prices the fulfilment on its own epoch, so neither {@link indicativePrice}
|
|
1522
|
+
* nor {@link estimatedShares} is a commitment. Free to poll while the user
|
|
1523
|
+
* sizes a deposit.
|
|
1524
|
+
*/
|
|
1525
|
+
type CentrifugeVaultQuote = {
|
|
1526
|
+
chain: EthereumChain;
|
|
1527
|
+
/** The vault's share token symbol, e.g. `deJTRSY`. */
|
|
1528
|
+
symbol: AssetSymbol;
|
|
1529
|
+
/** The amount priced, in the funding token's decimals. No fee is taken. */
|
|
1530
|
+
spendInputAmount: BlockchainAmount;
|
|
1531
|
+
/** Shares at the indicative price, in the share token's decimals. */
|
|
1532
|
+
estimatedShares: BlockchainAmount;
|
|
1533
|
+
/** Funding token per whole share. Null when the vault publishes no price. */
|
|
1534
|
+
indicativePrice: DecimalString | null;
|
|
1535
|
+
/** Null when the offer sets no minimum. Same decimals as the spend. */
|
|
1536
|
+
minimumInputAmount: BlockchainAmount | null;
|
|
1537
|
+
orderability: CentrifugeOrderability<CentrifugeOrderReason>;
|
|
1286
1538
|
};
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
1290
|
-
logoUrl: string | null;
|
|
1539
|
+
declare const CentrifugeVaultQuote: {
|
|
1540
|
+
fromDto: (dto: CentrifugeVaultQuoteDto) => CentrifugeVaultQuote;
|
|
1291
1541
|
};
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1542
|
+
/**
|
|
1543
|
+
* A vault's own state, independent of any wallet or amount: the gate to poll.
|
|
1544
|
+
* Centrifuge announces none of these changes, and an unlinked vault leaves the
|
|
1545
|
+
* offer's proxy permanently dead, so a cached answer goes wrong silently.
|
|
1546
|
+
*/
|
|
1547
|
+
type CentrifugeVaultStatus = {
|
|
1548
|
+
chain: EthereumChain;
|
|
1549
|
+
symbol: AssetSymbol;
|
|
1550
|
+
/** Centrifuge's vault behind the proxy. Fixed for the proxy's life. */
|
|
1551
|
+
vaultAddress: EvmContractAddress;
|
|
1552
|
+
/**
|
|
1553
|
+
* Whether Centrifuge still links the vault to its pool. False is terminal
|
|
1554
|
+
* for this proxy: no request or claim succeeds until a new one is deployed.
|
|
1555
|
+
*/
|
|
1556
|
+
linked: boolean;
|
|
1557
|
+
/**
|
|
1558
|
+
* Whether the proxy is on the share token's memberlist. It holds shares for
|
|
1559
|
+
* every wallet, so one expired entry stops the whole offer.
|
|
1560
|
+
*/
|
|
1561
|
+
permissioned: boolean;
|
|
1562
|
+
/** Watch it: {@link permissioned} goes false the moment it passes. */
|
|
1563
|
+
membershipValidUntil: Date | null;
|
|
1564
|
+
/** The proxy halted itself after a force-cancel; cleared only by hand. */
|
|
1565
|
+
halted: boolean;
|
|
1566
|
+
/** A stale value is the signal that a quote's price is old. */
|
|
1567
|
+
priceUpdatedAt: Date | null;
|
|
1568
|
+
orderability: CentrifugeOrderability<CentrifugeVaultReason>;
|
|
1569
|
+
/** When the chain was read: how old everything above is. */
|
|
1570
|
+
asOf: Date;
|
|
1571
|
+
};
|
|
1572
|
+
declare const CentrifugeVaultStatus: {
|
|
1573
|
+
fromDto: (dto: CentrifugeVaultStatusDto) => CentrifugeVaultStatus;
|
|
1296
1574
|
};
|
|
1297
1575
|
/**
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1300
|
-
* trades continuously, runs none, and carries none.
|
|
1576
|
+
* What both vault transactions share: calldata to broadcast verbatim, and the
|
|
1577
|
+
* deadline on it.
|
|
1301
1578
|
*/
|
|
1302
|
-
type
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1579
|
+
type CentrifugeVaultTransactionCore = {
|
|
1580
|
+
/** The `to` is the offer's proxy: the spender the deposit was approved to. */
|
|
1581
|
+
tx: Tx;
|
|
1582
|
+
/**
|
|
1583
|
+
* When the calldata stops being accepted, or null when it carries no
|
|
1584
|
+
* deadline - always the case for a claim, which nobody signs.
|
|
1585
|
+
*/
|
|
1586
|
+
expiresAt: Date | null;
|
|
1306
1587
|
};
|
|
1307
|
-
|
|
1588
|
+
/**
|
|
1589
|
+
* A signed deposit request, ready to broadcast.
|
|
1590
|
+
*
|
|
1591
|
+
* **Broadcasting it buys nothing yet.** It places a request in the vault's
|
|
1592
|
+
* queue; the fund fulfils it later at a price set then, and the user comes
|
|
1593
|
+
* back to claim. {@link estimatedShares} is therefore never a quantity
|
|
1594
|
+
* purchased. Single-use: built once on confirmation, never on a timer.
|
|
1595
|
+
*/
|
|
1596
|
+
type CentrifugeVaultBuyTransaction = CentrifugeVaultTransactionCore & {
|
|
1597
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1598
|
+
spendInputAmount: BlockchainAmount;
|
|
1599
|
+
/** At the price read when the calldata was built. An estimate, not a floor. */
|
|
1600
|
+
estimatedShares: BlockchainAmount;
|
|
1601
|
+
};
|
|
1602
|
+
declare const CentrifugeVaultBuyTransaction: {
|
|
1603
|
+
fromDto: (dto: CentrifugeVaultBuyDto) => CentrifugeVaultBuyTransaction;
|
|
1604
|
+
};
|
|
1605
|
+
/**
|
|
1606
|
+
* The claim that moves fulfilled shares from the proxy to the wallet: the
|
|
1607
|
+
* second transaction every vault purchase needs. The wallet that broadcasts it
|
|
1608
|
+
* is the one credited.
|
|
1609
|
+
*/
|
|
1610
|
+
type CentrifugeVaultClaimTransaction = CentrifugeVaultTransactionCore & {
|
|
1308
1611
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1612
|
+
* Read when the calldata was built. A floor: a fill landing before the
|
|
1613
|
+
* broadcast raises it, and the claim still collects everything.
|
|
1311
1614
|
*/
|
|
1312
|
-
|
|
1615
|
+
claimableShares: BlockchainAmount;
|
|
1616
|
+
};
|
|
1617
|
+
declare const CentrifugeVaultClaimTransaction: {
|
|
1618
|
+
fromDto: (dto: CentrifugeVaultClaimDto) => CentrifugeVaultClaimTransaction;
|
|
1313
1619
|
};
|
|
1314
1620
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1621
|
+
* One wallet's standing on one vault: what it put in, what has settled, and
|
|
1622
|
+
* what it can claim. The endpoint a returning user lands on, and the one that
|
|
1623
|
+
* says whether to offer the claim.
|
|
1624
|
+
*
|
|
1625
|
+
* The amounts are independent of each other: each piece of a request settles
|
|
1626
|
+
* and is claimed on its own, so a wallet can be pending, claimable and claimed
|
|
1627
|
+
* at once. There is no per-fulfilment breakdown; settlement pools every
|
|
1628
|
+
* fulfilment into one {@link averagePrice}.
|
|
1319
1629
|
*/
|
|
1320
|
-
type
|
|
1321
|
-
|
|
1322
|
-
|
|
1630
|
+
type CentrifugeVaultPosition = {
|
|
1631
|
+
chain: EthereumChain;
|
|
1632
|
+
symbol: AssetSymbol;
|
|
1633
|
+
walletAddress: EvmWalletAddress;
|
|
1323
1634
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1635
|
+
* Derived by frontline from the amounts. Not a lifecycle: a new request
|
|
1636
|
+
* moves it back to `pending` while earlier shares stay claimed.
|
|
1637
|
+
*/
|
|
1638
|
+
status: CentrifugePositionStatus;
|
|
1639
|
+
/** Funding token ever requested. */
|
|
1640
|
+
requested: BlockchainAmount;
|
|
1641
|
+
/** Of {@link requested}, what is still queued. */
|
|
1642
|
+
pending: BlockchainAmount;
|
|
1643
|
+
/** Of {@link requested}, what has been fulfilled. */
|
|
1644
|
+
filledAssets: BlockchainAmount;
|
|
1645
|
+
/** Shares the fulfilments earned. Held by the proxy until claimed. */
|
|
1646
|
+
earnedShares: BlockchainAmount;
|
|
1647
|
+
claimedShares: BlockchainAmount;
|
|
1648
|
+
/** Non-zero means a claim will return calldata. */
|
|
1649
|
+
claimableShares: BlockchainAmount;
|
|
1650
|
+
/**
|
|
1651
|
+
* What the wallet holds on the share token. Can exceed
|
|
1652
|
+
* {@link claimedShares}: shares acquired any other way count here.
|
|
1653
|
+
*/
|
|
1654
|
+
shareBalance: BlockchainAmount;
|
|
1655
|
+
/** Pooled rate over everything claimed. Null before the first claim. */
|
|
1656
|
+
averagePrice: DecimalString | null;
|
|
1657
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1658
|
+
frozen: boolean;
|
|
1659
|
+
asOf: Date;
|
|
1660
|
+
};
|
|
1661
|
+
declare const CentrifugeVaultPosition: {
|
|
1662
|
+
fromDto: (dto: CentrifugeVaultPositionDto) => CentrifugeVaultPosition;
|
|
1663
|
+
};
|
|
1664
|
+
/**
|
|
1665
|
+
* One wallet's standing on the redeem side of a vault: shares queued to sell,
|
|
1666
|
+
* and the funding token a fill has made claimable. The mirror of
|
|
1667
|
+
* {@link CentrifugeVaultPosition}, and as independent of it: a wallet can be
|
|
1668
|
+
* investing and redeeming on the same vault at once.
|
|
1669
|
+
*
|
|
1670
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1671
|
+
* `CentrifugeVaultRedeemPositionDto`.
|
|
1672
|
+
*/
|
|
1673
|
+
type CentrifugeVaultRedeemPosition = {
|
|
1674
|
+
chain: EthereumChain;
|
|
1675
|
+
symbol: AssetSymbol;
|
|
1676
|
+
walletAddress: EvmWalletAddress;
|
|
1677
|
+
status: CentrifugePositionStatus;
|
|
1678
|
+
/** Shares still queued for redemption. */
|
|
1679
|
+
pending: BlockchainAmount;
|
|
1680
|
+
/**
|
|
1681
|
+
* Funding token a claim would pay out now. An estimate: the vault prices the
|
|
1682
|
+
* claimable shares at the claim. Non-zero means a claim returns calldata.
|
|
1330
1683
|
*/
|
|
1331
|
-
|
|
1684
|
+
claimableAssets: BlockchainAmount;
|
|
1685
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1686
|
+
frozen: boolean;
|
|
1687
|
+
asOf: Date;
|
|
1332
1688
|
};
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
role: TokenRole;
|
|
1336
|
-
chain: Chain;
|
|
1337
|
-
address: EvmContractAddress;
|
|
1689
|
+
declare const CentrifugeVaultRedeemPosition: {
|
|
1690
|
+
fromDto: (dto: CentrifugeVaultRedeemPositionDto) => CentrifugeVaultRedeemPosition;
|
|
1338
1691
|
};
|
|
1339
|
-
|
|
1340
|
-
|
|
1692
|
+
/**
|
|
1693
|
+
* One wallet's position on one leg of a vault trade, tagged with the leg. The
|
|
1694
|
+
* two legs are read from two endpoints and settle in opposite units - the
|
|
1695
|
+
* invest leg queues the funding token and pays out shares, the redeem leg the
|
|
1696
|
+
* reverse - so the tag is what says which unit each figure is in.
|
|
1697
|
+
*/
|
|
1698
|
+
type CentrifugeVaultLeg = {
|
|
1699
|
+
direction: 'invest';
|
|
1700
|
+
position: CentrifugeVaultPosition;
|
|
1701
|
+
} | {
|
|
1702
|
+
direction: 'redeem';
|
|
1703
|
+
position: CentrifugeVaultRedeemPosition;
|
|
1704
|
+
};
|
|
1705
|
+
declare const CentrifugeVaultLeg: {
|
|
1341
1706
|
/**
|
|
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`.
|
|
1707
|
+
* What a claim on the leg would collect: shares for `invest`, the funding
|
|
1708
|
+
* token for `redeem`.
|
|
1351
1709
|
*/
|
|
1352
|
-
|
|
1710
|
+
claimable: (leg: CentrifugeVaultLeg) => BlockchainAmount;
|
|
1711
|
+
/** Whether the leg has anything queued or anything ready to claim. */
|
|
1712
|
+
isActive: (leg: CentrifugeVaultLeg) => boolean;
|
|
1353
1713
|
};
|
|
1354
|
-
|
|
1355
1714
|
/**
|
|
1356
|
-
*
|
|
1715
|
+
* One wallet's position on one leg of one vault: what a claim targets. A
|
|
1716
|
+
* wallet holds at most one per direction per chain, so the three together
|
|
1717
|
+
* name it.
|
|
1718
|
+
*/
|
|
1719
|
+
type CentrifugeVaultLegId = Newtype<string, 'CentrifugeVaultLegId'>;
|
|
1720
|
+
declare const CentrifugeVaultLegId: {
|
|
1721
|
+
/** Addresses compare case-insensitively: frontline echoes them lower case. */
|
|
1722
|
+
of: (leg: CentrifugeVaultLeg) => CentrifugeVaultLegId;
|
|
1723
|
+
};
|
|
1724
|
+
/**
|
|
1725
|
+
* The claim that pays a filled redemption out in the funding token: the
|
|
1726
|
+
* second transaction every vault sale needs. The wallet that broadcasts it is
|
|
1727
|
+
* the one paid.
|
|
1357
1728
|
*
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1729
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1730
|
+
* `CentrifugeVaultClaimProceedsDto`.
|
|
1360
1731
|
*/
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1732
|
+
type CentrifugeVaultClaimProceedsTransaction = CentrifugeVaultTransactionCore & {
|
|
1733
|
+
/** An estimate read when the calldata was built; the claim pays it all. */
|
|
1734
|
+
claimableAssets: BlockchainAmount;
|
|
1735
|
+
};
|
|
1736
|
+
declare const CentrifugeVaultClaimProceedsTransaction: {
|
|
1737
|
+
fromDto: (dto: CentrifugeVaultClaimProceedsDto) => CentrifugeVaultClaimProceedsTransaction;
|
|
1738
|
+
};
|
|
1366
1739
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1740
|
+
/**
|
|
1741
|
+
* Centrifuge vault reads and claims: an indicative quote, the vault-wide
|
|
1742
|
+
* ordering gate, each wallet's position per direction, and the calldata that
|
|
1743
|
+
* claims a filled request.
|
|
1744
|
+
*
|
|
1745
|
+
* The reads are free to poll - none spends an attestation, so a client may
|
|
1746
|
+
* call them while the user sizes a deposit or waits on a fill. The quote has
|
|
1747
|
+
* no expiry: it is indicative, the fund prices fulfilment later, and a
|
|
1748
|
+
* countdown would imply a commitment the API does not make.
|
|
1749
|
+
*
|
|
1750
|
+
* A vault trade settles in two legs: a request the fund fills on its own
|
|
1751
|
+
* schedule, then a claim. There is no order id - each wallet has one pooled
|
|
1752
|
+
* position per vault per direction - so the claims take a wallet, not an
|
|
1753
|
+
* order, and collect everything claimable.
|
|
1754
|
+
*
|
|
1755
|
+
* The calldata builders are the exception: {@link CentrifugeNamespace.buildBuyTransaction}
|
|
1756
|
+
* and the claims are each called once, when the user confirms, and never on a
|
|
1757
|
+
* timer. Broadcasting the buy calldata places a request. It does not buy
|
|
1758
|
+
* shares.
|
|
1759
|
+
*
|
|
1760
|
+
* Every method requires `AuthState === 'logged-in'` and throws
|
|
1761
|
+
* {@link NotAuthenticatedError} otherwise.
|
|
1762
|
+
*/
|
|
1763
|
+
interface CentrifugeNamespace {
|
|
1764
|
+
getQuote(params: GetCentrifugeVaultQuoteParams): Promise<CentrifugeVaultQuote>;
|
|
1765
|
+
getVaultStatus(params: GetCentrifugeVaultStatusParams): Promise<CentrifugeVaultStatus>;
|
|
1766
|
+
/** The wallet's invest position: funding queued, shares claimable. */
|
|
1767
|
+
getPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultPosition>;
|
|
1376
1768
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
* page holds, not where the next page starts.
|
|
1769
|
+
* The wallet's redeem position: shares queued, funding claimable.
|
|
1770
|
+
*
|
|
1771
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1381
1772
|
*/
|
|
1382
|
-
|
|
1773
|
+
getRedeemPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultRedeemPosition>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Calldata claiming every claimable share. Broadcast it from
|
|
1776
|
+
* `params.walletAddress`: the proxy credits the sender.
|
|
1777
|
+
*/
|
|
1778
|
+
createClaim(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimTransaction>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Calldata paying out every claimable redemption in the funding token.
|
|
1781
|
+
* Broadcast it from `params.walletAddress`.
|
|
1782
|
+
*
|
|
1783
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1784
|
+
*/
|
|
1785
|
+
createClaimProceeds(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimProceedsTransaction>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Builds the calldata that places a deposit request.
|
|
1788
|
+
*
|
|
1789
|
+
* Called once on confirmation. The reads above are the ones a checkout polls.
|
|
1790
|
+
*/
|
|
1791
|
+
buildBuyTransaction(params: BuildCentrifugeVaultBuyParams): Promise<CentrifugeVaultBuyTransaction>;
|
|
1792
|
+
}
|
|
1793
|
+
declare class CentrifugeNamespaceImpl implements CentrifugeNamespace {
|
|
1794
|
+
private readonly ctx;
|
|
1795
|
+
protected readonly log: InternalLogger;
|
|
1796
|
+
constructor(ctx: UniversalNamespaceContext);
|
|
1797
|
+
getQuote(params: GetCentrifugeVaultQuoteParams): Promise<CentrifugeVaultQuote>;
|
|
1798
|
+
getVaultStatus(params: GetCentrifugeVaultStatusParams): Promise<CentrifugeVaultStatus>;
|
|
1799
|
+
getPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultPosition>;
|
|
1800
|
+
getRedeemPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultRedeemPosition>;
|
|
1801
|
+
createClaim(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimTransaction>;
|
|
1802
|
+
createClaimProceeds(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimProceedsTransaction>;
|
|
1803
|
+
buildBuyTransaction(params: BuildCentrifugeVaultBuyParams): Promise<CentrifugeVaultBuyTransaction>;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
type AssetDto = {
|
|
1807
|
+
code: string;
|
|
1808
|
+
fractional_digits: number;
|
|
1809
|
+
id: string;
|
|
1810
|
+
name: string;
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
type AssetId = Newtype<string, 'AssetId'>;
|
|
1814
|
+
declare const AssetId: (value: string) => AssetId;
|
|
1815
|
+
type AssetCode = Newtype<string, 'AssetCode'>;
|
|
1816
|
+
declare const AssetCode: (value: string) => AssetCode;
|
|
1817
|
+
type Asset = {
|
|
1818
|
+
id: AssetId;
|
|
1819
|
+
code: AssetCode;
|
|
1820
|
+
name: string;
|
|
1821
|
+
fractionalDigits: number;
|
|
1383
1822
|
};
|
|
1823
|
+
declare const Asset: {
|
|
1824
|
+
fromDto: (dto: AssetDto) => Asset;
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1384
1827
|
/**
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1828
|
+
* The product an offer is checked out through. The backend sends one compound
|
|
1829
|
+
* `{supplier}::{saleType}` string, verbatim as spelled below: a double colon
|
|
1830
|
+
* between the two halves, `snake_case` within each. CoinList's token sale is
|
|
1831
|
+
* `coinlist::token_sale`; there is no `coinlist::sale` and no
|
|
1832
|
+
* `coinlist_token_sale`.
|
|
1833
|
+
*
|
|
1834
|
+
* Kept flat rather than split into a supplier and a sale type, because a flat
|
|
1835
|
+
* union makes a `switch` over it exhaustive: adding a provider without
|
|
1836
|
+
* handling it becomes a compile error.
|
|
1388
1837
|
*/
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1838
|
+
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap' | 'centrifuge::vault';
|
|
1839
|
+
/**
|
|
1840
|
+
* One variant per {@link OfferTypeDto}, mirroring frontline#1365, which keys
|
|
1841
|
+
* `GET /v1/offers` on `type`. Read `type` first: it decides which of the
|
|
1842
|
+
* fields below mean anything.
|
|
1843
|
+
*/
|
|
1844
|
+
type OfferDto = CoinListTokenSaleOfferDto | SuperstateSwapOfferDto | OndoSwapOfferDto | CentrifugeVaultOfferDto;
|
|
1845
|
+
type OfferBaseDto = {
|
|
1846
|
+
id: string;
|
|
1847
|
+
slug: string;
|
|
1848
|
+
ends_at: string | null;
|
|
1849
|
+
tokens: OfferTokenDto[];
|
|
1850
|
+
};
|
|
1851
|
+
/**
|
|
1852
|
+
* A curated sale window and the hand-authored copy that goes with it. Required
|
|
1853
|
+
* on every variant that runs such a campaign, which is every one but Ondo.
|
|
1854
|
+
*/
|
|
1855
|
+
type OfferEditorialDto = {
|
|
1856
|
+
tagline: string;
|
|
1857
|
+
banner_url: string;
|
|
1858
|
+
starts_at: string;
|
|
1859
|
+
};
|
|
1860
|
+
/**
|
|
1861
|
+
* What an Ondo swap or a Centrifuge vault sends in place of
|
|
1862
|
+
* {@link OfferEditorialDto}. Neither runs a campaign, so the keys arrive as
|
|
1863
|
+
* `null` and carry nothing, and the backend may stop sending them at all.
|
|
1864
|
+
* Declared so a fixture can describe the real payload; no `fromDto` reads
|
|
1865
|
+
* them.
|
|
1866
|
+
*/
|
|
1867
|
+
type OfferNoEditorialDto = {
|
|
1868
|
+
tagline?: null;
|
|
1869
|
+
banner_url?: null;
|
|
1870
|
+
starts_at?: null;
|
|
1396
1871
|
};
|
|
1397
|
-
|
|
1398
|
-
type
|
|
1399
|
-
|
|
1400
|
-
fractional_digits: number;
|
|
1401
|
-
id: string;
|
|
1402
|
-
name: string;
|
|
1872
|
+
type CoinListTokenSaleOfferDto = OfferBaseDto & OfferEditorialDto & {
|
|
1873
|
+
type: 'coinlist::token_sale';
|
|
1874
|
+
logo_url: string;
|
|
1403
1875
|
};
|
|
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;
|
|
1876
|
+
type SuperstateSwapOfferDto = OfferBaseDto & OfferEditorialDto & {
|
|
1877
|
+
type: 'superstate::swap';
|
|
1878
|
+
/** Publishing a swap does not require anyone to upload artwork for it. */
|
|
1879
|
+
logo_url: string | null;
|
|
1414
1880
|
};
|
|
1415
|
-
|
|
1416
|
-
|
|
1881
|
+
type OndoSwapOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
1882
|
+
type: 'ondo::swap';
|
|
1883
|
+
/** Publishing a swap does not require anyone to upload artwork for it. */
|
|
1884
|
+
logo_url: string | null;
|
|
1417
1885
|
};
|
|
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;
|
|
1886
|
+
type CentrifugeVaultOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
1887
|
+
type: 'centrifuge::vault';
|
|
1888
|
+
/** Publishing a vault does not require anyone to upload artwork for it. */
|
|
1889
|
+
logo_url: string | null;
|
|
1433
1890
|
};
|
|
1434
|
-
type
|
|
1435
|
-
|
|
1436
|
-
|
|
1891
|
+
type OfferTokenDto = {
|
|
1892
|
+
/**
|
|
1893
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for
|
|
1894
|
+
* deposits, as `swap` is the token a swap offer trades into.
|
|
1895
|
+
*/
|
|
1896
|
+
role: 'funding' | 'distribution' | 'swap' | 'vault';
|
|
1437
1897
|
chain: string;
|
|
1438
|
-
|
|
1439
|
-
amount: string;
|
|
1440
|
-
asset_id: string;
|
|
1441
|
-
approval_transaction_hash: string | null | undefined;
|
|
1898
|
+
address: string;
|
|
1442
1899
|
};
|
|
1443
1900
|
|
|
1444
1901
|
/**
|
|
1445
1902
|
* One variant per `OfferTypeDto`, the same split as `OfferDto` with what
|
|
1446
1903
|
* `GET /v1/offers/:id` adds on top. Read `type` first.
|
|
1447
1904
|
*/
|
|
1448
|
-
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto;
|
|
1449
|
-
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1905
|
+
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto | CentrifugeVaultOfferDetailDto;
|
|
1906
|
+
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1450
1907
|
type: 'coinlist::token_sale';
|
|
1451
1908
|
logo_url: string;
|
|
1452
1909
|
};
|
|
1453
|
-
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1910
|
+
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1454
1911
|
type: 'superstate::swap';
|
|
1455
1912
|
logo_url: string | null;
|
|
1456
1913
|
};
|
|
1457
|
-
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
1914
|
+
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoVaultContractsDto & {
|
|
1458
1915
|
type: 'ondo::swap';
|
|
1459
1916
|
logo_url: string | null;
|
|
1460
1917
|
/**
|
|
@@ -1463,6 +1920,19 @@ type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
|
1463
1920
|
*/
|
|
1464
1921
|
swap_contracts: OfferDetailSwapContractDto[];
|
|
1465
1922
|
};
|
|
1923
|
+
type CentrifugeVaultOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
1924
|
+
type: 'centrifuge::vault';
|
|
1925
|
+
logo_url: string | null;
|
|
1926
|
+
/**
|
|
1927
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
1928
|
+
* request goes through. `[]` is an answer - "deposits nowhere", which is
|
|
1929
|
+
* every vault until a proxy is deployed - and a missing key is not.
|
|
1930
|
+
*/
|
|
1931
|
+
vault_contracts: OfferDetailVaultContractDto[];
|
|
1932
|
+
};
|
|
1933
|
+
type OfferDetailNoVaultContractsDto = {
|
|
1934
|
+
vault_contracts?: OfferDetailVaultContractDto[];
|
|
1935
|
+
};
|
|
1466
1936
|
/**
|
|
1467
1937
|
* An offer that does not settle through a CoinList swap contract sends `[]`
|
|
1468
1938
|
* or no key at all, and either way there is nothing to read. Declared so a
|
|
@@ -1529,6 +1999,104 @@ type OfferDetailSwapContractDto = {
|
|
|
1529
1999
|
chain: string;
|
|
1530
2000
|
address: string;
|
|
1531
2001
|
};
|
|
2002
|
+
type OfferDetailVaultContractDto = {
|
|
2003
|
+
chain: string;
|
|
2004
|
+
address: string;
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
type OfferId = Newtype<string, 'OfferId'>;
|
|
2008
|
+
declare const OfferId: (value: string) => OfferId;
|
|
2009
|
+
type OfferSlug = Newtype<string, 'OfferSlug'>;
|
|
2010
|
+
declare const OfferSlug: (value: string) => OfferSlug;
|
|
2011
|
+
type OfferType = OfferTypeDto;
|
|
2012
|
+
declare const isOfferType: (value: string) => value is OfferType;
|
|
2013
|
+
type OfferBase = {
|
|
2014
|
+
id: OfferId;
|
|
2015
|
+
slug: OfferSlug;
|
|
2016
|
+
endsAt: Date | null;
|
|
2017
|
+
tokens: OfferToken[];
|
|
2018
|
+
};
|
|
2019
|
+
type CoinListTokenSaleOffer = OfferBase & OfferEditorial & {
|
|
2020
|
+
type: 'coinlist::token_sale';
|
|
2021
|
+
logoUrl: string;
|
|
2022
|
+
};
|
|
2023
|
+
type SuperstateSwapOffer = OfferBase & OfferEditorial & {
|
|
2024
|
+
type: 'superstate::swap';
|
|
2025
|
+
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
2026
|
+
logoUrl: string | null;
|
|
2027
|
+
};
|
|
2028
|
+
type OndoSwapOffer = OfferBase & {
|
|
2029
|
+
type: 'ondo::swap';
|
|
2030
|
+
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
2031
|
+
logoUrl: string | null;
|
|
2032
|
+
};
|
|
2033
|
+
type CentrifugeVaultOffer = OfferBase & {
|
|
2034
|
+
type: 'centrifuge::vault';
|
|
2035
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
2036
|
+
logoUrl: string | null;
|
|
2037
|
+
};
|
|
2038
|
+
/**
|
|
2039
|
+
* A curated sale window and the hand-authored copy that goes with it. Every
|
|
2040
|
+
* variant that runs such a campaign carries all three, validated; an Ondo swap
|
|
2041
|
+
* trades continuously and a Centrifuge vault takes deposits continuously, so
|
|
2042
|
+
* neither runs one and neither carries any.
|
|
2043
|
+
*/
|
|
2044
|
+
type OfferEditorial = {
|
|
2045
|
+
tagline: string;
|
|
2046
|
+
bannerUrl: string;
|
|
2047
|
+
startsAt: Date;
|
|
2048
|
+
};
|
|
2049
|
+
declare const OfferEditorial: {
|
|
2050
|
+
/**
|
|
2051
|
+
* `model` prefixes the field in the error (`'Offer'`, `'OfferDetail'`), so
|
|
2052
|
+
* the same three checks name the payload that failed them.
|
|
2053
|
+
*/
|
|
2054
|
+
fromDto: (dto: OfferEditorialDto, model: string) => OfferEditorial;
|
|
2055
|
+
};
|
|
2056
|
+
/**
|
|
2057
|
+
* An offer as `GET /v1/offers` lists it: a union on {@link OfferType}, each
|
|
2058
|
+
* variant carrying only the fields that mean something for it. Narrow on
|
|
2059
|
+
* `type` before reading anything beyond {@link OfferBase} - an Ondo swap has
|
|
2060
|
+
* no `startsAt` to read, and the compiler says so.
|
|
2061
|
+
*/
|
|
2062
|
+
type Offer = CoinListTokenSaleOffer | SuperstateSwapOffer | OndoSwapOffer | CentrifugeVaultOffer;
|
|
2063
|
+
declare const Offer: {
|
|
2064
|
+
fromDto: (dto: OfferDto) => Offer;
|
|
2065
|
+
/**
|
|
2066
|
+
* Maps a page of offers, dropping every offer whose `type` this SDK does not
|
|
2067
|
+
* name. The same reasoning as {@link OfferToken.listFromDto}: a plain `.map`
|
|
2068
|
+
* would throw out of `fromDto` and, through `PaginatedResponse.fromDto`,
|
|
2069
|
+
* reject the whole page, so one offer of an unknown type would blank the
|
|
2070
|
+
* grid for every offer beside it. A single offer fetched by id still
|
|
2071
|
+
* throws, because there is nothing beside it to keep.
|
|
2072
|
+
*/
|
|
2073
|
+
listFromDto: (dtos: OfferDto[]) => Offer[];
|
|
2074
|
+
};
|
|
2075
|
+
/**
|
|
2076
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for deposits,
|
|
2077
|
+
* as `swap` is the token a swap offer trades into.
|
|
2078
|
+
*/
|
|
2079
|
+
type TokenRole = 'funding' | 'distribution' | 'swap' | 'vault';
|
|
2080
|
+
type OfferToken = {
|
|
2081
|
+
role: TokenRole;
|
|
2082
|
+
chain: Chain;
|
|
2083
|
+
address: EvmContractAddress;
|
|
2084
|
+
};
|
|
2085
|
+
declare const OfferToken: {
|
|
2086
|
+
fromDto: (dto: OfferTokenDto) => OfferToken;
|
|
2087
|
+
/**
|
|
2088
|
+
* Maps an offer's token list, dropping every token on a chain this SDK does
|
|
2089
|
+
* not name. Frontline's chain registry runs ahead of {@link Chain}, and a
|
|
2090
|
+
* plain `.map` would throw out of `Offer.fromDto` and, through
|
|
2091
|
+
* `PaginatedResponse.fromDto`, reject the whole offers page - which is how
|
|
2092
|
+
* one Base token blanked production's offers list. Dropping costs that
|
|
2093
|
+
* token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
|
|
2094
|
+
* so nobody could have looked it up anyway.
|
|
2095
|
+
*
|
|
2096
|
+
* Same shape as `TokenMetadata.fromRegistryDto`.
|
|
2097
|
+
*/
|
|
2098
|
+
listFromDto: (dtos: OfferTokenDto[]) => OfferToken[];
|
|
2099
|
+
};
|
|
1532
2100
|
|
|
1533
2101
|
type Ticker = Newtype<string, 'Ticker'>;
|
|
1534
2102
|
declare const Ticker: (value: string) => Ticker;
|
|
@@ -1547,6 +2115,28 @@ type Isin = Newtype<string, 'Isin'>;
|
|
|
1547
2115
|
declare const Isin: (value: string) => Isin;
|
|
1548
2116
|
type OrderBookSide = 'buy' | 'sell';
|
|
1549
2117
|
|
|
2118
|
+
/** The `type` of every {@link AsyncOfferDetail}. */
|
|
2119
|
+
type AsyncOfferType = AsyncOfferDetail['type'];
|
|
2120
|
+
/**
|
|
2121
|
+
* An offer whose trade settles later: the user places a request, the fund
|
|
2122
|
+
* fills it on its own schedule, and the user comes back to claim the result.
|
|
2123
|
+
* Only these have a second leg for `ClaimContainer` to show.
|
|
2124
|
+
*
|
|
2125
|
+
* A subset of {@link OfferDetail} picked by `type`, so it narrows like any
|
|
2126
|
+
* other variant and a new async provider is one more member here.
|
|
2127
|
+
*/
|
|
2128
|
+
type AsyncOfferDetail = CentrifugeVaultOfferDetail;
|
|
2129
|
+
declare const AsyncOfferDetail: {
|
|
2130
|
+
/**
|
|
2131
|
+
* Narrows an offer fetched generically, e.g. on an offer page, to one with
|
|
2132
|
+
* something to claim.
|
|
2133
|
+
*
|
|
2134
|
+
* An exhaustive `switch` rather than a list of async types, so a new offer
|
|
2135
|
+
* type is a compile error here until someone decides whether it settles
|
|
2136
|
+
* later.
|
|
2137
|
+
*/
|
|
2138
|
+
is: (offer: OfferDetail) => offer is AsyncOfferDetail;
|
|
2139
|
+
};
|
|
1550
2140
|
type CoinListTokenSaleOfferDetail = OfferDetailBase & OfferEditorial & {
|
|
1551
2141
|
type: 'coinlist::token_sale';
|
|
1552
2142
|
logoUrl: string;
|
|
@@ -1566,6 +2156,16 @@ type OndoSwapOfferDetail = OfferDetailBase & {
|
|
|
1566
2156
|
*/
|
|
1567
2157
|
swapContracts: OfferSwapContract[];
|
|
1568
2158
|
};
|
|
2159
|
+
type CentrifugeVaultOfferDetail = OfferDetailBase & {
|
|
2160
|
+
type: 'centrifuge::vault';
|
|
2161
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
2162
|
+
logoUrl: string | null;
|
|
2163
|
+
/**
|
|
2164
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
2165
|
+
* request goes through. Empty means it takes deposits nowhere yet.
|
|
2166
|
+
*/
|
|
2167
|
+
vaultContracts: OfferVaultContract[];
|
|
2168
|
+
};
|
|
1569
2169
|
type OfferDetailBase = {
|
|
1570
2170
|
id: OfferId;
|
|
1571
2171
|
slug: OfferSlug;
|
|
@@ -1643,13 +2243,38 @@ type OfferSwapContract = {
|
|
|
1643
2243
|
declare const OfferSwapContract: {
|
|
1644
2244
|
fromDto: (dto: OfferDetailSwapContractDto) => OfferSwapContract;
|
|
1645
2245
|
};
|
|
2246
|
+
/**
|
|
2247
|
+
* A chain a Centrifuge vault takes deposits on, with the CoinList proxy the
|
|
2248
|
+
* request goes through. Not a token, so the token registry knows nothing about
|
|
2249
|
+
* it: it is the spender the user approves the funding token to, and the `to`
|
|
2250
|
+
* the buy and claim transactions are sent to.
|
|
2251
|
+
*
|
|
2252
|
+
* Its own type rather than an {@link OfferSwapContract}, although the shape is
|
|
2253
|
+
* the same, because the meaning is not: a swap contract serves every Ondo
|
|
2254
|
+
* asset on its chain, while a proxy belongs to one offer on one chain, so the
|
|
2255
|
+
* same chain carries a different address on every vault.
|
|
2256
|
+
*/
|
|
2257
|
+
type OfferVaultContract = {
|
|
2258
|
+
chain: Chain;
|
|
2259
|
+
address: EvmContractAddress;
|
|
2260
|
+
};
|
|
2261
|
+
declare const OfferVaultContract: {
|
|
2262
|
+
fromDto: (dto: OfferDetailVaultContractDto) => OfferVaultContract;
|
|
2263
|
+
/**
|
|
2264
|
+
* Drops every proxy on a chain this SDK does not name, as
|
|
2265
|
+
* `OfferToken.listFromDto` does: frontline publishes the full offer-token
|
|
2266
|
+
* chain list, which runs ahead of {@link Chain}, and one unmodelled chain
|
|
2267
|
+
* should not throw away the proxies the SDK can use.
|
|
2268
|
+
*/
|
|
2269
|
+
listFromDto: (dtos: OfferDetailVaultContractDto[]) => OfferVaultContract[];
|
|
2270
|
+
};
|
|
1646
2271
|
/**
|
|
1647
2272
|
* An offer as `GET /v1/offers/:id` serves it: the same union on `type` as
|
|
1648
2273
|
* {@link Offer}, each variant carrying only the fields that mean something
|
|
1649
2274
|
* for it. Narrow on `type` before reading anything beyond
|
|
1650
2275
|
* {@link OfferDetailBase}.
|
|
1651
2276
|
*/
|
|
1652
|
-
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail;
|
|
2277
|
+
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail | CentrifugeVaultOfferDetail;
|
|
1653
2278
|
declare const OfferDetail: {
|
|
1654
2279
|
fromDto: (dto: OfferDetailDto) => OfferDetail;
|
|
1655
2280
|
};
|
|
@@ -1696,6 +2321,74 @@ declare const Milestone: {
|
|
|
1696
2321
|
fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
|
|
1697
2322
|
};
|
|
1698
2323
|
|
|
2324
|
+
/**
|
|
2325
|
+
* The cursor-paginated envelope every list endpoint returns.
|
|
2326
|
+
*
|
|
2327
|
+
* Generic in its item type, so each resource pairs it with its own item DTO
|
|
2328
|
+
* rather than declaring an envelope of its own.
|
|
2329
|
+
*/
|
|
2330
|
+
interface PaginatedResponseDto<T> {
|
|
2331
|
+
data: T[];
|
|
2332
|
+
starting_after?: string;
|
|
2333
|
+
starting_before?: string;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
type Cursor = Newtype<string, 'Cursor'>;
|
|
2337
|
+
declare const Cursor: (value: string) => Cursor;
|
|
2338
|
+
interface PaginatedResponse<T> {
|
|
2339
|
+
data: T[];
|
|
2340
|
+
startingAfter: Cursor | null;
|
|
2341
|
+
startingBefore: Cursor | null;
|
|
2342
|
+
}
|
|
2343
|
+
declare const PaginatedResponse: {
|
|
2344
|
+
fromDto: <A, B>(dto: PaginatedResponseDto<A>, itemMapper: (item: A) => B) => PaginatedResponse<B>;
|
|
2345
|
+
/**
|
|
2346
|
+
* For a mapper that decides the page as a whole - one that drops items it
|
|
2347
|
+
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
2348
|
+
* cursors are the wire's either way: dropping an item changes what the
|
|
2349
|
+
* page holds, not where the next page starts.
|
|
2350
|
+
*/
|
|
2351
|
+
fromDtoPage: <A, B>(dto: PaginatedResponseDto<A>, pageMapper: (items: A[]) => B[]) => PaginatedResponse<B>;
|
|
2352
|
+
};
|
|
2353
|
+
/**
|
|
2354
|
+
* Cursor-based pagination input used when requesting paginated API resources.
|
|
2355
|
+
* Set `after` or `before` to navigate relative to a known cursor, and `limit`
|
|
2356
|
+
* to control the maximum number of returned items.
|
|
2357
|
+
*/
|
|
2358
|
+
interface PaginationParams {
|
|
2359
|
+
before?: Cursor;
|
|
2360
|
+
after?: Cursor;
|
|
2361
|
+
limit?: number;
|
|
2362
|
+
}
|
|
2363
|
+
declare const PaginationParams: {
|
|
2364
|
+
toQueryParams: (params: PaginationParams) => Record<string, QueryParamValue>;
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
type ParticipationStatusDto = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
|
|
2368
|
+
type ParticipationDto = {
|
|
2369
|
+
object: 'participation';
|
|
2370
|
+
id: string;
|
|
2371
|
+
offer_id: string;
|
|
2372
|
+
offer_option_id: string;
|
|
2373
|
+
status: ParticipationStatusDto;
|
|
2374
|
+
amount: string;
|
|
2375
|
+
amount_string: string;
|
|
2376
|
+
asset: AssetDto;
|
|
2377
|
+
chain: string;
|
|
2378
|
+
inserted_at: string | null | undefined;
|
|
2379
|
+
updated_at: string | null | undefined;
|
|
2380
|
+
wallet_address: string | null | undefined;
|
|
2381
|
+
};
|
|
2382
|
+
type CreateParticipationDto = {
|
|
2383
|
+
offer_id: string;
|
|
2384
|
+
offer_option_id: string;
|
|
2385
|
+
chain: string;
|
|
2386
|
+
wallet_address: string;
|
|
2387
|
+
amount: string;
|
|
2388
|
+
asset_id: string;
|
|
2389
|
+
approval_transaction_hash: string | null | undefined;
|
|
2390
|
+
};
|
|
2391
|
+
|
|
1699
2392
|
/** Unique identifier for a participation. */
|
|
1700
2393
|
type ParticipationId = Newtype<string, 'ParticipationId'>;
|
|
1701
2394
|
/** Casts a string into a typed {@link ParticipationId}. */
|
|
@@ -2436,6 +3129,17 @@ declare const OndoSellTransaction: {
|
|
|
2436
3129
|
*/
|
|
2437
3130
|
interface OndoNamespace {
|
|
2438
3131
|
getTradingStatus(params: GetOndoTradingStatusParams): Promise<OndoTradingStatus>;
|
|
3132
|
+
/**
|
|
3133
|
+
* An indicative price for `params`' size, from Ondo's live market.
|
|
3134
|
+
*
|
|
3135
|
+
* Ondo refuses to quote while the market is closed or paused, or the asset
|
|
3136
|
+
* is paused or closed for the session - including for about a minute at
|
|
3137
|
+
* every US session change, when `getTradingStatus` may still have reported
|
|
3138
|
+
* the asset tradable. The request then rejects with a 409 carrying
|
|
3139
|
+
* `code: "not_tradable"`; tell it apart from a failure with
|
|
3140
|
+
* {@link isOndoNotTradableError}. Retrying before the market opens fails the
|
|
3141
|
+
* same way.
|
|
3142
|
+
*/
|
|
2439
3143
|
getQuote(params: GetOndoQuoteParams): Promise<OndoQuote>;
|
|
2440
3144
|
/**
|
|
2441
3145
|
* Builds a purchase for a specific wallet and deposit: spends an attestation
|
|
@@ -3298,4 +4002,51 @@ declare class TokensNamespaceImpl implements TokensNamespace {
|
|
|
3298
4002
|
list(chain?: EthereumChain): Promise<TokenMetadata[]>;
|
|
3299
4003
|
}
|
|
3300
4004
|
|
|
3301
|
-
|
|
4005
|
+
/**
|
|
4006
|
+
* An instant: milliseconds since the Unix epoch, as `Date.now()` reads it.
|
|
4007
|
+
* Distinct from {@link Millis}, a duration, so an instant cannot be passed
|
|
4008
|
+
* where a timeout is expected or the other way round.
|
|
4009
|
+
*/
|
|
4010
|
+
type EpochMillis = Newtype<number, 'EpochMillis'>;
|
|
4011
|
+
declare const EpochMillis: {
|
|
4012
|
+
/**
|
|
4013
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
4014
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
4015
|
+
*/
|
|
4016
|
+
of: (value: number) => EpochMillis;
|
|
4017
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
4018
|
+
now: () => EpochMillis;
|
|
4019
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
4020
|
+
fromDate: (date: Date) => EpochMillis;
|
|
4021
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
4022
|
+
elapsed: (from: EpochMillis, to: EpochMillis) => Millis;
|
|
4023
|
+
plus: (at: EpochMillis, duration: Millis) => EpochMillis;
|
|
4024
|
+
};
|
|
4025
|
+
/**
|
|
4026
|
+
* A duration in milliseconds. May be negative: the gap between two instants
|
|
4027
|
+
* read off a wall clock that stepped back in between.
|
|
4028
|
+
*/
|
|
4029
|
+
type Millis = Newtype<number, 'Millis'>;
|
|
4030
|
+
declare const Millis: {
|
|
4031
|
+
of: (value: number) => Millis;
|
|
4032
|
+
};
|
|
4033
|
+
/** A duration in whole, non-negative seconds. */
|
|
4034
|
+
type Seconds = Newtype<number, 'Seconds'>;
|
|
4035
|
+
declare const Seconds: {
|
|
4036
|
+
/**
|
|
4037
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
4038
|
+
*/
|
|
4039
|
+
of: (value: number) => Seconds;
|
|
4040
|
+
toMillis: (value: Seconds) => Millis;
|
|
4041
|
+
};
|
|
4042
|
+
/**
|
|
4043
|
+
* Whether `expiresAt` has passed at `now`, counting it as passed `buffer`
|
|
4044
|
+
* early. The boundary instant itself counts as expired.
|
|
4045
|
+
*/
|
|
4046
|
+
declare function isExpired({ expiresAt, now, buffer, }: {
|
|
4047
|
+
expiresAt: EpochMillis;
|
|
4048
|
+
now: EpochMillis;
|
|
4049
|
+
buffer?: Millis;
|
|
4050
|
+
}): boolean;
|
|
4051
|
+
|
|
4052
|
+
export { AsyncOfferDetail as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, type OAuthAccessToken as D, type Erc20Namespace as E, type OffersNamespace as F, DecimalString as G, StablecoinSymbol as H, type Erc20Asset as I, OfferDetail as J, TokenMetadata as K, type Logger as L, type CentrifugeVaultOfferDetail as M, type OfferType as N, OfferVaultContract as O, Participation as P, type OndoSwapOfferDetail as Q, type RequirementsNamespace as R, type SuperstateSwapNamespace as S, type TokensNamespace as T, type UniversalNamespaceContext as U, type CoinListTokenSaleOfferDetail as V, type WalletError as W, type SuperstateSwapOfferDetail as X, CentrifugeVaultLegId as Y, Seconds as Z, type AsyncOfferType as _, EthereumChain as a, type CentrifugeVaultOffer as a$, Offer as a0, RequirementStatusInfo as a1, type RequirementType as a2, type RequirementStatusValue as a3, OfferOptionAddress as a4, RequirementId as a5, type KycLevelName as a6, DocumentSubmission as a7, type WalletChallengeType as a8, type PinoLoggerOptions as a9, type ProductionLogLevel as aA, RedactedWalletError as aB, type RequestId as aC, type RpcFailureReason as aD, type SafeEvent as aE, type SafeFields as aF, type UnredactedFields as aG, OAuthSession as aH, ClientCredentialsOAuth as aI, type Sender as aJ, PaginationParams as aK, PaginatedResponse as aL, ClientSecret as aM, OfferToken as aN, SwapStatus as aO, type Uint256 as aP, KnownAssetSymbol as aQ, type Newtype as aR, type AllowWalletParams as aS, AllowWalletResponse as aT, Asset as aU, AssetCode as aV, Blockchain as aW, type BuildOndoSwapParamsCore as aX, type CentrifugePositionStatus as aY, CentrifugeVaultClaimProceedsTransaction as aZ, CentrifugeVaultClaimTransaction as a_, AssetDecimals as aa, type BuildCentrifugeVaultBuyParams as ab, CentrifugeVaultQuote as ac, type CentrifugeOrderReason as ad, type CentrifugeOrderability as ae, OndoTradingStatus as af, type BuildOndoBuyParams as ag, type BuildOndoSellParams as ah, OndoQuote as ai, type OndoQuoteSize as aj, type TokenIdentifier as ak, CentrifugeVaultLeg as al, OfferOptionAddressId as am, CentrifugeVaultStatus as an, TokenLogo as ao, type DebugEvent as ap, type FrontlineEventId as aq, HttpError as ar, type HttpResponse as as, KycToken as at, type LogBinding as au, type LogBindings as av, type LogCause as aw, type LogLevel as ax, type LogScope as ay, type LogValue as az, EvmContractAddress as b, type RequirementActionNeededReason as b$, CentrifugeVaultPosition as b0, type CentrifugeVaultReason as b1, CentrifugeVaultRedeemPosition as b2, type CentrifugeVaultTransactionCore as b3, type CentrifugeWalletParams as b4, Chain as b5, ClientId as b6, CodeChallenge as b7, type CoinListTokenSaleOffer as b8, ConnectExternalWalletParams as b9, Milestone as bA, Millis as bB, OAuthRefreshToken as bC, type OfferBase as bD, type OfferDetailBase as bE, OfferEditorial as bF, OfferOption as bG, OfferOptionSlug as bH, OfferSlug as bI, OffersNamespaceImpl as bJ, type OndoQuoteDuration as bK, type OndoSellOutcome as bL, type OndoSwapOffer as bM, PKCEState as bN, type PaginatedResponseDto as bO, ParticipationId as bP, type ParticipationStatus as bQ, ParticipationsPaginationParams as bR, PauseFlags as bS, Pii as bT, PiiAddress as bU, PiiJurisdiction as bV, type PiiKind as bW, type QueryParamValue as bX, type QueryParamValues as bY, RedirectUri as bZ, type RemoveOptionAddressParams as b_, type CreateKycTokenParams as ba, CreateParticipationParams as bb, CreateWalletOwnershipChallengeParams as bc, Cursor as bd, type DocumentFormType as be, type DocumentSubmissionStatus as bf, type DocumentType as bg, ETHEREUM_CHAINS as bh, EpochMillis as bi, Erc20NamespaceImpl as bj, FaqItem as bk, type GetCentrifugeVaultQuoteParams as bl, type GetCentrifugeVaultStatusParams as bm, type GetOndoQuoteParams as bn, type GetOndoTradingStatusParams as bo, type GetSwapAuthorizationParams as bp, type GetSwapPreviewParams as bq, type GetTokenAllowanceParams as br, type GetTokenBalanceParams as bs, HexEncodedTransactionData as bt, Isin as bu, Iso2CountryCode as bv, Link as bw, type ListOptionAddressesParams as bx, MAX_ASSET_DECIMALS as by, MAX_UINT_256 as bz, type CentrifugeNamespace as c, type RpcConfig as c0, SOLANA_CHAINS as c1, STABLE_DECIMALS as c2, SolanaChain as c3, type SubmitDocumentParams as c4, type SuperstateSwapOffer as c5, type SwapContractRef as c6, SwapPreview as c7, TermItem as c8, Ticker as c9, type TokenLogoImage as ca, TokenLogoUrl as cb, type TokenRole as cc, TokensNamespaceImpl as cd, type Tx as ce, WalletAddress as cf, WalletOwnershipChallenge as cg, type WalletProtocol as ch, WalletsNamespaceImpl as ci, apiErrorCode as cj, assertUint256 as ck, isChain as cl, isExpired as cm, isOfferType as cn, parseUint256 as co, 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 };
|