@coinlist-co/react 0.12.2-rc.abd9d38 → 0.12.2-rc.bc20f5b

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.
Files changed (33) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-45LAPB7U.js → chunk-3WW5FLT7.js} +2 -2
  3. package/dist/{chunk-HDJEDOS4.js → chunk-C6GF7MDF.js} +759 -412
  4. package/dist/chunk-C6GF7MDF.js.map +1 -0
  5. package/dist/{chunk-M7WDZZPX.js → chunk-IZJ4JSSC.js} +69 -4
  6. package/dist/chunk-IZJ4JSSC.js.map +1 -0
  7. package/dist/client/index.cjs +11305 -7943
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +1545 -10
  10. package/dist/client/index.d.ts +1545 -10
  11. package/dist/client/index.js +7725 -4781
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.cjs +347 -62
  14. package/dist/server/index.cjs.map +1 -1
  15. package/dist/server/index.d.cts +6 -2
  16. package/dist/server/index.d.ts +6 -2
  17. package/dist/server/index.js +4 -2
  18. package/dist/server/index.js.map +1 -1
  19. package/dist/{tokens-namespace-DrwRi0AQ.d.cts → time-CVZpAkGY.d.cts} +815 -192
  20. package/dist/{tokens-namespace-DrwRi0AQ.d.ts → time-CVZpAkGY.d.ts} +815 -192
  21. package/dist/{token-registry-snapshot-C-Qs3Lgs.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +74 -8
  22. package/dist/{token-registry-snapshot-CpzLmsc2.d.cts → token-registry-snapshot-bR14QehS.d.cts} +74 -8
  23. package/dist/universal/index.cjs +812 -385
  24. package/dist/universal/index.cjs.map +1 -1
  25. package/dist/universal/index.d.cts +54 -6
  26. package/dist/universal/index.d.ts +54 -6
  27. package/dist/universal/index.js +30 -2
  28. package/package.json +1 -1
  29. package/dist/chunk-HDJEDOS4.js.map +0 -1
  30. package/dist/chunk-M7WDZZPX.js.map +0 -1
  31. package/dist/time-BOCS1TbH.d.cts +0 -50
  32. package/dist/time-C7mhO5_a.d.ts +0 -50
  33. /package/dist/{chunk-45LAPB7U.js.map → chunk-3WW5FLT7.js.map} +0 -0
@@ -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
@@ -1179,6 +1179,39 @@ declare class Erc20NamespaceImpl implements Erc20Namespace {
1179
1179
  getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
1180
1180
  }
1181
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
+
1182
1215
  /**
1183
1216
  * The logging surface SDK code uses. Never exported to hosts: they implement
1184
1217
  * {@link Logger}, which is deliberately smaller.
@@ -1257,256 +1290,563 @@ type InternalDebugEvent = {
1257
1290
  };
1258
1291
 
1259
1292
  /**
1260
- * The product an offer is checked out through. The backend sends one compound
1261
- * `{supplier}::{saleType}` string, verbatim as spelled below: a double colon
1262
- * between the two halves, `snake_case` within each. CoinList's token sale is
1263
- * `coinlist::token_sale`; there is no `coinlist::sale` and no
1264
- * `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.
1265
1296
  *
1266
- * Kept flat rather than split into a supplier and a sale type, because a flat
1267
- * union makes a `switch` over it exhaustive: adding a provider without
1268
- * handling it becomes a compile error.
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.
1269
1305
  */
1270
- type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap';
1271
1306
  /**
1272
- * One variant per {@link OfferTypeDto}, mirroring frontline#1365, which keys
1273
- * `GET /v1/offers` on `type`. Read `type` first: it decides which of the
1274
- * fields below mean anything.
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}.
1275
1313
  */
1276
- type OfferDto = CoinListTokenSaleOfferDto | SuperstateSwapOfferDto | OndoSwapOfferDto;
1277
- type OfferBaseDto = {
1278
- id: string;
1279
- slug: string;
1280
- ends_at: string | null;
1281
- tokens: OfferTokenDto[];
1282
- };
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'>;
1283
1317
  /**
1284
- * A curated sale window and the hand-authored copy that goes with it. Required
1285
- * on every variant that runs such a campaign, which is every one but Ondo.
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.
1286
1321
  */
1287
- type OfferEditorialDto = {
1288
- tagline: string;
1289
- banner_url: string;
1290
- starts_at: string;
1291
- };
1322
+ type CentrifugePositionStatusDto = 'none' | 'pending' | 'partially_filled' | 'filled' | 'claimed';
1292
1323
  /**
1293
- * What an Ondo swap sends in place of {@link OfferEditorialDto}. It trades
1294
- * continuously and runs no campaign, so the keys arrive as `null` and carry
1295
- * nothing. Declared so a fixture can describe the real payload; no `fromDto`
1296
- * 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.
1297
1327
  */
1298
- type OfferNoEditorialDto = {
1299
- tagline: null;
1300
- banner_url: null;
1301
- starts_at: null;
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;
1302
1357
  };
1303
- type CoinListTokenSaleOfferDto = OfferBaseDto & OfferEditorialDto & {
1304
- type: 'coinlist::token_sale';
1305
- logo_url: string;
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;
1306
1367
  };
1307
- type SuperstateSwapOfferDto = OfferBaseDto & OfferEditorialDto & {
1308
- type: 'superstate::swap';
1309
- /** Publishing a swap does not require anyone to upload artwork for it. */
1310
- logo_url: string | null;
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;
1311
1400
  };
1312
- type OndoSwapOfferDto = OfferBaseDto & OfferNoEditorialDto & {
1313
- type: 'ondo::swap';
1314
- /** Publishing a swap does not require anyone to upload artwork for it. */
1315
- logo_url: string | null;
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;
1316
1410
  };
1317
- type OfferTokenDto = {
1318
- role: 'funding' | 'distribution' | 'swap';
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;
1319
1424
  chain: string;
1320
- address: string;
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;
1321
1452
  };
1322
1453
 
1323
- type OfferId = Newtype<string, 'OfferId'>;
1324
- declare const OfferId: (value: string) => OfferId;
1325
- type OfferSlug = Newtype<string, 'OfferSlug'>;
1326
- declare const OfferSlug: (value: string) => OfferSlug;
1327
- type OfferType = OfferTypeDto;
1328
- declare const isOfferType: (value: string) => value is OfferType;
1329
- type OfferBase = {
1330
- id: OfferId;
1331
- slug: OfferSlug;
1332
- endsAt: Date | null;
1333
- tokens: OfferToken[];
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[]];
1334
1483
  };
