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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +10 -0
  2. package/dist/{chunk-QRVIBG6H.js → chunk-3WW5FLT7.js} +2 -2
  3. package/dist/{chunk-IAY3F42Q.js → chunk-C6GF7MDF.js} +125 -158
  4. package/dist/chunk-C6GF7MDF.js.map +1 -0
  5. package/dist/{chunk-3OTYQADF.js → chunk-IZJ4JSSC.js} +2 -2
  6. package/dist/chunk-IZJ4JSSC.js.map +1 -0
  7. package/dist/client/index.cjs +4469 -3149
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +939 -167
  10. package/dist/client/index.d.ts +939 -167
  11. package/dist/client/index.js +3867 -2555
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/server/index.cjs +40 -49
  14. package/dist/server/index.cjs.map +1 -1
  15. package/dist/server/index.d.cts +3 -6
  16. package/dist/server/index.d.ts +3 -6
  17. package/dist/server/index.js +2 -2
  18. package/dist/server/index.js.map +1 -1
  19. package/dist/{time-DyjvzWso.d.cts → time-CVZpAkGY.d.cts} +276 -318
  20. package/dist/{time-DyjvzWso.d.ts → time-CVZpAkGY.d.ts} +276 -318
  21. package/dist/{token-registry-snapshot-Bldj1r5X.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +1 -1
  22. package/dist/{token-registry-snapshot-CbNCYP_5.d.cts → token-registry-snapshot-bR14QehS.d.cts} +1 -1
  23. package/dist/universal/index.cjs +26 -60
  24. package/dist/universal/index.cjs.map +1 -1
  25. package/dist/universal/index.d.cts +7 -12
  26. package/dist/universal/index.d.ts +7 -12
  27. package/dist/universal/index.js +2 -4
  28. package/package.json +1 -1
  29. package/dist/chunk-3OTYQADF.js.map +0 -1
  30. package/dist/chunk-IAY3F42Q.js.map +0 -1
  31. /package/dist/{chunk-QRVIBG6H.js.map → chunk-3WW5FLT7.js.map} +0 -0
@@ -2118,37 +2118,6 @@ function blockchainAmountFromRawOrThrow({
2118
2118
  }
2119
2119
 
2120
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
2121
  var CentrifugeVaultStatus = {
2153
2122
  fromDto: (dto) => ({
2154
2123
  chain: EthereumChain(dto.chain),
@@ -2173,6 +2142,24 @@ var CentrifugeVaultStatus = {
2173
2142
  asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
2174
2143
  })
2175
2144
  };
2145
+ var CentrifugeVaultBuyTransaction = {
2146
+ fromDto: (dto) => {
2147
+ const spendInputAmount = blockchainAmountFromRawOrThrow({
2148
+ label: "spend_input_amount",
2149
+ raw: dto.spend_input_amount,
2150
+ decimals: AssetDecimals(dto.spend_input_decimals)
2151
+ });
2152
+ if (spendInputAmount.raw <= 0n) {
2153
+ throw new ValidationError(
2154
+ `spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
2155
+ );
2156
+ }
2157
+ return {
2158
+ ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
2159
+ spendInputAmount
2160
+ };
2161
+ }
2162
+ };
2176
2163
  var CentrifugeVaultClaimTransaction = {
2177
2164
  fromDto: (dto) => ({
2178
2165
  ...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
@@ -2265,30 +2252,34 @@ function parseTransactionCore(dto, model) {
2265
2252
  }
2266
2253
 
2267
2254
  // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
2268
- async function getCentrifugeVaultQuote(api, params) {
2255
+ async function getCentrifugeVaultStatus(api, params) {
2269
2256
  const dto = await api.send({
2270
2257
  method: "GET",
2271
- url: "/v1/centrifuge/vault/quote",
2258
+ url: "/v1/centrifuge/vault/status",
2272
2259
  queryParams: {
2273
2260
  symbol: params.symbol,
2274
- chain: params.chain,
2275
- amount: params.amount.raw.toString()
2261
+ chain: params.chain
2276
2262
  },
2277
2263
  attributes: Attributes.protected()
2278
2264
  });
2279
- return CentrifugeVaultQuote.fromDto(dto);
2265
+ return CentrifugeVaultStatus.fromDto(dto);
2280
2266
  }
2281
- async function getCentrifugeVaultStatus(api, params) {
2267
+ async function buildCentrifugeVaultBuy(api, params) {
2282
2268
  const dto = await api.send({
2283
- method: "GET",
2284
- url: "/v1/centrifuge/vault/status",
2285
- queryParams: {
2286
- symbol: params.symbol,
2287
- chain: params.chain
2269
+ method: "POST",
2270
+ url: "/v1/centrifuge/vault/invest",
2271
+ body: {
2272
+ ...walletFields(params),
2273
+ amount: params.amount.raw.toString()
2288
2274
  },
2289
2275
  attributes: Attributes.protected()
2290
2276
  });
2291
- return CentrifugeVaultStatus.fromDto(dto);
2277
+ if (dto.spend_input_decimals !== params.amount.decimals) {
2278
+ throw new ValidationError(
2279
+ `spend_input_decimals: the request was priced in ${dto.spend_input_decimals} decimals but the deposit was sized in ${params.amount.decimals}`
2280
+ );
2281
+ }
2282
+ return CentrifugeVaultBuyTransaction.fromDto(dto);
2292
2283
  }
2293
2284
  async function getCentrifugeVaultPosition(api, params) {
2294
2285
  const dto = await api.send({
@@ -2340,12 +2331,6 @@ var CentrifugeNamespaceImpl = class {
2340
2331
  this.ctx = ctx;
2341
2332
  this.log = internalLogger(ctx.logger, "CENTRIFUGE");
2342
2333
  }
2343
- async getQuote(params) {
2344
- return this.log.wrap("getQuote", params, async () => {
2345
- await this.ctx.ensureUserAuthenticated();
2346
- return getCentrifugeVaultQuote(this.ctx.api, params);
2347
- });
2348
- }
2349
2334
  async getVaultStatus(params) {
2350
2335
  return this.log.wrap("getVaultStatus", params, async () => {
2351
2336
  await this.ctx.ensureUserAuthenticated();
@@ -2376,6 +2361,12 @@ var CentrifugeNamespaceImpl = class {
2376
2361
  return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
2377
2362
  });
2378
2363
  }
2364
+ async buildBuyTransaction(params) {
2365
+ return this.log.wrap("buildBuyTransaction", params, async () => {
2366
+ await this.ctx.ensureUserAuthenticated();
2367
+ return buildCentrifugeVaultBuy(this.ctx.api, params);
2368
+ });
2369
+ }
2379
2370
  };
2380
2371
 
2381
2372
  // src/universal/types/providers/coin-list/token-sale.ts