@coinlist-co/react 0.12.2-rc.9fb6364 → 0.12.2-rc.aa91ce3
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-KRA6EM2L.js → chunk-3OTYQADF.js} +78 -4
- package/dist/chunk-3OTYQADF.js.map +1 -0
- package/dist/{chunk-BNMF2HMW.js → chunk-IAY3F42Q.js} +892 -512
- package/dist/chunk-IAY3F42Q.js.map +1 -0
- package/dist/{chunk-STAHYDLY.js → chunk-QRVIBG6H.js} +2 -2
- package/dist/client/index.cjs +5891 -3786
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +845 -30
- package/dist/client/index.d.ts +845 -30
- package/dist/client/index.js +2598 -910
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +361 -66
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +27 -5
- package/dist/server/index.d.ts +27 -5
- package/dist/server/index.js +9 -6
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-BJfFeowE.d.cts → time-DyjvzWso.d.cts} +735 -59
- package/dist/{tokens-namespace-BJfFeowE.d.ts → time-DyjvzWso.d.ts} +735 -59
- package/dist/{token-registry-snapshot-C1NxdBmF.d.ts → token-registry-snapshot-Bldj1r5X.d.ts} +74 -8
- package/dist/{token-registry-snapshot-DyjrA32p.d.cts → token-registry-snapshot-CbNCYP_5.d.cts} +74 -8
- package/dist/universal/index.cjs +848 -377
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +79 -6
- package/dist/universal/index.d.ts +79 -6
- package/dist/universal/index.js +36 -2
- package/package.json +1 -1
- package/dist/chunk-BNMF2HMW.js.map +0 -1
- package/dist/chunk-KRA6EM2L.js.map +0 -1
- package/dist/time-B5YOQxuh.d.ts +0 -50
- package/dist/time-BY3apBpc.d.cts +0 -50
- /package/dist/{chunk-STAHYDLY.js.map → chunk-QRVIBG6H.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
|
|
@@ -821,16 +821,36 @@ type Erc20Asset = {
|
|
|
821
821
|
type Bps = Newtype<bigint, 'Bps'>;
|
|
822
822
|
declare const Bps: (value: bigint) => Bps;
|
|
823
823
|
|
|
824
|
-
type
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
824
|
+
type GetCentrifugeVaultStatusParams = {
|
|
825
|
+
/** Share token symbol of the vault, e.g. `deJTRSY`. */
|
|
826
|
+
symbol: AssetSymbol;
|
|
827
|
+
/**
|
|
828
|
+
* The chain whose proxy answers. Only chains this offer has a proxy on
|
|
829
|
+
* are accepted; the offer's `vault_contracts` lists them.
|
|
830
|
+
*/
|
|
828
831
|
chain: EthereumChain;
|
|
829
832
|
};
|
|
830
|
-
type
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
833
|
+
type GetCentrifugeVaultQuoteParams = GetCentrifugeVaultStatusParams & {
|
|
834
|
+
/**
|
|
835
|
+
* Amount to price, in the base units of the funding token. Must be greater
|
|
836
|
+
* than zero. No fee is deducted; this product charges none.
|
|
837
|
+
*
|
|
838
|
+
* Sized by `amount` alone: the quote is a free read of one spend, not a
|
|
839
|
+
* dollar figure converted later.
|
|
840
|
+
*/
|
|
841
|
+
amount: BlockchainAmount;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* One wallet on one vault: what every position read and every claim is keyed
|
|
845
|
+
* by. There is no order id - a wallet has one pooled position per vault per
|
|
846
|
+
* direction.
|
|
847
|
+
*/
|
|
848
|
+
type CentrifugeWalletParams = GetCentrifugeVaultStatusParams & {
|
|
849
|
+
/**
|
|
850
|
+
* The wallet whose position is read, or claimed for. A claim must then be
|
|
851
|
+
* broadcast from this same wallet: the proxy credits the sender.
|
|
852
|
+
*/
|
|
853
|
+
walletAddress: EvmWalletAddress;
|
|
834
854
|
};
|
|
835
855
|
|
|
836
856
|
/**
|
|
@@ -1148,37 +1168,6 @@ interface UniversalNamespaceContext {
|
|
|
1148
1168
|
ensureUserAuthenticated(): Promise<void>;
|
|
1149
1169
|
}
|
|
1150
1170
|
|
|
1151
|
-
/**
|
|
1152
|
-
* Generic ERC-20 reads shared across on-chain flows (swap, token sale): the
|
|
1153
|
-
* allowance an owner has granted a spender, and the raw token balance an owner
|
|
1154
|
-
* holds. These are plain token reads, not tied to any single product flow.
|
|
1155
|
-
*
|
|
1156
|
-
* Read from the chain rather than from a CoinList endpoint. By default that
|
|
1157
|
-
* goes through CoinList's authenticated JSON-RPC proxy, so a logged-out caller
|
|
1158
|
-
* gets the proxy's `401` - surfaced as a viem error wrapping the SDK's
|
|
1159
|
-
* `HttpError`, not as `NotAuthenticatedError`, since viem re-wraps whatever a
|
|
1160
|
-
* `Transport` throws. Point `Config.rpc` at your own node for this chain and no
|
|
1161
|
-
* CoinList session is involved at all. See {@link RpcConfig}.
|
|
1162
|
-
*/
|
|
1163
|
-
interface Erc20Namespace {
|
|
1164
|
-
/**
|
|
1165
|
-
* Reads the ERC-20 allowance an `owner` has granted a `spender`, as a raw
|
|
1166
|
-
* on-chain integer.
|
|
1167
|
-
*/
|
|
1168
|
-
getAllowance(params: GetTokenAllowanceParams): Promise<Uint256>;
|
|
1169
|
-
/**
|
|
1170
|
-
* Reads the raw ERC-20 balance an `owner` holds of a token.
|
|
1171
|
-
*/
|
|
1172
|
-
getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
|
|
1173
|
-
}
|
|
1174
|
-
declare class Erc20NamespaceImpl implements Erc20Namespace {
|
|
1175
|
-
private readonly ctx;
|
|
1176
|
-
private readonly log;
|
|
1177
|
-
constructor(ctx: UniversalNamespaceContext);
|
|
1178
|
-
getAllowance(params: GetTokenAllowanceParams): Promise<Uint256>;
|
|
1179
|
-
getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
1171
|
/**
|
|
1183
1172
|
* The logging surface SDK code uses. Never exported to hosts: they implement
|
|
1184
1173
|
* {@link Logger}, which is deliberately smaller.
|
|
@@ -1256,6 +1245,541 @@ type InternalDebugEvent = {
|
|
|
1256
1245
|
readonly fields?: UnredactedFields;
|
|
1257
1246
|
};
|
|
1258
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* Wire shapes for frontline's `/v1/centrifuge/vault/*` endpoints, as published
|
|
1250
|
+
* in frontline's OpenAPI schema (ENG-1936). Every uint256 crosses as a decimal
|
|
1251
|
+
* string, every price as a decimal string, every timestamp as ISO 8601.
|
|
1252
|
+
*
|
|
1253
|
+
* **A vault deposit does not settle in the transaction that places it.** The
|
|
1254
|
+
* fund fulfils requests on its own epoch, in whole or in part, at a price set
|
|
1255
|
+
* then, and the user claims the resulting shares in a second transaction. So
|
|
1256
|
+
* every share figure before a fill is an estimate.
|
|
1257
|
+
*
|
|
1258
|
+
* The three GETs are free to poll. The two POSTs return calldata to broadcast:
|
|
1259
|
+
* `buy` is signed for one wallet and called once on confirmation, `claim`
|
|
1260
|
+
* collects everything claimable and carries no amount.
|
|
1261
|
+
*/
|
|
1262
|
+
/**
|
|
1263
|
+
* Why a deposit cannot be placed right now. A closed set, so a client can
|
|
1264
|
+
* branch on every value. `vault_unlinked` is terminal for the offer's proxy on
|
|
1265
|
+
* that chain; the rest clear on their own or by hand.
|
|
1266
|
+
*
|
|
1267
|
+
* `below_minimum` is the one reason that depends on an amount, so only a quote
|
|
1268
|
+
* can report it - see {@link CentrifugeVaultReasonDto}.
|
|
1269
|
+
*/
|
|
1270
|
+
type CentrifugeOrderReasonDto = 'vault_unlinked' | 'vault_halted' | 'proxy_not_permissioned' | 'price_unavailable' | 'below_minimum';
|
|
1271
|
+
/** What a vault status can report: every reason but the amount-dependent one. */
|
|
1272
|
+
type CentrifugeVaultReasonDto = Exclude<CentrifugeOrderReasonDto, 'below_minimum'>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Where a wallet stands on a vault, derived from its amounts rather than
|
|
1275
|
+
* stored. Not a lifecycle: a new request moves any of these back to `pending`
|
|
1276
|
+
* while earlier shares stay claimed.
|
|
1277
|
+
*/
|
|
1278
|
+
type CentrifugePositionStatusDto = 'none' | 'pending' | 'partially_filled' | 'filled' | 'claimed';
|
|
1279
|
+
/** `GET /v1/centrifuge/vault/quote?symbol&chain&amount`. Indicative only. */
|
|
1280
|
+
type CentrifugeVaultQuoteDto = {
|
|
1281
|
+
object: 'centrifuge_vault_quote';
|
|
1282
|
+
/** The vault's share token symbol, e.g. `deJTRSY`. */
|
|
1283
|
+
symbol: string;
|
|
1284
|
+
chain: string;
|
|
1285
|
+
/** The amount priced, echoed back, in `spend_input_decimals`. No fee. */
|
|
1286
|
+
spend_input_amount: string;
|
|
1287
|
+
spend_input_decimals: number;
|
|
1288
|
+
/** An estimate, not a floor: the fill can price either side of it. */
|
|
1289
|
+
estimated_shares: string;
|
|
1290
|
+
share_decimals: number;
|
|
1291
|
+
/** Funding token per whole share. Null when the vault has no price. */
|
|
1292
|
+
indicative_price: string | null;
|
|
1293
|
+
/** In `spend_input_decimals`. Null when the offer sets no minimum. */
|
|
1294
|
+
minimum_input_amount: string | null;
|
|
1295
|
+
can_order: boolean;
|
|
1296
|
+
/** Empty exactly when `can_order` is true. */
|
|
1297
|
+
reasons: CentrifugeOrderReasonDto[];
|
|
1298
|
+
};
|
|
1299
|
+
/**
|
|
1300
|
+
* `GET /v1/centrifuge/vault/status?symbol&chain`. The vault's own state, read
|
|
1301
|
+
* from the chain on every call; the gate to poll, because Centrifuge announces
|
|
1302
|
+
* none of these changes.
|
|
1303
|
+
*/
|
|
1304
|
+
type CentrifugeVaultStatusDto = {
|
|
1305
|
+
object: 'centrifuge_vault_status';
|
|
1306
|
+
symbol: string;
|
|
1307
|
+
chain: string;
|
|
1308
|
+
/** Centrifuge's vault, read from the proxy. Fixed for the proxy's life. */
|
|
1309
|
+
vault_address: string;
|
|
1310
|
+
/** False is terminal for this proxy: a replacement has to be deployed. */
|
|
1311
|
+
linked: boolean;
|
|
1312
|
+
/** Whether the proxy is on the share token's memberlist. */
|
|
1313
|
+
permissioned: boolean;
|
|
1314
|
+
membership_valid_until: string | null;
|
|
1315
|
+
/** Set by the proxy after a force-cancel; cleared only by hand. */
|
|
1316
|
+
halted: boolean;
|
|
1317
|
+
price_updated_at: string | null;
|
|
1318
|
+
can_order: boolean;
|
|
1319
|
+
reasons: CentrifugeVaultReasonDto[];
|
|
1320
|
+
as_of: string;
|
|
1321
|
+
};
|
|
1322
|
+
/**
|
|
1323
|
+
* What both POSTs return: calldata for the wallet to broadcast verbatim.
|
|
1324
|
+
* Unlike Ondo's, `expires_at` is nullable - a claim carries no signature, so
|
|
1325
|
+
* it is always null there.
|
|
1326
|
+
*/
|
|
1327
|
+
type CentrifugeBroadcastDto = {
|
|
1328
|
+
action: 'broadcast_transaction';
|
|
1329
|
+
/** The offer's proxy on the chain. Lower case: compare case-insensitively. */
|
|
1330
|
+
to: string;
|
|
1331
|
+
data: string;
|
|
1332
|
+
expires_at: string | null;
|
|
1333
|
+
};
|
|
1334
|
+
/**
|
|
1335
|
+
* `POST /v1/centrifuge/vault/buy` with `{ symbol, chain, wallet_address,
|
|
1336
|
+
* amount }`. Broadcasting it places a request in the vault's queue and buys
|
|
1337
|
+
* nothing yet.
|
|
1338
|
+
*/
|
|
1339
|
+
type CentrifugeVaultBuyDto = CentrifugeBroadcastDto & {
|
|
1340
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1341
|
+
spend_input_amount: string;
|
|
1342
|
+
spend_input_decimals: number;
|
|
1343
|
+
/** Not a quantity purchased: the fill prices later. */
|
|
1344
|
+
estimated_shares: string;
|
|
1345
|
+
share_decimals: number;
|
|
1346
|
+
};
|
|
1347
|
+
/**
|
|
1348
|
+
* `GET /v1/centrifuge/vault/position?symbol&chain&wallet_address`. The six
|
|
1349
|
+
* amounts are independent: a wallet can hold a pending request, a claimable
|
|
1350
|
+
* balance and claimed shares at once. There is no per-fulfilment breakdown;
|
|
1351
|
+
* settlement pools every fulfilment into one rate.
|
|
1352
|
+
*/
|
|
1353
|
+
type CentrifugeVaultPositionDto = {
|
|
1354
|
+
object: 'centrifuge_vault_position';
|
|
1355
|
+
symbol: string;
|
|
1356
|
+
chain: string;
|
|
1357
|
+
wallet_address: string;
|
|
1358
|
+
status: CentrifugePositionStatusDto;
|
|
1359
|
+
/** Funding token ever requested, in `asset_decimals`. */
|
|
1360
|
+
requested: string;
|
|
1361
|
+
/** Of that, still queued. */
|
|
1362
|
+
pending: string;
|
|
1363
|
+
/** Of that, fulfilled. */
|
|
1364
|
+
filled_assets: string;
|
|
1365
|
+
/** Shares the fulfilments earned, in `share_decimals`. Held by the proxy until claimed. */
|
|
1366
|
+
earned_shares: string;
|
|
1367
|
+
claimed_shares: string;
|
|
1368
|
+
/** Non-zero means the claim endpoint will return calldata. */
|
|
1369
|
+
claimable_shares: string;
|
|
1370
|
+
/** Read from the share token; can exceed `claimed_shares`. */
|
|
1371
|
+
share_balance: string;
|
|
1372
|
+
asset_decimals: number;
|
|
1373
|
+
share_decimals: number;
|
|
1374
|
+
/** Null before the first claim. */
|
|
1375
|
+
average_price: string | null;
|
|
1376
|
+
/** Centrifuge froze the wallet on the share token; blocks claiming. */
|
|
1377
|
+
frozen: boolean;
|
|
1378
|
+
as_of: string;
|
|
1379
|
+
};
|
|
1380
|
+
/**
|
|
1381
|
+
* `POST /v1/centrifuge/vault/claim` with `{ symbol, chain, wallet_address }`.
|
|
1382
|
+
* The wallet named must be the one that broadcasts: the proxy credits the
|
|
1383
|
+
* sender.
|
|
1384
|
+
*/
|
|
1385
|
+
type CentrifugeVaultClaimDto = CentrifugeBroadcastDto & {
|
|
1386
|
+
/** A floor: a fill landing before the broadcast raises it. */
|
|
1387
|
+
claimable_shares: string;
|
|
1388
|
+
share_decimals: number;
|
|
1389
|
+
};
|
|
1390
|
+
/**
|
|
1391
|
+
* `GET /v1/centrifuge/vault/redeem-position?symbol&chain&wallet_address`. The
|
|
1392
|
+
* redeem side of {@link CentrifugeVaultPositionDto}, with the units swapped:
|
|
1393
|
+
* what is queued is shares, and what a fill makes claimable is the funding
|
|
1394
|
+
* token.
|
|
1395
|
+
*
|
|
1396
|
+
* TODO(frontline, ENG-1909): guessed. Frontline publishes no redeem endpoint
|
|
1397
|
+
* yet; this mirrors the invest position field for field so the SDK can be
|
|
1398
|
+
* built against it. Replace with the published schema when it lands.
|
|
1399
|
+
*/
|
|
1400
|
+
type CentrifugeVaultRedeemPositionDto = {
|
|
1401
|
+
object: 'centrifuge_vault_redeem_position';
|
|
1402
|
+
symbol: string;
|
|
1403
|
+
chain: string;
|
|
1404
|
+
wallet_address: string;
|
|
1405
|
+
status: CentrifugePositionStatusDto;
|
|
1406
|
+
/** Shares still queued for redemption, in `share_decimals`. */
|
|
1407
|
+
pending: string;
|
|
1408
|
+
/**
|
|
1409
|
+
* Funding token a claim would pay out now, in `asset_decimals`. An
|
|
1410
|
+
* estimate: the vault holds the claimable amount in shares and prices it
|
|
1411
|
+
* at the claim.
|
|
1412
|
+
*/
|
|
1413
|
+
claimable_assets: string;
|
|
1414
|
+
asset_decimals: number;
|
|
1415
|
+
share_decimals: number;
|
|
1416
|
+
/** Centrifuge froze the wallet on the share token. */
|
|
1417
|
+
frozen: boolean;
|
|
1418
|
+
as_of: string;
|
|
1419
|
+
};
|
|
1420
|
+
/**
|
|
1421
|
+
* `POST /v1/centrifuge/vault/claim-proceeds` with `{ symbol, chain,
|
|
1422
|
+
* wallet_address }`. Collects everything claimable on the redeem side; the
|
|
1423
|
+
* proxy pays the sender.
|
|
1424
|
+
*
|
|
1425
|
+
* TODO(frontline, ENG-1909): guessed, as {@link CentrifugeVaultRedeemPositionDto}.
|
|
1426
|
+
*/
|
|
1427
|
+
type CentrifugeVaultClaimProceedsDto = CentrifugeBroadcastDto & {
|
|
1428
|
+
/** An estimate read when the calldata was built, in `asset_decimals`. */
|
|
1429
|
+
claimable_assets: string;
|
|
1430
|
+
asset_decimals: number;
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* Which leg of a vault trade: `invest` turns the funding token into shares,
|
|
1435
|
+
* `redeem` turns shares back into the funding token. Each wallet holds one
|
|
1436
|
+
* pooled position per vault per direction, and a claim settles one of them.
|
|
1437
|
+
*/
|
|
1438
|
+
type CentrifugeClaimDirection = 'invest' | 'redeem';
|
|
1439
|
+
/**
|
|
1440
|
+
* Why a deposit cannot be placed on a vault right now. Kept verbatim from the
|
|
1441
|
+
* wire: frontline publishes it as a closed set for clients to branch on.
|
|
1442
|
+
*/
|
|
1443
|
+
type CentrifugeOrderReason = CentrifugeOrderReasonDto;
|
|
1444
|
+
/** The reasons a vault status can report - all but `below_minimum`. */
|
|
1445
|
+
type CentrifugeVaultReason = CentrifugeVaultReasonDto;
|
|
1446
|
+
/**
|
|
1447
|
+
* Where a wallet stands on a vault. Not a lifecycle - see
|
|
1448
|
+
* {@link CentrifugeVaultPosition.status}.
|
|
1449
|
+
*/
|
|
1450
|
+
type CentrifugePositionStatus = CentrifugePositionStatusDto;
|
|
1451
|
+
/**
|
|
1452
|
+
* Whether a deposit can be placed, as one union rather than the wire's
|
|
1453
|
+
* `can_order` beside `reasons`: a blocked answer always says why, and an
|
|
1454
|
+
* orderable one has nothing to say. The wire pair can contradict itself; this
|
|
1455
|
+
* cannot, because `fromDto` refuses the payloads that do.
|
|
1456
|
+
*/
|
|
1457
|
+
type CentrifugeOrderability<R extends CentrifugeOrderReason> = {
|
|
1458
|
+
type: 'orderable';
|
|
1459
|
+
} | {
|
|
1460
|
+
type: 'blocked';
|
|
1461
|
+
reasons: [R, ...R[]];
|
|
1462
|
+
};
|
|
1463
|
+
/**
|
|
1464
|
+
* What a deposit of a given size would buy, and whether it can be placed.
|
|
1465
|
+
*
|
|
1466
|
+
* **Indicative only.** The price is read from the vault now and the fund
|
|
1467
|
+
* prices the fulfilment on its own epoch, so neither {@link indicativePrice}
|
|
1468
|
+
* nor {@link estimatedShares} is a commitment. Free to poll while the user
|
|
1469
|
+
* sizes a deposit.
|
|
1470
|
+
*/
|
|
1471
|
+
type CentrifugeVaultQuote = {
|
|
1472
|
+
chain: EthereumChain;
|
|
1473
|
+
/** The vault's share token symbol, e.g. `deJTRSY`. */
|
|
1474
|
+
symbol: AssetSymbol;
|
|
1475
|
+
/** The amount priced, in the funding token's decimals. No fee is taken. */
|
|
1476
|
+
spendInputAmount: BlockchainAmount;
|
|
1477
|
+
/** Shares at the indicative price, in the share token's decimals. */
|
|
1478
|
+
estimatedShares: BlockchainAmount;
|
|
1479
|
+
/** Funding token per whole share. Null when the vault publishes no price. */
|
|
1480
|
+
indicativePrice: DecimalString | null;
|
|
1481
|
+
/** Null when the offer sets no minimum. Same decimals as the spend. */
|
|
1482
|
+
minimumInputAmount: BlockchainAmount | null;
|
|
1483
|
+
orderability: CentrifugeOrderability<CentrifugeOrderReason>;
|
|
1484
|
+
};
|
|
1485
|
+
declare const CentrifugeVaultQuote: {
|
|
1486
|
+
fromDto: (dto: CentrifugeVaultQuoteDto) => CentrifugeVaultQuote;
|
|
1487
|
+
};
|
|
1488
|
+
/**
|
|
1489
|
+
* A vault's own state, independent of any wallet or amount: the gate to poll.
|
|
1490
|
+
* Centrifuge announces none of these changes, and an unlinked vault leaves the
|
|
1491
|
+
* offer's proxy permanently dead, so a cached answer goes wrong silently.
|
|
1492
|
+
*/
|
|
1493
|
+
type CentrifugeVaultStatus = {
|
|
1494
|
+
chain: EthereumChain;
|
|
1495
|
+
symbol: AssetSymbol;
|
|
1496
|
+
/** Centrifuge's vault behind the proxy. Fixed for the proxy's life. */
|
|
1497
|
+
vaultAddress: EvmContractAddress;
|
|
1498
|
+
/**
|
|
1499
|
+
* Whether Centrifuge still links the vault to its pool. False is terminal
|
|
1500
|
+
* for this proxy: no request or claim succeeds until a new one is deployed.
|
|
1501
|
+
*/
|
|
1502
|
+
linked: boolean;
|
|
1503
|
+
/**
|
|
1504
|
+
* Whether the proxy is on the share token's memberlist. It holds shares for
|
|
1505
|
+
* every wallet, so one expired entry stops the whole offer.
|
|
1506
|
+
*/
|
|
1507
|
+
permissioned: boolean;
|
|
1508
|
+
/** Watch it: {@link permissioned} goes false the moment it passes. */
|
|
1509
|
+
membershipValidUntil: Date | null;
|
|
1510
|
+
/** The proxy halted itself after a force-cancel; cleared only by hand. */
|
|
1511
|
+
halted: boolean;
|
|
1512
|
+
/** A stale value is the signal that a quote's price is old. */
|
|
1513
|
+
priceUpdatedAt: Date | null;
|
|
1514
|
+
orderability: CentrifugeOrderability<CentrifugeVaultReason>;
|
|
1515
|
+
/** When the chain was read: how old everything above is. */
|
|
1516
|
+
asOf: Date;
|
|
1517
|
+
};
|
|
1518
|
+
declare const CentrifugeVaultStatus: {
|
|
1519
|
+
fromDto: (dto: CentrifugeVaultStatusDto) => CentrifugeVaultStatus;
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* What both vault transactions share: calldata to broadcast verbatim, and the
|
|
1523
|
+
* deadline on it.
|
|
1524
|
+
*/
|
|
1525
|
+
type CentrifugeVaultTransactionCore = {
|
|
1526
|
+
/** The `to` is the offer's proxy: the spender the deposit was approved to. */
|
|
1527
|
+
tx: Tx;
|
|
1528
|
+
/**
|
|
1529
|
+
* When the calldata stops being accepted, or null when it carries no
|
|
1530
|
+
* deadline - always the case for a claim, which nobody signs.
|
|
1531
|
+
*/
|
|
1532
|
+
expiresAt: Date | null;
|
|
1533
|
+
};
|
|
1534
|
+
/**
|
|
1535
|
+
* A signed deposit request, ready to broadcast.
|
|
1536
|
+
*
|
|
1537
|
+
* **Broadcasting it buys nothing yet.** It places a request in the vault's
|
|
1538
|
+
* queue; the fund fulfils it later at a price set then, and the user comes
|
|
1539
|
+
* back to claim. {@link estimatedShares} is therefore never a quantity
|
|
1540
|
+
* purchased. Single-use: built once on confirmation, never on a timer.
|
|
1541
|
+
*/
|
|
1542
|
+
type CentrifugeVaultBuyTransaction = CentrifugeVaultTransactionCore & {
|
|
1543
|
+
/** Exactly what the approval has to cover: no fee comes off it. */
|
|
1544
|
+
spendInputAmount: BlockchainAmount;
|
|
1545
|
+
/** At the price read when the calldata was built. An estimate, not a floor. */
|
|
1546
|
+
estimatedShares: BlockchainAmount;
|
|
1547
|
+
};
|
|
1548
|
+
declare const CentrifugeVaultBuyTransaction: {
|
|
1549
|
+
fromDto: (dto: CentrifugeVaultBuyDto) => CentrifugeVaultBuyTransaction;
|
|
1550
|
+
};
|
|
1551
|
+
/**
|
|
1552
|
+
* The claim that moves fulfilled shares from the proxy to the wallet: the
|
|
1553
|
+
* second transaction every vault purchase needs. The wallet that broadcasts it
|
|
1554
|
+
* is the one credited.
|
|
1555
|
+
*/
|
|
1556
|
+
type CentrifugeVaultClaimTransaction = CentrifugeVaultTransactionCore & {
|
|
1557
|
+
/**
|
|
1558
|
+
* Read when the calldata was built. A floor: a fill landing before the
|
|
1559
|
+
* broadcast raises it, and the claim still collects everything.
|
|
1560
|
+
*/
|
|
1561
|
+
claimableShares: BlockchainAmount;
|
|
1562
|
+
};
|
|
1563
|
+
declare const CentrifugeVaultClaimTransaction: {
|
|
1564
|
+
fromDto: (dto: CentrifugeVaultClaimDto) => CentrifugeVaultClaimTransaction;
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* One wallet's standing on one vault: what it put in, what has settled, and
|
|
1568
|
+
* what it can claim. The endpoint a returning user lands on, and the one that
|
|
1569
|
+
* says whether to offer the claim.
|
|
1570
|
+
*
|
|
1571
|
+
* The amounts are independent of each other: each piece of a request settles
|
|
1572
|
+
* and is claimed on its own, so a wallet can be pending, claimable and claimed
|
|
1573
|
+
* at once. There is no per-fulfilment breakdown; settlement pools every
|
|
1574
|
+
* fulfilment into one {@link averagePrice}.
|
|
1575
|
+
*/
|
|
1576
|
+
type CentrifugeVaultPosition = {
|
|
1577
|
+
chain: EthereumChain;
|
|
1578
|
+
symbol: AssetSymbol;
|
|
1579
|
+
walletAddress: EvmWalletAddress;
|
|
1580
|
+
/**
|
|
1581
|
+
* Derived by frontline from the amounts. Not a lifecycle: a new request
|
|
1582
|
+
* moves it back to `pending` while earlier shares stay claimed.
|
|
1583
|
+
*/
|
|
1584
|
+
status: CentrifugePositionStatus;
|
|
1585
|
+
/** Funding token ever requested. */
|
|
1586
|
+
requested: BlockchainAmount;
|
|
1587
|
+
/** Of {@link requested}, what is still queued. */
|
|
1588
|
+
pending: BlockchainAmount;
|
|
1589
|
+
/** Of {@link requested}, what has been fulfilled. */
|
|
1590
|
+
filledAssets: BlockchainAmount;
|
|
1591
|
+
/** Shares the fulfilments earned. Held by the proxy until claimed. */
|
|
1592
|
+
earnedShares: BlockchainAmount;
|
|
1593
|
+
claimedShares: BlockchainAmount;
|
|
1594
|
+
/** Non-zero means a claim will return calldata. */
|
|
1595
|
+
claimableShares: BlockchainAmount;
|
|
1596
|
+
/**
|
|
1597
|
+
* What the wallet holds on the share token. Can exceed
|
|
1598
|
+
* {@link claimedShares}: shares acquired any other way count here.
|
|
1599
|
+
*/
|
|
1600
|
+
shareBalance: BlockchainAmount;
|
|
1601
|
+
/** Pooled rate over everything claimed. Null before the first claim. */
|
|
1602
|
+
averagePrice: DecimalString | null;
|
|
1603
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1604
|
+
frozen: boolean;
|
|
1605
|
+
asOf: Date;
|
|
1606
|
+
};
|
|
1607
|
+
declare const CentrifugeVaultPosition: {
|
|
1608
|
+
fromDto: (dto: CentrifugeVaultPositionDto) => CentrifugeVaultPosition;
|
|
1609
|
+
};
|
|
1610
|
+
/**
|
|
1611
|
+
* One wallet's standing on the redeem side of a vault: shares queued to sell,
|
|
1612
|
+
* and the funding token a fill has made claimable. The mirror of
|
|
1613
|
+
* {@link CentrifugeVaultPosition}, and as independent of it: a wallet can be
|
|
1614
|
+
* investing and redeeming on the same vault at once.
|
|
1615
|
+
*
|
|
1616
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1617
|
+
* `CentrifugeVaultRedeemPositionDto`.
|
|
1618
|
+
*/
|
|
1619
|
+
type CentrifugeVaultRedeemPosition = {
|
|
1620
|
+
chain: EthereumChain;
|
|
1621
|
+
symbol: AssetSymbol;
|
|
1622
|
+
walletAddress: EvmWalletAddress;
|
|
1623
|
+
status: CentrifugePositionStatus;
|
|
1624
|
+
/** Shares still queued for redemption. */
|
|
1625
|
+
pending: BlockchainAmount;
|
|
1626
|
+
/**
|
|
1627
|
+
* Funding token a claim would pay out now. An estimate: the vault prices the
|
|
1628
|
+
* claimable shares at the claim. Non-zero means a claim returns calldata.
|
|
1629
|
+
*/
|
|
1630
|
+
claimableAssets: BlockchainAmount;
|
|
1631
|
+
/** Centrifuge froze this wallet on the share token. Blocks claiming. */
|
|
1632
|
+
frozen: boolean;
|
|
1633
|
+
asOf: Date;
|
|
1634
|
+
};
|
|
1635
|
+
declare const CentrifugeVaultRedeemPosition: {
|
|
1636
|
+
fromDto: (dto: CentrifugeVaultRedeemPositionDto) => CentrifugeVaultRedeemPosition;
|
|
1637
|
+
};
|
|
1638
|
+
/**
|
|
1639
|
+
* One wallet's position on one leg of a vault trade, tagged with the leg. The
|
|
1640
|
+
* two legs are read from two endpoints and settle in opposite units - the
|
|
1641
|
+
* invest leg queues the funding token and pays out shares, the redeem leg the
|
|
1642
|
+
* reverse - so the tag is what says which unit each figure is in.
|
|
1643
|
+
*/
|
|
1644
|
+
type CentrifugeVaultLeg = {
|
|
1645
|
+
direction: 'invest';
|
|
1646
|
+
position: CentrifugeVaultPosition;
|
|
1647
|
+
} | {
|
|
1648
|
+
direction: 'redeem';
|
|
1649
|
+
position: CentrifugeVaultRedeemPosition;
|
|
1650
|
+
};
|
|
1651
|
+
declare const CentrifugeVaultLeg: {
|
|
1652
|
+
/**
|
|
1653
|
+
* What a claim on the leg would collect: shares for `invest`, the funding
|
|
1654
|
+
* token for `redeem`.
|
|
1655
|
+
*/
|
|
1656
|
+
claimable: (leg: CentrifugeVaultLeg) => BlockchainAmount;
|
|
1657
|
+
/** Whether the leg has anything queued or anything ready to claim. */
|
|
1658
|
+
isActive: (leg: CentrifugeVaultLeg) => boolean;
|
|
1659
|
+
};
|
|
1660
|
+
/**
|
|
1661
|
+
* One wallet's position on one leg of one vault: what a claim targets. A
|
|
1662
|
+
* wallet holds at most one per direction per chain, so the three together
|
|
1663
|
+
* name it.
|
|
1664
|
+
*/
|
|
1665
|
+
type CentrifugeVaultLegId = Newtype<string, 'CentrifugeVaultLegId'>;
|
|
1666
|
+
declare const CentrifugeVaultLegId: {
|
|
1667
|
+
/** Addresses compare case-insensitively: frontline echoes them lower case. */
|
|
1668
|
+
of: (leg: CentrifugeVaultLeg) => CentrifugeVaultLegId;
|
|
1669
|
+
};
|
|
1670
|
+
/**
|
|
1671
|
+
* The claim that pays a filled redemption out in the funding token: the
|
|
1672
|
+
* second transaction every vault sale needs. The wallet that broadcasts it is
|
|
1673
|
+
* the one paid.
|
|
1674
|
+
*
|
|
1675
|
+
* TODO(frontline, ENG-1909): built against a guessed wire shape - see
|
|
1676
|
+
* `CentrifugeVaultClaimProceedsDto`.
|
|
1677
|
+
*/
|
|
1678
|
+
type CentrifugeVaultClaimProceedsTransaction = CentrifugeVaultTransactionCore & {
|
|
1679
|
+
/** An estimate read when the calldata was built; the claim pays it all. */
|
|
1680
|
+
claimableAssets: BlockchainAmount;
|
|
1681
|
+
};
|
|
1682
|
+
declare const CentrifugeVaultClaimProceedsTransaction: {
|
|
1683
|
+
fromDto: (dto: CentrifugeVaultClaimProceedsDto) => CentrifugeVaultClaimProceedsTransaction;
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Centrifuge vault reads and claims: an indicative quote, the vault-wide
|
|
1688
|
+
* ordering gate, each wallet's position per direction, and the calldata that
|
|
1689
|
+
* claims a filled request.
|
|
1690
|
+
*
|
|
1691
|
+
* The reads are free to poll - none spends an attestation, so a client may
|
|
1692
|
+
* call them while the user sizes a deposit or waits on a fill. The quote has
|
|
1693
|
+
* no expiry: it is indicative, the fund prices fulfilment later, and a
|
|
1694
|
+
* countdown would imply a commitment the API does not make.
|
|
1695
|
+
*
|
|
1696
|
+
* A vault trade settles in two legs: a request the fund fills on its own
|
|
1697
|
+
* schedule, then a claim. There is no order id - each wallet has one pooled
|
|
1698
|
+
* position per vault per direction - so the claims take a wallet, not an
|
|
1699
|
+
* order, and collect everything claimable.
|
|
1700
|
+
*
|
|
1701
|
+
* Every method requires `AuthState === 'logged-in'` and throws
|
|
1702
|
+
* {@link NotAuthenticatedError} otherwise.
|
|
1703
|
+
*/
|
|
1704
|
+
interface CentrifugeNamespace {
|
|
1705
|
+
getQuote(params: GetCentrifugeVaultQuoteParams): Promise<CentrifugeVaultQuote>;
|
|
1706
|
+
getVaultStatus(params: GetCentrifugeVaultStatusParams): Promise<CentrifugeVaultStatus>;
|
|
1707
|
+
/** The wallet's invest position: funding queued, shares claimable. */
|
|
1708
|
+
getPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultPosition>;
|
|
1709
|
+
/**
|
|
1710
|
+
* The wallet's redeem position: shares queued, funding claimable.
|
|
1711
|
+
*
|
|
1712
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1713
|
+
*/
|
|
1714
|
+
getRedeemPosition(params: CentrifugeWalletParams): Promise<CentrifugeVaultRedeemPosition>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Calldata claiming every claimable share. Broadcast it from
|
|
1717
|
+
* `params.walletAddress`: the proxy credits the sender.
|
|
1718
|
+
*/
|
|
1719
|
+
createClaim(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimTransaction>;
|
|
1720
|
+
/**
|
|
1721
|
+
* Calldata paying out every claimable redemption in the funding token.
|
|
1722
|
+
* Broadcast it from `params.walletAddress`.
|
|
1723
|
+
*
|
|
1724
|
+
* TODO(frontline, ENG-1909): built against a guessed endpoint.
|
|
1725
|
+
*/
|
|
1726
|
+
createClaimProceeds(params: CentrifugeWalletParams): Promise<CentrifugeVaultClaimProceedsTransaction>;
|
|
1727
|
+
}
|
|
1728
|
+
declare class CentrifugeNamespaceImpl implements CentrifugeNamespace {
|
|
1729
|
+
private readonly ctx;
|
|
1730
|
+
protected readonly log: InternalLogger;
|
|
1731
|
+
constructor(ctx: UniversalNamespaceContext);
|
|
1732
|
+
getQuote(params: GetCentrifugeVaultQuoteParams): Promise<CentrifugeVaultQuote>;
|
|
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
|
+
}
|
|
1739
|
+
|
|
1740
|
+
type GetTokenAllowanceParams = {
|
|
1741
|
+
tokenAddress: EvmContractAddress;
|
|
1742
|
+
owner: EvmWalletAddress;
|
|
1743
|
+
spender: EvmContractAddress;
|
|
1744
|
+
chain: EthereumChain;
|
|
1745
|
+
};
|
|
1746
|
+
type GetTokenBalanceParams = {
|
|
1747
|
+
tokenAddress: EvmContractAddress;
|
|
1748
|
+
owner: EvmWalletAddress;
|
|
1749
|
+
chain: EthereumChain;
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Generic ERC-20 reads shared across on-chain flows (swap, token sale): the
|
|
1754
|
+
* allowance an owner has granted a spender, and the raw token balance an owner
|
|
1755
|
+
* holds. These are plain token reads, not tied to any single product flow.
|
|
1756
|
+
*
|
|
1757
|
+
* Read from the chain rather than from a CoinList endpoint. By default that
|
|
1758
|
+
* goes through CoinList's authenticated JSON-RPC proxy, so a logged-out caller
|
|
1759
|
+
* gets the proxy's `401` - surfaced as a viem error wrapping the SDK's
|
|
1760
|
+
* `HttpError`, not as `NotAuthenticatedError`, since viem re-wraps whatever a
|
|
1761
|
+
* `Transport` throws. Point `Config.rpc` at your own node for this chain and no
|
|
1762
|
+
* CoinList session is involved at all. See {@link RpcConfig}.
|
|
1763
|
+
*/
|
|
1764
|
+
interface Erc20Namespace {
|
|
1765
|
+
/**
|
|
1766
|
+
* Reads the ERC-20 allowance an `owner` has granted a `spender`, as a raw
|
|
1767
|
+
* on-chain integer.
|
|
1768
|
+
*/
|
|
1769
|
+
getAllowance(params: GetTokenAllowanceParams): Promise<Uint256>;
|
|
1770
|
+
/**
|
|
1771
|
+
* Reads the raw ERC-20 balance an `owner` holds of a token.
|
|
1772
|
+
*/
|
|
1773
|
+
getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
|
|
1774
|
+
}
|
|
1775
|
+
declare class Erc20NamespaceImpl implements Erc20Namespace {
|
|
1776
|
+
private readonly ctx;
|
|
1777
|
+
private readonly log;
|
|
1778
|
+
constructor(ctx: UniversalNamespaceContext);
|
|
1779
|
+
getAllowance(params: GetTokenAllowanceParams): Promise<Uint256>;
|
|
1780
|
+
getBalance(params: GetTokenBalanceParams): Promise<Uint256>;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1259
1783
|
/**
|
|
1260
1784
|
* The product an offer is checked out through. The backend sends one compound
|
|
1261
1785
|
* `{supplier}::{saleType}` string, verbatim as spelled below: a double colon
|
|
@@ -1267,13 +1791,13 @@ type InternalDebugEvent = {
|
|
|
1267
1791
|
* union makes a `switch` over it exhaustive: adding a provider without
|
|
1268
1792
|
* handling it becomes a compile error.
|
|
1269
1793
|
*/
|
|
1270
|
-
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap';
|
|
1794
|
+
type OfferTypeDto = 'coinlist::token_sale' | 'superstate::swap' | 'ondo::swap' | 'centrifuge::vault';
|
|
1271
1795
|
/**
|
|
1272
1796
|
* One variant per {@link OfferTypeDto}, mirroring frontline#1365, which keys
|
|
1273
1797
|
* `GET /v1/offers` on `type`. Read `type` first: it decides which of the
|
|
1274
1798
|
* fields below mean anything.
|
|
1275
1799
|
*/
|
|
1276
|
-
type OfferDto = CoinListTokenSaleOfferDto | SuperstateSwapOfferDto | OndoSwapOfferDto;
|
|
1800
|
+
type OfferDto = CoinListTokenSaleOfferDto | SuperstateSwapOfferDto | OndoSwapOfferDto | CentrifugeVaultOfferDto;
|
|
1277
1801
|
type OfferBaseDto = {
|
|
1278
1802
|
id: string;
|
|
1279
1803
|
slug: string;
|
|
@@ -1290,15 +1814,16 @@ type OfferEditorialDto = {
|
|
|
1290
1814
|
starts_at: string;
|
|
1291
1815
|
};
|
|
1292
1816
|
/**
|
|
1293
|
-
* What an Ondo swap sends in place of
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1296
|
-
* reads
|
|
1817
|
+
* What an Ondo swap or a Centrifuge vault sends in place of
|
|
1818
|
+
* {@link OfferEditorialDto}. Neither runs a campaign, so the keys arrive as
|
|
1819
|
+
* `null` and carry nothing, and the backend may stop sending them at all.
|
|
1820
|
+
* Declared so a fixture can describe the real payload; no `fromDto` reads
|
|
1821
|
+
* them.
|
|
1297
1822
|
*/
|
|
1298
1823
|
type OfferNoEditorialDto = {
|
|
1299
|
-
tagline
|
|
1300
|
-
banner_url
|
|
1301
|
-
starts_at
|
|
1824
|
+
tagline?: null;
|
|
1825
|
+
banner_url?: null;
|
|
1826
|
+
starts_at?: null;
|
|
1302
1827
|
};
|
|
1303
1828
|
type CoinListTokenSaleOfferDto = OfferBaseDto & OfferEditorialDto & {
|
|
1304
1829
|
type: 'coinlist::token_sale';
|
|
@@ -1314,8 +1839,17 @@ type OndoSwapOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
|
1314
1839
|
/** Publishing a swap does not require anyone to upload artwork for it. */
|
|
1315
1840
|
logo_url: string | null;
|
|
1316
1841
|
};
|
|
1842
|
+
type CentrifugeVaultOfferDto = OfferBaseDto & OfferNoEditorialDto & {
|
|
1843
|
+
type: 'centrifuge::vault';
|
|
1844
|
+
/** Publishing a vault does not require anyone to upload artwork for it. */
|
|
1845
|
+
logo_url: string | null;
|
|
1846
|
+
};
|
|
1317
1847
|
type OfferTokenDto = {
|
|
1318
|
-
|
|
1848
|
+
/**
|
|
1849
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for
|
|
1850
|
+
* deposits, as `swap` is the token a swap offer trades into.
|
|
1851
|
+
*/
|
|
1852
|
+
role: 'funding' | 'distribution' | 'swap' | 'vault';
|
|
1319
1853
|
chain: string;
|
|
1320
1854
|
address: string;
|
|
1321
1855
|
};
|
|
@@ -1346,10 +1880,16 @@ type OndoSwapOffer = OfferBase & {
|
|
|
1346
1880
|
/** Null when nobody has uploaded artwork: a swap publishes without it. */
|
|
1347
1881
|
logoUrl: string | null;
|
|
1348
1882
|
};
|
|
1883
|
+
type CentrifugeVaultOffer = OfferBase & {
|
|
1884
|
+
type: 'centrifuge::vault';
|
|
1885
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
1886
|
+
logoUrl: string | null;
|
|
1887
|
+
};
|
|
1349
1888
|
/**
|
|
1350
1889
|
* A curated sale window and the hand-authored copy that goes with it. Every
|
|
1351
1890
|
* variant that runs such a campaign carries all three, validated; an Ondo swap
|
|
1352
|
-
* trades continuously
|
|
1891
|
+
* trades continuously and a Centrifuge vault takes deposits continuously, so
|
|
1892
|
+
* neither runs one and neither carries any.
|
|
1353
1893
|
*/
|
|
1354
1894
|
type OfferEditorial = {
|
|
1355
1895
|
tagline: string;
|
|
@@ -1369,7 +1909,7 @@ declare const OfferEditorial: {
|
|
|
1369
1909
|
* `type` before reading anything beyond {@link OfferBase} - an Ondo swap has
|
|
1370
1910
|
* no `startsAt` to read, and the compiler says so.
|
|
1371
1911
|
*/
|
|
1372
|
-
type Offer = CoinListTokenSaleOffer | SuperstateSwapOffer | OndoSwapOffer;
|
|
1912
|
+
type Offer = CoinListTokenSaleOffer | SuperstateSwapOffer | OndoSwapOffer | CentrifugeVaultOffer;
|
|
1373
1913
|
declare const Offer: {
|
|
1374
1914
|
fromDto: (dto: OfferDto) => Offer;
|
|
1375
1915
|
/**
|
|
@@ -1382,7 +1922,11 @@ declare const Offer: {
|
|
|
1382
1922
|
*/
|
|
1383
1923
|
listFromDto: (dtos: OfferDto[]) => Offer[];
|
|
1384
1924
|
};
|
|
1385
|
-
|
|
1925
|
+
/**
|
|
1926
|
+
* `vault` is the share token a `centrifuge::vault` offer issues for deposits,
|
|
1927
|
+
* as `swap` is the token a swap offer trades into.
|
|
1928
|
+
*/
|
|
1929
|
+
type TokenRole = 'funding' | 'distribution' | 'swap' | 'vault';
|
|
1386
1930
|
type OfferToken = {
|
|
1387
1931
|
role: TokenRole;
|
|
1388
1932
|
chain: Chain;
|
|
@@ -1497,16 +2041,16 @@ type CreateParticipationDto = {
|
|
|
1497
2041
|
* One variant per `OfferTypeDto`, the same split as `OfferDto` with what
|
|
1498
2042
|
* `GET /v1/offers/:id` adds on top. Read `type` first.
|
|
1499
2043
|
*/
|
|
1500
|
-
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto;
|
|
1501
|
-
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
2044
|
+
type OfferDetailDto = CoinListTokenSaleOfferDetailDto | SuperstateSwapOfferDetailDto | OndoSwapOfferDetailDto | CentrifugeVaultOfferDetailDto;
|
|
2045
|
+
type CoinListTokenSaleOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1502
2046
|
type: 'coinlist::token_sale';
|
|
1503
2047
|
logo_url: string;
|
|
1504
2048
|
};
|
|
1505
|
-
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
2049
|
+
type SuperstateSwapOfferDetailDto = OfferDetailBaseDto & OfferEditorialDto & OfferDetailNoSwapContractsDto & OfferDetailNoVaultContractsDto & {
|
|
1506
2050
|
type: 'superstate::swap';
|
|
1507
2051
|
logo_url: string | null;
|
|
1508
2052
|
};
|
|
1509
|
-
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
2053
|
+
type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoVaultContractsDto & {
|
|
1510
2054
|
type: 'ondo::swap';
|
|
1511
2055
|
logo_url: string | null;
|
|
1512
2056
|
/**
|
|
@@ -1515,6 +2059,19 @@ type OndoSwapOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & {
|
|
|
1515
2059
|
*/
|
|
1516
2060
|
swap_contracts: OfferDetailSwapContractDto[];
|
|
1517
2061
|
};
|
|
2062
|
+
type CentrifugeVaultOfferDetailDto = OfferDetailBaseDto & OfferNoEditorialDto & OfferDetailNoSwapContractsDto & {
|
|
2063
|
+
type: 'centrifuge::vault';
|
|
2064
|
+
logo_url: string | null;
|
|
2065
|
+
/**
|
|
2066
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
2067
|
+
* request goes through. `[]` is an answer - "deposits nowhere", which is
|
|
2068
|
+
* every vault until a proxy is deployed - and a missing key is not.
|
|
2069
|
+
*/
|
|
2070
|
+
vault_contracts: OfferDetailVaultContractDto[];
|
|
2071
|
+
};
|
|
2072
|
+
type OfferDetailNoVaultContractsDto = {
|
|
2073
|
+
vault_contracts?: OfferDetailVaultContractDto[];
|
|
2074
|
+
};
|
|
1518
2075
|
/**
|
|
1519
2076
|
* An offer that does not settle through a CoinList swap contract sends `[]`
|
|
1520
2077
|
* or no key at all, and either way there is nothing to read. Declared so a
|
|
@@ -1581,6 +2138,10 @@ type OfferDetailSwapContractDto = {
|
|
|
1581
2138
|
chain: string;
|
|
1582
2139
|
address: string;
|
|
1583
2140
|
};
|
|
2141
|
+
type OfferDetailVaultContractDto = {
|
|
2142
|
+
chain: string;
|
|
2143
|
+
address: string;
|
|
2144
|
+
};
|
|
1584
2145
|
|
|
1585
2146
|
type Ticker = Newtype<string, 'Ticker'>;
|
|
1586
2147
|
declare const Ticker: (value: string) => Ticker;
|
|
@@ -1599,6 +2160,28 @@ type Isin = Newtype<string, 'Isin'>;
|
|
|
1599
2160
|
declare const Isin: (value: string) => Isin;
|
|
1600
2161
|
type OrderBookSide = 'buy' | 'sell';
|
|
1601
2162
|
|
|
2163
|
+
/** The `type` of every {@link AsyncOfferDetail}. */
|
|
2164
|
+
type AsyncOfferType = AsyncOfferDetail['type'];
|
|
2165
|
+
/**
|
|
2166
|
+
* An offer whose trade settles later: the user places a request, the fund
|
|
2167
|
+
* fills it on its own schedule, and the user comes back to claim the result.
|
|
2168
|
+
* Only these have a second leg for `ClaimContainer` to show.
|
|
2169
|
+
*
|
|
2170
|
+
* A subset of {@link OfferDetail} picked by `type`, so it narrows like any
|
|
2171
|
+
* other variant and a new async provider is one more member here.
|
|
2172
|
+
*/
|
|
2173
|
+
type AsyncOfferDetail = CentrifugeVaultOfferDetail;
|
|
2174
|
+
declare const AsyncOfferDetail: {
|
|
2175
|
+
/**
|
|
2176
|
+
* Narrows an offer fetched generically, e.g. on an offer page, to one with
|
|
2177
|
+
* something to claim.
|
|
2178
|
+
*
|
|
2179
|
+
* An exhaustive `switch` rather than a list of async types, so a new offer
|
|
2180
|
+
* type is a compile error here until someone decides whether it settles
|
|
2181
|
+
* later.
|
|
2182
|
+
*/
|
|
2183
|
+
is: (offer: OfferDetail) => offer is AsyncOfferDetail;
|
|
2184
|
+
};
|
|
1602
2185
|
type CoinListTokenSaleOfferDetail = OfferDetailBase & OfferEditorial & {
|
|
1603
2186
|
type: 'coinlist::token_sale';
|
|
1604
2187
|
logoUrl: string;
|
|
@@ -1618,6 +2201,16 @@ type OndoSwapOfferDetail = OfferDetailBase & {
|
|
|
1618
2201
|
*/
|
|
1619
2202
|
swapContracts: OfferSwapContract[];
|
|
1620
2203
|
};
|
|
2204
|
+
type CentrifugeVaultOfferDetail = OfferDetailBase & {
|
|
2205
|
+
type: 'centrifuge::vault';
|
|
2206
|
+
/** Null when nobody has uploaded artwork: a vault publishes without it. */
|
|
2207
|
+
logoUrl: string | null;
|
|
2208
|
+
/**
|
|
2209
|
+
* Every chain this vault takes deposits on, with the CoinList proxy each
|
|
2210
|
+
* request goes through. Empty means it takes deposits nowhere yet.
|
|
2211
|
+
*/
|
|
2212
|
+
vaultContracts: OfferVaultContract[];
|
|
2213
|
+
};
|
|
1621
2214
|
type OfferDetailBase = {
|
|
1622
2215
|
id: OfferId;
|
|
1623
2216
|
slug: OfferSlug;
|
|
@@ -1695,13 +2288,38 @@ type OfferSwapContract = {
|
|
|
1695
2288
|
declare const OfferSwapContract: {
|
|
1696
2289
|
fromDto: (dto: OfferDetailSwapContractDto) => OfferSwapContract;
|
|
1697
2290
|
};
|
|
2291
|
+
/**
|
|
2292
|
+
* A chain a Centrifuge vault takes deposits on, with the CoinList proxy the
|
|
2293
|
+
* request goes through. Not a token, so the token registry knows nothing about
|
|
2294
|
+
* it: it is the spender the user approves the funding token to, and the `to`
|
|
2295
|
+
* the buy and claim transactions are sent to.
|
|
2296
|
+
*
|
|
2297
|
+
* Its own type rather than an {@link OfferSwapContract}, although the shape is
|
|
2298
|
+
* the same, because the meaning is not: a swap contract serves every Ondo
|
|
2299
|
+
* asset on its chain, while a proxy belongs to one offer on one chain, so the
|
|
2300
|
+
* same chain carries a different address on every vault.
|
|
2301
|
+
*/
|
|
2302
|
+
type OfferVaultContract = {
|
|
2303
|
+
chain: Chain;
|
|
2304
|
+
address: EvmContractAddress;
|
|
2305
|
+
};
|
|
2306
|
+
declare const OfferVaultContract: {
|
|
2307
|
+
fromDto: (dto: OfferDetailVaultContractDto) => OfferVaultContract;
|
|
2308
|
+
/**
|
|
2309
|
+
* Drops every proxy on a chain this SDK does not name, as
|
|
2310
|
+
* `OfferToken.listFromDto` does: frontline publishes the full offer-token
|
|
2311
|
+
* chain list, which runs ahead of {@link Chain}, and one unmodelled chain
|
|
2312
|
+
* should not throw away the proxies the SDK can use.
|
|
2313
|
+
*/
|
|
2314
|
+
listFromDto: (dtos: OfferDetailVaultContractDto[]) => OfferVaultContract[];
|
|
2315
|
+
};
|
|
1698
2316
|
/**
|
|
1699
2317
|
* An offer as `GET /v1/offers/:id` serves it: the same union on `type` as
|
|
1700
2318
|
* {@link Offer}, each variant carrying only the fields that mean something
|
|
1701
2319
|
* for it. Narrow on `type` before reading anything beyond
|
|
1702
2320
|
* {@link OfferDetailBase}.
|
|
1703
2321
|
*/
|
|
1704
|
-
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail;
|
|
2322
|
+
type OfferDetail = CoinListTokenSaleOfferDetail | SuperstateSwapOfferDetail | OndoSwapOfferDetail | CentrifugeVaultOfferDetail;
|
|
1705
2323
|
declare const OfferDetail: {
|
|
1706
2324
|
fromDto: (dto: OfferDetailDto) => OfferDetail;
|
|
1707
2325
|
};
|
|
@@ -2488,6 +3106,17 @@ declare const OndoSellTransaction: {
|
|
|
2488
3106
|
*/
|
|
2489
3107
|
interface OndoNamespace {
|
|
2490
3108
|
getTradingStatus(params: GetOndoTradingStatusParams): Promise<OndoTradingStatus>;
|
|
3109
|
+
/**
|
|
3110
|
+
* An indicative price for `params`' size, from Ondo's live market.
|
|
3111
|
+
*
|
|
3112
|
+
* Ondo refuses to quote while the market is closed or paused, or the asset
|
|
3113
|
+
* is paused or closed for the session - including for about a minute at
|
|
3114
|
+
* every US session change, when `getTradingStatus` may still have reported
|
|
3115
|
+
* the asset tradable. The request then rejects with a 409 carrying
|
|
3116
|
+
* `code: "not_tradable"`; tell it apart from a failure with
|
|
3117
|
+
* {@link isOndoNotTradableError}. Retrying before the market opens fails the
|
|
3118
|
+
* same way.
|
|
3119
|
+
*/
|
|
2491
3120
|
getQuote(params: GetOndoQuoteParams): Promise<OndoQuote>;
|
|
2492
3121
|
/**
|
|
2493
3122
|
* Builds a purchase for a specific wallet and deposit: spends an attestation
|
|
@@ -3350,4 +3979,51 @@ declare class TokensNamespaceImpl implements TokensNamespace {
|
|
|
3350
3979
|
list(chain?: EthereumChain): Promise<TokenMetadata[]>;
|
|
3351
3980
|
}
|
|
3352
3981
|
|
|
3353
|
-
|
|
3982
|
+
/**
|
|
3983
|
+
* An instant: milliseconds since the Unix epoch, as `Date.now()` reads it.
|
|
3984
|
+
* Distinct from {@link Millis}, a duration, so an instant cannot be passed
|
|
3985
|
+
* where a timeout is expected or the other way round.
|
|
3986
|
+
*/
|
|
3987
|
+
type EpochMillis = Newtype<number, 'EpochMillis'>;
|
|
3988
|
+
declare const EpochMillis: {
|
|
3989
|
+
/**
|
|
3990
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
3991
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
3992
|
+
*/
|
|
3993
|
+
of: (value: number) => EpochMillis;
|
|
3994
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
3995
|
+
now: () => EpochMillis;
|
|
3996
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
3997
|
+
fromDate: (date: Date) => EpochMillis;
|
|
3998
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
3999
|
+
elapsed: (from: EpochMillis, to: EpochMillis) => Millis;
|
|
4000
|
+
plus: (at: EpochMillis, duration: Millis) => EpochMillis;
|
|
4001
|
+
};
|
|
4002
|
+
/**
|
|
4003
|
+
* A duration in milliseconds. May be negative: the gap between two instants
|
|
4004
|
+
* read off a wall clock that stepped back in between.
|
|
4005
|
+
*/
|
|
4006
|
+
type Millis = Newtype<number, 'Millis'>;
|
|
4007
|
+
declare const Millis: {
|
|
4008
|
+
of: (value: number) => Millis;
|
|
4009
|
+
};
|
|
4010
|
+
/** A duration in whole, non-negative seconds. */
|
|
4011
|
+
type Seconds = Newtype<number, 'Seconds'>;
|
|
4012
|
+
declare const Seconds: {
|
|
4013
|
+
/**
|
|
4014
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
4015
|
+
*/
|
|
4016
|
+
of: (value: number) => Seconds;
|
|
4017
|
+
toMillis: (value: Seconds) => Millis;
|
|
4018
|
+
};
|
|
4019
|
+
/**
|
|
4020
|
+
* Whether `expiresAt` has passed at `now`, counting it as passed `buffer`
|
|
4021
|
+
* early. The boundary instant itself counts as expired.
|
|
4022
|
+
*/
|
|
4023
|
+
declare function isExpired({ expiresAt, now, buffer, }: {
|
|
4024
|
+
expiresAt: EpochMillis;
|
|
4025
|
+
now: EpochMillis;
|
|
4026
|
+
buffer?: Millis;
|
|
4027
|
+
}): boolean;
|
|
4028
|
+
|
|
4029
|
+
export { type RequirementType as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, StablecoinSymbol as D, EthereumChain as E, type Erc20Asset as F, OfferDetail as G, TokenMetadata as H, type CentrifugeVaultOfferDetail as I, type OfferType as J, type OndoSwapOfferDetail as K, type Logger as L, type CoinListTokenSaleOfferDetail as M, type SuperstateSwapOfferDetail as N, OfferId as O, Participation as P, CentrifugeVaultLegId as Q, type RequirementsNamespace as R, type SuperstateSwapNamespace as S, type TokensNamespace as T, type UniversalNamespaceContext as U, Seconds as V, type WalletError as W, type AsyncOfferType as X, AsyncOfferDetail as Y, Offer as Z, RequirementStatusInfo as _, type CentrifugeNamespace as a, type CentrifugeVaultReason as a$, type RequirementStatusValue as a0, OfferOptionAddress as a1, RequirementId as a2, type KycLevelName as a3, DocumentSubmission as a4, type WalletChallengeType as a5, type PinoLoggerOptions as a6, type CentrifugeOrderReason as a7, type CentrifugeOrderability as a8, CentrifugeVaultQuote as a9, type SafeEvent as aA, type SafeFields as aB, type UnredactedFields as aC, OAuthSession as aD, ClientCredentialsOAuth as aE, type Sender as aF, PaginationParams as aG, PaginatedResponse as aH, ClientSecret as aI, OfferToken as aJ, DecimalString as aK, SwapStatus as aL, type Uint256 as aM, KnownAssetSymbol as aN, type Newtype as aO, type AllowWalletParams as aP, AllowWalletResponse as aQ, Asset as aR, AssetCode as aS, Blockchain as aT, type BuildOndoSwapParamsCore as aU, type CentrifugePositionStatus as aV, CentrifugeVaultBuyTransaction as aW, CentrifugeVaultClaimProceedsTransaction as aX, CentrifugeVaultClaimTransaction as aY, type CentrifugeVaultOffer as aZ, CentrifugeVaultPosition as a_, OndoTradingStatus as aa, AssetDecimals as ab, type BuildOndoBuyParams as ac, type BuildOndoSellParams as ad, OndoQuote as ae, type OndoQuoteSize as af, type TokenIdentifier as ag, CentrifugeVaultLeg as ah, OfferOptionAddressId as ai, CentrifugeVaultStatus as aj, TokenLogo as ak, type DebugEvent as al, type FrontlineEventId as am, HttpError as an, type HttpResponse as ao, KycToken as ap, type LogBinding as aq, type LogBindings as ar, type LogCause as as, type LogLevel as at, type LogScope as au, type LogValue as av, type ProductionLogLevel as aw, RedactedWalletError as ax, type RequestId as ay, type RpcFailureReason as az, AssetSymbol as b, type RpcConfig as b$, CentrifugeVaultRedeemPosition as b0, type CentrifugeVaultTransactionCore as b1, type CentrifugeWalletParams as b2, Chain as b3, ClientId as b4, CodeChallenge as b5, type CoinListTokenSaleOffer as b6, ConnectExternalWalletParams as b7, type CreateKycTokenParams as b8, CreateParticipationParams 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, OfferVaultContract as bH, OffersNamespaceImpl as bI, type OndoQuoteDuration as bJ, type OndoSellOutcome as bK, type OndoSwapOffer as bL, PKCEState as bM, type PaginatedResponseDto as bN, ParticipationId as bO, type ParticipationStatus as bP, ParticipationsPaginationParams as bQ, PauseFlags as bR, Pii as bS, PiiAddress as bT, PiiJurisdiction as bU, type PiiKind as bV, type QueryParamValue as bW, type QueryParamValues as bX, RedirectUri as bY, type RemoveOptionAddressParams as bZ, type RequirementActionNeededReason as b_, CreateWalletOwnershipChallengeParams as ba, Cursor as bb, type DocumentFormType as bc, type DocumentSubmissionStatus as bd, type DocumentType as be, ETHEREUM_CHAINS as bf, EpochMillis as bg, Erc20NamespaceImpl as bh, FaqItem as bi, type GetCentrifugeVaultQuoteParams 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 CentrifugeClaimDirection as c, SOLANA_CHAINS as c0, STABLE_DECIMALS as c1, SolanaChain as c2, type SubmitDocumentParams as c3, type SuperstateSwapOffer as c4, type SwapContractRef as c5, SwapPreview as c6, TermItem as c7, Ticker as c8, type TokenLogoImage as c9, TokenLogoUrl as ca, type TokenRole as cb, TokensNamespaceImpl as cc, type Tx as cd, WalletAddress as ce, WalletOwnershipChallenge as cf, type WalletProtocol as cg, WalletsNamespaceImpl as ch, apiErrorCode as ci, assertUint256 as cj, isChain as ck, isExpired as cl, isOfferType as cm, parseUint256 as cn, CentrifugeNamespaceImpl as d, type Erc20Namespace as e, EvmContractAddress as f, type CoinListTokenSaleNamespace as g, OfferOptionId as h, AssetId as i, CoinListTokenSaleNamespaceImpl as j, type OndoNamespace as k, OfferSwapContract as l, OndoBuyTransaction as m, OndoSellTransaction as n, type OndoSwapTransactionCore as o, type OrderBookSide as p, OndoNamespaceImpl as q, type WalletsNamespace as r, Bps as s, EvmWalletAddress as t, SuperstateSwapNamespaceImpl as u, Requirement as v, RequirementsNamespaceImpl as w, type Config as x, type OAuthAccessToken as y, type OffersNamespace as z };
|