1335
- type CoinListTokenSaleOffer = OfferBase & OfferEditorial & {
1336
- type: 'coinlist::token_sale';
1337
- logoUrl: string;
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;
1338
1513
  };
1339
- type SuperstateSwapOffer = OfferBase & OfferEditorial & {
1340
- type: 'superstate::swap';
1341
- /** Null when nobody has uploaded artwork: a swap publishes without it. */
1342
- logoUrl: string | null;
1514
+ declare const CentrifugeVaultStatus: {
1515
+ fromDto: (dto: CentrifugeVaultStatusDto) => CentrifugeVaultStatus;
1343
1516
  };
1344
- type OndoSwapOffer = OfferBase & {
1345
- type: 'ondo::swap';
1346
- /** Null when nobody has uploaded artwork: a swap publishes without it. */
1347
- logoUrl: string | null;
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;
1348
1529
  };
1349
1530
  /**
1350
- * A curated sale window and the hand-authored copy that goes with it. Every
1351
- * variant that runs such a campaign carries all three, validated; an Ondo swap
1352
- * trades continuously, runs none, and carries none.
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.
1353
1536
  */
1354
- type OfferEditorial = {
1355
- tagline: string;
1356
- bannerUrl: string;
1357
- startsAt: Date;
1537
+ type CentrifugeVaultBuyTransaction = CentrifugeVaultTransactionCore & {
1538
+ /** Exactly what the approval has to cover: no fee comes off it. */
1539
+ spendInputAmount: BlockchainAmount;
1358
1540
  };
1359
- declare const OfferEditorial: {
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 & {
1360
1550
  /**
1361
- * `model` prefixes the field in the error (`'Offer'`, `'OfferDetail'`), so
1362
- * the same three checks name the payload that failed them.
1551
+ * Read when the calldata was built. A floor: a fill landing before the
1552
+ * broadcast raises it, and the claim still collects everything.
1363
1553
  */
1364
- fromDto: (dto: OfferEditorialDto, model: string) => OfferEditorial;
1554
+ claimableShares: BlockchainAmount;
1555
+ };
1556
+ declare const CentrifugeVaultClaimTransaction: {
1557
+ fromDto: (dto: CentrifugeVaultClaimDto) => CentrifugeVaultClaimTransaction;
1365
1558
  };
1366
1559
  /**
1367
- * An offer as `GET /v1/offers` lists it: a union on {@link OfferType}, each
1368
- * variant carrying only the fields that mean something for it. Narrow on
1369
- * `type` before reading anything beyond {@link OfferBase} - an Ondo swap has
1370
- * no `startsAt` to read, and the compiler says so.
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}.
1371
1568
  */
1372
- type Offer = CoinListTokenSaleOffer | SuperstateSwapOffer | OndoSwapOffer;
1373
- declare const Offer: {
1374
- fromDto: (dto: OfferDto) => Offer;
1569
+ type CentrifugeVaultPosition = {
1570
+ chain: EthereumChain;
1571
+ symbol: AssetSymbol;
1572
+ walletAddress: EvmWalletAddress;
1375
1573
  /**
1376
- * Maps a page of offers, dropping every offer whose `type` this SDK does not
1377
- * name. The same reasoning as {@link OfferToken.listFromDto}: a plain `.map`
1378
- * would throw out of `fromDto` and, through `PaginatedResponse.fromDto`,
1379
- * reject the whole page, so one offer of an unknown type would blank the
1380
- * grid for every offer beside it. A single offer fetched by id still
1381
- * throws, because there is nothing beside it to keep.
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.
1382
1622
  */
1383
- listFromDto: (dtos: OfferDto[]) => Offer[];
1623
+ claimableAssets: BlockchainAmount;
1624
+ /** Centrifuge froze this wallet on the share token. Blocks claiming. */
1625
+ frozen: boolean;
1626
+ asOf: Date;
1384
1627
  };
1385
- type TokenRole = 'funding' | 'distribution' | 'swap';
1386
- type OfferToken = {
1387
- role: TokenRole;
1388
- chain: Chain;
1389
- address: EvmContractAddress;
1628
+ declare const CentrifugeVaultRedeemPosition: {
1629
+ fromDto: (dto: CentrifugeVaultRedeemPositionDto) => CentrifugeVaultRedeemPosition;
1390
1630
  };
1391
- declare const OfferToken: {
1392
- fromDto: (dto: OfferTokenDto) => OfferToken;
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: {
1393
1645
  /**
1394
- * Maps an offer's token list, dropping every token on a chain this SDK does
1395
- * not name. Frontline's chain registry runs ahead of {@link Chain}, and a
1396
- * plain `.map` would throw out of `Offer.fromDto` and, through
1397
- * `PaginatedResponse.fromDto`, reject the whole offers page - which is how
1398
- * one Base token blanked production's offers list. Dropping costs that
1399
- * token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
1400
- * so nobody could have looked it up anyway.
1401
- *
1402
- * Same shape as `TokenMetadata.fromRegistryDto`.
1646
+ * What a claim on the leg would collect: shares for `invest`, the funding
1647
+ * token for `redeem`.
1403
1648
  */
1404
- listFromDto: (dtos: OfferTokenDto[]) => OfferToken[];
1649
+ claimable: (leg: CentrifugeVaultLeg) => BlockchainAmount;
1650
+ /** Whether the leg has anything queued or anything ready to claim. */
1651
+ isActive: (leg: CentrifugeVaultLeg) => boolean;
1405
1652
  };
1406
-
1407
1653
  /**
1408
- * The cursor-paginated envelope every list endpoint returns.
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.
1409
1667
  *
1410
- * Generic in its item type, so each resource pairs it with its own item DTO
1411
- * rather than declaring an envelope of its own.
1668
+ * TODO(frontline, ENG-1909): built against a guessed wire shape - see
1669
+ * `CentrifugeVaultClaimProceedsDto`.
1412
1670
  */
1413
- interface PaginatedResponseDto<T> {
1414
- data: T[];
1415
- starting_after?: string;
1416
- starting_before?: string;
1417
- }
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
+ };
1418
1678
 
1419
- type Cursor = Newtype<string, 'Cursor'>;
1420
- declare const Cursor: (value: string) => Cursor;
1421
- interface PaginatedResponse<T> {
1422
- data: T[];
1423
- startingAfter: Cursor | null;
1424
- startingBefore: Cursor | null;
1425
- }
1426
- declare const PaginatedResponse: {
1427
- fromDto: <A, B>(dto: PaginatedResponseDto<A>, itemMapper: (item: A) => B) => PaginatedResponse<B>;
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>;
1428
1704
  /**
1429
- * For a mapper that decides the page as a whole - one that drops items it
1430
- * cannot map, such as `Offer.listFromDto` - rather than item by item. The
1431
- * cursors are the wire's either way: dropping an item changes what the
1432
- * 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.
1433
1708
  */
1434
- fromDtoPage: <A, B>(dto: PaginatedResponseDto<A>, pageMapper: (items: A[]) => B[]) => PaginatedResponse<B>;
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;
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
+
1762
+ /**
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.
1772
+ */
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[];
1435
1785
  };
1436
1786
  /**
1437
- * Cursor-based pagination input used when requesting paginated API resources.
1438
- * Set `after` or `before` to navigate relative to a known cursor, and `limit`
1439
- * to control the maximum number of returned items.
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.
1440
1789
  */
1441
- interface PaginationParams {
1442
- before?: Cursor;
1443
- after?: Cursor;
1444
- limit?: number;
1445
- }
1446
- declare const PaginationParams: {
1447
- toQueryParams: (params: PaginationParams) => Record<string, QueryParamValue>;
1790
+ type OfferEditorialDto = {
1791
+ tagline: string;
1792
+ banner_url: string;
1793
+ starts_at: string;
1448
1794
  };
1449
-
1450
- type AssetDto = {
1451
- code: string;
1452
- fractional_digits: number;
1453
- id: string;
1454
- name: string;
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;
1455
1806
  };
1456
-
1457
- type AssetId = Newtype<string, 'AssetId'>;
1458
- declare const AssetId: (value: string) => AssetId;
1459
- type AssetCode = Newtype<string, 'AssetCode'>;
1460
- declare const AssetCode: (value: string) => AssetCode;
1461
- type Asset = {
1462
- id: AssetId;
1463
- code: AssetCode;
1464
- name: string;
1465
- fractionalDigits: number;
1807
+ type CoinListTokenSaleOfferDto = OfferBaseDto & OfferEditorialDto & {
1808
+ type: 'coinlist::token_sale';
1809
+ logo_url: string;
1466
1810
  };
1467
- declare const Asset: {
1468
- fromDto: (dto: AssetDto) => Asset;
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;
1469
1815
  };
1470
-
1471
- type ParticipationStatusDto = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
1472
- type ParticipationDto = {
1473
- object: 'participation';
1474
- id: string;
1475
- offer_id: string;
1476
- offer_option_id: string;
1477
- status: ParticipationStatusDto;
1478
- amount: string;
1479
- amount_string: string;
1480
- asset: AssetDto;
1481
- chain: string;
1482
- inserted_at: string | null | undefined;
1483
- updated_at: string | null | undefined;
1484
- wallet_address: string | null | undefined;
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;
1485
1820
  };
1486
- type CreateParticipationDto = {
1487
- offer_id: string;
1488
- offer_option_id: string;
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;
1825
+ };
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';
1489
1832
  chain: string;
1490
- wallet_address: string;
1491
- amount: string;
1492
- asset_id: string;
1493
- approval_transaction_hash: string | null | undefined;
1833
+ address: string;
1494
1834
  };
1495
1835
 
1496
1836
  /**
1497
1837
  * One variant per `OfferTypeDto`, the same split as `OfferDto` with what
1498
1838
  * `GET /v1/offers/:id` adds on top. Read `type` first.
1499
1839
  */
1500
- type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto;
1501
- type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
1840
+ type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto | CentrifugeVaultOfferDetailDto;
1841
+ type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
1502
1842
  type: 'coinlist::token_sale';
1503
1843
  logo_url: string;
1504
1844
  };
1505
- type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
1845
+ type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
1506
1846
  type: 'superstate::swap';
1507
1847
  logo_url: string | null;
1508
1848
  };
1509
- type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
1849
+ type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoVaultContractsDto & {
1510
1850
  type: 'ondo::swap';
1511
1851
  logo_url: string | null;
1512
1852
  /**
@@ -1515,6 +1855,19 @@ type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
1515
1855
  */
1516
1856
  swap_contracts: OfferDetailSwapContractDto[];
1517
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
+ };
1518
1871
  /**
1519
1872
  * An offer that does not settle through a CoinList swap contract sends `[]`
1520
1873
  * or no key at all, and either way there is nothing to read. Declared so a
@@ -1581,6 +1934,104 @@ type OfferDetailSwapContractDto = {
1581
1934
  chain: string;
1582
1935
  address: string;
1583
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
+ };
1584
2035
 
1585
2036
  type Ticker = Newtype<string, 'Ticker'>;
1586
2037
  declare const Ticker: (value: string) => Ticker;
@@ -1599,6 +2050,28 @@ type Isin = Newtype<string, 'Isin'>;
1599
2050
  declare const Isin: (value: string) => Isin;
1600
2051
  type OrderBookSide = 'buy' | 'sell';
1601
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
+ };
1602
2075
  type CoinListTokenSaleOfferDetail = OfferDetailBase & OfferEditorial & {
1603
2076
  type: 'coinlist::token_sale';
1604
2077
  logoUrl: string;
@@ -1618,6 +2091,16 @@ type OndoSwapOfferDetail = OfferDetailBase & {
1618
2091
  */
1619
2092
  swapContracts: OfferSwapContract[];
1620
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
+ };
1621
2104
  type OfferDetailBase = {
1622
2105
  id: OfferId;
1623
2106
  slug: OfferSlug;
@@ -1695,13 +2178,38 @@ type OfferSwapContract = {
1695
2178
  declare const OfferSwapContract: {
1696
2179
  fromDto: (dto: OfferDetailSwapContractDto) => OfferSwapContract;
1697
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
+ };
1698
2206
  /**
1699
2207
  * An offer as `GET /v1/offers/:id` serves it: the same union on `type` as
1700
2208
  * {@link Offer}, each variant carrying only the fields that mean something
1701
2209
  * for it. Narrow on `type` before reading anything beyond
1702
2210
  * {@link OfferDetailBase}.
1703
2211
  */
1704
- type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail;
2212
+ type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail | CentrifugeVaultOfferDetail;
1705
2213
  declare const OfferDetail: {
1706
2214
  fromDto: (dto: OfferDetailDto) => OfferDetail;
1707
2215
  };
@@ -1748,6 +2256,74 @@ declare const Milestone: {
1748
2256
  fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
1749
2257
  };
1750
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
+
1751
2327
  /** Unique identifier for a participation. */
1752
2328
  type ParticipationId = Newtype<string, 'ParticipationId'>;
1753
2329
  /** Casts a string into a typed {@link ParticipationId}. */
@@ -3361,4 +3937,51 @@ declare class TokensNamespaceImpl implements TokensNamespace {
3361
3937
  list(chain?: EthereumChain): Promise<TokenMetadata[]>;
3362
3938
  }
3363
3939
 
3364
- export { OndoTradingStatus as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, TokenMetadata as D, type Erc20Namespace as E, type OfferType as F, type OndoSwapOfferDetail as G, type CoinListTokenSaleOfferDetail as H, type SuperstateSwapOfferDetail as I, Offer as J, RequirementStatusInfo as K, type Logger as L, type RequirementType as M, type RequirementStatusValue as N, OfferId as O, Participation as P, OfferOptionAddress as Q, type RequirementsNamespace as R, type SuperstateSwapNamespace as S, type TokensNamespace as T, type UniversalNamespaceContext as U, RequirementId as V, type WalletError as W, type KycLevelName as X, DocumentSubmission as Y, type WalletChallengeType as Z, type PinoLoggerOptions as _, EthereumChain as a, type GetTokenBalanceParams as a$, AssetDecimals as a0, type BuildOndoBuyParams as a1, type BuildOndoSellParams as a2, OndoQuote as a3, type OndoQuoteSize as a4, type TokenIdentifier as a5, OfferOptionAddressId as a6, TokenLogo as a7, type DebugEvent as a8, type FrontlineEventId as a9, type Newtype as aA, type AllowWalletParams as aB, AllowWalletResponse as aC, Asset as aD, AssetCode as aE, Blockchain as aF, type BuildOndoSwapParamsCore as aG, Chain as aH, ClientId as aI, CodeChallenge as aJ, type CoinListTokenSaleOffer as aK, ConnectExternalWalletParams as aL, type CreateKycTokenParams as aM, CreateParticipationParams as aN, CreateWalletOwnershipChallengeParams as aO, Cursor as aP, type DocumentFormType as aQ, type DocumentSubmissionStatus as aR, type DocumentType as aS, ETHEREUM_CHAINS as aT, Erc20NamespaceImpl as aU, FaqItem as aV, type GetOndoQuoteParams as aW, type GetOndoTradingStatusParams as aX, type GetSwapAuthorizationParams as aY, type GetSwapPreviewParams as aZ, type GetTokenAllowanceParams as a_, HttpError as aa, type HttpResponse as ab, KycToken as ac, type LogBinding as ad, type LogBindings as ae, type LogCause as af, type LogLevel as ag, type LogScope as ah, type LogValue as ai, type ProductionLogLevel as aj, RedactedWalletError as ak, type RequestId as al, type RpcFailureReason as am, type SafeEvent as an, type SafeFields as ao, type UnredactedFields as ap, OAuthSession as aq, ClientCredentialsOAuth as ar, type Sender as as, PaginationParams as at, PaginatedResponse as au, ClientSecret as av, DecimalString as aw, SwapStatus as ax, type Uint256 as ay, KnownAssetSymbol as az, EvmContractAddress as b, HexEncodedTransactionData as b0, Isin as b1, Iso2CountryCode as b2, Link as b3, type ListOptionAddressesParams as b4, MAX_ASSET_DECIMALS as b5, MAX_UINT_256 as b6, Milestone as b7, OAuthRefreshToken as b8, type OfferBase as b9, SOLANA_CHAINS as bA, STABLE_DECIMALS as bB, SolanaChain as bC, type SubmitDocumentParams as bD, type SuperstateSwapOffer as bE, type SwapContractRef as bF, SwapPreview as bG, TermItem as bH, Ticker as bI, type TokenLogoImage as bJ, TokenLogoUrl as bK, type TokenRole as bL, TokensNamespaceImpl as bM, type Tx as bN, WalletAddress as bO, WalletOwnershipChallenge as bP, type WalletProtocol as bQ, WalletsNamespaceImpl as bR, apiErrorCode as bS, assertUint256 as bT, isChain as bU, isOfferType as bV, parseUint256 as bW, type OfferDetailBase as ba, OfferEditorial as bb, OfferOption as bc, OfferOptionSlug as bd, OfferSlug as be, OfferToken as bf, OffersNamespaceImpl as bg, type OndoQuoteDuration as bh, type OndoSellOutcome as bi, type OndoSwapOffer as bj, PKCEState as bk, type PaginatedResponseDto as bl, ParticipationId as bm, type ParticipationStatus as bn, ParticipationsPaginationParams as bo, PauseFlags as bp, Pii as bq, PiiAddress as br, PiiJurisdiction as bs, type PiiKind as bt, type QueryParamValue as bu, type QueryParamValues as bv, RedirectUri as bw, type RemoveOptionAddressParams as bx, type RequirementActionNeededReason as by, type RpcConfig as bz, type CoinListTokenSaleNamespace as c, OfferOptionId as d, AssetId as e, CoinListTokenSaleNamespaceImpl as f, type OndoNamespace as g, AssetSymbol as h, OfferSwapContract as i, OndoBuyTransaction as j, OndoSellTransaction as k, type OndoSwapTransactionCore as l, type OrderBookSide as m, OndoNamespaceImpl as n, type WalletsNamespace as o, Bps as p, EvmWalletAddress as q, SuperstateSwapNamespaceImpl as r, Requirement as s, RequirementsNamespaceImpl as t, type Config as u, type OAuthAccessToken as v, type OffersNamespace as w, StablecoinSymbol as x, type Erc20Asset as y, OfferDetail as z };
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 };