@coinlist-co/react 0.11.1-rc.8cfcd2a → 0.11.1-rc.e102bdb
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-ZVB6KWZ2.js → chunk-7CTH4KPU.js} +254 -61
- package/dist/chunk-7CTH4KPU.js.map +1 -0
- package/dist/{chunk-5KYO7OOX.js → chunk-LSPZETDH.js} +58 -25
- package/dist/chunk-LSPZETDH.js.map +1 -0
- package/dist/{chunk-AQIHCFW4.js → chunk-UZUQALFY.js} +2 -2
- package/dist/client/index.cjs +4585 -2330
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2995 -1672
- package/dist/client/index.d.ts +2995 -1672
- package/dist/client/index.js +4404 -2383
- package/dist/client/index.js.map +1 -1
- package/dist/{collections-DrJFEDHl.d.cts → collections-BBI_XydI.d.cts} +1 -1
- package/dist/{collections-pLtrj6fw.d.ts → collections-BrX9rRWc.d.ts} +1 -1
- package/dist/{config-C6vlghJY.d.cts → config-CMl1bR3F.d.cts} +472 -130
- package/dist/{config-C6vlghJY.d.ts → config-CMl1bR3F.d.ts} +472 -130
- package/dist/server/index.cjs +242 -59
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +315 -84
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +85 -16
- package/dist/shared/index.d.ts +85 -16
- package/dist/shared/index.js +16 -6
- package/package.json +1 -1
- package/dist/chunk-5KYO7OOX.js.map +0 -1
- package/dist/chunk-ZVB6KWZ2.js.map +0 -1
- /package/dist/{chunk-AQIHCFW4.js.map → chunk-UZUQALFY.js.map} +0 -0
|
@@ -302,7 +302,7 @@ type LogBinding = {
|
|
|
302
302
|
};
|
|
303
303
|
/**
|
|
304
304
|
* Every {@link LogBinding} applied so far, merged. This is what reaches a
|
|
305
|
-
* host, so a line from `
|
|
305
|
+
* host, so a line from `prepareOndoSell` carries `flow: 'prepareSell'` as its
|
|
306
306
|
* own key and is filterable without parsing anything.
|
|
307
307
|
*/
|
|
308
308
|
type LogBindings = {
|
|
@@ -499,6 +499,21 @@ type LogCause =
|
|
|
499
499
|
type: 'invariant';
|
|
500
500
|
message: string;
|
|
501
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Every operand was well-formed and the arithmetic on them still had no
|
|
504
|
+
* answer: a division by zero, a result outside the range its type can hold.
|
|
505
|
+
* `message` is an SDK-authored template, like `validation`'s.
|
|
506
|
+
*
|
|
507
|
+
* Separate from `invariant` because the remedy differs. An `invariant` says
|
|
508
|
+
* the SDK computed something impossible and is a bug to report against the
|
|
509
|
+
* SDK; a `math` says the operation was well-posed and the operands, which
|
|
510
|
+
* came off the wire, admit no result - so it points at the response the same
|
|
511
|
+
* way `validation` does, one step later.
|
|
512
|
+
*/
|
|
513
|
+
| {
|
|
514
|
+
type: 'math';
|
|
515
|
+
message: string;
|
|
516
|
+
}
|
|
502
517
|
/** An API-backed call was made without a logged-in user. */
|
|
503
518
|
| {
|
|
504
519
|
type: 'not-authenticated';
|
|
@@ -542,7 +557,7 @@ type LogCause =
|
|
|
542
557
|
* here until it is listed, which is what keeps the constructor total.
|
|
543
558
|
*/
|
|
544
559
|
declare const ETHEREUM_CHAINS: Record<EthereumChain, true>;
|
|
545
|
-
type EthereumChain = 'ethereum_mainnet' | 'ethereum_sepolia';
|
|
560
|
+
type EthereumChain = 'ethereum_mainnet' | 'ethereum_sepolia' | 'base_mainnet' | 'base_sepolia';
|
|
546
561
|
/**
|
|
547
562
|
* Validates that a raw backend string names a chain the SDK supports.
|
|
548
563
|
*
|
|
@@ -690,7 +705,7 @@ type BlockchainAmount = Newtype<{
|
|
|
690
705
|
/**
|
|
691
706
|
* Constructs a {@link BlockchainAmount} and exposes arithmetic helpers.
|
|
692
707
|
* TypeScript has no operator overloading, so use `BlockchainAmount.add(a, b)`
|
|
693
|
-
* instead of
|
|
708
|
+
* instead of `+`/`-`/`*`/`/` on the objects directly.
|
|
694
709
|
*/
|
|
695
710
|
declare const BlockchainAmount: ((value: {
|
|
696
711
|
raw: Uint256;
|
|
@@ -698,7 +713,57 @@ declare const BlockchainAmount: ((value: {
|
|
|
698
713
|
}) => BlockchainAmount) & {
|
|
699
714
|
add: (a: BlockchainAmount, b: BlockchainAmount) => BlockchainAmount;
|
|
700
715
|
sub: (a: BlockchainAmount, b: BlockchainAmount) => BlockchainAmount;
|
|
716
|
+
mul: typeof multiplyAmounts;
|
|
717
|
+
div: typeof divideAmounts;
|
|
701
718
|
};
|
|
719
|
+
/**
|
|
720
|
+
* `a * b`, denominated in `a`'s decimals - a price times a quantity, an amount
|
|
721
|
+
* times a rate.
|
|
722
|
+
*
|
|
723
|
+
* The exact inverse of {@link divideAmounts}, and it reads the same way round:
|
|
724
|
+
* the answer stays in `a`'s scale and `b`'s divides back out, so the two
|
|
725
|
+
* compose - `mul(div(a, b), b)` is `a` again, short only what truncation took.
|
|
726
|
+
* That is what makes `price x quantity` land in the currency the price was
|
|
727
|
+
* quoted in rather than at some product of two exponents no token uses.
|
|
728
|
+
*
|
|
729
|
+
* The multiplication happens *before* the division by `10^b.decimals`, so the
|
|
730
|
+
* full precision of both operands survives into the one rounding at the end.
|
|
731
|
+
* Like `div` it truncates towards zero on both signs, which is the safe
|
|
732
|
+
* direction for money: a total is never inflated past what the parts hold.
|
|
733
|
+
*
|
|
734
|
+
* Total - unlike `div`, there is nothing here to reject. The scale it divides
|
|
735
|
+
* by is a power of ten, never zero, and a product is not bounds-checked for
|
|
736
|
+
* the same reason a quotient is not: whether one past uint256 is a corrupt
|
|
737
|
+
* response or an expected magnitude belongs to the caller.
|
|
738
|
+
*/
|
|
739
|
+
declare function multiplyAmounts(a: BlockchainAmount, b: BlockchainAmount): BlockchainAmount;
|
|
740
|
+
/**
|
|
741
|
+
* `a / b`, denominated in `a`'s decimals - a price, a ratio, a rate.
|
|
742
|
+
*
|
|
743
|
+
* Unlike {@link combineAmounts}, the two operands may be at different scales,
|
|
744
|
+
* and usually are: dividing dollars by shares is the point of the operation,
|
|
745
|
+
* and the two tokens rarely share an exponent. `b`'s scale divides back out -
|
|
746
|
+
* the numerator is scaled by `10^b.decimals` *before* the division, so nothing
|
|
747
|
+
* is lost to integer truncation early and the quotient lands in `a`'s scale,
|
|
748
|
+
* which is the one the amounts it is rendered beside are in.
|
|
749
|
+
*
|
|
750
|
+
* Truncates towards zero on both signs, which is what BigInt division already
|
|
751
|
+
* does and the safe direction for money: the total a price implies never
|
|
752
|
+
* exceeds, in magnitude, the amount that actually moved.
|
|
753
|
+
*
|
|
754
|
+
* A zero divisor is the only rejection. The quotient is deliberately *not*
|
|
755
|
+
* bounds-checked the way {@link combineAmounts} checks a sum: scaling the
|
|
756
|
+
* numerator carries even legal pairs past uint256 (a maximal amount over a
|
|
757
|
+
* single base unit), and whether that reads as a corrupt response or an
|
|
758
|
+
* expected magnitude is the caller's to judge - see `computeOndoBuyPrice` and
|
|
759
|
+
* `computeOndoSellPrice`, which bounds-check the price they build out of this.
|
|
760
|
+
*
|
|
761
|
+
* @throws MathError when `b` is zero. `add` and `sub` throw a bare `Error`
|
|
762
|
+
* because a scale mismatch is a programming error caught in review; a zero
|
|
763
|
+
* divisor arrives from a server response and is divided by during render, so
|
|
764
|
+
* it is a named failure a screen can catch and map to a failed state.
|
|
765
|
+
*/
|
|
766
|
+
declare function divideAmounts(a: BlockchainAmount, b: BlockchainAmount): BlockchainAmount;
|
|
702
767
|
type AssetSymbol = Newtype<string, 'AssetSymbol'>;
|
|
703
768
|
declare const AssetSymbol: (value: string) => AssetSymbol;
|
|
704
769
|
/**
|
|
@@ -1498,53 +1563,98 @@ type GetOndoQuoteParams = {
|
|
|
1498
1563
|
duration?: OndoQuoteDuration;
|
|
1499
1564
|
} & OndoQuoteSize;
|
|
1500
1565
|
/**
|
|
1501
|
-
* What
|
|
1502
|
-
*
|
|
1503
|
-
* Sized by `amount` alone - the coin being spent, in its own base units - with
|
|
1504
|
-
* no `notionalValue` alternative: the calldata authorises a specific ERC-20
|
|
1505
|
-
* pull, so the number that ends up on chain has to be the number the caller
|
|
1506
|
-
* meant, not one derived from a dollar figure. It is the **gross**: CoinList's
|
|
1507
|
-
* fee comes off it, and Ondo prices the remainder.
|
|
1566
|
+
* What both builders take, before the one field whose meaning forks.
|
|
1508
1567
|
*
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1568
|
+
* There is no funding token and no asset here - frontline resolves both from
|
|
1569
|
+
* the offer, because Ninshubur signs a request bound to them and a caller that
|
|
1570
|
+
* could name them could have CoinList sign for a contract of its own. Which
|
|
1571
|
+
* endpoint was called is what says which of the two `amount` counts.
|
|
1513
1572
|
*
|
|
1514
|
-
* `chain` is required
|
|
1515
|
-
*
|
|
1516
|
-
* price. `walletAddress` must be the wallet that will *send* the transaction:
|
|
1517
|
-
* the calldata is signed over it, so a transaction built for one wallet and
|
|
1518
|
-
* broadcast by another reverts.
|
|
1573
|
+
* `chain` is required although the read params refuse it, because these name a
|
|
1574
|
+
* real contract on a real chain rather than asking Ondo for a price.
|
|
1519
1575
|
*/
|
|
1520
|
-
type
|
|
1576
|
+
type BuildOndoSwapParamsCore = {
|
|
1521
1577
|
symbol: AssetSymbol;
|
|
1522
1578
|
chain: EthereumChain;
|
|
1523
|
-
/**
|
|
1579
|
+
/**
|
|
1580
|
+
* The wallet that will *send* the transaction, and that receives the other
|
|
1581
|
+
* token. The calldata is signed over it, so a transaction built for one
|
|
1582
|
+
* wallet and broadcast by another reverts.
|
|
1583
|
+
*/
|
|
1524
1584
|
walletAddress: EvmWalletAddress;
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* What it takes to turn an indicative price into signed, fillable calldata for
|
|
1588
|
+
* a purchase: `POST /v1/ondo/swap/buy`.
|
|
1589
|
+
*
|
|
1590
|
+
* Separate from {@link BuildOndoSellParams} although the fields match today,
|
|
1591
|
+
* because `amount` is denominated in a different token on each - which is
|
|
1592
|
+
* frontline's own reason for splitting the endpoint rather than taking a
|
|
1593
|
+
* `side`. Sharing one type would re-merge the distinction the split exists to
|
|
1594
|
+
* make, and the two will diverge the day either side gains a knob.
|
|
1595
|
+
*/
|
|
1596
|
+
type BuildOndoBuyParams = BuildOndoSwapParamsCore & {
|
|
1525
1597
|
/**
|
|
1526
|
-
* The gross
|
|
1598
|
+
* The **gross** deposit, in the base units of the funding token - the coin
|
|
1599
|
+
* the user chose and approved.
|
|
1600
|
+
*
|
|
1601
|
+
* Sized by `amount` alone, with no `notionalValue` alternative: the calldata
|
|
1602
|
+
* authorises a specific ERC-20 pull, so the number that ends up on chain has
|
|
1603
|
+
* to be the number the caller meant rather than one derived from a dollar
|
|
1604
|
+
* figure. CoinList's fee comes off it, and Ondo prices the remainder.
|
|
1527
1605
|
*
|
|
1528
|
-
* Its `decimals` are also what the response's `
|
|
1606
|
+
* Its `decimals` are also what the response's `spend_input_decimals` is
|
|
1529
1607
|
* checked against: frontline resolves the funding token from the offer
|
|
1530
1608
|
* rather than from this request, so the two are independent answers to the
|
|
1531
1609
|
* same question and a disagreement means the wrong token was sized.
|
|
1532
1610
|
*/
|
|
1533
1611
|
amount: BlockchainAmount;
|
|
1534
1612
|
};
|
|
1613
|
+
/**
|
|
1614
|
+
* What it takes to turn an indicative price into signed, fillable calldata for
|
|
1615
|
+
* a sale: `POST /v1/ondo/swap/sell`.
|
|
1616
|
+
*
|
|
1617
|
+
* See {@link BuildOndoBuyParams} for why this is its own type.
|
|
1618
|
+
*/
|
|
1619
|
+
type BuildOndoSellParams = BuildOndoSwapParamsCore & {
|
|
1620
|
+
/**
|
|
1621
|
+
* The quantity of the **asset** to sell, in the asset's own base units - not
|
|
1622
|
+
* in the funding token's, which is the same integer meaning something 1e12
|
|
1623
|
+
* different.
|
|
1624
|
+
*
|
|
1625
|
+
* This is the figure the wallet must have approved: a sale delivers the
|
|
1626
|
+
* asset, so the swap contract pulls it with `transferFrom` exactly as it
|
|
1627
|
+
* pulls the deposit on a purchase.
|
|
1628
|
+
*
|
|
1629
|
+
* Its `decimals` are checked against the response's `spend_input_decimals`,
|
|
1630
|
+
* which frontline reads on-chain from the asset on `chain`. The SDK's own
|
|
1631
|
+
* answer comes from the quote, which resolves the asset on Ethereum mainnet,
|
|
1632
|
+
* so on a testnet these are two independent resolutions of two different
|
|
1633
|
+
* contracts - and the check is what says so.
|
|
1634
|
+
*/
|
|
1635
|
+
amount: BlockchainAmount;
|
|
1636
|
+
};
|
|
1535
1637
|
|
|
1536
1638
|
/**
|
|
1537
1639
|
* Raw JSON models for the Ondo swap endpoints, mirroring
|
|
1538
|
-
* `OndoSwapTradingStatus`, `OndoSwapQuote` and `
|
|
1539
|
-
* frontline's OpenAPI schema. The two GETs are free to poll: neither spends
|
|
1540
|
-
* attestation, so a client may call them while the user edits an order. The
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1640
|
+
* `OndoSwapTradingStatus`, `OndoSwapQuote`, `OndoSwapBuy` and `OndoSwapSell`
|
|
1641
|
+
* in frontline's OpenAPI schema. The two GETs are free to poll: neither spends
|
|
1642
|
+
* an attestation, so a client may call them while the user edits an order. The
|
|
1643
|
+
* two POSTs are not - each spends one and hands back signed calldata with a
|
|
1644
|
+
* deadline.
|
|
1645
|
+
*
|
|
1646
|
+
* **One endpoint per side, and therefore one model per side.** The reads take
|
|
1647
|
+
* a `side` and answer the same shape either way, so they stay single. The
|
|
1648
|
+
* writes do not: a buy commits to an exact quantity, a sell to a range with a
|
|
1649
|
+
* floor beneath it, and `amount` is the funding token on one and the asset on
|
|
1650
|
+
* the other. Only the transport fields mean the same thing on both.
|
|
1651
|
+
* `POST /v1/ondo/swap/transaction` survives as a deprecated alias of the buy
|
|
1652
|
+
* under the old `pay_input_*` names; the SDK does not call it.
|
|
1543
1653
|
*
|
|
1544
1654
|
* Neither GET takes a `chain`. Ondo runs no sandbox, so every environment
|
|
1545
|
-
* prices against Ondo production on Ethereum mainnet. The
|
|
1546
|
-
*
|
|
1547
|
-
* Sepolia one with the mocked attestation.
|
|
1655
|
+
* prices against Ondo production on Ethereum mainnet. The POSTs do carry one:
|
|
1656
|
+
* they target a real contract, which on every environment but production is
|
|
1657
|
+
* the Sepolia one with the mocked attestation.
|
|
1548
1658
|
*/
|
|
1549
1659
|
/**
|
|
1550
1660
|
* Whether an asset can be traded right now, and the caps if so.
|
|
@@ -1607,34 +1717,19 @@ type OndoQuoteDto = {
|
|
|
1607
1717
|
price: string;
|
|
1608
1718
|
};
|
|
1609
1719
|
/**
|
|
1610
|
-
*
|
|
1611
|
-
* to: `POST /v1/ondo/swap/transaction`.
|
|
1612
|
-
*
|
|
1613
|
-
* Unlike {@link OndoQuoteDto} this **spends an attestation**, so it is not
|
|
1614
|
-
* pollable: one call per order, plus one per user-requested refresh. Frontline
|
|
1615
|
-
* also reads the wallet's allowance before asking Ninshubur for anything, so
|
|
1616
|
-
* an unapproved wallet is refused here rather than reverting on chain.
|
|
1617
|
-
*
|
|
1618
|
-
* Buy-only. There is no `side`: the funding token goes in and the asset comes
|
|
1619
|
-
* out, both resolved from the offer, so a caller cannot name either.
|
|
1720
|
+
* The transport half of a built swap, identical on both sides.
|
|
1620
1721
|
*
|
|
1621
|
-
*
|
|
1622
|
-
*
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
* beyond the amounts comes from that GET or from the offer.
|
|
1722
|
+
* `spend_input_amount` is the only key here whose *token* depends on the side,
|
|
1723
|
+
* and `spend_input_decimals` is what says at what scale. Everything below this
|
|
1724
|
+
* point differs, which is why the two responses are two types rather than one
|
|
1725
|
+
* with nullable halves.
|
|
1626
1726
|
*
|
|
1627
|
-
*
|
|
1628
|
-
*
|
|
1629
|
-
*
|
|
1630
|
-
*
|
|
1631
|
-
* `asset_decimals`, which answers for a different number - see the two fields
|
|
1632
|
-
* below.
|
|
1633
|
-
*
|
|
1634
|
-
* The response has no `object` envelope. `action` says what to do with the
|
|
1635
|
-
* body, matching `AllowWalletResponseDto`.
|
|
1727
|
+
* There is no `object` envelope and no `side` echo. `action` says what to do
|
|
1728
|
+
* with the body, matching `AllowWalletResponseDto`; which trade it encodes is
|
|
1729
|
+
* settled by the endpoint that was called, so nothing on the wire has to say
|
|
1730
|
+
* it and nothing has to be checked against it.
|
|
1636
1731
|
*/
|
|
1637
|
-
type
|
|
1732
|
+
type OndoSwapDtoCore = {
|
|
1638
1733
|
action: 'broadcast_transaction';
|
|
1639
1734
|
/** The swap contract the transaction is sent to. */
|
|
1640
1735
|
to: string;
|
|
@@ -1648,36 +1743,74 @@ type OndoSwapTransactionDto = {
|
|
|
1648
1743
|
*/
|
|
1649
1744
|
expires_at: string;
|
|
1650
1745
|
/**
|
|
1651
|
-
* Gross amount the wallet
|
|
1652
|
-
*
|
|
1746
|
+
* Gross amount the wallet spends, echoing the requested `amount`, in the
|
|
1747
|
+
* smallest unit of the token this side spends - the funding token on a buy,
|
|
1748
|
+
* the asset on a sell. The approval is compared against this.
|
|
1749
|
+
*
|
|
1750
|
+
* Named `pay_input_amount` on the deprecated
|
|
1751
|
+
* `POST /v1/ondo/swap/transaction`. `pay` was accurate only while a buy was
|
|
1752
|
+
* the sole thing this could encode: a sell delivers the asset rather than
|
|
1753
|
+
* paying for one.
|
|
1653
1754
|
*/
|
|
1654
|
-
|
|
1755
|
+
spend_input_amount: string;
|
|
1655
1756
|
/**
|
|
1656
|
-
* Decimals `
|
|
1757
|
+
* Decimals `spend_input_amount` is counted in.
|
|
1758
|
+
*
|
|
1759
|
+
* Frontline reads it on-chain from the token the side spends, which it
|
|
1760
|
+
* resolves from the offer rather than from anything the caller sent. That
|
|
1761
|
+
* makes it the only published scale for a token the request never names -
|
|
1762
|
+
* and an independent answer to the one the SDK derived when it sized the
|
|
1763
|
+
* order, which is why both builders compare the two.
|
|
1657
1764
|
*
|
|
1658
|
-
*
|
|
1659
|
-
* the
|
|
1660
|
-
*
|
|
1661
|
-
* independent answer to the one the SDK derived when it sized the order,
|
|
1662
|
-
* which is why `buildOndoSwapTransaction` compares the two.
|
|
1765
|
+
* **The same key, two scales.** It counts whichever token the side spends:
|
|
1766
|
+
* the funding token's 6 on a buy, the asset's 18 on a sell. Worth knowing
|
|
1767
|
+
* before integrating against both.
|
|
1663
1768
|
*/
|
|
1664
|
-
|
|
1769
|
+
spend_input_decimals: number;
|
|
1770
|
+
};
|
|
1771
|
+
/**
|
|
1772
|
+
* Signed, ready-to-broadcast calldata for a purchase, and the amounts it
|
|
1773
|
+
* commits to: `POST /v1/ondo/swap/buy`.
|
|
1774
|
+
*
|
|
1775
|
+
* Unlike {@link OndoQuoteDto} this **spends an attestation**, so it is not
|
|
1776
|
+
* pollable: one call per order, plus one per user-requested refresh. Frontline
|
|
1777
|
+
* also reads the wallet's allowance on the funding token before asking
|
|
1778
|
+
* Ninshubur for anything, so an unapproved wallet is refused here rather than
|
|
1779
|
+
* reverting on chain.
|
|
1780
|
+
*
|
|
1781
|
+
* The quantity is attested and exact, with no floor beneath it, which is what
|
|
1782
|
+
* separates a buy from an {@link OndoSellDto}.
|
|
1783
|
+
*
|
|
1784
|
+
* **Carries no identity and no price.** No `chain_id`, `symbol`, `ticker` or
|
|
1785
|
+
* `price` - the request named the first few and frontline drops Ninshubur's
|
|
1786
|
+
* `price` deliberately, because `GET /v1/ondo/swap/quote` already publishes
|
|
1787
|
+
* one under that name at a different scale. Anything the UI needs beyond the
|
|
1788
|
+
* amounts comes from that GET or from the offer.
|
|
1789
|
+
*
|
|
1790
|
+
* Two scales are on the wire: `fee` and `notional_value` are in
|
|
1791
|
+
* `spend_input_decimals`, and `receive_output_amount` is in
|
|
1792
|
+
* `receive_output_decimals`. Neither is interchangeable with the quote's
|
|
1793
|
+
* `asset_decimals`, which answers for a different number.
|
|
1794
|
+
*/
|
|
1795
|
+
type OndoBuyDto = OndoSwapDtoCore & {
|
|
1665
1796
|
/**
|
|
1666
|
-
* CoinList's cut of `
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1797
|
+
* CoinList's cut of `spend_input_amount`, in the same units. `"0"` until
|
|
1798
|
+
* ENG-1718 turns a fee on - frontline rejects a non-zero one today.
|
|
1799
|
+
*
|
|
1800
|
+
* Taken at execution rather than added on top, so the wallet never approves
|
|
1801
|
+
* more than `spend_input_amount`.
|
|
1670
1802
|
*/
|
|
1671
1803
|
fee: string;
|
|
1672
1804
|
/**
|
|
1673
|
-
* `
|
|
1674
|
-
*
|
|
1805
|
+
* `spend_input_amount` less `fee`, in `spend_input_decimals`: the part that
|
|
1806
|
+
* reaches Ondo, what the quantity was priced against, and what the
|
|
1807
|
+
* signature commits to.
|
|
1675
1808
|
*/
|
|
1676
1809
|
notional_value: string;
|
|
1677
1810
|
/**
|
|
1678
|
-
* Quantity of the asset the wallet receives, in the
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1811
|
+
* Quantity of the asset the wallet receives, in the asset's smallest unit.
|
|
1812
|
+
* Scale it by `receive_output_decimals`, not by the funding token's and not
|
|
1813
|
+
* by {@link OndoQuoteDto}'s `asset_decimals`.
|
|
1681
1814
|
*/
|
|
1682
1815
|
receive_output_amount: string;
|
|
1683
1816
|
/**
|
|
@@ -1691,6 +1824,74 @@ type OndoSwapTransactionDto = {
|
|
|
1691
1824
|
*/
|
|
1692
1825
|
receive_output_decimals: number;
|
|
1693
1826
|
};
|
|
1827
|
+
/**
|
|
1828
|
+
* Signed, ready-to-broadcast calldata for a sale, and the range it commits to:
|
|
1829
|
+
* `POST /v1/ondo/swap/sell`.
|
|
1830
|
+
*
|
|
1831
|
+
* Like {@link OndoBuyDto} it **spends an attestation** and expires, so it is
|
|
1832
|
+
* called once on confirmation and never on a timer. Frontline reads the
|
|
1833
|
+
* wallet's allowance on the **asset** before signing - a sell delivers it -
|
|
1834
|
+
* and refuses a short one with a 422 naming that address.
|
|
1835
|
+
*
|
|
1836
|
+
* **A sell commits to a range rather than a quantity.** Ondo settles through
|
|
1837
|
+
* USDon before converting to the settlement token, so the response publishes
|
|
1838
|
+
* what to expect and the floor the calldata enforces, each with the fee
|
|
1839
|
+
* charged at it. There is no `notional_value`: a sell commits on the output
|
|
1840
|
+
* side, so there is no fee-exclusive input to report and frontline declines to
|
|
1841
|
+
* relate numbers Ninshubur did not relate.
|
|
1842
|
+
*
|
|
1843
|
+
* All four amounts below are in `receive_output_decimals`. The one amount that
|
|
1844
|
+
* is not is `spend_input_amount`, in `spend_input_decimals` - see
|
|
1845
|
+
* {@link OndoSwapDtoCore}.
|
|
1846
|
+
*
|
|
1847
|
+
* One thing the response does not say, and the calldata does: the floor signed
|
|
1848
|
+
* into `data` is **gross** of CoinList's fee, so a caller decoding it finds a
|
|
1849
|
+
* larger number than `minimum_quantity`. Both are correct; `minimum_quantity`
|
|
1850
|
+
* is what the wallet actually receives.
|
|
1851
|
+
*/
|
|
1852
|
+
type OndoSellDto = OndoSwapDtoCore & {
|
|
1853
|
+
/**
|
|
1854
|
+
* CoinList's cut at the expected outcome, in the settlement token. Already
|
|
1855
|
+
* deducted from `expected_quantity` rather than charged on top of it.
|
|
1856
|
+
*
|
|
1857
|
+
* `"0"` until ENG-1718 turns a fee on - frontline rejects a non-zero one on
|
|
1858
|
+
* either side today.
|
|
1859
|
+
*/
|
|
1860
|
+
expected_fee: string;
|
|
1861
|
+
/**
|
|
1862
|
+
* What the sale is expected to return, **net of `expected_fee`**, in the
|
|
1863
|
+
* settlement token's smallest unit.
|
|
1864
|
+
*
|
|
1865
|
+
* An expectation rather than a guarantee. What the contract enforces is
|
|
1866
|
+
* {@link OndoSellDto.minimum_quantity}.
|
|
1867
|
+
*/
|
|
1868
|
+
expected_quantity: string;
|
|
1869
|
+
/**
|
|
1870
|
+
* CoinList's cut at the floor, in the same units.
|
|
1871
|
+
*
|
|
1872
|
+
* A different number from `expected_fee` because the two are charged on
|
|
1873
|
+
* different amounts - which is why frontline publishes both rather than one.
|
|
1874
|
+
* This is the one to disclose worst-case cost with.
|
|
1875
|
+
*/
|
|
1876
|
+
minimum_fee: string;
|
|
1877
|
+
/**
|
|
1878
|
+
* The least the wallet can receive, **net of `minimum_fee`**, in the same
|
|
1879
|
+
* units. Below it the transaction reverts on chain.
|
|
1880
|
+
*
|
|
1881
|
+
* Frontline guarantees it is at most `expected_quantity` and greater than
|
|
1882
|
+
* zero. The settlement lands somewhere between the two.
|
|
1883
|
+
*/
|
|
1884
|
+
minimum_quantity: string;
|
|
1885
|
+
/**
|
|
1886
|
+
* Decimals both quantities and both fees are counted in, reported by
|
|
1887
|
+
* whatever priced them rather than looked up from the token.
|
|
1888
|
+
*
|
|
1889
|
+
* Not the same number as {@link OndoQuoteDto}'s `asset_decimals`, which
|
|
1890
|
+
* answers for the asset being sold rather than for the coin the proceeds
|
|
1891
|
+
* arrive in.
|
|
1892
|
+
*/
|
|
1893
|
+
receive_output_decimals: number;
|
|
1894
|
+
};
|
|
1694
1895
|
|
|
1695
1896
|
/**
|
|
1696
1897
|
* Whether an Ondo asset can be traded right now.
|
|
@@ -1735,22 +1936,30 @@ declare const OndoTradingStatus: {
|
|
|
1735
1936
|
* contract's `preview`, and no such contract exists for Ondo yet.
|
|
1736
1937
|
*
|
|
1737
1938
|
* The quote carries no transaction to broadcast and no expiry. Building one is
|
|
1738
|
-
* a separate endpoint that spends an attestation - see
|
|
1739
|
-
* {@link
|
|
1939
|
+
* a separate endpoint per side that spends an attestation - see
|
|
1940
|
+
* {@link OndoBuyTransaction} and {@link OndoSellTransaction}.
|
|
1740
1941
|
*/
|
|
1741
1942
|
type OndoQuote = {
|
|
1742
1943
|
/** Always `ethereum_mainnet`: Ondo runs no sandbox in any environment. */
|
|
1743
1944
|
chain: EthereumChain;
|
|
1744
1945
|
ticker: Ticker;
|
|
1745
|
-
/**
|
|
1946
|
+
/**
|
|
1947
|
+
* Needed to approve or transfer the asset; the quote is the only source.
|
|
1948
|
+
*
|
|
1949
|
+
* **Resolved on Ethereum mainnet**, like everything else on this quote, and
|
|
1950
|
+
* therefore not necessarily the contract the swap pulls from on the chain
|
|
1951
|
+
* the order executes on. Frontline resolves that one per chain and publishes
|
|
1952
|
+
* it nowhere, so on a testnet these are two different tokens. Tracked
|
|
1953
|
+
* against the frontline stack that follows ENG-1756.
|
|
1954
|
+
*/
|
|
1746
1955
|
assetAddress: EvmContractAddress;
|
|
1747
1956
|
/**
|
|
1748
1957
|
* The asset as the quote resolves it, from frontline's own catalogue.
|
|
1749
1958
|
*
|
|
1750
1959
|
* Its `decimals` scale {@link tokenBaseUnits} and nothing else. They are
|
|
1751
|
-
* **not** the scale of
|
|
1752
|
-
* reported by whatever priced
|
|
1753
|
-
*
|
|
1960
|
+
* **not** the scale of a built transaction's spend or output: those are
|
|
1961
|
+
* reported by whatever priced them, the sources are allowed to disagree, and
|
|
1962
|
+
* only the one that produced a number answers for it.
|
|
1754
1963
|
*/
|
|
1755
1964
|
asset: Erc20Asset;
|
|
1756
1965
|
side: OrderBookSide;
|
|
@@ -1766,26 +1975,22 @@ declare const OndoQuote: {
|
|
|
1766
1975
|
fromDto: (dto: OndoQuoteDto) => OndoQuote;
|
|
1767
1976
|
};
|
|
1768
1977
|
/**
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1771
|
-
*
|
|
1772
|
-
* Distinct from {@link OndoQuote} in three ways that matter: it costs an
|
|
1773
|
-
* attestation to obtain, it expires, and it carries a {@link Tx} the wallet
|
|
1774
|
-
* broadcasts verbatim. Treat it as single-use - once broadcast (or once
|
|
1775
|
-
* `expiresAt` passes) it is spent, and a new one must be built.
|
|
1978
|
+
* The half of a built swap that both sides share: the calldata, its deadline,
|
|
1979
|
+
* and what the wallet parts with.
|
|
1776
1980
|
*
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1779
|
-
*
|
|
1780
|
-
*
|
|
1781
|
-
*
|
|
1981
|
+
* There is deliberately **no union over the two sides**. Each is built by its
|
|
1982
|
+
* own endpoint and its own namespace method, so a caller never holds one
|
|
1983
|
+
* without knowing which it is, and a union would only re-pose a question the
|
|
1984
|
+
* call site had already answered. What is genuinely common lives here, and
|
|
1985
|
+
* {@link executeOndoSwap} takes this rather than either arm - broadcasting
|
|
1986
|
+
* knows nothing about the direction of the trade.
|
|
1782
1987
|
*
|
|
1783
|
-
*
|
|
1784
|
-
*
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1988
|
+
* `side` is not on this type but on each arm, as a literal the SDK authors
|
|
1989
|
+
* from the method that was called. The wire stopped echoing one when the
|
|
1990
|
+
* endpoint split, and it is still worth carrying: `OndoOrderPlaced` is a union
|
|
1991
|
+
* the SDK builds from both, and that union needs a tag.
|
|
1787
1992
|
*/
|
|
1788
|
-
type
|
|
1993
|
+
type OndoSwapTransactionCore = {
|
|
1789
1994
|
/**
|
|
1790
1995
|
* Broadcast as-is. The `to` is the swap contract, which is also the ERC-20
|
|
1791
1996
|
* spender the user must have approved.
|
|
@@ -1796,16 +2001,51 @@ type OndoSwapTransaction = {
|
|
|
1796
2001
|
* reverts, so callers must compare against it before signing.
|
|
1797
2002
|
*/
|
|
1798
2003
|
expiresAt: Date;
|
|
1799
|
-
/** Gross amount the wallet pays, in the funding token's decimals. */
|
|
1800
|
-
payInputAmount: BlockchainAmount;
|
|
1801
2004
|
/**
|
|
1802
|
-
*
|
|
1803
|
-
* the
|
|
1804
|
-
*
|
|
2005
|
+
* Gross amount the wallet spends, in the decimals of the token this side
|
|
2006
|
+
* spends: the funding token on a buy, the asset on a sell.
|
|
2007
|
+
*
|
|
2008
|
+
* The same field at two scales, which is the whole reason the two sides are
|
|
2009
|
+
* two types. It is also what the approval has to cover.
|
|
2010
|
+
*/
|
|
2011
|
+
spendInputAmount: BlockchainAmount;
|
|
2012
|
+
};
|
|
2013
|
+
/**
|
|
2014
|
+
* A signed, expiring purchase: a funding token in, an exact quantity of the
|
|
2015
|
+
* asset out.
|
|
2016
|
+
*
|
|
2017
|
+
* Distinct from {@link OndoQuote} in three ways that matter: it costs an
|
|
2018
|
+
* attestation to obtain, it expires, and it carries a {@link Tx} the wallet
|
|
2019
|
+
* broadcasts verbatim. Treat it as single-use - once broadcast (or once
|
|
2020
|
+
* `expiresAt` passes) it is spent, and a new one must be built.
|
|
2021
|
+
*
|
|
2022
|
+
* **The quantity is attested and exact, with no floor beneath it.** That is
|
|
2023
|
+
* what separates it from an {@link OndoSellTransaction}, which commits to a
|
|
2024
|
+
* range: nothing here is an estimate.
|
|
2025
|
+
*
|
|
2026
|
+
* **It carries no other identity.** No chain, ticker or asset: the endpoint
|
|
2027
|
+
* publishes none of them, and inventing them from the request would assert
|
|
2028
|
+
* what the server resolved rather than report it. What it does publish is the
|
|
2029
|
+
* scale of every amount on it, so a caller needs nothing alongside it to read
|
|
2030
|
+
* the numbers - only to name the assets, which the offer already does.
|
|
2031
|
+
*
|
|
2032
|
+
* It carries no price either. See `computeOndoBuyPrice`, which derives it from
|
|
2033
|
+
* the amounts the response does carry - the price this transaction fills at,
|
|
2034
|
+
* rather than an indicative one that has since moved.
|
|
2035
|
+
*/
|
|
2036
|
+
type OndoBuyTransaction = OndoSwapTransactionCore & {
|
|
2037
|
+
side: 'buy';
|
|
2038
|
+
/**
|
|
2039
|
+
* CoinList's cut, in `spendInputAmount`'s decimals. Zero until ENG-1718
|
|
2040
|
+
* lands - frontline rejects a non-zero one on either side today.
|
|
2041
|
+
*
|
|
2042
|
+
* Taken at execution rather than added on top, so the approval never has to
|
|
2043
|
+
* cover more than `spendInputAmount`.
|
|
1805
2044
|
*/
|
|
1806
2045
|
fee: BlockchainAmount;
|
|
1807
2046
|
/**
|
|
1808
|
-
* `
|
|
2047
|
+
* `spendInputAmount` less `fee`, in the same decimals: what Ondo priced, and
|
|
2048
|
+
* the numerator of the fill price.
|
|
1809
2049
|
*
|
|
1810
2050
|
* Read from the response rather than subtracted here. Whether the fee comes
|
|
1811
2051
|
* off the deposit or goes on top of it is the server's definition to change,
|
|
@@ -1813,22 +2053,86 @@ type OndoSwapTransaction = {
|
|
|
1813
2053
|
*/
|
|
1814
2054
|
notionalValue: BlockchainAmount;
|
|
1815
2055
|
/**
|
|
1816
|
-
*
|
|
1817
|
-
* reported - not at the {@link OndoQuote}'s.
|
|
2056
|
+
* Quantity of the asset the wallet receives, at the scale whatever priced it
|
|
2057
|
+
* reported - not at the {@link OndoQuote}'s `asset.decimals`.
|
|
1818
2058
|
*/
|
|
1819
2059
|
receiveOutputAmount: BlockchainAmount;
|
|
1820
2060
|
};
|
|
1821
|
-
declare const
|
|
1822
|
-
fromDto: (dto:
|
|
2061
|
+
declare const OndoBuyTransaction: {
|
|
2062
|
+
fromDto: (dto: OndoBuyDto) => OndoBuyTransaction;
|
|
2063
|
+
};
|
|
2064
|
+
/**
|
|
2065
|
+
* One end of the range a sale commits to: what arrives, and what CoinList took
|
|
2066
|
+
* to get it there.
|
|
2067
|
+
*
|
|
2068
|
+
* The two travel together because they are charged against each other -
|
|
2069
|
+
* `quantity` is already **net** of `fee` - and because the pair a caller wants
|
|
2070
|
+
* is always both halves of the same outcome. Grouping them is what makes
|
|
2071
|
+
* "the expected quantity, less the fee at the floor" unrepresentable rather
|
|
2072
|
+
* than merely wrong.
|
|
2073
|
+
*/
|
|
2074
|
+
type OndoSellOutcome = {
|
|
2075
|
+
/** What the wallet receives at this outcome, net of {@link fee}. */
|
|
2076
|
+
quantity: BlockchainAmount;
|
|
2077
|
+
/**
|
|
2078
|
+
* CoinList's cut at this outcome, in the same decimals. Zero until ENG-1718
|
|
2079
|
+
* lands - frontline rejects a non-zero one on either side today.
|
|
2080
|
+
*
|
|
2081
|
+
* Already deducted from {@link quantity} rather than charged on top of it.
|
|
2082
|
+
*/
|
|
2083
|
+
fee: BlockchainAmount;
|
|
2084
|
+
};
|
|
2085
|
+
/**
|
|
2086
|
+
* A signed, expiring sale: the asset in, a settlement coin out, somewhere
|
|
2087
|
+
* between two published outcomes.
|
|
2088
|
+
*
|
|
2089
|
+
* Single-use and expiring for the same reasons as an {@link OndoBuyTransaction},
|
|
2090
|
+
* and obtained the same way - one endpoint, one attestation.
|
|
2091
|
+
*
|
|
2092
|
+
* **A sale commits to a range, not a quantity.** Ondo settles through USDon
|
|
2093
|
+
* before converting to the settlement token, so {@link expected} is what to
|
|
2094
|
+
* expect and {@link minimum} is what the calldata enforces. A screen that
|
|
2095
|
+
* shows only the first presents a firm-looking number the contract may
|
|
2096
|
+
* legitimately fill below.
|
|
2097
|
+
*
|
|
2098
|
+
* There is deliberately no counterpart to a buy's `notionalValue`. A sale
|
|
2099
|
+
* commits on the output side, so frontline reports no fee-exclusive input and
|
|
2100
|
+
* refuses to relate numbers Ninshubur did not relate. What it does relate is
|
|
2101
|
+
* each quantity to the fee beside it, which is why {@link OndoSellOutcome}
|
|
2102
|
+
* pairs them.
|
|
2103
|
+
*
|
|
2104
|
+
* One thing this type cannot see: the floor signed into `tx.data` is gross of
|
|
2105
|
+
* the fee, so a caller decoding the calldata finds a larger number than
|
|
2106
|
+
* `minimum.quantity`. Both are correct; `minimum.quantity` is what the wallet
|
|
2107
|
+
* actually receives.
|
|
2108
|
+
*/
|
|
2109
|
+
type OndoSellTransaction = OndoSwapTransactionCore & {
|
|
2110
|
+
side: 'sell';
|
|
2111
|
+
/** What the sale is expected to return. An expectation, not a guarantee. */
|
|
2112
|
+
expected: OndoSellOutcome;
|
|
2113
|
+
/**
|
|
2114
|
+
* The floor the calldata enforces. A fill below it reverts on chain, so this
|
|
2115
|
+
* - not {@link expected} - is what a seller is actually guaranteed.
|
|
2116
|
+
*/
|
|
2117
|
+
minimum: OndoSellOutcome;
|
|
2118
|
+
};
|
|
2119
|
+
declare const OndoSellTransaction: {
|
|
2120
|
+
fromDto: (dto: OndoSellDto) => OndoSellTransaction;
|
|
1823
2121
|
};
|
|
1824
2122
|
|
|
1825
2123
|
/**
|
|
1826
2124
|
* Ondo swap reads, plus the write that turns one into a fillable transaction.
|
|
1827
2125
|
*
|
|
1828
2126
|
* The two reads are free to poll - neither spends an attestation, so a client
|
|
1829
|
-
* may call them while the user edits an order.
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
2127
|
+
* may call them while the user edits an order. The two builders are not:
|
|
2128
|
+
* budget one call per order placed, plus one per refresh the user asks for.
|
|
2129
|
+
*
|
|
2130
|
+
* **One builder per side, mirroring the endpoints.** A purchase and a sale
|
|
2131
|
+
* agree on how to broadcast and on nothing else: a purchase commits to an
|
|
2132
|
+
* exact quantity, a sale to a range with a floor beneath it, and `amount` is
|
|
2133
|
+
* the funding token on one and the asset on the other. A single method taking
|
|
2134
|
+
* a `side` would have to return a union the caller then re-narrows, having
|
|
2135
|
+
* already decided which trade it was placing.
|
|
1832
2136
|
*
|
|
1833
2137
|
* **No CoinList fee is applied to a read quote, and no read discloses one.**
|
|
1834
2138
|
* Ondo prices exactly the amount passed. A CoinList approval is fee-inclusive,
|
|
@@ -1843,19 +2147,35 @@ interface OndoNamespace {
|
|
|
1843
2147
|
getTradingStatus(params: GetOndoTradingStatusParams): Promise<OndoTradingStatus>;
|
|
1844
2148
|
getQuote(params: GetOndoQuoteParams): Promise<OndoQuote>;
|
|
1845
2149
|
/**
|
|
1846
|
-
* Builds
|
|
1847
|
-
* returns calldata to broadcast, valid until
|
|
1848
|
-
* {@link
|
|
2150
|
+
* Builds a purchase for a specific wallet and deposit: spends an attestation
|
|
2151
|
+
* and returns calldata to broadcast, valid until
|
|
2152
|
+
* {@link OndoBuyTransaction.expiresAt}.
|
|
1849
2153
|
*
|
|
1850
2154
|
* The wallet must have approved the swap contract to spend `amount` of the
|
|
1851
|
-
* offer's funding token first
|
|
1852
|
-
* Ninshubur for anything, and rejects a short one with a 422 carrying
|
|
1853
|
-
* `code: "insufficient_allowance"`. See `
|
|
2155
|
+
* offer's **funding token** first. Frontline reads that allowance before
|
|
2156
|
+
* asking Ninshubur for anything, and rejects a short one with a 422 carrying
|
|
2157
|
+
* `code: "insufficient_allowance"`. See `prepareBuy` on the client
|
|
1854
2158
|
* namespace, which approves and then builds, in that order.
|
|
1855
2159
|
*
|
|
1856
|
-
*
|
|
2160
|
+
* The tokens themselves are the offer's rather than the caller's to name.
|
|
2161
|
+
*/
|
|
2162
|
+
buildBuyTransaction(params: BuildOndoBuyParams): Promise<OndoBuyTransaction>;
|
|
2163
|
+
/**
|
|
2164
|
+
* Builds a sale for a specific wallet and quantity: spends an attestation
|
|
2165
|
+
* and returns calldata to broadcast, valid until
|
|
2166
|
+
* {@link OndoSellTransaction.expiresAt}.
|
|
2167
|
+
*
|
|
2168
|
+
* The approval this one needs is on the **asset**, not on a stablecoin - a
|
|
2169
|
+
* sale delivers the asset, so the swap contract pulls it with `transferFrom`
|
|
2170
|
+
* exactly as it pulls the deposit on a purchase. Same 422 when it is short,
|
|
2171
|
+
* with a message naming that address. See `prepareSell` on the client
|
|
2172
|
+
* namespace.
|
|
2173
|
+
*
|
|
2174
|
+
* Returns a range rather than a quantity: Ondo settles through USDon before
|
|
2175
|
+
* converting to the settlement token, so disclose
|
|
2176
|
+
* {@link OndoSellTransaction.minimum} and not only `expected`.
|
|
1857
2177
|
*/
|
|
1858
|
-
|
|
2178
|
+
buildSellTransaction(params: BuildOndoSellParams): Promise<OndoSellTransaction>;
|
|
1859
2179
|
}
|
|
1860
2180
|
declare class OndoNamespaceImpl implements OndoNamespace {
|
|
1861
2181
|
private readonly ctx;
|
|
@@ -1863,7 +2183,8 @@ declare class OndoNamespaceImpl implements OndoNamespace {
|
|
|
1863
2183
|
constructor(ctx: SharedNamespaceContext);
|
|
1864
2184
|
getTradingStatus(params: GetOndoTradingStatusParams): Promise<OndoTradingStatus>;
|
|
1865
2185
|
getQuote(params: GetOndoQuoteParams): Promise<OndoQuote>;
|
|
1866
|
-
|
|
2186
|
+
buildBuyTransaction(params: BuildOndoBuyParams): Promise<OndoBuyTransaction>;
|
|
2187
|
+
buildSellTransaction(params: BuildOndoSellParams): Promise<OndoSellTransaction>;
|
|
1867
2188
|
}
|
|
1868
2189
|
|
|
1869
2190
|
/** Parameters shared by contract reads scoped to a chain. */
|
|
@@ -2454,6 +2775,16 @@ type NabuChainAssetsDto = {
|
|
|
2454
2775
|
protocol: string;
|
|
2455
2776
|
assets: NabuChainAssetDto[];
|
|
2456
2777
|
};
|
|
2778
|
+
/** The registry's `/assets.json` route: the complete snapshot, every chain. */
|
|
2779
|
+
type NabuRegistryDto = {
|
|
2780
|
+
data_version: string;
|
|
2781
|
+
schema_version: number;
|
|
2782
|
+
chains: Array<{
|
|
2783
|
+
chain: string;
|
|
2784
|
+
protocol: string;
|
|
2785
|
+
assets: NabuChainAssetDto[];
|
|
2786
|
+
}>;
|
|
2787
|
+
};
|
|
2457
2788
|
|
|
2458
2789
|
/**
|
|
2459
2790
|
* An absolute URL to a logo image in the token registry. Registry image URLs
|
|
@@ -2503,6 +2834,13 @@ type TokenMetadata = {
|
|
|
2503
2834
|
declare const TokenMetadata: {
|
|
2504
2835
|
/** `baseUrl` is the registry origin; registry logo URLs are root-relative. */
|
|
2505
2836
|
fromDto: (dto: NabuTokenDto, baseUrl: string) => TokenMetadata;
|
|
2837
|
+
/**
|
|
2838
|
+
* Maps the complete registry snapshot to every token it lists across the
|
|
2839
|
+
* chains this SDK models, skipping native coins and chains outside
|
|
2840
|
+
* {@link EthereumChain} (e.g. Solana) rather than failing on them — the
|
|
2841
|
+
* registry may serve chains ahead of the SDK's type surface.
|
|
2842
|
+
*/
|
|
2843
|
+
fromRegistryDto: (dto: NabuRegistryDto, baseUrl: string) => TokenMetadata[];
|
|
2506
2844
|
/**
|
|
2507
2845
|
* Maps a chain snapshot to the tokens it lists, skipping the chain's native
|
|
2508
2846
|
* coin (`kind: 'COIN'`, no contract address).
|
|
@@ -2513,7 +2851,7 @@ declare const TokenMetadata: {
|
|
|
2513
2851
|
/**
|
|
2514
2852
|
* Token display metadata — name, symbol, decimals, and logos — from
|
|
2515
2853
|
* CoinList's public token registry, keyed by {@link TokenIdentifier} (the
|
|
2516
|
-
* same chain + address pairs `
|
|
2854
|
+
* same chain + address pairs `Offer.tokens` carries).
|
|
2517
2855
|
*
|
|
2518
2856
|
* Unlike the other namespaces, this one is public: no method requires an
|
|
2519
2857
|
* authenticated user, and nothing here touches the CoinList API — reads go to
|
|
@@ -2527,15 +2865,19 @@ interface TokensNamespace {
|
|
|
2527
2865
|
*/
|
|
2528
2866
|
get(token: TokenIdentifier): Promise<TokenMetadata | null>;
|
|
2529
2867
|
/**
|
|
2530
|
-
* Fetches
|
|
2531
|
-
*
|
|
2532
|
-
*
|
|
2868
|
+
* Fetches every token the registry lists, in one request: the complete
|
|
2869
|
+
* snapshot with no `chain`, or one chain's snapshot with it. Prefer this
|
|
2870
|
+
* over calling {@link get} in a loop when displaying a catalogue — two
|
|
2871
|
+
* hundred tokens across three chains is still a single download.
|
|
2872
|
+
*
|
|
2873
|
+
* The complete snapshot spans every chain the registry knows; tokens on
|
|
2874
|
+
* chains this SDK does not model (e.g. Solana) are left out of the result.
|
|
2533
2875
|
*
|
|
2534
|
-
* Unlike {@link get}, a missing
|
|
2535
|
-
*
|
|
2536
|
-
* is a deployment problem, not an empty catalogue.
|
|
2876
|
+
* Unlike {@link get}, a missing snapshot throws rather than returning `[]`:
|
|
2877
|
+
* the registry always publishes the complete snapshot and one per chain it
|
|
2878
|
+
* knows, so an absence is a deployment problem, not an empty catalogue.
|
|
2537
2879
|
*/
|
|
2538
|
-
list(chain
|
|
2880
|
+
list(chain?: EthereumChain): Promise<TokenMetadata[]>;
|
|
2539
2881
|
}
|
|
2540
2882
|
declare class TokensNamespaceImpl implements TokensNamespace {
|
|
2541
2883
|
private readonly api;
|
|
@@ -2547,7 +2889,7 @@ declare class TokensNamespaceImpl implements TokensNamespace {
|
|
|
2547
2889
|
*/
|
|
2548
2890
|
constructor(baseUrl: string, logger?: Logger | null);
|
|
2549
2891
|
get(token: TokenIdentifier): Promise<TokenMetadata | null>;
|
|
2550
|
-
list(chain
|
|
2892
|
+
list(chain?: EthereumChain): Promise<TokenMetadata[]>;
|
|
2551
2893
|
}
|
|
2552
2894
|
|
|
2553
2895
|
interface Config {
|
|
@@ -2614,4 +2956,4 @@ interface Config {
|
|
|
2614
2956
|
readonly logger?: Logger;
|
|
2615
2957
|
}
|
|
2616
2958
|
|
|
2617
|
-
export { type
|
|
2959
|
+
export { type OndoQuoteSize as $, AuthorizationCode as A, BlockchainAmount as B, CodeVerifier as C, type OfferType as D, type Erc20Namespace as E, Offer as F, RequirementStatusInfo as G, type RequirementType as H, type RequirementStatusValue as I, OfferOptionAddress as J, RequirementId as K, type Logger as L, type KycLevelName as M, DocumentSubmission as N, OfferId as O, Participation as P, type WalletChallengeType as Q, type RequirementsNamespace as R, type SharedNamespaceContext as S, type TokensNamespace as T, type PinoLoggerOptions as U, OndoTradingStatus as V, type WalletError as W, AssetDecimals as X, type BuildOndoBuyParams as Y, type BuildOndoSellParams as Z, OndoQuote as _, EthereumChain as a, Milestone as a$, OfferOptionAddressId as a0, TokenMetadata as a1, type TokenIdentifier as a2, type DebugEvent as a3, type FrontlineEventId as a4, HttpError as a5, type HttpResponse as a6, KycToken as a7, type LogBinding as a8, type LogBindings as a9, type BuildOndoSwapParamsCore as aA, Chain as aB, ClientId as aC, CodeChallenge as aD, ConnectExternalWalletParams as aE, type CreateKycTokenParams as aF, CreateParticipationParams as aG, CreateWalletOwnershipChallengeParams as aH, Cursor as aI, type DocumentFormType as aJ, type DocumentSubmissionStatus as aK, type DocumentType as aL, ETHEREUM_CHAINS as aM, Erc20NamespaceImpl as aN, FaqItem as aO, type GetOndoQuoteParams as aP, type GetOndoTradingStatusParams as aQ, type GetSwapAuthorizationParams as aR, type GetSwapPreviewParams as aS, type GetTokenAllowanceParams as aT, type GetTokenBalanceParams as aU, HexEncodedTransactionData as aV, Iso2CountryCode as aW, Link as aX, type ListOptionAddressesParams as aY, MAX_ASSET_DECIMALS as aZ, MAX_UINT_256 as a_, type LogCause as aa, type LogLevel as ab, type LogScope as ac, type LogValue as ad, type ProductionLogLevel as ae, RedactedWalletError as af, type RequestId as ag, type SafeEvent as ah, type SafeFields as ai, type UnredactedFields as aj, OAuthSession as ak, ClientCredentialsOAuth as al, ClientSecret as am, type Sender as an, PaginationParams as ao, PaginatedResponse as ap, type Uint256 as aq, KnownAssetSymbol as ar, DecimalString as as, SwapStatus as at, type Newtype as au, type AllowWalletParams as av, AllowWalletResponse as aw, Asset as ax, AssetCode as ay, Blockchain as az, EvmContractAddress as b, OAuthRefreshToken as b0, OfferOption as b1, OfferOptionSlug as b2, OfferSlug as b3, OfferToken as b4, OffersNamespaceImpl as b5, type OndoQuoteDuration as b6, type OndoSellOutcome as b7, PKCEState as b8, type PaginatedResponseDto as b9, type TokenRole as bA, TokensNamespaceImpl as bB, type Tx as bC, WalletAddress as bD, WalletOwnershipChallenge as bE, type WalletProtocol as bF, WalletsNamespaceImpl as bG, apiErrorCode as bH, assertUint256 as bI, parseUint256 as bJ, ParticipationId as ba, type ParticipationStatus as bb, ParticipationsPaginationParams as bc, Pii as bd, PiiAddress as be, PiiJurisdiction as bf, type PiiKind as bg, type QueryParamValue as bh, type QueryParamValues as bi, RedirectUri as bj, type RemoveOptionAddressParams as bk, type RequirementActionNeededReason as bl, SOLANA_CHAINS as bm, STABLE_DECIMALS as bn, SolanaChain as bo, type SubmitDocumentParams as bp, SwapAuthorization as bq, type SwapContractRef as br, SwapPreview as bs, TermItem as bt, Ticker as bu, TokenAllowance as bv, TokenBalance as bw, TokenLogo as bx, type TokenLogoImage as by, TokenLogoUrl as bz, type CoinListTokenSaleNamespace as c, OfferOptionId as d, AssetId as e, CoinListTokenSaleNamespaceImpl as f, type OndoNamespace as g, AssetSymbol as h, OndoBuyTransaction as i, OndoSellTransaction as j, type OndoSwapTransactionCore as k, type OrderBookSide as l, OndoNamespaceImpl as m, type SuperstateSwapNamespace 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 };
|