@coinlist-co/react 0.12.2-rc.31c2f50 → 0.12.2-rc.5f2ca48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/{chunk-4IZ2F732.js → chunk-6NCNF5GF.js} +2 -2
  2. package/dist/{chunk-UJYSXXJF.js → chunk-VUIDJYHY.js} +6 -156
  3. package/dist/chunk-VUIDJYHY.js.map +1 -0
  4. package/dist/{chunk-NBO5E2RO.js → chunk-XCRU3YE2.js} +599 -409
  5. package/dist/chunk-XCRU3YE2.js.map +1 -0
  6. package/dist/client/index.cjs +458 -111
  7. package/dist/client/index.cjs.map +1 -1
  8. package/dist/client/index.d.cts +184 -5
  9. package/dist/client/index.d.ts +184 -5
  10. package/dist/client/index.js +222 -9
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/server/index.cjs +151 -26
  13. package/dist/server/index.cjs.map +1 -1
  14. package/dist/server/index.d.cts +10 -2
  15. package/dist/server/index.d.ts +10 -2
  16. package/dist/server/index.js +4 -2
  17. package/dist/server/index.js.map +1 -1
  18. package/dist/{time-DvgN98Q9.d.ts → time-CTuVDTx6.d.ts} +1 -1
  19. package/dist/{time-CFocgYyl.d.cts → time-Dv1dejVB.d.cts} +1 -1
  20. package/dist/{token-registry-snapshot-Cc_eA5zM.d.cts → token-registry-snapshot-CX5YiSHp.d.cts} +1 -1
  21. package/dist/{token-registry-snapshot-BsAfBL_b.d.ts → token-registry-snapshot-CzJd2VYU.d.ts} +1 -1
  22. package/dist/{tokens-namespace-D_XSpiS-.d.cts → tokens-namespace-CcvHrw-k.d.cts} +361 -2
  23. package/dist/{tokens-namespace-D_XSpiS-.d.ts → tokens-namespace-CcvHrw-k.d.ts} +361 -2
  24. package/dist/universal/index.cjs +528 -472
  25. package/dist/universal/index.cjs.map +1 -1
  26. package/dist/universal/index.d.cts +18 -321
  27. package/dist/universal/index.d.ts +18 -321
  28. package/dist/universal/index.js +11 -7
  29. package/package.json +1 -1
  30. package/dist/chunk-NBO5E2RO.js.map +0 -1
  31. package/dist/chunk-UJYSXXJF.js.map +0 -1
  32. /package/dist/{chunk-4IZ2F732.js.map → chunk-6NCNF5GF.js.map} +0 -0
@@ -1406,6 +1406,9 @@ function requiredDate(value, field) {
1406
1406
  }
1407
1407
  return date;
1408
1408
  }
1409
+ function dateOrNull(value, field) {
1410
+ return value === null ? null : requiredDate(value, field);
1411
+ }
1409
1412
  function decimalOrNull(value) {
1410
1413
  return value === null ? null : DecimalString(value);
1411
1414
  }
@@ -2090,6 +2093,151 @@ function transportFor(api, override, chain, logger) {
2090
2093
  return typeof override === "string" ? (0, import_viem3.http)(override) : override;
2091
2094
  }
2092
2095
 
