@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
@@ -1,4 +1,4 @@
1
- import { b4 as ClientId, bY as RedirectUri, b5 as CodeChallenge, bM as PKCEState, C as CodeVerifier, t as EvmWalletAddress, E as EthereumChain, cd as Tx, B as BlockchainAmount, c6 as SwapPreview, ab as AssetDecimals, aO as Newtype, H as TokenMetadata, b3 as Chain, f as EvmContractAddress, aJ as OfferToken } from './time-DyjvzWso.js';
1
+ import { b5 as ClientId, bX as RedirectUri, b6 as CodeChallenge, bL as PKCEState, C as CodeVerifier, v as EvmWalletAddress, a as EthereumChain, cc as Tx, B as BlockchainAmount, c5 as SwapPreview, a9 as AssetDecimals, aQ as Newtype, J as TokenMetadata, b4 as Chain, b as EvmContractAddress, aL as OfferToken } from './time-CVZpAkGY.js';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
4
  type PKCEParams = {
@@ -1,4 +1,4 @@
1
- import { b4 as ClientId, bY as RedirectUri, b5 as CodeChallenge, bM as PKCEState, C as CodeVerifier, t as EvmWalletAddress, E as EthereumChain, cd as Tx, B as BlockchainAmount, c6 as SwapPreview, ab as AssetDecimals, aO as Newtype, H as TokenMetadata, b3 as Chain, f as EvmContractAddress, aJ as OfferToken } from './time-DyjvzWso.cjs';
1
+ import { b5 as ClientId, bX as RedirectUri, b6 as CodeChallenge, bL as PKCEState, C as CodeVerifier, v as EvmWalletAddress, a as EthereumChain, cc as Tx, B as BlockchainAmount, c5 as SwapPreview, a9 as AssetDecimals, aQ as Newtype, J as TokenMetadata, b4 as Chain, b as EvmContractAddress, aL as OfferToken } from './time-CVZpAkGY.cjs';
2
2
  import { Hex, Abi, Hash, TransactionReceipt } from 'viem';
3
3
 
4
4
  type PKCEParams = {
@@ -41,7 +41,6 @@ __export(universal_exports, {
41
41
  CentrifugeVaultLeg: () => CentrifugeVaultLeg,
42
42
  CentrifugeVaultLegId: () => CentrifugeVaultLegId,
43
43
  CentrifugeVaultPosition: () => CentrifugeVaultPosition,
44
- CentrifugeVaultQuote: () => CentrifugeVaultQuote,
45
44
  CentrifugeVaultRedeemPosition: () => CentrifugeVaultRedeemPosition,
46
45
  CentrifugeVaultStatus: () => CentrifugeVaultStatus,
47
46
  Chain: () => Chain,
@@ -471,9 +470,6 @@ async function generatePKCEParams(config) {
471
470
  };
472
471
  }
473
472
 
474
- // src/universal/core/shared/blockchain/math.ts
475
- var import_viem = require("viem");
476
-
477
473
  // src/universal/types/errors.ts
478
474
  var NotImplementedError = class extends Error {
479
475
  constructor(message = "Not implemented yet") {
@@ -506,6 +502,9 @@ var MathError = class extends Error {
506
502
  }
507
503
  };
508
504
 
505
+ // src/universal/core/shared/blockchain/math.ts
506
+ var import_viem = require("viem");
507
+
509
508
  // src/universal/types/blockchain/core.ts
510
509
  var ETHEREUM_CHAINS = {
511
510
  ethereum_mainnet: true,
@@ -703,37 +702,6 @@ function requiredArray(value, field) {
703
702
  }
704
703
 
705
704
  // src/universal/types/providers/centrifuge/centrifuge.ts
706
- var CentrifugeVaultQuote = {
707
- fromDto: (dto) => {
708
- const spendDecimals = AssetDecimals(dto.spend_input_decimals);
709
- const shareDecimals = AssetDecimals(dto.share_decimals);
710
- return {
711
- chain: EthereumChain(dto.chain),
712
- symbol: AssetSymbol(dto.symbol),
713
- spendInputAmount: blockchainAmountFromRawOrThrow({
714
- label: "spend_input_amount",
715
- raw: dto.spend_input_amount,
716
- decimals: spendDecimals
717
- }),
718
- estimatedShares: blockchainAmountFromRawOrThrow({
719
- label: "estimated_shares",
720
- raw: dto.estimated_shares,
721
- decimals: shareDecimals
722
- }),
723
- indicativePrice: decimalOrNull(dto.indicative_price),
724
- minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
725
- label: "minimum_input_amount",
726
- raw: dto.minimum_input_amount,
727
- decimals: spendDecimals
728
- }),
729
- orderability: parseOrderability(
730
- dto.can_order,
731
- dto.reasons,
732
- "CentrifugeVaultQuote"
733
- )
734
- };
735
- }
736
- };
737
705
  var CentrifugeVaultStatus = {
738
706
  fromDto: (dto) => ({
739
707
  chain: EthereumChain(dto.chain),
@@ -772,12 +740,7 @@ var CentrifugeVaultBuyTransaction = {
772
740
  }
773
741
  return {
774
742
  ...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
775
- spendInputAmount,
776
- estimatedShares: blockchainAmountFromRawOrThrow({
777
- label: "estimated_shares",
778
- raw: dto.estimated_shares,
779
- decimals: AssetDecimals(dto.share_decimals)
780
- })
743
+ spendInputAmount
781
744
  };
782
745
  }
783
746
  };
@@ -901,30 +864,34 @@ function parseTransactionCore(dto, model) {
901
864
  }
902
865
 
903
866
  // src/universal/api/frontline/providers/centrifuge/centrifuge.ts
904
- async function getCentrifugeVaultQuote(api, params) {
867
+ async function getCentrifugeVaultStatus(api, params) {
905
868
  const dto = await api.send({
906
869
  method: "GET",
907
- url: "/v1/centrifuge/vault/quote",
870
+ url: "/v1/centrifuge/vault/status",
908
871
  queryParams: {
909
872
  symbol: params.symbol,
910
- chain: params.chain,
911
- amount: params.amount.raw.toString()
873
+ chain: params.chain
912
874
  },
913
875
  attributes: Attributes.protected()
914
876
  });
915
- return CentrifugeVaultQuote.fromDto(dto);
877
+ return CentrifugeVaultStatus.fromDto(dto);
916
878
  }
917
- async function getCentrifugeVaultStatus(api, params) {
879
+ async function buildCentrifugeVaultBuy(api, params) {
918
880
  const dto = await api.send({
919
- method: "GET",
920
- url: "/v1/centrifuge/vault/status",
921
- queryParams: {
922
- symbol: params.symbol,
923
- chain: params.chain
881
+ method: "POST",
882
+ url: "/v1/centrifuge/vault/invest",
883
+ body: {
884
+ ...walletFields(params),
885
+ amount: params.amount.raw.toString()
924
886
  },
925
887
  attributes: Attributes.protected()
926
888
  });
927
- return CentrifugeVaultStatus.fromDto(dto);
889
+ if (dto.spend_input_decimals !== params.amount.decimals) {
890
+ throw new ValidationError(
891
+ `spend_input_decimals: the request was priced in ${dto.spend_input_decimals} decimals but the deposit was sized in ${params.amount.decimals}`
892
+ );
893
+ }
894
+ return CentrifugeVaultBuyTransaction.fromDto(dto);
928
895
  }
929
896
  async function getCentrifugeVaultPosition(api, params) {
930
897
  const dto = await api.send({
@@ -1150,12 +1117,6 @@ var CentrifugeNamespaceImpl = class {
1150
1117
  this.ctx = ctx;
1151
1118
  this.log = internalLogger(ctx.logger, "CENTRIFUGE");
1152
1119
  }
1153
- async getQuote(params) {
1154
- return this.log.wrap("getQuote", params, async () => {
1155
- await this.ctx.ensureUserAuthenticated();
1156
- return getCentrifugeVaultQuote(this.ctx.api, params);
1157
- });
1158
- }
1159
1120
  async getVaultStatus(params) {
1160
1121
  return this.log.wrap("getVaultStatus", params, async () => {
1161
1122
  await this.ctx.ensureUserAuthenticated();
@@ -1186,6 +1147,12 @@ var CentrifugeNamespaceImpl = class {
1186
1147
  return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
1187
1148
  });
1188
1149
  }
1150
+ async buildBuyTransaction(params) {
1151
+ return this.log.wrap("buildBuyTransaction", params, async () => {
1152
+ await this.ctx.ensureUserAuthenticated();
1153
+ return buildCentrifugeVaultBuy(this.ctx.api, params);
1154
+ });
1155
+ }
1189
1156
  };
1190
1157
 
1191
1158
  // src/universal/core/checkout/centrifuge/constants.ts
@@ -4427,7 +4394,6 @@ var User = {
4427
4394
  CentrifugeVaultLeg,
4428
4395
  CentrifugeVaultLegId,
4429
4396
  CentrifugeVaultPosition,
4430
- CentrifugeVaultQuote,
4431
4397
  CentrifugeVaultRedeemPosition,
4432
4398
  CentrifugeVaultStatus,
4433
4399
  Chain,