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

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 (33) hide show
  1. package/dist/{chunk-3WW5FLT7.js → chunk-EKLUJZ7T.js} +10 -10
  2. package/dist/chunk-EKLUJZ7T.js.map +1 -0
  3. package/dist/{chunk-C6GF7MDF.js → chunk-GIE4UWB3.js} +680 -619
  4. package/dist/chunk-GIE4UWB3.js.map +1 -0
  5. package/dist/chunk-MJ6YXZWH.js +22 -0
  6. package/dist/chunk-MJ6YXZWH.js.map +1 -0
  7. package/dist/{chunk-IZJ4JSSC.js → chunk-PIOQA6HW.js} +173 -234
  8. package/dist/chunk-PIOQA6HW.js.map +1 -0
  9. package/dist/client/index.d.ts +2414 -5239
  10. package/dist/client/index.js +683 -788
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/server/index.d.ts +2 -32
  13. package/dist/server/index.js +6 -4
  14. package/dist/server/index.js.map +1 -1
  15. package/dist/{time-CVZpAkGY.d.cts → time-Bbqlt2x7.d.ts} +1907 -3183
  16. package/dist/{token-registry-snapshot-BkwA8KmD.d.ts → token-registry-snapshot-DttZXGvY.d.ts} +7 -41
  17. package/dist/universal/index.d.ts +57 -1044
  18. package/dist/universal/index.js +16 -42
  19. package/package.json +18 -14
  20. package/dist/chunk-3WW5FLT7.js.map +0 -1
  21. package/dist/chunk-C6GF7MDF.js.map +0 -1
  22. package/dist/chunk-IZJ4JSSC.js.map +0 -1
  23. package/dist/client/index.cjs +0 -20460
  24. package/dist/client/index.cjs.map +0 -1
  25. package/dist/client/index.d.cts +0 -8195
  26. package/dist/server/index.cjs +0 -4525
  27. package/dist/server/index.cjs.map +0 -1
  28. package/dist/server/index.d.cts +0 -382
  29. package/dist/time-CVZpAkGY.d.ts +0 -3987
  30. package/dist/token-registry-snapshot-bR14QehS.d.cts +0 -245
  31. package/dist/universal/index.cjs +0 -4562
  32. package/dist/universal/index.cjs.map +0 -1
  33. package/dist/universal/index.d.cts +0 -1362
@@ -291,106 +291,6 @@ function isExpired({
291
291
  return now >= expiresAt - buffer;
292
292
  }
293
293
 
294
- // src/universal/core/shared/blockchain/erc20/abi.ts
295
- var ERC20_ABI = [
296
- {
297
- type: "function",
298
- name: "allowance",
299
- inputs: [
300
- { name: "owner", type: "address" },
301
- { name: "spender", type: "address" }
302
- ],
303
- outputs: [{ name: "", type: "uint256" }],
304
- stateMutability: "view"
305
- },
306
- {
307
- type: "function",
308
- name: "approve",
309
- inputs: [
310
- { name: "spender", type: "address" },
311
- { name: "amount", type: "uint256" }
312
- ],
313
- outputs: [{ name: "", type: "bool" }],
314
- stateMutability: "nonpayable"
315
- },
316
- {
317
- type: "function",
318
- name: "balanceOf",
319
- inputs: [{ name: "account", type: "address" }],
320
- outputs: [{ name: "", type: "uint256" }],
321
- stateMutability: "view"
322
- },
323
- {
324
- type: "function",
325
- name: "decimals",
326
- inputs: [],
327
- outputs: [{ name: "", type: "uint8" }],
328
- stateMutability: "view"
329
- },
330
- {
331
- type: "function",
332
- name: "name",
333
- inputs: [],
334
- outputs: [{ name: "", type: "string" }],
335
- stateMutability: "view"
336
- },
337
- {
338
- type: "function",
339
- name: "symbol",
340
- inputs: [],
341
- outputs: [{ name: "", type: "string" }],
342
- stateMutability: "view"
343
- },
344
- {
345
- type: "function",
346
- name: "totalSupply",
347
- inputs: [],
348
- outputs: [{ name: "", type: "uint256" }],
349
- stateMutability: "view"
350
- },
351
- {
352
- type: "function",
353
- name: "transfer",
354
- inputs: [
355
- { name: "recipient", type: "address" },
356
- { name: "amount", type: "uint256" }
357
- ],
358
- outputs: [{ name: "", type: "bool" }],
359
- stateMutability: "nonpayable"
360
- },
361
- {
362
- type: "function",
363
- name: "transferFrom",
364
- inputs: [
365
- { name: "sender", type: "address" },
366
- { name: "recipient", type: "address" },
367
- { name: "amount", type: "uint256" }
368
- ],
369
- outputs: [{ name: "", type: "bool" }],
370
- stateMutability: "nonpayable"
371
- },
372
- {
373
- type: "event",
374
- name: "Approval",
375
- inputs: [
376
- { name: "owner", type: "address", indexed: true },
377
- { name: "spender", type: "address", indexed: true },
378
- { name: "value", type: "uint256", indexed: false }
379
- ],
380
- anonymous: false
381
- },
382
- {
383
- type: "event",
384
- name: "Transfer",
385
- inputs: [
386
- { name: "from", type: "address", indexed: true },
387
- { name: "to", type: "address", indexed: true },
388
- { name: "value", type: "uint256", indexed: false }
389
- ],
390
- anonymous: false
391
- }
392
- ];
393
-
394
294
  // src/universal/types/blockchain/core.ts
395
295
  var ETHEREUM_CHAINS = {
396
296
  ethereum_mainnet: true,
@@ -453,8 +353,18 @@ var BlockchainAmount = Object.assign(
453
353
  {
454
354
  add: (a, b) => combineAmounts(a, b, (x, y) => x + y),
455
355
  sub: (a, b) => combineAmounts(a, b, (x, y) => x - y),
456
- mul: multiplyAmounts,
457
- div: divideAmounts
356
+ /**
357
+ * `a * b`, in `a`'s decimals - a price times a quantity. Multiplies before
358
+ * it rescales, then truncates towards zero. The exact inverse of `div`.
359
+ */
360
+ mul: (a, b) => multiplyAmounts(a, b),
361
+ /**
362
+ * `a / b`, in `a`'s decimals - a price, a ratio. Rescales before it
363
+ * divides, then truncates towards zero.
364
+ *
365
+ * @throws MathError when `b` is zero.
366
+ */
367
+ div: (a, b) => divideAmounts(a, b)
458
368
  }
459
369
  );
460
370
  function multiplyAmounts(a, b) {
@@ -691,72 +601,41 @@ var CentrifugeVaultClaimTransaction = {
691
601
  })
692
602
  })
693
603
  };