2096
+ // src/universal/core/shared/blockchain/math.ts
2097
+ var import_viem4 = require("viem");
2098
+ function blockchainAmountFromRawOrThrow({
2099
+ label,
2100
+ raw,
2101
+ decimals
2102
+ }) {
2103
+ const trimmed = raw.trim();
2104
+ if (trimmed === "") {
2105
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2106
+ }
2107
+ let value;
2108
+ try {
2109
+ value = BigInt(trimmed);
2110
+ } catch {
2111
+ throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2112
+ }
2113
+ try {
2114
+ return BlockchainAmount({ raw: assertUint256(value), decimals });
2115
+ } catch {
2116
+ throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
2117
+ }
2118
+ }
2119
+
2120
+ // src/universal/types/providers/centrifuge/centrifuge.ts
2121
+ var CentrifugeVaultQuote = {
2122
+ fromDto: (dto) => {
2123
+ const spendDecimals = AssetDecimals(dto.spend_input_decimals);
2124
+ const shareDecimals = AssetDecimals(dto.share_decimals);
2125
+ return {
2126
+ chain: EthereumChain(dto.chain),
2127
+ symbol: AssetSymbol(dto.symbol),
2128
+ spendInputAmount: blockchainAmountFromRawOrThrow({
2129
+ label: "spend_input_amount",
2130
+ raw: dto.spend_input_amount,
2131
+ decimals: spendDecimals
2132
+ }),
2133
+ estimatedShares: blockchainAmountFromRawOrThrow({
2134
+ label: "estimated_shares",
2135
+ raw: dto.estimated_shares,
2136
+ decimals: shareDecimals
2137
+ }),
2138
+ indicativePrice: decimalOrNull(dto.indicative_price),
2139
+ minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
2140
+ label: "minimum_input_amount",
2141
+ raw: dto.minimum_input_amount,
2142
+ decimals: spendDecimals
2143
+ }),
2144
+ orderability: parseOrderability(
2145
+ dto.can_order,
2146
+ dto.reasons,
2147
+ "CentrifugeVaultQuote"
2148
+ )
2149
+ };
2150
+ }
2151
+ };
2152
+ var CentrifugeVaultStatus = {
2153
+ fromDto: (dto) => ({
2154
+ chain: EthereumChain(dto.chain),
2155
+ symbol: AssetSymbol(dto.symbol),
2156
+ vaultAddress: EvmContractAddress(dto.vault_address),
2157
+ linked: dto.linked,
2158
+ permissioned: dto.permissioned,
2159
+ membershipValidUntil: dateOrNull(
2160
+ dto.membership_valid_until,
2161
+ "CentrifugeVaultStatus.membership_valid_until"
2162
+ ),
2163
+ halted: dto.halted,
2164
+ priceUpdatedAt: dateOrNull(
2165
+ dto.price_updated_at,
2166
+ "CentrifugeVaultStatus.price_updated_at"
2167
+ ),
2168
+ orderability: parseOrderability(
2169
+ dto.can_order,
2170
+ dto.reasons,
2171
+ "CentrifugeVaultStatus"
2172
+ ),
2173
+ asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
2174
+ })
2175
+ };
2176
+ function parseOrderability(canOrder, reasons, model) {
2177
+ const [first, ...rest] = reasons;
2178
+ if (canOrder) {
2179
+ if (first !== void 0) {
2180
+ throw new ValidationError(
2181
+ `${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
2182
+ );
2183
+ }
2184
+ return { type: "orderable" };
2185
+ }
2186
+ if (first === void 0) {
2187
+ throw new ValidationError(
2188
+ `${model}.reasons: expected at least one when can_order is false`
2189
+ );
2190
+ }
2191
+ return { type: "blocked", reasons: [first, ...rest] };
2192
+ }
2193
+
2194
+ // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
2195
+ async function getCentrifugeVaultQuote(api, params) {
2196
+ const dto = await api.send({
2197
+ method: "GET",
2198
+ url: "/v1/centrifuge/vault/quote",
2199
+ queryParams: {
2200
+ symbol: params.symbol,
2201
+ chain: params.chain,
2202
+ amount: params.amount.raw.toString()
2203
+ },
2204
+ attributes: Attributes.protected()
2205
+ });
2206
+ return CentrifugeVaultQuote.fromDto(dto);
2207
+ }
2208
+ async function getCentrifugeVaultStatus(api, params) {
2209
+ const dto = await api.send({
2210
+ method: "GET",
2211
+ url: "/v1/centrifuge/vault/status",
2212
+ queryParams: {
2213
+ symbol: params.symbol,
2214
+ chain: params.chain
2215
+ },
2216
+ attributes: Attributes.protected()
2217
+ });
2218
+ return CentrifugeVaultStatus.fromDto(dto);
2219
+ }
2220
+
2221
+ // src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
2222
+ var CentrifugeNamespaceImpl = class {
2223
+ constructor(ctx) {
2224
+ this.ctx = ctx;
2225
+ this.log = internalLogger(ctx.logger, "CENTRIFUGE");
2226
+ }
2227
+ async getQuote(params) {
2228
+ return this.log.wrap("getQuote", params, async () => {
2229
+ await this.ctx.ensureUserAuthenticated();
2230
+ return getCentrifugeVaultQuote(this.ctx.api, params);
2231
+ });
2232
+ }
2233
+ async getVaultStatus(params) {
2234
+ return this.log.wrap("getVaultStatus", params, async () => {
2235
+ await this.ctx.ensureUserAuthenticated();
2236
+ return getCentrifugeVaultStatus(this.ctx.api, params);
2237
+ });
2238
+ }
2239
+ };
2240
+
2093
2241
  // src/universal/types/providers/coin-list/token-sale.ts
2094
2242
  var ParticipationId = (value) => value;
2095
2243
  var Blockchain = (value) => value;
@@ -2204,39 +2352,15 @@ var CoinListTokenSaleNamespaceImpl = class {
2204
2352
  };
2205
2353
 
2206
2354
  // src/universal/core/shared/blockchain/formatters.ts
2207
- var import_viem4 = require("viem");
2355
+ var import_viem5 = require("viem");
2208
2356
  function formatRawAmount(amount) {
2209
- return (0, import_viem4.formatUnits)(amount.raw, amount.decimals);
2357
+ return (0, import_viem5.formatUnits)(amount.raw, amount.decimals);
2210
2358
  }
2211
2359
  var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
2212
2360
  var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
2213
2361
  var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
2214
2362
  var USD_FRACTION_DIGITS = AssetDecimals(2);
2215
2363
 
2216
- // src/universal/core/shared/blockchain/math.ts
2217
- var import_viem5 = require("viem");
2218
- function blockchainAmountFromRawOrThrow({
2219
- label,
2220
- raw,
2221
- decimals
2222
- }) {
2223
- const trimmed = raw.trim();
2224
- if (trimmed === "") {
2225
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2226
- }
2227
- let value;
2228
- try {
2229
- value = BigInt(trimmed);
2230
- } catch {
2231
- throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
2232
- }
2233
- try {
2234
- return BlockchainAmount({ raw: assertUint256(value), decimals });
2235
- } catch {
2236
- throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
2237
- }
2238
- }
2239
-
2240
2364
  // src/universal/types/providers/ondo/ondo.ts
2241
2365
  var OndoTradingStatus = {
2242
2366
  fromDto: (dto) => {
@@ -4089,6 +4213,7 @@ var CoinListServerImpl = class {
4089
4213
  this.tokenSale = new CoinListTokenSaleNamespaceImpl(ctx);
4090
4214
  this.superstate = new SuperstateSwapNamespaceImpl(ctx);
4091
4215
  this.ondo = new OndoNamespaceImpl(ctx);
4216
+ this.centrifuge = new CentrifugeNamespaceImpl(ctx);
4092
4217
  this.tokens = new TokensNamespaceImpl(
4093
4218
  _config.tokensBaseUrl ?? NABU_BASE_URL,
4094
4219
  logger