694
- var CentrifugeVaultPosition = {
695
- fromDto: (dto) => {
696
- const assetDecimals = AssetDecimals(dto.asset_decimals);
697
- const shareDecimals = AssetDecimals(dto.share_decimals);
698
- const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
699
- const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
604
+ var CentrifugeAssets = (amount) => amount;
605
+ var CentrifugeShares = (amount) => amount;
606
+ var CentrifugeDepositPosition = {
607
+ fromContract: (raw, context) => {
608
+ const assets = (label, value) => CentrifugeAssets(contractAmount(label, value, context.assetDecimals));
700
609
  return {
701
- chain: EthereumChain(dto.chain),
702
- symbol: AssetSymbol(dto.symbol),
703
- walletAddress: EvmWalletAddress(dto.wallet_address),
704
- status: dto.status,
705
- requested: asset("requested", dto.requested),
706
- pending: asset("pending", dto.pending),
707
- filledAssets: asset("filled_assets", dto.filled_assets),
708
- earnedShares: shares("earned_shares", dto.earned_shares),
709
- claimedShares: shares("claimed_shares", dto.claimed_shares),
710
- claimableShares: shares("claimable_shares", dto.claimable_shares),
711
- shareBalance: shares("share_balance", dto.share_balance),
712
- averagePrice: decimalOrNull(dto.average_price),
713
- frozen: dto.frozen,
714
- asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
610
+ chain: context.chain,
611
+ proxy: context.proxy,
612
+ walletAddress: context.walletAddress,
613
+ pending: assets("pendingDepositRequest", raw.pendingDepositRequest),
614
+ claimable: assets("claimableDepositRequest", raw.claimableDepositRequest)
715
615
  };
716
616
  }
717
617
  };
718
- var CentrifugeVaultRedeemPosition = {
719
- fromDto: (dto) => ({
720
- chain: EthereumChain(dto.chain),
721
- symbol: AssetSymbol(dto.symbol),
722
- walletAddress: EvmWalletAddress(dto.wallet_address),
723
- status: dto.status,
724
- pending: blockchainAmountFromRawOrThrow({
725
- label: "pending",
726
- raw: dto.pending,
727
- decimals: AssetDecimals(dto.share_decimals)
728
- }),
729
- claimableAssets: blockchainAmountFromRawOrThrow({
730
- label: "claimable_assets",
731
- raw: dto.claimable_assets,
732
- decimals: AssetDecimals(dto.asset_decimals)
733
- }),
734
- frozen: dto.frozen,
735
- asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
736
- })
618
+ var CentrifugeRedeemPosition = {
619
+ fromContract: (raw, context) => {
620
+ const shares = (label, value) => CentrifugeShares(contractAmount(label, value, context.shareDecimals));
621
+ return {
622
+ chain: context.chain,
623
+ proxy: context.proxy,
624
+ walletAddress: context.walletAddress,
625
+ pending: shares("pendingRedeemRequest", raw.pendingRedeemRequest),
626
+ claimable: shares("claimableRedeemRequest", raw.claimableRedeemRequest)
627
+ };
628
+ }
737
629
  };
738
630
  var CentrifugeVaultLeg = {
739
- /**
740
- * What a claim on the leg would collect: shares for `invest`, the funding
741
- * token for `redeem`.
742
- */
743
- claimable: (leg) => {
744
- switch (leg.direction) {
745
- case "invest":
746
- return leg.position.claimableShares;
747
- case "redeem":
748
- return leg.position.claimableAssets;
749
- default: {
750
- const exhaustive = leg;
751
- return exhaustive;
752
- }
753
- }
754
- },
755
631
  /** Whether the leg has anything queued or anything ready to claim. */
756
- isActive: (leg) => leg.position.pending.raw > 0n || CentrifugeVaultLeg.claimable(leg).raw > 0n
632
+ isActive: (leg) => leg.position.pending.raw > 0n || leg.position.claimable.raw > 0n
757
633
  };
634
+ function contractAmount(label, value, decimals) {
635
+ return BlockchainAmount({ raw: parseUint256(value, label), decimals });
636
+ }
758
637
  var CentrifugeVaultLegId = {
759
- /** Addresses compare case-insensitively: frontline echoes them lower case. */
638
+ /** Addresses compare case-insensitively: a host may pass either case. */
760
639
  of: (leg) => [
761
640
  leg.direction,
762
641
  leg.position.chain,
@@ -830,24 +709,6 @@ async function buildCentrifugeVaultBuy(api, params) {
830
709
  }
831
710
  return CentrifugeVaultBuyTransaction.fromDto(dto);
832
711
  }
833
- async function getCentrifugeVaultPosition(api, params) {
834
- const dto = await api.send({
835
- method: "GET",
836
- url: "/v1/centrifuge/vault/position",
837
- queryParams: walletFields(params),
838
- attributes: Attributes.protected()
839
- });
840
- return CentrifugeVaultPosition.fromDto(dto);
841
- }
842
- async function getCentrifugeVaultRedeemPosition(api, params) {
843
- const dto = await api.send({
844
- method: "GET",
845
- url: "/v1/centrifuge/vault/redeem-position",
846
- queryParams: walletFields(params),
847
- attributes: Attributes.protected()
848
- });
849
- return CentrifugeVaultRedeemPosition.fromDto(dto);
850
- }
851
712
  async function createCentrifugeVaultClaim(api, params) {
852
713
  const dto = await api.send({
853
714
  method: "POST",
@@ -874,6 +735,86 @@ function walletFields(params) {
874
735
  };
875
736
  }
876
737
 
738
+ // src/universal/core/checkout/centrifuge/blockchain/abi.ts
739
+ var CENTRIFUGE_PROXY_ABI = [
740
+ {
741
+ type: "function",
742
+ name: "pendingDepositRequest",
743
+ inputs: [{ name: "investor", type: "address" }],
744
+ outputs: [{ name: "", type: "uint256" }],
745
+ stateMutability: "view"
746
+ },
747
+ {
748
+ type: "function",
749
+ name: "claimableDepositRequest",
750
+ inputs: [{ name: "investor", type: "address" }],
751
+ outputs: [{ name: "", type: "uint256" }],
752
+ stateMutability: "view"
753
+ },
754
+ {
755
+ type: "function",
756
+ name: "pendingRedeemRequest",
757
+ inputs: [{ name: "investor", type: "address" }],
758
+ outputs: [{ name: "", type: "uint256" }],
759
+ stateMutability: "view"
760
+ },
761
+ {
762
+ type: "function",
763
+ name: "claimableRedeemRequest",
764
+ inputs: [{ name: "investor", type: "address" }],
765
+ outputs: [{ name: "", type: "uint256" }],
766
+ stateMutability: "view"
767
+ }
768
+ ];
769
+
770
+ // src/universal/api/rpc/providers/centrifuge/position.ts
771
+ async function readCentrifugeDepositPosition(clients, params) {
772
+ const client = clients(params.vault.chain);
773
+ const proxy = proxyOf(params);
774
+ const wallet = params.walletAddress;
775
+ const [pendingDepositRequest, claimableDepositRequest] = await client.multicall({
776
+ allowFailure: false,
777
+ contracts: [
778
+ { ...proxy, functionName: "pendingDepositRequest", args: [wallet] },
779
+ { ...proxy, functionName: "claimableDepositRequest", args: [wallet] }
780
+ ]
781
+ });
782
+ return CentrifugeDepositPosition.fromContract(
783
+ { pendingDepositRequest, claimableDepositRequest },
784
+ contextOf(params)
785
+ );
786
+ }
787
+ async function readCentrifugeRedeemPosition(clients, params) {
788
+ const client = clients(params.vault.chain);
789
+ const proxy = proxyOf(params);
790
+ const wallet = params.walletAddress;
791
+ const [pendingRedeemRequest, claimableRedeemRequest] = await client.multicall(
792
+ {
793
+ allowFailure: false,
794
+ contracts: [
795
+ { ...proxy, functionName: "pendingRedeemRequest", args: [wallet] },
796
+ { ...proxy, functionName: "claimableRedeemRequest", args: [wallet] }
797
+ ]
798
+ }
799
+ );
800
+ return CentrifugeRedeemPosition.fromContract(
801
+ { pendingRedeemRequest, claimableRedeemRequest },
802
+ contextOf(params)
803
+ );
804
+ }
805
+ function proxyOf(params) {
806
+ return { address: params.vault.proxy, abi: CENTRIFUGE_PROXY_ABI };
807
+ }
808
+ function contextOf(params) {
809
+ return {
810
+ chain: params.vault.chain,
811
+ proxy: params.vault.proxy,
812
+ walletAddress: params.walletAddress,
813
+ assetDecimals: params.vault.funding.decimals,
814
+ shareDecimals: params.vault.share.decimals
815
+ };
816
+ }
817
+
877
818
  // src/universal/core/shared/observability/log-cause.ts
878
819
  import {
879
820
  BaseError,
@@ -1069,17 +1010,19 @@ var CentrifugeNamespaceImpl = class {
1069
1010
  return getCentrifugeVaultStatus(this.ctx.api, params);
1070
1011
  });
1071
1012
  }
1072
- async getPosition(params) {
1073
- return this.log.wrap("getPosition", params, async () => {
1074
- await this.ctx.ensureUserAuthenticated();
1075
- return getCentrifugeVaultPosition(this.ctx.api, params);
1076
- });
1013
+ async readDepositPosition(params) {
1014
+ return this.log.wrap(
1015
+ "readDepositPosition",
1016
+ params,
1017
+ () => readCentrifugeDepositPosition(this.ctx.rpc, params)
1018
+ );
1077
1019
  }
1078
- async getRedeemPosition(params) {
1079
- return this.log.wrap("getRedeemPosition", params, async () => {
1080
- await this.ctx.ensureUserAuthenticated();
1081
- return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
1082
- });
1020
+ async readRedeemPosition(params) {
1021
+ return this.log.wrap(
1022
+ "readRedeemPosition",
1023
+ params,
1024
+ () => readCentrifugeRedeemPosition(this.ctx.rpc, params)
1025
+ );
1083
1026
  }
1084
1027
  async createClaim(params) {
1085
1028
  return this.log.wrap("createClaim", params, async () => {
@@ -1101,53 +1044,121 @@ var CentrifugeNamespaceImpl = class {
1101
1044
  }
1102
1045
  };
1103
1046
 
1104
- // src/universal/api/pagination.ts
1105
- async function fetchAllPages(fetchPage, baseParams) {
1106
- const items = [];
1107
- let cursor = null;
1108
- do {
1109
- const params = {
1110
- ...baseParams ?? {},
1111
- after: cursor ?? void 0
1112
- };
1113
- const page = await fetchPage(params);
1114
- items.push(...page.data);
1115
- cursor = page.startingAfter;
1116
- } while (cursor);
1117
- return items;
1118
- }
1047
+ // src/universal/types/blockchain/ui.ts
1048
+ var FormattedAmountUi = (value) => value;
1049
+ var FormattedPercentUi = (value) => value;
1050
+ var TxExplorerUrl = (value) => value;
1051
+ var ShortenedWalletAddress = (value) => value;
1052
+ var FormattedAmountAssetUi = (value) => value;
1053
+ var AssetIconUrl = (value) => value;
1119
1054
 
1120
- // src/universal/types/pagination.ts
1121
- var Cursor = (value) => value;
1122
- var PaginatedResponse = {
1123
- fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
1124
- /**
1125
- * For a mapper that decides the page as a whole - one that drops items it
1126
- * cannot map, such as `Offer.listFromDto` - rather than item by item. The
1127
- * cursors are the wire's either way: dropping an item changes what the
1128
- * page holds, not where the next page starts.
1129
- */
1130
- fromDtoPage: (dto, pageMapper) => ({
1131
- data: pageMapper(dto.data),
1132
- startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
1133
- startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
1134
- })
1135
- };
1136
- var PaginationParams = {
1137
- toQueryParams: (params) => {
1138
- const queryParams = {};
1139
- if (params.after) {
1140
- queryParams.starting_after = params.after;
1141
- }
1142
- if (params.before) {
1143
- queryParams.starting_before = params.before;
1144
- }
1145
- if (params.limit) {
1146
- queryParams.limit = params.limit;
1147
- }
1148
- return queryParams;
1055
+ // src/universal/core/shared/blockchain/formatters.ts
1056
+ import { formatUnits } from "viem";
1057
+ function shortenAddress(address) {
1058
+ const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1059
+ return ShortenedWalletAddress(short);
1060
+ }
1061
+ function formatAmount(amount, locale, options) {
1062
+ const decimal = formatRawAmount(amount);
1063
+ let [integerPart, fractionPart = ""] = decimal.split(".");
1064
+ const maxFractionDigits = options?.maxFractionDigits;
1065
+ const minFractionDigits = Math.min(
1066
+ options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1067
+ maxFractionDigits ?? amount.decimals,
1068
+ amount.decimals
1069
+ );
1070
+ if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1071
+ ({ integerPart, fractionPart } = roundFractionHalfUp(
1072
+ integerPart,
1073
+ fractionPart,
1074
+ maxFractionDigits
1075
+ ));
1149
1076
  }
1150
- };
1077
+ const trimmed = fractionPart.replace(/0+$/, "");
1078
+ const fraction = trimmed.padEnd(minFractionDigits, "0");
1079
+ const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1080
+ if (minFractionDigits === 0 && fraction === "") {
1081
+ return FormattedAmountUi(integerFormatted);
1082
+ }
1083
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1084
+ return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1085
+ }
1086
+ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1087
+ if (fractionPart.length <= maxFractionDigits) {
1088
+ return { integerPart, fractionPart };
1089
+ }
1090
+ if (maxFractionDigits === 0) {
1091
+ const roundUp = fractionPart[0] >= "5";
1092
+ const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1093
+ return { integerPart: integer.toString(), fractionPart: "" };
1094
+ }
1095
+ const trimmed = fractionPart.slice(0, maxFractionDigits);
1096
+ if (fractionPart[maxFractionDigits] < "5") {
1097
+ return { integerPart, fractionPart: trimmed };
1098
+ }
1099
+ const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1100
+ let carry = 1;
1101
+ for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1102
+ const sum = digits[i] + carry;
1103
+ if (sum === 10) {
1104
+ digits[i] = 0;
1105
+ carry = 1;
1106
+ } else {
1107
+ digits[i] = sum;
1108
+ carry = 0;
1109
+ }
1110
+ }
1111
+ return {
1112
+ integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1113
+ fractionPart: digits.join("")
1114
+ };
1115
+ }
1116
+ function formatRawAmount(amount) {
1117
+ return formatUnits(amount.raw, amount.decimals);
1118
+ }
1119
+ function formatCompactAmount(amount, locale) {
1120
+ const value = Number(formatRawAmount(amount));
1121
+ const formatted = new Intl.NumberFormat(locale, {
1122
+ notation: "compact",
1123
+ maximumFractionDigits: 2
1124
+ }).format(value);
1125
+ return FormattedAmountUi(formatted);
1126
+ }
1127
+ function formatBpsAsPercent(bps, locale) {
1128
+ const whole = bps / 100n;
1129
+ const fraction = bps % 100n;
1130
+ const wholeFormatted = whole.toLocaleString(locale);
1131
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1132
+ if (fraction === 0n) {
1133
+ return FormattedPercentUi(`${wholeFormatted}%`);
1134
+ }
1135
+ const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1136
+ return FormattedPercentUi(
1137
+ `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1138
+ );
1139
+ }
1140
+ function usdAmount(amount) {
1141
+ return FormattedAmountAssetUi(`$${amount}`);
1142
+ }
1143
+ function assetAmount(amount, symbol) {
1144
+ return FormattedAmountAssetUi(`${amount} ${symbol}`);
1145
+ }
1146
+ var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1147
+ var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1148
+ var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1149
+ function formatShareAmount(amount, locale) {
1150
+ return formatAmount(amount, locale, {
1151
+ maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1152
+ minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1153
+ });
1154
+ }
1155
+ var USD_FRACTION_DIGITS = AssetDecimals(2);
1156
+ function formattedUsdPrice(amount, locale) {
1157
+ if (!amount) return NA_AMOUNT_ASSET_UI;
1158
+ return usdAmount(
1159
+ formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1160
+ );
1161
+ }
1151
1162
 
1152
1163
  // src/universal/types/asset.ts
1153
1164
  var AssetId = (value) => value;
@@ -1417,6 +1428,38 @@ var Milestone = {
1417
1428
  })
1418
1429
  };
1419
1430
 
1431
+ // src/universal/types/pagination.ts
1432
+ var Cursor = (value) => value;
1433
+ var PaginatedResponse = {
1434
+ fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
1435
+ /**
1436
+ * For a mapper that decides the page as a whole - one that drops items it
1437
+ * cannot map, such as `Offer.listFromDto` - rather than item by item. The
1438
+ * cursors are the wire's either way: dropping an item changes what the
1439
+ * page holds, not where the next page starts.
1440
+ */
1441
+ fromDtoPage: (dto, pageMapper) => ({
1442
+ data: pageMapper(dto.data),
1443
+ startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
1444
+ startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
1445
+ })
1446
+ };
1447
+ var PaginationParams = {
1448
+ toQueryParams: (params) => {
1449
+ const queryParams = {};
1450
+ if (params.after) {
1451
+ queryParams.starting_after = params.after;
1452
+ }
1453
+ if (params.before) {
1454
+ queryParams.starting_before = params.before;
1455
+ }
1456
+ if (params.limit) {
1457
+ queryParams.limit = params.limit;
1458
+ }
1459
+ return queryParams;
1460
+ }
1461
+ };
1462
+
1420
1463
  // src/universal/types/providers/coin-list/token-sale.ts
1421
1464
  var ParticipationId = (value) => value;
1422
1465
  var Blockchain = (value) => value;
@@ -1464,6 +1507,22 @@ var CreateParticipationParams = {
1464
1507
  })
1465
1508
  };
1466
1509
 
1510
+ // src/universal/api/pagination.ts
1511
+ async function fetchAllPages(fetchPage, baseParams) {
1512
+ const items = [];
1513
+ let cursor = null;
1514
+ do {
1515
+ const params = {
1516
+ ...baseParams ?? {},
1517
+ after: cursor ?? void 0
1518
+ };
1519
+ const page = await fetchPage(params);
1520
+ items.push(...page.data);
1521
+ cursor = page.startingAfter;
1522
+ } while (cursor);
1523
+ return items;
1524
+ }
1525
+
1467
1526
  // src/universal/api/frontline/providers/coin-list/token-sale.ts
1468
1527
  async function fetchParticipations(api, offerId) {
1469
1528
  return fetchAllPages(
@@ -1530,122 +1589,6 @@ var CoinListTokenSaleNamespaceImpl = class {
1530
1589
  }
1531
1590
  };
1532
1591
 
1533
- // src/universal/types/blockchain/ui.ts
1534
- var FormattedAmountUi = (value) => value;
1535
- var FormattedPercentUi = (value) => value;
1536
- var TxExplorerUrl = (value) => value;
1537
- var ShortenedWalletAddress = (value) => value;
1538
- var FormattedAmountAssetUi = (value) => value;
1539
- var AssetIconUrl = (value) => value;
1540
-
1541
- // src/universal/core/shared/blockchain/formatters.ts
1542
- import { formatUnits } from "viem";
1543
- function shortenAddress(address) {
1544
- const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
1545
- return ShortenedWalletAddress(short);
1546
- }
1547
- function formatAmount(amount, locale, options) {
1548
- const decimal = formatRawAmount(amount);
1549
- let [integerPart, fractionPart = ""] = decimal.split(".");
1550
- const maxFractionDigits = options?.maxFractionDigits;
1551
- const minFractionDigits = Math.min(
1552
- options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1553
- maxFractionDigits ?? amount.decimals,
1554
- amount.decimals
1555
- );
1556
- if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1557
- ({ integerPart, fractionPart } = roundFractionHalfUp(
1558
- integerPart,
1559
- fractionPart,
1560
- maxFractionDigits
1561
- ));
1562
- }
1563
- const trimmed = fractionPart.replace(/0+$/, "");
1564
- const fraction = trimmed.padEnd(minFractionDigits, "0");
1565
- const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1566
- if (minFractionDigits === 0 && fraction === "") {
1567
- return FormattedAmountUi(integerFormatted);
1568
- }
1569
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1570
- return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
1571
- }
1572
- function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
1573
- if (fractionPart.length <= maxFractionDigits) {
1574
- return { integerPart, fractionPart };
1575
- }
1576
- if (maxFractionDigits === 0) {
1577
- const roundUp = fractionPart[0] >= "5";
1578
- const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
1579
- return { integerPart: integer.toString(), fractionPart: "" };
1580
- }
1581
- const trimmed = fractionPart.slice(0, maxFractionDigits);
1582
- if (fractionPart[maxFractionDigits] < "5") {
1583
- return { integerPart, fractionPart: trimmed };
1584
- }
1585
- const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
1586
- let carry = 1;
1587
- for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
1588
- const sum = digits[i] + carry;
1589
- if (sum === 10) {
1590
- digits[i] = 0;
1591
- carry = 1;
1592
- } else {
1593
- digits[i] = sum;
1594
- carry = 0;
1595
- }
1596
- }
1597
- return {
1598
- integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
1599
- fractionPart: digits.join("")
1600
- };
1601
- }
1602
- function formatRawAmount(amount) {
1603
- return formatUnits(amount.raw, amount.decimals);
1604
- }
1605
- function formatCompactAmount(amount, locale) {
1606
- const value = Number(formatRawAmount(amount));
1607
- const formatted = new Intl.NumberFormat(locale, {
1608
- notation: "compact",
1609
- maximumFractionDigits: 2
1610
- }).format(value);
1611
- return FormattedAmountUi(formatted);
1612
- }
1613
- function formatBpsAsPercent(bps, locale) {
1614
- const whole = bps / 100n;
1615
- const fraction = bps % 100n;
1616
- const wholeFormatted = whole.toLocaleString(locale);
1617
- const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1618
- if (fraction === 0n) {
1619
- return FormattedPercentUi(`${wholeFormatted}%`);
1620
- }
1621
- const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
1622
- return FormattedPercentUi(
1623
- `${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
1624
- );
1625
- }
1626
- function usdAmount(amount) {
1627
- return FormattedAmountAssetUi(`$${amount}`);
1628
- }
1629
- function assetAmount(amount, symbol) {
1630
- return FormattedAmountAssetUi(`${amount} ${symbol}`);
1631
- }
1632
- var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1633
- var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1634
- var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1635
- function formatShareAmount(amount, locale) {
1636
- return formatAmount(amount, locale, {
1637
- maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1638
- minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1639
- });
1640
- }
1641
- var USD_FRACTION_DIGITS = AssetDecimals(2);
1642
- function formattedUsdPrice(amount, locale) {
1643
- if (!amount) return NA_AMOUNT_ASSET_UI;
1644
- return usdAmount(
1645
- formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
1646
- );
1647
- }
1648
-
1649
1592
  // src/universal/core/shared/blockchain/chain.ts
1650
1593
  import { base, baseSepolia, mainnet, sepolia } from "viem/chains";
1651
1594
  var VIEM_CHAINS = {
@@ -1996,13 +1939,108 @@ var OndoNamespaceImpl = class {
1996
1939
  }
1997
1940
  };
1998
1941
 
1999
- // src/universal/core/checkout/superstate/blockchain/abi.ts
2000
- var SUPERSTATE_SWAP_ABI = [
2001
- {
2002
- type: "function",
2003
- name: "KIND",
2004
- inputs: [],
2005
- outputs: [
1942
+ // src/universal/types/providers/superstate/swap.ts
1943
+ var SwapPreview = {
1944
+ /** Maps the contract's `Preview { input, fee, output }` struct. */
1945
+ fromContract: (preview) => ({
1946
+ inputAmount: parseUint256(preview.input, "SwapPreview.input"),
1947
+ fee: parseUint256(preview.fee, "SwapPreview.fee"),
1948
+ outputAmount: parseUint256(preview.output, "SwapPreview.output")
1949
+ })
1950
+ };
1951
+ var PauseFlags = (value) => value;
1952
+ var SwapStatus = {
1953
+ /**
1954
+ * Maps the contract's `Status { uint32 flags; State state }` struct, where
1955
+ * `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
1956
+ *
1957
+ * `flags` is carried onto the `paused` arm only. On the other two the
1958
+ * contract sets it to a self-identifying marker rather than to information -
1959
+ * so repeating it would invite a caller to read meaning into a constant.
1960
+ *
1961
+ * @throws ValidationError on a `state` outside the enum. A contract that has
1962
+ * grown a fourth state is one the SDK does not model, and guessing `active`
1963
+ * would let a halted swap read as a live one.
1964
+ */
1965
+ fromContract: (status) => {
1966
+ switch (status.state) {
1967
+ case 0:
1968
+ return { state: "active" };
1969
+ case 1:
1970
+ return { state: "paused", pausedLevels: PauseFlags(status.flags) };
1971
+ case 2:
1972
+ return { state: "stopped" };
1973
+ default:
1974
+ throw new ValidationError(
1975
+ `SwapStatus.state: unknown contract state (${status.state})`
1976
+ );
1977
+ }
1978
+ }
1979
+ };
1980
+ var AllowWalletResponse = {
1981
+ fromDto: (dto) => {
1982
+ switch (dto.action) {
1983
+ case "broadcast_transaction":
1984
+ return {
1985
+ action: "broadcast_transaction",
1986
+ to: EvmContractAddress(dto.to),
1987
+ data: HexEncodedTransactionData(dto.data)
1988
+ };
1989
+ case "none":
1990
+ return {
1991
+ action: "none",
1992
+ alreadyAllowed: dto.already_allowed
1993
+ };
1994
+ default: {
1995
+ const _exhaustive = dto;
1996
+ return _exhaustive;
1997
+ }
1998
+ }
1999
+ }
2000
+ };
2001
+
2002
+ // src/universal/core/checkout/superstate/blockchain/quote.ts
2003
+ var SwapQuote = {
2004
+ /**
2005
+ * Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
2006
+ * input and fee are denominated in the input token; the output in the output
2007
+ * token.
2008
+ */
2009
+ fromPreview: (preview, inputDecimals, outputDecimals) => ({
2010
+ inputTokenAmount: BlockchainAmount({
2011
+ raw: preview.inputAmount,
2012
+ decimals: inputDecimals
2013
+ }),
2014
+ fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),
2015
+ outputTokenAmount: BlockchainAmount({
2016
+ raw: preview.outputAmount,
2017
+ decimals: outputDecimals
2018
+ })
2019
+ })
2020
+ };
2021
+
2022
+ // src/universal/api/frontline/providers/superstate/swap.ts
2023
+ async function allowWallet(api, params) {
2024
+ const dto = await api.send({
2025
+ method: "POST",
2026
+ url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
2027
+ body: {
2028
+ wallet_address: params.walletAddress,
2029
+ chain: params.chain,
2030
+ signature: params.signature
2031
+ },
2032
+ attributes: Attributes.protected()
2033
+ });
2034
+ return AllowWalletResponse.fromDto(dto);
2035
+ }
2036
+
2037
+ // src/universal/core/checkout/superstate/blockchain/abi.ts
2038
+ var SUPERSTATE_SWAP_ABI = [
2039
+ {
2040
+ type: "function",
2041
+ name: "KIND",
2042
+ inputs: [],
2043
+ outputs: [
2006
2044
  {
2007
2045
  name: "",
2008
2046
  type: "uint16",
@@ -2868,80 +2906,105 @@ var SUPERSTATE_SWAP_ABI = [
2868
2906
  }
2869
2907
  ];
2870
2908
 
2871
- // src/universal/types/providers/superstate/swap.ts
2872
- var SwapPreview = {
2873
- /** Maps the contract's `Preview { input, fee, output }` struct. */
2874
- fromContract: (preview) => ({
2875
- inputAmount: parseUint256(preview.input, "SwapPreview.input"),
2876
- fee: parseUint256(preview.fee, "SwapPreview.fee"),
2877
- outputAmount: parseUint256(preview.output, "SwapPreview.output")
2878
- })
2879
- };
2880
- var PauseFlags = (value) => value;
2881
- var SwapStatus = {
2882
- /**
2883
- * Maps the contract's `Status { uint32 flags; State state }` struct, where
2884
- * `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
2885
- *
2886
- * `flags` is carried onto the `paused` arm only. On the other two the
2887
- * contract sets it to a self-identifying marker rather than to information -
2888
- * so repeating it would invite a caller to read meaning into a constant.
2889
- *
2890
- * @throws ValidationError on a `state` outside the enum. A contract that has
2891
- * grown a fourth state is one the SDK does not model, and guessing `active`
2892
- * would let a halted swap read as a live one.
2893
- */
2894
- fromContract: (status) => {
2895
- switch (status.state) {
2896
- case 0:
2897
- return { state: "active" };
2898
- case 1:
2899
- return { state: "paused", pausedLevels: PauseFlags(status.flags) };
2900
- case 2:
2901
- return { state: "stopped" };
2902
- default:
2903
- throw new ValidationError(
2904
- `SwapStatus.state: unknown contract state (${status.state})`
2905
- );
2906
- }
2907
- }
2908
- };
2909
- var AllowWalletResponse = {
2910
- fromDto: (dto) => {
2911
- switch (dto.action) {
2912
- case "broadcast_transaction":
2913
- return {
2914
- action: "broadcast_transaction",
2915
- to: EvmContractAddress(dto.to),
2916
- data: HexEncodedTransactionData(dto.data)
2917
- };
2918
- case "none":
2919
- return {
2920
- action: "none",
2921
- alreadyAllowed: dto.already_allowed
2922
- };
2923
- default: {
2924
- const _exhaustive = dto;
2925
- return _exhaustive;
2926
- }
2927
- }
2909
+ // src/universal/core/shared/blockchain/erc20/abi.ts
2910
+ var ERC20_ABI = [
2911
+ {
2912
+ type: "function",
2913
+ name: "allowance",
2914
+ inputs: [
2915
+ { name: "owner", type: "address" },
2916
+ { name: "spender", type: "address" }
2917
+ ],
2918
+ outputs: [{ name: "", type: "uint256" }],
2919
+ stateMutability: "view"
2920
+ },
2921
+ {
2922
+ type: "function",
2923
+ name: "approve",
2924
+ inputs: [
2925
+ { name: "spender", type: "address" },
2926
+ { name: "amount", type: "uint256" }
2927
+ ],
2928
+ outputs: [{ name: "", type: "bool" }],
2929
+ stateMutability: "nonpayable"
2930
+ },
2931
+ {
2932
+ type: "function",
2933
+ name: "balanceOf",
2934
+ inputs: [{ name: "account", type: "address" }],
2935
+ outputs: [{ name: "", type: "uint256" }],
2936
+ stateMutability: "view"
2937
+ },
2938
+ {
2939
+ type: "function",
2940
+ name: "decimals",
2941
+ inputs: [],
2942
+ outputs: [{ name: "", type: "uint8" }],
2943
+ stateMutability: "view"
2944
+ },
2945
+ {
2946
+ type: "function",
2947
+ name: "name",
2948
+ inputs: [],
2949
+ outputs: [{ name: "", type: "string" }],
2950
+ stateMutability: "view"
2951
+ },
2952
+ {
2953
+ type: "function",
2954
+ name: "symbol",
2955
+ inputs: [],
2956
+ outputs: [{ name: "", type: "string" }],
2957
+ stateMutability: "view"
2958
+ },
2959
+ {
2960
+ type: "function",
2961
+ name: "totalSupply",
2962
+ inputs: [],
2963
+ outputs: [{ name: "", type: "uint256" }],
2964
+ stateMutability: "view"
2965
+ },
2966
+ {
2967
+ type: "function",
2968
+ name: "transfer",
2969
+ inputs: [
2970
+ { name: "recipient", type: "address" },
2971
+ { name: "amount", type: "uint256" }
2972
+ ],
2973
+ outputs: [{ name: "", type: "bool" }],
2974
+ stateMutability: "nonpayable"
2975
+ },
2976
+ {
2977
+ type: "function",
2978
+ name: "transferFrom",
2979
+ inputs: [
2980
+ { name: "sender", type: "address" },
2981
+ { name: "recipient", type: "address" },
2982
+ { name: "amount", type: "uint256" }
2983
+ ],
2984
+ outputs: [{ name: "", type: "bool" }],
2985
+ stateMutability: "nonpayable"
2986
+ },
2987
+ {
2988
+ type: "event",
2989
+ name: "Approval",
2990
+ inputs: [
2991
+ { name: "owner", type: "address", indexed: true },
2992
+ { name: "spender", type: "address", indexed: true },
2993
+ { name: "value", type: "uint256", indexed: false }
2994
+ ],
2995
+ anonymous: false
2996
+ },
2997
+ {
2998
+ type: "event",
2999
+ name: "Transfer",
3000
+ inputs: [
3001
+ { name: "from", type: "address", indexed: true },
3002
+ { name: "to", type: "address", indexed: true },
3003
+ { name: "value", type: "uint256", indexed: false }
3004
+ ],
3005
+ anonymous: false
2928
3006
  }
2929
- };
2930
-
2931
- // src/universal/api/frontline/providers/superstate/swap.ts
2932
- async function allowWallet(api, params) {
2933
- const dto = await api.send({
2934
- method: "POST",
2935
- url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
2936
- body: {
2937
- wallet_address: params.walletAddress,
2938
- chain: params.chain,
2939
- signature: params.signature
2940
- },
2941
- attributes: Attributes.protected()
2942
- });
2943
- return AllowWalletResponse.fromDto(dto);
2944
- }
3007
+ ];
2945
3008
 
2946
3009
  // src/universal/api/rpc/providers/superstate/swap.ts
2947
3010
  async function getSwapAuthorization(clients, params) {
@@ -3012,6 +3075,20 @@ var SuperstateSwapNamespaceImpl = class {
3012
3075
  async () => getSwapPreview(this.ctx.rpc, params)
3013
3076
  );
3014
3077
  }
3078
+ async getQuote(params) {
3079
+ return this.log.wrap("getQuote", params, async () => {
3080
+ const { amount, outputTokenDecimals, ...ref } = params;
3081
+ const preview = await getSwapPreview(this.ctx.rpc, {
3082
+ ...ref,
3083
+ amount: amount.raw
3084
+ });
3085
+ return SwapQuote.fromPreview(
3086
+ preview,
3087
+ amount.decimals,
3088
+ outputTokenDecimals
3089
+ );
3090
+ });
3091
+ }
3015
3092
  async getStatus(params) {
3016
3093
  return this.log.wrap(
3017
3094
  "getStatus",
@@ -3209,6 +3286,147 @@ var RequirementsNamespaceImpl = class {
3209
3286
  }
3210
3287
  };
3211
3288
 
3289
+ // src/universal/types/offer-option-address.ts
3290
+ var OfferOptionAddressId = (value) => value;
3291
+ var OfferOptionAddress = {
3292
+ /** Maps the API DTO into the SDK offer-option-address domain model. */
3293
+ fromDto: (dto) => ({
3294
+ id: OfferOptionAddressId(dto.id),
3295
+ offerOptionId: OfferOptionId(dto.offer_option_id),
3296
+ address: EvmWalletAddress(dto.address),
3297
+ protocol: dto.protocol,
3298
+ createdAt: new Date(dto.created_at)
3299
+ })
3300
+ };
3301
+ var ConnectExternalWalletParams = {
3302
+ /** Maps connect-wallet params into the API DTO payload. */
3303
+ toDto: (params) => ({
3304
+ offer_option_id: params.offerOptionId,
3305
+ wallet_address: params.walletAddress,
3306
+ chain: params.chain,
3307
+ signature: params.signature
3308
+ })
3309
+ };
3310
+
3311
+ // src/universal/types/wallet-ownership-challenge.ts
3312
+ var WalletOwnershipChallenge = {
3313
+ /** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
3314
+ fromDto: (dto) => ({
3315
+ message: dto.message,
3316
+ expiresAt: new Date(dto.expires_at)
3317
+ })
3318
+ };
3319
+ var CreateWalletOwnershipChallengeParams = {
3320
+ /**
3321
+ * Maps challenge-request params into the API DTO payload. The discriminated
3322
+ * union guarantees SIWE fields are present exactly when `challengeType` is
3323
+ * `siwe`, so the mapping narrows on the discriminant.
3324
+ */
3325
+ toDto: (params) => {
3326
+ switch (params.challengeType) {
3327
+ case "plain":
3328
+ return {
3329
+ wallet_address: params.walletAddress,
3330
+ chain: params.chain,
3331
+ challenge_type: "plain"
3332
+ };
3333
+ case "siwe":
3334
+ return {
3335
+ wallet_address: params.walletAddress,
3336
+ chain: params.chain,
3337
+ challenge_type: "siwe",
3338
+ domain: params.domain,
3339
+ uri: params.uri,
3340
+ statement: params.statement
3341
+ };
3342
+ default: {
3343
+ const _exhaustive = params;
3344
+ return _exhaustive;
3345
+ }
3346
+ }
3347
+ }
3348
+ };
3349
+
3350
+ // src/universal/api/frontline/wallet-connect.ts
3351
+ async function createWalletOwnershipChallenge(api, params) {
3352
+ const dto = await api.send({
3353
+ method: "POST",
3354
+ url: "/v1/wallet-ownership",
3355
+ body: CreateWalletOwnershipChallengeParams.toDto(params),
3356
+ attributes: Attributes.protected()
3357
+ });
3358
+ return WalletOwnershipChallenge.fromDto(dto);
3359
+ }
3360
+ async function connectExternalWallet(api, params) {
3361
+ const dto = await api.send({
3362
+ method: "POST",
3363
+ url: `/v1/offers/${params.offerId}/addresses`,
3364
+ body: ConnectExternalWalletParams.toDto(params),
3365
+ attributes: Attributes.protected()
3366
+ });
3367
+ return OfferOptionAddress.fromDto(dto);
3368
+ }
3369
+ async function listOptionAddresses(api, offerId, offerOptionId) {
3370
+ const { data } = await api.send({
3371
+ method: "GET",
3372
+ url: `/v1/offers/${offerId}/addresses`,
3373
+ queryParams: { offer_option_id: offerOptionId },
3374
+ attributes: Attributes.protected()
3375
+ });
3376
+ return data.map(OfferOptionAddress.fromDto);
3377
+ }
3378
+ async function removeOptionAddress(api, offerId, addressId) {
3379
+ const dto = await api.send({
3380
+ method: "DELETE",
3381
+ url: `/v1/offers/${offerId}/addresses/${addressId}`,
3382
+ attributes: Attributes.protected()
3383
+ });
3384
+ return OfferOptionAddress.fromDto(dto);
3385
+ }
3386
+
3387
+ // src/universal/core/wallets/wallets-namespace.ts
3388
+ var WalletsNamespaceImpl = class {
3389
+ constructor(ctx) {
3390
+ this.ctx = ctx;
3391
+ this.log = internalLogger(ctx.logger, "WALLETS");
3392
+ }
3393
+ async createOwnershipChallenge(params) {
3394
+ return this.log.wrap("createOwnershipChallenge", params, async () => {
3395
+ await this.ctx.ensureUserAuthenticated();
3396
+ return createWalletOwnershipChallenge(
3397
+ this.ctx.api,
3398
+ params
3399
+ );
3400
+ });
3401
+ }
3402
+ async connectExternal(params) {
3403
+ return this.log.wrap("connectExternal", params, async () => {
3404
+ await this.ctx.ensureUserAuthenticated();
3405
+ return connectExternalWallet(this.ctx.api, params);
3406
+ });
3407
+ }
3408
+ async list(params) {
3409
+ return this.log.wrap("list", params, async () => {
3410
+ await this.ctx.ensureUserAuthenticated();
3411
+ return listOptionAddresses(
3412
+ this.ctx.api,
3413
+ params.offerId,
3414
+ params.offerOptionId
3415
+ );
3416
+ });
3417
+ }
3418
+ async remove(params) {
3419
+ return this.log.wrap("remove", params, async () => {
3420
+ await this.ctx.ensureUserAuthenticated();
3421
+ return removeOptionAddress(
3422
+ this.ctx.api,
3423
+ params.offerId,
3424
+ params.addressId
3425
+ );
3426
+ });
3427
+ }
3428
+ };
3429
+
3212
3430
  // src/universal/api/rpc/erc20.ts
3213
3431
  async function getTokenAllowance(clients, params) {
3214
3432
  const allowance = await clients(params.chain).readContract({
@@ -3631,163 +3849,6 @@ var TokensNamespaceImpl = class {
3631
3849
  }
3632
3850
  };
3633
3851
 
3634
- // src/universal/types/offer-option-address.ts
3635
- var OfferOptionAddressId = (value) => value;
3636
- var OfferOptionAddress = {
3637
- /** Maps the API DTO into the SDK offer-option-address domain model. */
3638
- fromDto: (dto) => ({
3639
- id: OfferOptionAddressId(dto.id),
3640
- offerOptionId: OfferOptionId(dto.offer_option_id),
3641
- address: EvmWalletAddress(dto.address),
3642
- protocol: dto.protocol,
3643
- createdAt: new Date(dto.created_at)
3644
- })
3645
- };
3646
- var ConnectExternalWalletParams = {
3647
- /** Maps connect-wallet params into the API DTO payload. */
3648
- toDto: (params) => ({
3649
- offer_option_id: params.offerOptionId,
3650
- wallet_address: params.walletAddress,
3651
- chain: params.chain,
3652
- signature: params.signature
3653
- })
3654
- };
3655
-
3656
- // src/universal/types/wallet-ownership-challenge.ts
3657
- var WalletOwnershipChallenge = {
3658
- /** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
3659
- fromDto: (dto) => ({
3660
- message: dto.message,
3661
- expiresAt: new Date(dto.expires_at)
3662
- })
3663
- };
3664
- var CreateWalletOwnershipChallengeParams = {
3665
- /**
3666
- * Maps challenge-request params into the API DTO payload. The discriminated
3667
- * union guarantees SIWE fields are present exactly when `challengeType` is
3668
- * `siwe`, so the mapping narrows on the discriminant.
3669
- */
3670
- toDto: (params) => {
3671
- switch (params.challengeType) {
3672
- case "plain":
3673
- return {
3674
- wallet_address: params.walletAddress,
3675
- chain: params.chain,
3676
- challenge_type: "plain"
3677
- };
3678
- case "siwe":
3679
- return {
3680
- wallet_address: params.walletAddress,
3681
- chain: params.chain,
3682
- challenge_type: "siwe",
3683
- domain: params.domain,
3684
- uri: params.uri,
3685
- statement: params.statement
3686
- };
3687
- default: {
3688
- const _exhaustive = params;
3689
- return _exhaustive;
3690
- }
3691
- }
3692
- }
3693
- };
3694
-
3695
- // src/universal/api/frontline/wallet-connect.ts
3696
- async function createWalletOwnershipChallenge(api, params) {
3697
- const dto = await api.send({
3698
- method: "POST",
3699
- url: "/v1/wallet-ownership",
3700
- body: CreateWalletOwnershipChallengeParams.toDto(params),
3701
- attributes: Attributes.protected()
3702
- });
3703
- return WalletOwnershipChallenge.fromDto(dto);
3704
- }
3705
- async function connectExternalWallet(api, params) {
3706
- const dto = await api.send({
3707
- method: "POST",
3708
- url: `/v1/offers/${params.offerId}/addresses`,
3709
- body: ConnectExternalWalletParams.toDto(params),
3710
- attributes: Attributes.protected()
3711
- });
3712
- return OfferOptionAddress.fromDto(dto);
3713
- }
3714
- async function listOptionAddresses(api, offerId, offerOptionId) {
3715
- const { data } = await api.send({
3716
- method: "GET",
3717
- url: `/v1/offers/${offerId}/addresses`,
3718
- queryParams: { offer_option_id: offerOptionId },
3719
- attributes: Attributes.protected()
3720
- });
3721
- return data.map(OfferOptionAddress.fromDto);
3722
- }
3723
- async function removeOptionAddress(api, offerId, addressId) {
3724
- const dto = await api.send({
3725
- method: "DELETE",
3726
- url: `/v1/offers/${offerId}/addresses/${addressId}`,
3727
- attributes: Attributes.protected()
3728
- });
3729
- return OfferOptionAddress.fromDto(dto);
3730
- }
3731
-
3732
- // src/universal/core/wallets/wallets-namespace.ts
3733
- var WalletsNamespaceImpl = class {
3734
- constructor(ctx) {
3735
- this.ctx = ctx;
3736
- this.log = internalLogger(ctx.logger, "WALLETS");
3737
- }
3738
- async createOwnershipChallenge(params) {
3739
- return this.log.wrap("createOwnershipChallenge", params, async () => {
3740
- await this.ctx.ensureUserAuthenticated();
3741
- return createWalletOwnershipChallenge(
3742
- this.ctx.api,
3743
- params
3744
- );
3745
- });
3746
- }
3747
- async connectExternal(params) {
3748
- return this.log.wrap("connectExternal", params, async () => {
3749
- await this.ctx.ensureUserAuthenticated();
3750
- return connectExternalWallet(this.ctx.api, params);
3751
- });
3752
- }
3753
- async list(params) {
3754
- return this.log.wrap("list", params, async () => {
3755
- await this.ctx.ensureUserAuthenticated();
3756
- return listOptionAddresses(
3757
- this.ctx.api,
3758
- params.offerId,
3759
- params.offerOptionId
3760
- );
3761
- });
3762
- }
3763
- async remove(params) {
3764
- return this.log.wrap("remove", params, async () => {
3765
- await this.ctx.ensureUserAuthenticated();
3766
- return removeOptionAddress(
3767
- this.ctx.api,
3768
- params.offerId,
3769
- params.addressId
3770
- );
3771
- });
3772
- }
3773
- };
3774
-
3775
- // src/universal/types/oauth-session.ts
3776
- var ClientCredentialsOAuth = (value) => value;
3777
- var OAuthRefreshToken = (value) => value;
3778
- var OAuthSession = {
3779
- fromDto: (dto) => {
3780
- const expiresAt = new Date(Date.now() + dto.expires_in * 1e3);
3781
- return {
3782
- accessToken: {
3783
- value: dto.access_token,
3784
- expiresAt
3785
- },
3786
- ...dto.refresh_token != null && dto.refresh_token !== "" ? { refreshToken: OAuthRefreshToken(dto.refresh_token) } : void 0
3787
- };
3788
- }
3789
- };
3790
-
3791
3852
  // src/universal/api/frontline/offers.ts
3792
3853
  async function fetchOffers(api, clientCreds) {
3793
3854
  return fetchAllPages((params) => fetchOffersPage(api, params, clientCreds));
@@ -3844,6 +3905,7 @@ export {
3844
3905
  ValidationError,
3845
3906
  InvariantError,
3846
3907
  MathError,
3908
+ classifyLogCause,
3847
3909
  describeErrorUnredacted,
3848
3910
  internalLogger,
3849
3911
  HttpClient,
@@ -3878,16 +3940,30 @@ export {
3878
3940
  CentrifugeVaultStatus,
3879
3941
  CentrifugeVaultBuyTransaction,
3880
3942
  CentrifugeVaultClaimTransaction,
3881
- CentrifugeVaultPosition,
3882
- CentrifugeVaultRedeemPosition,
3943
+ CentrifugeAssets,
3944
+ CentrifugeShares,
3945
+ CentrifugeDepositPosition,
3946
+ CentrifugeRedeemPosition,
3883
3947
  CentrifugeVaultLeg,
3884
3948
  CentrifugeVaultLegId,
3885
3949
  CentrifugeVaultClaimProceedsTransaction,
3886
3950
  CentrifugeNamespaceImpl,
3887
- fetchAllPages,
3888
- Cursor,
3889
- PaginatedResponse,
3890
- PaginationParams,
3951
+ FormattedAmountUi,
3952
+ FormattedPercentUi,
3953
+ TxExplorerUrl,
3954
+ ShortenedWalletAddress,
3955
+ FormattedAmountAssetUi,
3956
+ AssetIconUrl,
3957
+ shortenAddress,
3958
+ formatAmount,
3959
+ formatRawAmount,
3960
+ formatCompactAmount,
3961
+ formatBpsAsPercent,
3962
+ usdAmount,
3963
+ assetAmount,
3964
+ NA_AMOUNT_ASSET_UI,
3965
+ formatShareAmount,
3966
+ formattedUsdPrice,
3891
3967
  AssetId,
3892
3968
  AssetCode,
3893
3969
  Asset,
@@ -3910,6 +3986,9 @@ export {
3910
3986
  Link,
3911
3987
  TermItem,
3912
3988
  Milestone,
3989
+ Cursor,
3990
+ PaginatedResponse,
3991
+ PaginationParams,
3913
3992
  ParticipationId,
3914
3993
  Blockchain,
3915
3994
  WalletAddress,
@@ -3917,22 +3996,6 @@ export {
3917
3996
  Participation,
3918
3997
  CreateParticipationParams,
3919
3998
  CoinListTokenSaleNamespaceImpl,
3920
- FormattedAmountUi,
3921
- FormattedPercentUi,
3922
- TxExplorerUrl,
3923
- ShortenedWalletAddress,
3924
- FormattedAmountAssetUi,
3925
- AssetIconUrl,
3926
- shortenAddress,
3927
- formatAmount,
3928
- formatRawAmount,
3929
- formatCompactAmount,
3930
- formatBpsAsPercent,
3931
- usdAmount,
3932
- assetAmount,
3933
- NA_AMOUNT_ASSET_UI,
3934
- formatShareAmount,
3935
- formattedUsdPrice,
3936
3999
  viemChain,
3937
4000
  getChainId,
3938
4001
  chainFromId,
@@ -3948,10 +4011,8 @@ export {
3948
4011
  PauseFlags,
3949
4012
  SwapStatus,
3950
4013
  AllowWalletResponse,
4014
+ SwapQuote,
3951
4015
  SuperstateSwapNamespaceImpl,
3952
- fetchOffers,
3953
- fetchOffersPage,
3954
- fetchOfferDetails,
3955
4016
  DocumentSubmission,
3956
4017
  KycToken,
3957
4018
  Iso2CountryCode,
@@ -3963,19 +4024,19 @@ export {
3963
4024
  RequirementStatusInfo,
3964
4025
  fetchOfferRequirements,
3965
4026
  RequirementsNamespaceImpl,
3966
- Erc20NamespaceImpl,
3967
- TokenLogoUrl,
3968
- TokenLogo,
3969
- TokenMetadata,
3970
- TokensNamespaceImpl,
3971
4027
  OfferOptionAddressId,
3972
4028
  OfferOptionAddress,
3973
4029
  ConnectExternalWalletParams,
3974
4030
  WalletOwnershipChallenge,
3975
4031
  CreateWalletOwnershipChallengeParams,
3976
4032
  WalletsNamespaceImpl,
3977
- ClientCredentialsOAuth,
3978
- OAuthRefreshToken,
3979
- OAuthSession
4033
+ fetchOffers,
4034
+ fetchOffersPage,
4035
+ fetchOfferDetails,
4036
+ Erc20NamespaceImpl,
4037
+ TokenLogoUrl,
4038
+ TokenLogo,
4039
+ TokenMetadata,
4040
+ TokensNamespaceImpl
3980
4041
  };
3981
- //# sourceMappingURL=chunk-C6GF7MDF.js.map
4042
+ //# sourceMappingURL=chunk-GIE4UWB3.js.map