@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.8a0d02a
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-DCW7NQXH.js → chunk-3WW5FLT7.js} +52 -19
- package/dist/chunk-3WW5FLT7.js.map +1 -0
- package/dist/{chunk-MOE5S6CE.js → chunk-C6GF7MDF.js} +915 -458
- package/dist/chunk-C6GF7MDF.js.map +1 -0
- package/dist/{chunk-VH34YC3Q.js → chunk-IZJ4JSSC.js} +78 -4
- package/dist/chunk-IZJ4JSSC.js.map +1 -0
- package/dist/client/index.cjs +12103 -8452
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1640 -37
- package/dist/client/index.d.ts +1640 -37
- package/dist/client/index.js +7923 -4800
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +789 -142
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +69 -41
- package/dist/server/index.d.ts +69 -41
- package/dist/server/index.js +323 -65
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → time-CVZpAkGY.d.cts} +878 -192
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → time-CVZpAkGY.d.ts} +878 -192
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +74 -8
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-bR14QehS.d.cts} +74 -8
- package/dist/universal/index.cjs +982 -448
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +91 -5
- package/dist/universal/index.d.ts +91 -5
- package/dist/universal/index.js +44 -2
- package/package.json +1 -1
- package/dist/chunk-DCW7NQXH.js.map +0 -1
- package/dist/chunk-MOE5S6CE.js.map +0 -1
- package/dist/chunk-VH34YC3Q.js.map +0 -1
package/dist/universal/index.cjs
CHANGED
|
@@ -27,11 +27,22 @@ __export(universal_exports, {
|
|
|
27
27
|
AssetIconUrl: () => AssetIconUrl,
|
|
28
28
|
AssetId: () => AssetId,
|
|
29
29
|
AssetSymbol: () => AssetSymbol,
|
|
30
|
+
AsyncOfferDetail: () => AsyncOfferDetail,
|
|
30
31
|
AuthorizationCode: () => AuthorizationCode,
|
|
31
32
|
BPS_DENOM: () => BPS_DENOM,
|
|
32
33
|
Blockchain: () => Blockchain,
|
|
33
34
|
BlockchainAmount: () => BlockchainAmount,
|
|
34
35
|
Bps: () => Bps,
|
|
36
|
+
CENTRIFUGE_POLL_INTERVAL_MS: () => CENTRIFUGE_POLL_INTERVAL_MS,
|
|
37
|
+
CentrifugeNamespaceImpl: () => CentrifugeNamespaceImpl,
|
|
38
|
+
CentrifugeVaultBuyTransaction: () => CentrifugeVaultBuyTransaction,
|
|
39
|
+
CentrifugeVaultClaimProceedsTransaction: () => CentrifugeVaultClaimProceedsTransaction,
|
|
40
|
+
CentrifugeVaultClaimTransaction: () => CentrifugeVaultClaimTransaction,
|
|
41
|
+
CentrifugeVaultLeg: () => CentrifugeVaultLeg,
|
|
42
|
+
CentrifugeVaultLegId: () => CentrifugeVaultLegId,
|
|
43
|
+
CentrifugeVaultPosition: () => CentrifugeVaultPosition,
|
|
44
|
+
CentrifugeVaultRedeemPosition: () => CentrifugeVaultRedeemPosition,
|
|
45
|
+
CentrifugeVaultStatus: () => CentrifugeVaultStatus,
|
|
35
46
|
Chain: () => Chain,
|
|
36
47
|
ClientCredentialsOAuth: () => ClientCredentialsOAuth,
|
|
37
48
|
ClientId: () => ClientId,
|
|
@@ -51,6 +62,7 @@ __export(universal_exports, {
|
|
|
51
62
|
DocumentSubmission: () => DocumentSubmission,
|
|
52
63
|
ERC20_ABI: () => ERC20_ABI,
|
|
53
64
|
ETHEREUM_CHAINS: () => ETHEREUM_CHAINS,
|
|
65
|
+
EpochMillis: () => EpochMillis,
|
|
54
66
|
Erc20NamespaceImpl: () => Erc20NamespaceImpl,
|
|
55
67
|
EthereumChain: () => EthereumChain,
|
|
56
68
|
EvmContractAddress: () => EvmContractAddress,
|
|
@@ -71,11 +83,13 @@ __export(universal_exports, {
|
|
|
71
83
|
MAX_UINT_256: () => MAX_UINT_256,
|
|
72
84
|
MathError: () => MathError,
|
|
73
85
|
Milestone: () => Milestone,
|
|
86
|
+
Millis: () => Millis,
|
|
74
87
|
NA_AMOUNT_ASSET_UI: () => NA_AMOUNT_ASSET_UI,
|
|
75
88
|
NotAuthenticatedError: () => NotAuthenticatedError,
|
|
76
89
|
NotImplementedError: () => NotImplementedError,
|
|
77
90
|
OAuthRefreshToken: () => OAuthRefreshToken,
|
|
78
91
|
OAuthSession: () => OAuthSession,
|
|
92
|
+
ONDO_NOT_TRADABLE_CODE: () => ONDO_NOT_TRADABLE_CODE,
|
|
79
93
|
ONDO_POLL_INTERVAL_MS: () => ONDO_POLL_INTERVAL_MS,
|
|
80
94
|
ONDO_QUOTE_MAX_TTL_MS: () => ONDO_QUOTE_MAX_TTL_MS,
|
|
81
95
|
ONDO_SETTLEMENT_ASSET: () => ONDO_SETTLEMENT_ASSET,
|
|
@@ -92,6 +106,7 @@ __export(universal_exports, {
|
|
|
92
106
|
OfferSlug: () => OfferSlug,
|
|
93
107
|
OfferSwapContract: () => OfferSwapContract,
|
|
94
108
|
OfferToken: () => OfferToken,
|
|
109
|
+
OfferVaultContract: () => OfferVaultContract,
|
|
95
110
|
OffersNamespaceImpl: () => OffersNamespaceImpl,
|
|
96
111
|
OndoBuyTransaction: () => OndoBuyTransaction,
|
|
97
112
|
OndoNamespaceImpl: () => OndoNamespaceImpl,
|
|
@@ -123,6 +138,7 @@ __export(universal_exports, {
|
|
|
123
138
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: () => SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
124
139
|
SWAP_LEVEL: () => SWAP_LEVEL,
|
|
125
140
|
SWAP_POLL_INTERVAL_MS: () => SWAP_POLL_INTERVAL_MS,
|
|
141
|
+
Seconds: () => Seconds,
|
|
126
142
|
ShortenedWalletAddress: () => ShortenedWalletAddress,
|
|
127
143
|
SolanaChain: () => SolanaChain,
|
|
128
144
|
StablecoinSymbol: () => StablecoinSymbol,
|
|
@@ -149,6 +165,7 @@ __export(universal_exports, {
|
|
|
149
165
|
ValidationError: () => ValidationError,
|
|
150
166
|
WalletAddress: () => WalletAddress,
|
|
151
167
|
WalletOwnershipChallenge: () => WalletOwnershipChallenge,
|
|
168
|
+
WalletSelection: () => WalletSelection,
|
|
152
169
|
WalletsNamespaceImpl: () => WalletsNamespaceImpl,
|
|
153
170
|
apiErrorCode: () => apiErrorCode,
|
|
154
171
|
applyBps: () => applyBps,
|
|
@@ -166,18 +183,22 @@ __export(universal_exports, {
|
|
|
166
183
|
formatBpsAsPercent: () => formatBpsAsPercent,
|
|
167
184
|
formatCompactAmount: () => formatCompactAmount,
|
|
168
185
|
formatRawAmount: () => formatRawAmount,
|
|
186
|
+
formatShareAmount: () => formatShareAmount,
|
|
169
187
|
formattedPricePerShare: () => formattedPricePerShare,
|
|
170
188
|
formattedUsdPrice: () => formattedUsdPrice,
|
|
171
189
|
generatePKCEParams: () => generatePKCEParams,
|
|
172
190
|
getChainId: () => getChainId,
|
|
173
191
|
getNetworkName: () => getNetworkName,
|
|
174
192
|
isChain: () => isChain,
|
|
193
|
+
isExpired: () => isExpired,
|
|
175
194
|
isOfferType: () => isOfferType,
|
|
195
|
+
isOndoNotTradableError: () => isOndoNotTradableError,
|
|
176
196
|
isSwapAvailable: () => isSwapAvailable,
|
|
177
197
|
offerDisplayTokens: () => offerDisplayTokens,
|
|
178
198
|
ondoQuoteOfferDeadline: () => ondoQuoteOfferDeadline,
|
|
179
199
|
parseBlockchainAmount: () => parseBlockchainAmount,
|
|
180
200
|
parseUint256: () => parseUint256,
|
|
201
|
+
resolveCentrifugeVaults: () => resolveCentrifugeVaults,
|
|
181
202
|
shortenAddress: () => shortenAddress,
|
|
182
203
|
superstateSwapContractAddress: () => superstateSwapContractAddress,
|
|
183
204
|
swapSpender: () => swapSpender,
|
|
@@ -187,6 +208,15 @@ __export(universal_exports, {
|
|
|
187
208
|
});
|
|
188
209
|
module.exports = __toCommonJS(universal_exports);
|
|
189
210
|
|
|
211
|
+
// src/universal/api/internal-access-token-source.ts
|
|
212
|
+
var SentWith = {
|
|
213
|
+
userToken: (token) => ({
|
|
214
|
+
type: "user-token",
|
|
215
|
+
token
|
|
216
|
+
}),
|
|
217
|
+
noUserToken: { type: "no-user-token" }
|
|
218
|
+
};
|
|
219
|
+
|
|
190
220
|
// src/universal/api/http-attributes.ts
|
|
191
221
|
var empty = {};
|
|
192
222
|
var concat = (left, right) => ({
|
|
@@ -214,6 +244,10 @@ var retryAttempt = (attempt) => ({
|
|
|
214
244
|
var renewAttempted = (value) => ({
|
|
215
245
|
renewAttempted: value
|
|
216
246
|
});
|
|
247
|
+
var notRetryable = () => ({ retryable: false });
|
|
248
|
+
var sentWith = (token) => ({
|
|
249
|
+
sentWith: token
|
|
250
|
+
});
|
|
217
251
|
var requestId = (id) => ({ requestId: id });
|
|
218
252
|
var getRequestId = (attrs) => attrs?.requestId ?? null;
|
|
219
253
|
var isProtected = (attrs) => attrs?.protected === true;
|
|
@@ -221,6 +255,8 @@ var needUserAgent = (attrs) => attrs?.userAgent === true;
|
|
|
221
255
|
var isIdempotent = (attrs) => attrs?.idempotencyKey === true;
|
|
222
256
|
var getRetryAttempt = (attrs) => attrs?.retryAttempt ?? 0;
|
|
223
257
|
var wasRenewAttempted = (attrs) => attrs?.renewAttempted === true;
|
|
258
|
+
var isRetryable = (attrs) => attrs?.retryable !== false;
|
|
259
|
+
var getSentWith = (attrs) => attrs?.sentWith === void 0 ? SentWith.noUserToken : SentWith.userToken(attrs.sentWith);
|
|
224
260
|
var getClientCredentials = (attrs) => attrs?.clientCredentials;
|
|
225
261
|
var Attributes = {
|
|
226
262
|
empty,
|
|
@@ -236,6 +272,10 @@ var Attributes = {
|
|
|
236
272
|
getRetryAttempt,
|
|
237
273
|
renewAttempted,
|
|
238
274
|
wasRenewAttempted,
|
|
275
|
+
notRetryable,
|
|
276
|
+
isRetryable,
|
|
277
|
+
sentWith,
|
|
278
|
+
getSentWith,
|
|
239
279
|
clientCredentials,
|
|
240
280
|
getClientCredentials,
|
|
241
281
|
requestId,
|
|
@@ -430,50 +470,6 @@ async function generatePKCEParams(config) {
|
|
|
430
470
|
};
|
|
431
471
|
}
|
|
432
472
|
|
|
433
|
-
// src/universal/types/pagination.ts
|
|
434
|
-
var Cursor = (value) => value;
|
|
435
|
-
var PaginatedResponse = {
|
|
436
|
-
fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
|
|
437
|
-
/**
|
|
438
|
-
* For a mapper that decides the page as a whole - one that drops items it
|
|
439
|
-
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
440
|
-
* cursors are the wire's either way: dropping an item changes what the
|
|
441
|
-
* page holds, not where the next page starts.
|
|
442
|
-
*/
|
|
443
|
-
fromDtoPage: (dto, pageMapper) => ({
|
|
444
|
-
data: pageMapper(dto.data),
|
|
445
|
-
startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
|
|
446
|
-
startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
|
|
447
|
-
})
|
|
448
|
-
};
|
|
449
|
-
var PaginationParams = {
|
|
450
|
-
toQueryParams: (params) => {
|
|
451
|
-
const queryParams = {};
|
|
452
|
-
if (params.after) {
|
|
453
|
-
queryParams.starting_after = params.after;
|
|
454
|
-
}
|
|
455
|
-
if (params.before) {
|
|
456
|
-
queryParams.starting_before = params.before;
|
|
457
|
-
}
|
|
458
|
-
if (params.limit) {
|
|
459
|
-
queryParams.limit = params.limit;
|
|
460
|
-
}
|
|
461
|
-
return queryParams;
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
// src/universal/types/asset.ts
|
|
466
|
-
var AssetId = (value) => value;
|
|
467
|
-
var AssetCode = (value) => value;
|
|
468
|
-
var Asset = {
|
|
469
|
-
fromDto: (dto) => ({
|
|
470
|
-
id: AssetId(dto.id),
|
|
471
|
-
code: AssetCode(dto.code),
|
|
472
|
-
name: dto.name,
|
|
473
|
-
fractionalDigits: dto.fractional_digits
|
|
474
|
-
})
|
|
475
|
-
};
|
|
476
|
-
|
|
477
473
|
// src/universal/types/errors.ts
|
|
478
474
|
var NotImplementedError = class extends Error {
|
|
479
475
|
constructor(message = "Not implemented yet") {
|
|
@@ -506,39 +502,8 @@ var MathError = class extends Error {
|
|
|
506
502
|
}
|
|
507
503
|
};
|
|
508
504
|
|
|
509
|
-
// src/universal/core/shared/
|
|
510
|
-
|
|
511
|
-
const type = dto.type;
|
|
512
|
-
throw new ValidationError(
|
|
513
|
-
`${model}.type: unknown type ${JSON.stringify(type)}`
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
function requiredString(value, field) {
|
|
517
|
-
const text = notBlankStringOrNull(value);
|
|
518
|
-
if (text === null) {
|
|
519
|
-
throw new ValidationError(
|
|
520
|
-
`${field}: expected a non-blank string, got ${typeof value === "string" ? "a blank string" : String(value)}`
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
return text;
|
|
524
|
-
}
|
|
525
|
-
function requiredDate(value, field) {
|
|
526
|
-
const date = typeof value === "string" ? new Date(value) : null;
|
|
527
|
-
if (date === null || Number.isNaN(date.getTime())) {
|
|
528
|
-
throw new ValidationError(
|
|
529
|
-
`${field}: expected a date, got ${JSON.stringify(value)}`
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
return date;
|
|
533
|
-
}
|
|
534
|
-
function requiredArray(value, field) {
|
|
535
|
-
if (!Array.isArray(value)) {
|
|
536
|
-
throw new ValidationError(
|
|
537
|
-
`${field}: expected an array, got ${typeof value}`
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
return value;
|
|
541
|
-
}
|
|
505
|
+
// src/universal/core/shared/blockchain/math.ts
|
|
506
|
+
var import_viem = require("viem");
|
|
542
507
|
|
|
543
508
|
// src/universal/types/blockchain/core.ts
|
|
544
509
|
var ETHEREUM_CHAINS = {
|
|
@@ -637,83 +602,720 @@ var StablecoinSymbol = (value) => value;
|
|
|
637
602
|
var KnownAssetSymbol = StablecoinSymbol;
|
|
638
603
|
var Bps = (value) => value;
|
|
639
604
|
|
|
640
|
-
// src/universal/
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
605
|
+
// src/universal/core/shared/blockchain/math.ts
|
|
606
|
+
function blockchainAmountFromRawOrThrow({
|
|
607
|
+
label,
|
|
608
|
+
raw,
|
|
609
|
+
decimals
|
|
610
|
+
}) {
|
|
611
|
+
const trimmed = raw.trim();
|
|
612
|
+
if (trimmed === "") {
|
|
613
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
614
|
+
}
|
|
615
|
+
let value;
|
|
616
|
+
try {
|
|
617
|
+
value = BigInt(trimmed);
|
|
618
|
+
} catch {
|
|
619
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
620
|
+
}
|
|
621
|
+
try {
|
|
622
|
+
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
623
|
+
} catch {
|
|
624
|
+
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function parseBlockchainAmount(amount, decimals) {
|
|
628
|
+
const trimmed = amount.trim();
|
|
629
|
+
if (trimmed === "") return { valid: false, reason: { type: "empty" } };
|
|
630
|
+
if (trimmed.startsWith("-")) {
|
|
631
|
+
return { valid: false, reason: { type: "negative" } };
|
|
632
|
+
}
|
|
633
|
+
if (/[eE]/.test(trimmed)) {
|
|
634
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
635
|
+
}
|
|
636
|
+
if (trimmed === ".") {
|
|
637
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
638
|
+
}
|
|
639
|
+
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
640
|
+
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
641
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
642
|
+
}
|
|
643
|
+
const [, fraction = ""] = normalised.split(".");
|
|
644
|
+
if (fraction.length > decimals) {
|
|
645
|
+
return {
|
|
646
|
+
valid: false,
|
|
647
|
+
reason: { type: "too-many-decimals", maxDecimals: decimals }
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
try {
|
|
651
|
+
const raw = (0, import_viem.parseUnits)(normalised, decimals);
|
|
652
|
+
if (raw > MAX_UINT_256) {
|
|
653
|
+
return { valid: false, reason: { type: "overflow" } };
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
valid: true,
|
|
657
|
+
amount: BlockchainAmount({ raw, decimals })
|
|
658
|
+
};
|
|
659
|
+
} catch {
|
|
660
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/universal/core/shared/utils/wire.ts
|
|
665
|
+
function unknownTypeError(dto, model) {
|
|
666
|
+
const type = dto.type;
|
|
667
|
+
throw new ValidationError(
|
|
668
|
+
`${model}.type: unknown type ${JSON.stringify(type)}`
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
function requiredString(value, field) {
|
|
672
|
+
const text = notBlankStringOrNull(value);
|
|
673
|
+
if (text === null) {
|
|
674
|
+
throw new ValidationError(
|
|
675
|
+
`${field}: expected a non-blank string, got ${typeof value === "string" ? "a blank string" : String(value)}`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
return text;
|
|
679
|
+
}
|
|
680
|
+
function requiredDate(value, field) {
|
|
681
|
+
const date = typeof value === "string" ? new Date(value) : null;
|
|
682
|
+
if (date === null || Number.isNaN(date.getTime())) {
|
|
683
|
+
throw new ValidationError(
|
|
684
|
+
`${field}: expected a date, got ${JSON.stringify(value)}`
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
return date;
|
|
688
|
+
}
|
|
689
|
+
function dateOrNull(value, field) {
|
|
690
|
+
return value === null ? null : requiredDate(value, field);
|
|
691
|
+
}
|
|
692
|
+
function decimalOrNull(value) {
|
|
693
|
+
return value === null ? null : DecimalString(value);
|
|
694
|
+
}
|
|
695
|
+
function requiredArray(value, field) {
|
|
696
|
+
if (!Array.isArray(value)) {
|
|
697
|
+
throw new ValidationError(
|
|
698
|
+
`${field}: expected an array, got ${typeof value}`
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
return value;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// src/universal/types/providers/centrifuge/centrifuge.ts
|
|
705
|
+
var CentrifugeVaultStatus = {
|
|
706
|
+
fromDto: (dto) => ({
|
|
707
|
+
chain: EthereumChain(dto.chain),
|
|
708
|
+
symbol: AssetSymbol(dto.symbol),
|
|
709
|
+
vaultAddress: EvmContractAddress(dto.vault_address),
|
|
710
|
+
linked: dto.linked,
|
|
711
|
+
permissioned: dto.permissioned,
|
|
712
|
+
membershipValidUntil: dateOrNull(
|
|
713
|
+
dto.membership_valid_until,
|
|
714
|
+
"CentrifugeVaultStatus.membership_valid_until"
|
|
715
|
+
),
|
|
716
|
+
halted: dto.halted,
|
|
717
|
+
priceUpdatedAt: dateOrNull(
|
|
718
|
+
dto.price_updated_at,
|
|
719
|
+
"CentrifugeVaultStatus.price_updated_at"
|
|
720
|
+
),
|
|
721
|
+
orderability: parseOrderability(
|
|
722
|
+
dto.can_order,
|
|
723
|
+
dto.reasons,
|
|
724
|
+
"CentrifugeVaultStatus"
|
|
725
|
+
),
|
|
726
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
|
|
658
727
|
})
|
|
659
728
|
};
|
|
660
|
-
var
|
|
729
|
+
var CentrifugeVaultBuyTransaction = {
|
|
661
730
|
fromDto: (dto) => {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
return {
|
|
672
|
-
...base2,
|
|
673
|
-
...OfferEditorial.fromDto(dto, "Offer"),
|
|
674
|
-
type: dto.type,
|
|
675
|
-
logoUrl: requiredString(dto.logo_url, "Offer.logo_url")
|
|
676
|
-
};
|
|
677
|
-
case "superstate::swap":
|
|
678
|
-
return {
|
|
679
|
-
...base2,
|
|
680
|
-
...OfferEditorial.fromDto(dto, "Offer"),
|
|
681
|
-
type: dto.type,
|
|
682
|
-
logoUrl: notBlankStringOrNull(dto.logo_url)
|
|
683
|
-
};
|
|
684
|
-
// `tagline`, `banner_url` and `starts_at` arrive as `null` and are left
|
|
685
|
-
// on the wire: copying them would hand every consumer a `startsAt` that
|
|
686
|
-
// is 1970 for one variant and a date for the others.
|
|
687
|
-
case "ondo::swap":
|
|
688
|
-
return {
|
|
689
|
-
...base2,
|
|
690
|
-
type: dto.type,
|
|
691
|
-
logoUrl: notBlankStringOrNull(dto.logo_url)
|
|
692
|
-
};
|
|
693
|
-
default:
|
|
694
|
-
return unknownTypeError(dto, "Offer");
|
|
731
|
+
const spendInputAmount = blockchainAmountFromRawOrThrow({
|
|
732
|
+
label: "spend_input_amount",
|
|
733
|
+
raw: dto.spend_input_amount,
|
|
734
|
+
decimals: AssetDecimals(dto.spend_input_decimals)
|
|
735
|
+
});
|
|
736
|
+
if (spendInputAmount.raw <= 0n) {
|
|
737
|
+
throw new ValidationError(
|
|
738
|
+
`spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
|
|
739
|
+
);
|
|
695
740
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
* reject the whole page, so one offer of an unknown type would blank the
|
|
702
|
-
* grid for every offer beside it. A single offer fetched by id still
|
|
703
|
-
* throws, because there is nothing beside it to keep.
|
|
704
|
-
*/
|
|
705
|
-
listFromDto: (dtos) => dtos.filter((dto) => isOfferType(dto.type)).map(Offer.fromDto)
|
|
741
|
+
return {
|
|
742
|
+
...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
|
|
743
|
+
spendInputAmount
|
|
744
|
+
};
|
|
745
|
+
}
|
|
706
746
|
};
|
|
707
|
-
var
|
|
747
|
+
var CentrifugeVaultClaimTransaction = {
|
|
708
748
|
fromDto: (dto) => ({
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
749
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
|
|
750
|
+
claimableShares: blockchainAmountFromRawOrThrow({
|
|
751
|
+
label: "claimable_shares",
|
|
752
|
+
raw: dto.claimable_shares,
|
|
753
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
754
|
+
})
|
|
755
|
+
})
|
|
756
|
+
};
|
|
757
|
+
var CentrifugeVaultPosition = {
|
|
758
|
+
fromDto: (dto) => {
|
|
759
|
+
const assetDecimals = AssetDecimals(dto.asset_decimals);
|
|
760
|
+
const shareDecimals = AssetDecimals(dto.share_decimals);
|
|
761
|
+
const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
|
|
762
|
+
const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
|
|
763
|
+
return {
|
|
764
|
+
chain: EthereumChain(dto.chain),
|
|
765
|
+
symbol: AssetSymbol(dto.symbol),
|
|
766
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
767
|
+
status: dto.status,
|
|
768
|
+
requested: asset("requested", dto.requested),
|
|
769
|
+
pending: asset("pending", dto.pending),
|
|
770
|
+
filledAssets: asset("filled_assets", dto.filled_assets),
|
|
771
|
+
earnedShares: shares("earned_shares", dto.earned_shares),
|
|
772
|
+
claimedShares: shares("claimed_shares", dto.claimed_shares),
|
|
773
|
+
claimableShares: shares("claimable_shares", dto.claimable_shares),
|
|
774
|
+
shareBalance: shares("share_balance", dto.share_balance),
|
|
775
|
+
averagePrice: decimalOrNull(dto.average_price),
|
|
776
|
+
frozen: dto.frozen,
|
|
777
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var CentrifugeVaultRedeemPosition = {
|
|
782
|
+
fromDto: (dto) => ({
|
|
783
|
+
chain: EthereumChain(dto.chain),
|
|
784
|
+
symbol: AssetSymbol(dto.symbol),
|
|
785
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
786
|
+
status: dto.status,
|
|
787
|
+
pending: blockchainAmountFromRawOrThrow({
|
|
788
|
+
label: "pending",
|
|
789
|
+
raw: dto.pending,
|
|
790
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
791
|
+
}),
|
|
792
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
793
|
+
label: "claimable_assets",
|
|
794
|
+
raw: dto.claimable_assets,
|
|
795
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
796
|
+
}),
|
|
797
|
+
frozen: dto.frozen,
|
|
798
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
|
|
799
|
+
})
|
|
800
|
+
};
|
|
801
|
+
var CentrifugeVaultLeg = {
|
|
802
|
+
/**
|
|
803
|
+
* What a claim on the leg would collect: shares for `invest`, the funding
|
|
804
|
+
* token for `redeem`.
|
|
805
|
+
*/
|
|
806
|
+
claimable: (leg) => {
|
|
807
|
+
switch (leg.direction) {
|
|
808
|
+
case "invest":
|
|
809
|
+
return leg.position.claimableShares;
|
|
810
|
+
case "redeem":
|
|
811
|
+
return leg.position.claimableAssets;
|
|
812
|
+
default: {
|
|
813
|
+
const exhaustive = leg;
|
|
814
|
+
return exhaustive;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
/** Whether the leg has anything queued or anything ready to claim. */
|
|
819
|
+
isActive: (leg) => leg.position.pending.raw > 0n || CentrifugeVaultLeg.claimable(leg).raw > 0n
|
|
820
|
+
};
|
|
821
|
+
var CentrifugeVaultLegId = {
|
|
822
|
+
/** Addresses compare case-insensitively: frontline echoes them lower case. */
|
|
823
|
+
of: (leg) => [
|
|
824
|
+
leg.direction,
|
|
825
|
+
leg.position.chain,
|
|
826
|
+
leg.position.walletAddress.toLowerCase()
|
|
827
|
+
].join(":")
|
|
828
|
+
};
|
|
829
|
+
var CentrifugeVaultClaimProceedsTransaction = {
|
|
830
|
+
fromDto: (dto) => ({
|
|
831
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimProceedsTransaction"),
|
|
832
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
833
|
+
label: "claimable_assets",
|
|
834
|
+
raw: dto.claimable_assets,
|
|
835
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
836
|
+
})
|
|
837
|
+
})
|
|
838
|
+
};
|
|
839
|
+
function parseOrderability(canOrder, reasons, model) {
|
|
840
|
+
const [first, ...rest] = reasons;
|
|
841
|
+
if (canOrder) {
|
|
842
|
+
if (first !== void 0) {
|
|
843
|
+
throw new ValidationError(
|
|
844
|
+
`${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
return { type: "orderable" };
|
|
848
|
+
}
|
|
849
|
+
if (first === void 0) {
|
|
850
|
+
throw new ValidationError(
|
|
851
|
+
`${model}.reasons: expected at least one when can_order is false`
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
return { type: "blocked", reasons: [first, ...rest] };
|
|
855
|
+
}
|
|
856
|
+
function parseTransactionCore(dto, model) {
|
|
857
|
+
return {
|
|
858
|
+
tx: {
|
|
859
|
+
to: EvmContractAddress(dto.to),
|
|
860
|
+
data: HexEncodedTransactionData(dto.data)
|
|
861
|
+
},
|
|
862
|
+
expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// src/universal/api/frontline/providers/centrifuge/centrifuge.ts
|
|
867
|
+
async function getCentrifugeVaultStatus(api, params) {
|
|
868
|
+
const dto = await api.send({
|
|
869
|
+
method: "GET",
|
|
870
|
+
url: "/v1/centrifuge/vault/status",
|
|
871
|
+
queryParams: {
|
|
872
|
+
symbol: params.symbol,
|
|
873
|
+
chain: params.chain
|
|
874
|
+
},
|
|
875
|
+
attributes: Attributes.protected()
|
|
876
|
+
});
|
|
877
|
+
return CentrifugeVaultStatus.fromDto(dto);
|
|
878
|
+
}
|
|
879
|
+
async function buildCentrifugeVaultBuy(api, params) {
|
|
880
|
+
const dto = await api.send({
|
|
881
|
+
method: "POST",
|
|
882
|
+
url: "/v1/centrifuge/vault/invest",
|
|
883
|
+
body: {
|
|
884
|
+
...walletFields(params),
|
|
885
|
+
amount: params.amount.raw.toString()
|
|
886
|
+
},
|
|
887
|
+
attributes: Attributes.protected()
|
|
888
|
+
});
|
|
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);
|
|
895
|
+
}
|
|
896
|
+
async function getCentrifugeVaultPosition(api, params) {
|
|
897
|
+
const dto = await api.send({
|
|
898
|
+
method: "GET",
|
|
899
|
+
url: "/v1/centrifuge/vault/position",
|
|
900
|
+
queryParams: walletFields(params),
|
|
901
|
+
attributes: Attributes.protected()
|
|
902
|
+
});
|
|
903
|
+
return CentrifugeVaultPosition.fromDto(dto);
|
|
904
|
+
}
|
|
905
|
+
async function getCentrifugeVaultRedeemPosition(api, params) {
|
|
906
|
+
const dto = await api.send({
|
|
907
|
+
method: "GET",
|
|
908
|
+
url: "/v1/centrifuge/vault/redeem-position",
|
|
909
|
+
queryParams: walletFields(params),
|
|
910
|
+
attributes: Attributes.protected()
|
|
911
|
+
});
|
|
912
|
+
return CentrifugeVaultRedeemPosition.fromDto(dto);
|
|
913
|
+
}
|
|
914
|
+
async function createCentrifugeVaultClaim(api, params) {
|
|
915
|
+
const dto = await api.send({
|
|
916
|
+
method: "POST",
|
|
917
|
+
url: "/v1/centrifuge/vault/claim",
|
|
918
|
+
body: walletFields(params),
|
|
919
|
+
attributes: Attributes.protected()
|
|
920
|
+
});
|
|
921
|
+
return CentrifugeVaultClaimTransaction.fromDto(dto);
|
|
922
|
+
}
|
|
923
|
+
async function createCentrifugeVaultClaimProceeds(api, params) {
|
|
924
|
+
const dto = await api.send({
|
|
925
|
+
method: "POST",
|
|
926
|
+
url: "/v1/centrifuge/vault/claim-proceeds",
|
|
927
|
+
body: walletFields(params),
|
|
928
|
+
attributes: Attributes.protected()
|
|
929
|
+
});
|
|
930
|
+
return CentrifugeVaultClaimProceedsTransaction.fromDto(dto);
|
|
931
|
+
}
|
|
932
|
+
function walletFields(params) {
|
|
933
|
+
return {
|
|
934
|
+
symbol: params.symbol,
|
|
935
|
+
chain: params.chain,
|
|
936
|
+
wallet_address: params.walletAddress
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/universal/core/shared/observability/log-cause.ts
|
|
941
|
+
var import_viem2 = require("viem");
|
|
942
|
+
function classifyLogCause(error) {
|
|
943
|
+
if (error instanceof HttpError) {
|
|
944
|
+
return httpCause(error);
|
|
945
|
+
}
|
|
946
|
+
if (error instanceof ValidationError) {
|
|
947
|
+
return { type: "validation", message: error.message };
|
|
948
|
+
}
|
|
949
|
+
if (error instanceof InvariantError) {
|
|
950
|
+
return { type: "invariant", message: error.message };
|
|
951
|
+
}
|
|
952
|
+
if (error instanceof MathError) {
|
|
953
|
+
return { type: "math", message: error.message };
|
|
954
|
+
}
|
|
955
|
+
if (error instanceof NotAuthenticatedError) {
|
|
956
|
+
return { type: "not-authenticated" };
|
|
957
|
+
}
|
|
958
|
+
if (error instanceof NotImplementedError) {
|
|
959
|
+
return { type: "not-implemented" };
|
|
960
|
+
}
|
|
961
|
+
if (error instanceof import_viem2.BaseError) {
|
|
962
|
+
const http = error.walk((e) => e instanceof HttpError);
|
|
963
|
+
if (http instanceof HttpError) {
|
|
964
|
+
return httpCause(http);
|
|
965
|
+
}
|
|
966
|
+
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
967
|
+
}
|
|
968
|
+
return { type: "generic-error", name: errorName(error) };
|
|
969
|
+
}
|
|
970
|
+
function rpcFailureReason(error) {
|
|
971
|
+
if (error.walk((e) => e instanceof import_viem2.ContractFunctionRevertedError)) {
|
|
972
|
+
return "reverted";
|
|
973
|
+
}
|
|
974
|
+
if (error.walk((e) => e instanceof import_viem2.RpcError)) {
|
|
975
|
+
return "node-rejected";
|
|
976
|
+
}
|
|
977
|
+
if (error.walk(
|
|
978
|
+
(e) => e instanceof import_viem2.HttpRequestError || e instanceof import_viem2.WebSocketRequestError || e instanceof import_viem2.SocketClosedError || e instanceof import_viem2.TimeoutError
|
|
979
|
+
)) {
|
|
980
|
+
return "transport";
|
|
981
|
+
}
|
|
982
|
+
if (error instanceof import_viem2.ContractFunctionExecutionError) {
|
|
983
|
+
return "malformed-response";
|
|
984
|
+
}
|
|
985
|
+
return "unknown";
|
|
986
|
+
}
|
|
987
|
+
function describeErrorUnredacted(error) {
|
|
988
|
+
if (error instanceof HttpError) {
|
|
989
|
+
return describeHttpErrorRedacted(error);
|
|
990
|
+
}
|
|
991
|
+
if (error instanceof Error) {
|
|
992
|
+
return `${error.name}: ${error.message}`;
|
|
993
|
+
}
|
|
994
|
+
return `thrown non-error: ${stringifyUnredacted(error)}`;
|
|
995
|
+
}
|
|
996
|
+
function stringifyUnredacted(value) {
|
|
997
|
+
if (value === void 0) return "";
|
|
998
|
+
try {
|
|
999
|
+
return JSON.stringify(
|
|
1000
|
+
value,
|
|
1001
|
+
(_key, item) => typeof item === "bigint" ? `${item}` : item
|
|
1002
|
+
) ?? String(value);
|
|
1003
|
+
} catch (_) {
|
|
1004
|
+
return "<unserializable>";
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
function describeHttpErrorRedacted(error) {
|
|
1008
|
+
const code = apiErrorCode(error);
|
|
1009
|
+
const status = error.response.status;
|
|
1010
|
+
return code === null ? `HttpError ${status}` : `HttpError ${status} (${code})`;
|
|
1011
|
+
}
|
|
1012
|
+
function errorName(error) {
|
|
1013
|
+
return error instanceof Error ? error.name : `non-error ${typeof error}`;
|
|
1014
|
+
}
|
|
1015
|
+
function httpCause(error) {
|
|
1016
|
+
return {
|
|
1017
|
+
type: "http",
|
|
1018
|
+
requestId: error.requestId,
|
|
1019
|
+
status: error.response.status,
|
|
1020
|
+
code: apiErrorCode(error),
|
|
1021
|
+
eventId: apiErrorEventId(error)
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
function apiErrorEventId(error) {
|
|
1025
|
+
const body = error.response.body;
|
|
1026
|
+
if (typeof body !== "object" || body === null) return null;
|
|
1027
|
+
const eventId = body.event_id;
|
|
1028
|
+
return typeof eventId === "string" ? eventId : null;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// src/universal/core/shared/observability/internal-logger.ts
|
|
1032
|
+
function internalLogger(logger, scope) {
|
|
1033
|
+
return logger ? scopedLogger(logger, scope, {}) : noopInternalLogger;
|
|
1034
|
+
}
|
|
1035
|
+
var LEVEL_RANK = {
|
|
1036
|
+
none: 0,
|
|
1037
|
+
error: 1,
|
|
1038
|
+
warn: 2,
|
|
1039
|
+
info: 3,
|
|
1040
|
+
debug: 4
|
|
1041
|
+
};
|
|
1042
|
+
function scopedLogger(logger, scope, bindings) {
|
|
1043
|
+
const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
|
|
1044
|
+
const safe = (event) => ({
|
|
1045
|
+
msg: event.msg,
|
|
1046
|
+
scope,
|
|
1047
|
+
bindings,
|
|
1048
|
+
fields: event.fields ?? {},
|
|
1049
|
+
...event.cause === void 0 ? {} : { cause: event.cause }
|
|
1050
|
+
});
|
|
1051
|
+
const unredacted = (event) => ({
|
|
1052
|
+
msg: event.msg,
|
|
1053
|
+
scope,
|
|
1054
|
+
bindings,
|
|
1055
|
+
fields: event.fields ?? {}
|
|
1056
|
+
});
|
|
1057
|
+
const self = {
|
|
1058
|
+
child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
|
|
1059
|
+
debug: (event) => {
|
|
1060
|
+
if (admits("debug")) logger.debug(() => unredacted(event()));
|
|
1061
|
+
},
|
|
1062
|
+
info: (event) => {
|
|
1063
|
+
if (admits("info")) logger.info(() => safe(event()));
|
|
1064
|
+
},
|
|
1065
|
+
warn: (event) => {
|
|
1066
|
+
if (admits("warn")) logger.warn(() => safe(event()));
|
|
1067
|
+
},
|
|
1068
|
+
error: (event) => {
|
|
1069
|
+
if (admits("error")) logger.error(() => safe(event()));
|
|
1070
|
+
},
|
|
1071
|
+
failure: (event, error) => {
|
|
1072
|
+
if (admits("debug"))
|
|
1073
|
+
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1074
|
+
if (admits("error")) logger.error(() => safe(classified(event(), error)));
|
|
1075
|
+
},
|
|
1076
|
+
warning: (event, error) => {
|
|
1077
|
+
if (admits("debug"))
|
|
1078
|
+
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1079
|
+
if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
|
|
1080
|
+
},
|
|
1081
|
+
wrap: async (op, params, run) => {
|
|
1082
|
+
const opLog = self.child({ op });
|
|
1083
|
+
opLog.debug(() => ({ msg: "call", fields: { params } }));
|
|
1084
|
+
try {
|
|
1085
|
+
return await run();
|
|
1086
|
+
} catch (error) {
|
|
1087
|
+
opLog.failure(() => ({ msg: "call failed" }), error);
|
|
1088
|
+
throw error;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
return self;
|
|
1093
|
+
}
|
|
1094
|
+
function verbatim(event, error) {
|
|
1095
|
+
return {
|
|
1096
|
+
msg: event.msg,
|
|
1097
|
+
fields: { ...event.fields, error: describeErrorUnredacted(error) }
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function classified(event, error) {
|
|
1101
|
+
return { ...event, cause: event.cause ?? classifyLogCause(error) };
|
|
1102
|
+
}
|
|
1103
|
+
var noopInternalLogger = {
|
|
1104
|
+
child: () => noopInternalLogger,
|
|
1105
|
+
debug: () => void 0,
|
|
1106
|
+
info: () => void 0,
|
|
1107
|
+
warn: () => void 0,
|
|
1108
|
+
error: () => void 0,
|
|
1109
|
+
failure: () => void 0,
|
|
1110
|
+
warning: () => void 0,
|
|
1111
|
+
wrap: (_op, _params, run) => run()
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
|
|
1115
|
+
var CentrifugeNamespaceImpl = class {
|
|
1116
|
+
constructor(ctx) {
|
|
1117
|
+
this.ctx = ctx;
|
|
1118
|
+
this.log = internalLogger(ctx.logger, "CENTRIFUGE");
|
|
1119
|
+
}
|
|
1120
|
+
async getVaultStatus(params) {
|
|
1121
|
+
return this.log.wrap("getVaultStatus", params, async () => {
|
|
1122
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1123
|
+
return getCentrifugeVaultStatus(this.ctx.api, params);
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
async getPosition(params) {
|
|
1127
|
+
return this.log.wrap("getPosition", params, async () => {
|
|
1128
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1129
|
+
return getCentrifugeVaultPosition(this.ctx.api, params);
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
async getRedeemPosition(params) {
|
|
1133
|
+
return this.log.wrap("getRedeemPosition", params, async () => {
|
|
1134
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1135
|
+
return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
async createClaim(params) {
|
|
1139
|
+
return this.log.wrap("createClaim", params, async () => {
|
|
1140
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1141
|
+
return createCentrifugeVaultClaim(this.ctx.api, params);
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
async createClaimProceeds(params) {
|
|
1145
|
+
return this.log.wrap("createClaimProceeds", params, async () => {
|
|
1146
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1147
|
+
return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
|
|
1148
|
+
});
|
|
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
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// src/universal/core/checkout/centrifuge/constants.ts
|
|
1159
|
+
var CENTRIFUGE_POLL_INTERVAL_MS = 15e3;
|
|
1160
|
+
|
|
1161
|
+
// src/universal/core/checkout/centrifuge/vaults.ts
|
|
1162
|
+
function resolveCentrifugeVaults(offer, lookup) {
|
|
1163
|
+
return offer.vaultContracts.map((contract) => {
|
|
1164
|
+
const { chain } = contract;
|
|
1165
|
+
if (!isEthereumChain(chain)) {
|
|
1166
|
+
return { type: "unresolved", chain, missing: "evm-chain" };
|
|
1167
|
+
}
|
|
1168
|
+
const onChain = (role) => offer.tokens.filter(
|
|
1169
|
+
(token) => token.role === role && token.chain === chain
|
|
1170
|
+
);
|
|
1171
|
+
const share = firstKnown(onChain("vault"), lookup);
|
|
1172
|
+
if (share === null) {
|
|
1173
|
+
return { type: "unresolved", chain, missing: "share-token" };
|
|
1174
|
+
}
|
|
1175
|
+
const funding = firstKnown(onChain("funding"), lookup);
|
|
1176
|
+
if (funding === null) {
|
|
1177
|
+
return { type: "unresolved", chain, missing: "funding-token" };
|
|
1178
|
+
}
|
|
1179
|
+
return {
|
|
1180
|
+
type: "resolved",
|
|
1181
|
+
vault: { chain, proxy: contract.address, share, funding }
|
|
1182
|
+
};
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
function firstKnown(tokens, lookup) {
|
|
1186
|
+
for (const token of tokens) {
|
|
1187
|
+
const metadata = lookup(token);
|
|
1188
|
+
if (metadata !== null) return metadata;
|
|
1189
|
+
}
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
function isEthereumChain(chain) {
|
|
1193
|
+
return chain in ETHEREUM_CHAINS;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// src/universal/types/pagination.ts
|
|
1197
|
+
var Cursor = (value) => value;
|
|
1198
|
+
var PaginatedResponse = {
|
|
1199
|
+
fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
|
|
1200
|
+
/**
|
|
1201
|
+
* For a mapper that decides the page as a whole - one that drops items it
|
|
1202
|
+
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
1203
|
+
* cursors are the wire's either way: dropping an item changes what the
|
|
1204
|
+
* page holds, not where the next page starts.
|
|
1205
|
+
*/
|
|
1206
|
+
fromDtoPage: (dto, pageMapper) => ({
|
|
1207
|
+
data: pageMapper(dto.data),
|
|
1208
|
+
startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
|
|
1209
|
+
startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
|
|
1210
|
+
})
|
|
1211
|
+
};
|
|
1212
|
+
var PaginationParams = {
|
|
1213
|
+
toQueryParams: (params) => {
|
|
1214
|
+
const queryParams = {};
|
|
1215
|
+
if (params.after) {
|
|
1216
|
+
queryParams.starting_after = params.after;
|
|
1217
|
+
}
|
|
1218
|
+
if (params.before) {
|
|
1219
|
+
queryParams.starting_before = params.before;
|
|
1220
|
+
}
|
|
1221
|
+
if (params.limit) {
|
|
1222
|
+
queryParams.limit = params.limit;
|
|
1223
|
+
}
|
|
1224
|
+
return queryParams;
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
// src/universal/types/asset.ts
|
|
1229
|
+
var AssetId = (value) => value;
|
|
1230
|
+
var AssetCode = (value) => value;
|
|
1231
|
+
var Asset = {
|
|
1232
|
+
fromDto: (dto) => ({
|
|
1233
|
+
id: AssetId(dto.id),
|
|
1234
|
+
code: AssetCode(dto.code),
|
|
1235
|
+
name: dto.name,
|
|
1236
|
+
fractionalDigits: dto.fractional_digits
|
|
1237
|
+
})
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
// src/universal/types/offer.ts
|
|
1241
|
+
var OfferId = (value) => value;
|
|
1242
|
+
var OfferSlug = (value) => value;
|
|
1243
|
+
var OFFER_TYPES = {
|
|
1244
|
+
"coinlist::token_sale": true,
|
|
1245
|
+
"superstate::swap": true,
|
|
1246
|
+
"ondo::swap": true,
|
|
1247
|
+
"centrifuge::vault": true
|
|
1248
|
+
};
|
|
1249
|
+
var isOfferType = (value) => Object.keys(OFFER_TYPES).includes(value);
|
|
1250
|
+
var OfferEditorial = {
|
|
1251
|
+
/**
|
|
1252
|
+
* `model` prefixes the field in the error (`'Offer'`, `'OfferDetail'`), so
|
|
1253
|
+
* the same three checks name the payload that failed them.
|
|
1254
|
+
*/
|
|
1255
|
+
fromDto: (dto, model) => ({
|
|
1256
|
+
tagline: requiredString(dto.tagline, `${model}.tagline`),
|
|
1257
|
+
bannerUrl: requiredString(dto.banner_url, `${model}.banner_url`),
|
|
1258
|
+
startsAt: requiredDate(dto.starts_at, `${model}.starts_at`)
|
|
1259
|
+
})
|
|
1260
|
+
};
|
|
1261
|
+
var Offer = {
|
|
1262
|
+
fromDto: (dto) => {
|
|
1263
|
+
const tokens = requiredArray(dto.tokens, "Offer.tokens");
|
|
1264
|
+
const base2 = {
|
|
1265
|
+
id: OfferId(dto.id),
|
|
1266
|
+
slug: OfferSlug(dto.slug),
|
|
1267
|
+
endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
|
|
1268
|
+
tokens: OfferToken.listFromDto(tokens)
|
|
1269
|
+
};
|
|
1270
|
+
switch (dto.type) {
|
|
1271
|
+
case "coinlist::token_sale":
|
|
1272
|
+
return {
|
|
1273
|
+
...base2,
|
|
1274
|
+
...OfferEditorial.fromDto(dto, "Offer"),
|
|
1275
|
+
type: dto.type,
|
|
1276
|
+
logoUrl: requiredString(dto.logo_url, "Offer.logo_url")
|
|
1277
|
+
};
|
|
1278
|
+
case "superstate::swap":
|
|
1279
|
+
return {
|
|
1280
|
+
...base2,
|
|
1281
|
+
...OfferEditorial.fromDto(dto, "Offer"),
|
|
1282
|
+
type: dto.type,
|
|
1283
|
+
logoUrl: notBlankStringOrNull(dto.logo_url)
|
|
1284
|
+
};
|
|
1285
|
+
// `tagline`, `banner_url` and `starts_at` arrive as `null` and are left
|
|
1286
|
+
// on the wire: copying them would hand every consumer a `startsAt` that
|
|
1287
|
+
// is 1970 for one variant and a date for the others.
|
|
1288
|
+
case "ondo::swap":
|
|
1289
|
+
case "centrifuge::vault":
|
|
1290
|
+
return {
|
|
1291
|
+
...base2,
|
|
1292
|
+
type: dto.type,
|
|
1293
|
+
logoUrl: notBlankStringOrNull(dto.logo_url)
|
|
1294
|
+
};
|
|
1295
|
+
default:
|
|
1296
|
+
return unknownTypeError(dto, "Offer");
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
/**
|
|
1300
|
+
* Maps a page of offers, dropping every offer whose `type` this SDK does not
|
|
1301
|
+
* name. The same reasoning as {@link OfferToken.listFromDto}: a plain `.map`
|
|
1302
|
+
* would throw out of `fromDto` and, through `PaginatedResponse.fromDto`,
|
|
1303
|
+
* reject the whole page, so one offer of an unknown type would blank the
|
|
1304
|
+
* grid for every offer beside it. A single offer fetched by id still
|
|
1305
|
+
* throws, because there is nothing beside it to keep.
|
|
1306
|
+
*/
|
|
1307
|
+
listFromDto: (dtos) => dtos.filter((dto) => isOfferType(dto.type)).map(Offer.fromDto)
|
|
1308
|
+
};
|
|
1309
|
+
var OfferToken = {
|
|
1310
|
+
fromDto: (dto) => ({
|
|
1311
|
+
role: dto.role,
|
|
1312
|
+
chain: Chain(dto.chain),
|
|
1313
|
+
address: EvmContractAddress(dto.address)
|
|
1314
|
+
}),
|
|
1315
|
+
/**
|
|
1316
|
+
* Maps an offer's token list, dropping every token on a chain this SDK does
|
|
1317
|
+
* not name. Frontline's chain registry runs ahead of {@link Chain}, and a
|
|
1318
|
+
* plain `.map` would throw out of `Offer.fromDto` and, through
|
|
717
1319
|
* `PaginatedResponse.fromDto`, reject the whole offers page - which is how
|
|
718
1320
|
* one Base token blanked production's offers list. Dropping costs that
|
|
719
1321
|
* token's metadata alone: `coinlist.tokens.get` takes an `EthereumChain`,
|
|
@@ -729,6 +1331,30 @@ var Ticker = (value) => value;
|
|
|
729
1331
|
var Isin = (value) => value;
|
|
730
1332
|
|
|
731
1333
|
// src/universal/types/offer-detail.ts
|
|
1334
|
+
var AsyncOfferDetail = {
|
|
1335
|
+
/**
|
|
1336
|
+
* Narrows an offer fetched generically, e.g. on an offer page, to one with
|
|
1337
|
+
* something to claim.
|
|
1338
|
+
*
|
|
1339
|
+
* An exhaustive `switch` rather than a list of async types, so a new offer
|
|
1340
|
+
* type is a compile error here until someone decides whether it settles
|
|
1341
|
+
* later.
|
|
1342
|
+
*/
|
|
1343
|
+
is: (offer) => {
|
|
1344
|
+
switch (offer.type) {
|
|
1345
|
+
case "centrifuge::vault":
|
|
1346
|
+
return true;
|
|
1347
|
+
case "ondo::swap":
|
|
1348
|
+
case "superstate::swap":
|
|
1349
|
+
case "coinlist::token_sale":
|
|
1350
|
+
return false;
|
|
1351
|
+
default: {
|
|
1352
|
+
const exhaustive = offer;
|
|
1353
|
+
return exhaustive;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
732
1358
|
var OfferOptionId = (value) => value;
|
|
733
1359
|
var OfferOptionSlug = (value) => value;
|
|
734
1360
|
var OfferSwapContract = {
|
|
@@ -737,6 +1363,19 @@ var OfferSwapContract = {
|
|
|
737
1363
|
address: EvmContractAddress(dto.address)
|
|
738
1364
|
})
|
|
739
1365
|
};
|
|
1366
|
+
var OfferVaultContract = {
|
|
1367
|
+
fromDto: (dto) => ({
|
|
1368
|
+
chain: Chain(dto.chain),
|
|
1369
|
+
address: EvmContractAddress(dto.address)
|
|
1370
|
+
}),
|
|
1371
|
+
/**
|
|
1372
|
+
* Drops every proxy on a chain this SDK does not name, as
|
|
1373
|
+
* `OfferToken.listFromDto` does: frontline publishes the full offer-token
|
|
1374
|
+
* chain list, which runs ahead of {@link Chain}, and one unmodelled chain
|
|
1375
|
+
* should not throw away the proxies the SDK can use.
|
|
1376
|
+
*/
|
|
1377
|
+
listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferVaultContract.fromDto)
|
|
1378
|
+
};
|
|
740
1379
|
var OfferDetail = {
|
|
741
1380
|
fromDto: (dto) => {
|
|
742
1381
|
const fundingAssets = requiredArray(
|
|
@@ -799,6 +1438,18 @@ var OfferDetail = {
|
|
|
799
1438
|
"OfferDetail.swap_contracts"
|
|
800
1439
|
).map(OfferSwapContract.fromDto)
|
|
801
1440
|
};
|
|
1441
|
+
// No editorial, as for Ondo. `[]` is fine and a missing key is not, for
|
|
1442
|
+
// the same reason as `swap_contracts`: this is the spender a user
|
|
1443
|
+
// approves.
|
|
1444
|
+
case "centrifuge::vault":
|
|
1445
|
+
return {
|
|
1446
|
+
...base2,
|
|
1447
|
+
type: dto.type,
|
|
1448
|
+
logoUrl: notBlankStringOrNull(dto.logo_url),
|
|
1449
|
+
vaultContracts: OfferVaultContract.listFromDto(
|
|
1450
|
+
requiredArray(dto.vault_contracts, "OfferDetail.vault_contracts")
|
|
1451
|
+
)
|
|
1452
|
+
};
|
|
802
1453
|
default:
|
|
803
1454
|
return unknownTypeError(dto, "OfferDetail");
|
|
804
1455
|
}
|
|
@@ -856,246 +1507,72 @@ var ParticipationsPaginationParams = {
|
|
|
856
1507
|
}
|
|
857
1508
|
return queryParams;
|
|
858
1509
|
}
|
|
859
|
-
};
|
|
860
|
-
var Participation = {
|
|
861
|
-
/** Maps API DTO shape into the SDK participation domain model. */
|
|
862
|
-
fromDto: (dto) => {
|
|
863
|
-
const walletAddress = notBlankStringOrNull(dto.wallet_address);
|
|
864
|
-
return {
|
|
865
|
-
id: ParticipationId(dto.id),
|
|
866
|
-
offerId: OfferId(dto.offer_id),
|
|
867
|
-
offerOptionId: OfferOptionId(dto.offer_option_id),
|
|
868
|
-
status: dto.status,
|
|
869
|
-
amount: dto.amount,
|
|
870
|
-
displayAmount: dto.amount_string,
|
|
871
|
-
asset: Asset.fromDto(dto.asset),
|
|
872
|
-
chain: Blockchain(dto.chain),
|
|
873
|
-
insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
|
|
874
|
-
updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
|
|
875
|
-
walletAddress: walletAddress ? WalletAddress(walletAddress) : null
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
var CreateParticipationParams = {
|
|
880
|
-
/** Maps participation creation params into API DTO payload. */
|
|
881
|
-
toDto: (params) => ({
|
|
882
|
-
offer_id: params.offerId,
|
|
883
|
-
offer_option_id: params.offerOptionId,
|
|
884
|
-
chain: params.chain,
|
|
885
|
-
wallet_address: params.walletAddress,
|
|
886
|
-
amount: params.amount,
|
|
887
|
-
asset_id: params.assetId,
|
|
888
|
-
approval_transaction_hash: params.approvalTransactionHash
|
|
889
|
-
})
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
// src/universal/api/frontline/providers/coin-list/token-sale.ts
|
|
893
|
-
async function fetchParticipations(api, offerId) {
|
|
894
|
-
return fetchAllPages(
|
|
895
|
-
(params) => fetchParticipationsPage(api, params),
|
|
896
|
-
{ offerId }
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
async function fetchParticipationsPage(api, params) {
|
|
900
|
-
const pageDto = await api.send({
|
|
901
|
-
method: "GET",
|
|
902
|
-
url: "/v1/participations",
|
|
903
|
-
queryParams: ParticipationsPaginationParams.toQueryParams(params),
|
|
904
|
-
attributes: Attributes.protected()
|
|
905
|
-
});
|
|
906
|
-
return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
|
|
907
|
-
}
|
|
908
|
-
async function fetchParticipation(api, id) {
|
|
909
|
-
const dto = await api.send({
|
|
910
|
-
method: "GET",
|
|
911
|
-
url: `/v1/participations/${id}`,
|
|
912
|
-
attributes: Attributes.protected()
|
|
913
|
-
});
|
|
914
|
-
return Participation.fromDto(dto);
|
|
915
|
-
}
|
|
916
|
-
async function createParticipation(api, params) {
|
|
917
|
-
const dto = await api.send({
|
|
918
|
-
method: "POST",
|
|
919
|
-
url: "/v1/participations",
|
|
920
|
-
body: CreateParticipationParams.toDto(params),
|
|
921
|
-
attributes: Attributes.protected()
|
|
922
|
-
});
|
|
923
|
-
return Participation.fromDto(dto);
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
// src/universal/core/shared/observability/log-cause.ts
|
|
927
|
-
var import_viem = require("viem");
|
|
928
|
-
function classifyLogCause(error) {
|
|
929
|
-
if (error instanceof HttpError) {
|
|
930
|
-
return httpCause(error);
|
|
931
|
-
}
|
|
932
|
-
if (error instanceof ValidationError) {
|
|
933
|
-
return { type: "validation", message: error.message };
|
|
934
|
-
}
|
|
935
|
-
if (error instanceof InvariantError) {
|
|
936
|
-
return { type: "invariant", message: error.message };
|
|
937
|
-
}
|
|
938
|
-
if (error instanceof MathError) {
|
|
939
|
-
return { type: "math", message: error.message };
|
|
940
|
-
}
|
|
941
|
-
if (error instanceof NotAuthenticatedError) {
|
|
942
|
-
return { type: "not-authenticated" };
|
|
943
|
-
}
|
|
944
|
-
if (error instanceof NotImplementedError) {
|
|
945
|
-
return { type: "not-implemented" };
|
|
946
|
-
}
|
|
947
|
-
if (error instanceof import_viem.BaseError) {
|
|
948
|
-
const http = error.walk((e) => e instanceof HttpError);
|
|
949
|
-
if (http instanceof HttpError) {
|
|
950
|
-
return httpCause(http);
|
|
951
|
-
}
|
|
952
|
-
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
953
|
-
}
|
|
954
|
-
return { type: "generic-error", name: errorName(error) };
|
|
955
|
-
}
|
|
956
|
-
function rpcFailureReason(error) {
|
|
957
|
-
if (error.walk((e) => e instanceof import_viem.ContractFunctionRevertedError)) {
|
|
958
|
-
return "reverted";
|
|
959
|
-
}
|
|
960
|
-
if (error.walk((e) => e instanceof import_viem.RpcError)) {
|
|
961
|
-
return "node-rejected";
|
|
962
|
-
}
|
|
963
|
-
if (error.walk(
|
|
964
|
-
(e) => e instanceof import_viem.HttpRequestError || e instanceof import_viem.WebSocketRequestError || e instanceof import_viem.SocketClosedError || e instanceof import_viem.TimeoutError
|
|
965
|
-
)) {
|
|
966
|
-
return "transport";
|
|
967
|
-
}
|
|
968
|
-
if (error instanceof import_viem.ContractFunctionExecutionError) {
|
|
969
|
-
return "malformed-response";
|
|
970
|
-
}
|
|
971
|
-
return "unknown";
|
|
972
|
-
}
|
|
973
|
-
function describeErrorUnredacted(error) {
|
|
974
|
-
if (error instanceof HttpError) {
|
|
975
|
-
return describeHttpErrorRedacted(error);
|
|
976
|
-
}
|
|
977
|
-
if (error instanceof Error) {
|
|
978
|
-
return `${error.name}: ${error.message}`;
|
|
979
|
-
}
|
|
980
|
-
return `thrown non-error: ${stringifyUnredacted(error)}`;
|
|
981
|
-
}
|
|
982
|
-
function stringifyUnredacted(value) {
|
|
983
|
-
if (value === void 0) return "";
|
|
984
|
-
try {
|
|
985
|
-
return JSON.stringify(
|
|
986
|
-
value,
|
|
987
|
-
(_key, item) => typeof item === "bigint" ? `${item}` : item
|
|
988
|
-
) ?? String(value);
|
|
989
|
-
} catch (_) {
|
|
990
|
-
return "<unserializable>";
|
|
1510
|
+
};
|
|
1511
|
+
var Participation = {
|
|
1512
|
+
/** Maps API DTO shape into the SDK participation domain model. */
|
|
1513
|
+
fromDto: (dto) => {
|
|
1514
|
+
const walletAddress = notBlankStringOrNull(dto.wallet_address);
|
|
1515
|
+
return {
|
|
1516
|
+
id: ParticipationId(dto.id),
|
|
1517
|
+
offerId: OfferId(dto.offer_id),
|
|
1518
|
+
offerOptionId: OfferOptionId(dto.offer_option_id),
|
|
1519
|
+
status: dto.status,
|
|
1520
|
+
amount: dto.amount,
|
|
1521
|
+
displayAmount: dto.amount_string,
|
|
1522
|
+
asset: Asset.fromDto(dto.asset),
|
|
1523
|
+
chain: Blockchain(dto.chain),
|
|
1524
|
+
insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
|
|
1525
|
+
updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
|
|
1526
|
+
walletAddress: walletAddress ? WalletAddress(walletAddress) : null
|
|
1527
|
+
};
|
|
991
1528
|
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
status: error.response.status,
|
|
1006
|
-
code: apiErrorCode(error),
|
|
1007
|
-
eventId: apiErrorEventId(error)
|
|
1008
|
-
};
|
|
1009
|
-
}
|
|
1010
|
-
function apiErrorEventId(error) {
|
|
1011
|
-
const body = error.response.body;
|
|
1012
|
-
if (typeof body !== "object" || body === null) return null;
|
|
1013
|
-
const eventId = body.event_id;
|
|
1014
|
-
return typeof eventId === "string" ? eventId : null;
|
|
1015
|
-
}
|
|
1529
|
+
};
|
|
1530
|
+
var CreateParticipationParams = {
|
|
1531
|
+
/** Maps participation creation params into API DTO payload. */
|
|
1532
|
+
toDto: (params) => ({
|
|
1533
|
+
offer_id: params.offerId,
|
|
1534
|
+
offer_option_id: params.offerOptionId,
|
|
1535
|
+
chain: params.chain,
|
|
1536
|
+
wallet_address: params.walletAddress,
|
|
1537
|
+
amount: params.amount,
|
|
1538
|
+
asset_id: params.assetId,
|
|
1539
|
+
approval_transaction_hash: params.approvalTransactionHash
|
|
1540
|
+
})
|
|
1541
|
+
};
|
|
1016
1542
|
|
|
1017
|
-
// src/universal/
|
|
1018
|
-
function
|
|
1019
|
-
return
|
|
1543
|
+
// src/universal/api/frontline/providers/coin-list/token-sale.ts
|
|
1544
|
+
async function fetchParticipations(api, offerId) {
|
|
1545
|
+
return fetchAllPages(
|
|
1546
|
+
(params) => fetchParticipationsPage(api, params),
|
|
1547
|
+
{ offerId }
|
|
1548
|
+
);
|
|
1020
1549
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
};
|
|
1028
|
-
function scopedLogger(logger, scope, bindings) {
|
|
1029
|
-
const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
|
|
1030
|
-
const safe = (event) => ({
|
|
1031
|
-
msg: event.msg,
|
|
1032
|
-
scope,
|
|
1033
|
-
bindings,
|
|
1034
|
-
fields: event.fields ?? {},
|
|
1035
|
-
...event.cause === void 0 ? {} : { cause: event.cause }
|
|
1036
|
-
});
|
|
1037
|
-
const unredacted = (event) => ({
|
|
1038
|
-
msg: event.msg,
|
|
1039
|
-
scope,
|
|
1040
|
-
bindings,
|
|
1041
|
-
fields: event.fields ?? {}
|
|
1550
|
+
async function fetchParticipationsPage(api, params) {
|
|
1551
|
+
const pageDto = await api.send({
|
|
1552
|
+
method: "GET",
|
|
1553
|
+
url: "/v1/participations",
|
|
1554
|
+
queryParams: ParticipationsPaginationParams.toQueryParams(params),
|
|
1555
|
+
attributes: Attributes.protected()
|
|
1042
1556
|
});
|
|
1043
|
-
|
|
1044
|
-
child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
|
|
1045
|
-
debug: (event) => {
|
|
1046
|
-
if (admits("debug")) logger.debug(() => unredacted(event()));
|
|
1047
|
-
},
|
|
1048
|
-
info: (event) => {
|
|
1049
|
-
if (admits("info")) logger.info(() => safe(event()));
|
|
1050
|
-
},
|
|
1051
|
-
warn: (event) => {
|
|
1052
|
-
if (admits("warn")) logger.warn(() => safe(event()));
|
|
1053
|
-
},
|
|
1054
|
-
error: (event) => {
|
|
1055
|
-
if (admits("error")) logger.error(() => safe(event()));
|
|
1056
|
-
},
|
|
1057
|
-
failure: (event, error) => {
|
|
1058
|
-
if (admits("debug"))
|
|
1059
|
-
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1060
|
-
if (admits("error")) logger.error(() => safe(classified(event(), error)));
|
|
1061
|
-
},
|
|
1062
|
-
warning: (event, error) => {
|
|
1063
|
-
if (admits("debug"))
|
|
1064
|
-
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1065
|
-
if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
|
|
1066
|
-
},
|
|
1067
|
-
wrap: async (op, params, run) => {
|
|
1068
|
-
const opLog = self.child({ op });
|
|
1069
|
-
opLog.debug(() => ({ msg: "call", fields: { params } }));
|
|
1070
|
-
try {
|
|
1071
|
-
return await run();
|
|
1072
|
-
} catch (error) {
|
|
1073
|
-
opLog.failure(() => ({ msg: "call failed" }), error);
|
|
1074
|
-
throw error;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
};
|
|
1078
|
-
return self;
|
|
1557
|
+
return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
|
|
1079
1558
|
}
|
|
1080
|
-
function
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1559
|
+
async function fetchParticipation(api, id) {
|
|
1560
|
+
const dto = await api.send({
|
|
1561
|
+
method: "GET",
|
|
1562
|
+
url: `/v1/participations/${id}`,
|
|
1563
|
+
attributes: Attributes.protected()
|
|
1564
|
+
});
|
|
1565
|
+
return Participation.fromDto(dto);
|
|
1085
1566
|
}
|
|
1086
|
-
function
|
|
1087
|
-
|
|
1567
|
+
async function createParticipation(api, params) {
|
|
1568
|
+
const dto = await api.send({
|
|
1569
|
+
method: "POST",
|
|
1570
|
+
url: "/v1/participations",
|
|
1571
|
+
body: CreateParticipationParams.toDto(params),
|
|
1572
|
+
attributes: Attributes.protected()
|
|
1573
|
+
});
|
|
1574
|
+
return Participation.fromDto(dto);
|
|
1088
1575
|
}
|
|
1089
|
-
var noopInternalLogger = {
|
|
1090
|
-
child: () => noopInternalLogger,
|
|
1091
|
-
debug: () => void 0,
|
|
1092
|
-
info: () => void 0,
|
|
1093
|
-
warn: () => void 0,
|
|
1094
|
-
error: () => void 0,
|
|
1095
|
-
failure: () => void 0,
|
|
1096
|
-
warning: () => void 0,
|
|
1097
|
-
wrap: (_op, _params, run) => run()
|
|
1098
|
-
};
|
|
1099
1576
|
|
|
1100
1577
|
// src/universal/core/checkout/coin-list/token-sale-namespace.ts
|
|
1101
1578
|
var CoinListTokenSaleNamespaceImpl = class {
|
|
@@ -1245,8 +1722,14 @@ function assertPriceFits(raw) {
|
|
|
1245
1722
|
}
|
|
1246
1723
|
}
|
|
1247
1724
|
|
|
1725
|
+
// src/universal/core/checkout/ondo/not-tradable.ts
|
|
1726
|
+
var ONDO_NOT_TRADABLE_CODE = "not_tradable";
|
|
1727
|
+
function isOndoNotTradableError(error) {
|
|
1728
|
+
return apiErrorCode(error) === ONDO_NOT_TRADABLE_CODE;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1248
1731
|
// src/universal/core/shared/blockchain/formatters.ts
|
|
1249
|
-
var
|
|
1732
|
+
var import_viem3 = require("viem");
|
|
1250
1733
|
|
|
1251
1734
|
// src/universal/types/blockchain/ui.ts
|
|
1252
1735
|
var FormattedAmountUi = (value) => value;
|
|
@@ -1265,7 +1748,11 @@ function formatAmount(amount, locale, options) {
|
|
|
1265
1748
|
const decimal = formatRawAmount(amount);
|
|
1266
1749
|
let [integerPart, fractionPart = ""] = decimal.split(".");
|
|
1267
1750
|
const maxFractionDigits = options?.maxFractionDigits;
|
|
1268
|
-
const minFractionDigits =
|
|
1751
|
+
const minFractionDigits = Math.min(
|
|
1752
|
+
options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
|
|
1753
|
+
maxFractionDigits ?? amount.decimals,
|
|
1754
|
+
amount.decimals
|
|
1755
|
+
);
|
|
1269
1756
|
if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
|
|
1270
1757
|
({ integerPart, fractionPart } = roundFractionHalfUp(
|
|
1271
1758
|
integerPart,
|
|
@@ -1273,7 +1760,8 @@ function formatAmount(amount, locale, options) {
|
|
|
1273
1760
|
maxFractionDigits
|
|
1274
1761
|
));
|
|
1275
1762
|
}
|
|
1276
|
-
const
|
|
1763
|
+
const trimmed = fractionPart.replace(/0+$/, "");
|
|
1764
|
+
const fraction = trimmed.padEnd(minFractionDigits, "0");
|
|
1277
1765
|
const integerFormatted = BigInt(integerPart).toLocaleString(locale);
|
|
1278
1766
|
if (minFractionDigits === 0 && fraction === "") {
|
|
1279
1767
|
return FormattedAmountUi(integerFormatted);
|
|
@@ -1312,7 +1800,7 @@ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
|
|
|
1312
1800
|
};
|
|
1313
1801
|
}
|
|
1314
1802
|
function formatRawAmount(amount) {
|
|
1315
|
-
return (0,
|
|
1803
|
+
return (0, import_viem3.formatUnits)(amount.raw, amount.decimals);
|
|
1316
1804
|
}
|
|
1317
1805
|
function formatCompactAmount(amount, locale) {
|
|
1318
1806
|
const value = Number(formatRawAmount(amount));
|
|
@@ -1342,6 +1830,14 @@ function assetAmount(amount, symbol) {
|
|
|
1342
1830
|
return FormattedAmountAssetUi(`${amount} ${symbol}`);
|
|
1343
1831
|
}
|
|
1344
1832
|
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
1833
|
+
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
1834
|
+
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
1835
|
+
function formatShareAmount(amount, locale) {
|
|
1836
|
+
return formatAmount(amount, locale, {
|
|
1837
|
+
maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
|
|
1838
|
+
minFractionDigits: SHARE_MIN_FRACTION_DIGITS
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1345
1841
|
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
1346
1842
|
function formattedUsdPrice(amount, locale) {
|
|
1347
1843
|
if (!amount) return NA_AMOUNT_ASSET_UI;
|
|
@@ -1408,66 +1904,6 @@ function explorerBaseUrl(chain) {
|
|
|
1408
1904
|
}
|
|
1409
1905
|
}
|
|
1410
1906
|
|
|
1411
|
-
// src/universal/core/shared/blockchain/math.ts
|
|
1412
|
-
var import_viem3 = require("viem");
|
|
1413
|
-
function blockchainAmountFromRawOrThrow({
|
|
1414
|
-
label,
|
|
1415
|
-
raw,
|
|
1416
|
-
decimals
|
|
1417
|
-
}) {
|
|
1418
|
-
const trimmed = raw.trim();
|
|
1419
|
-
if (trimmed === "") {
|
|
1420
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
1421
|
-
}
|
|
1422
|
-
let value;
|
|
1423
|
-
try {
|
|
1424
|
-
value = BigInt(trimmed);
|
|
1425
|
-
} catch {
|
|
1426
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
1427
|
-
}
|
|
1428
|
-
try {
|
|
1429
|
-
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
1430
|
-
} catch {
|
|
1431
|
-
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
function parseBlockchainAmount(amount, decimals) {
|
|
1435
|
-
const trimmed = amount.trim();
|
|
1436
|
-
if (trimmed === "") return { valid: false, reason: { type: "empty" } };
|
|
1437
|
-
if (trimmed.startsWith("-")) {
|
|
1438
|
-
return { valid: false, reason: { type: "negative" } };
|
|
1439
|
-
}
|
|
1440
|
-
if (/[eE]/.test(trimmed)) {
|
|
1441
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1442
|
-
}
|
|
1443
|
-
if (trimmed === ".") {
|
|
1444
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1445
|
-
}
|
|
1446
|
-
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
1447
|
-
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
1448
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1449
|
-
}
|
|
1450
|
-
const [, fraction = ""] = normalised.split(".");
|
|
1451
|
-
if (fraction.length > decimals) {
|
|
1452
|
-
return {
|
|
1453
|
-
valid: false,
|
|
1454
|
-
reason: { type: "too-many-decimals", maxDecimals: decimals }
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1457
|
-
try {
|
|
1458
|
-
const raw = (0, import_viem3.parseUnits)(normalised, decimals);
|
|
1459
|
-
if (raw > MAX_UINT_256) {
|
|
1460
|
-
return { valid: false, reason: { type: "overflow" } };
|
|
1461
|
-
}
|
|
1462
|
-
return {
|
|
1463
|
-
valid: true,
|
|
1464
|
-
amount: BlockchainAmount({ raw, decimals })
|
|
1465
|
-
};
|
|
1466
|
-
} catch {
|
|
1467
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
1907
|
// src/universal/types/providers/ondo/ondo.ts
|
|
1472
1908
|
var OndoTradingStatus = {
|
|
1473
1909
|
fromDto: (dto) => {
|
|
@@ -1483,7 +1919,6 @@ var OndoTradingStatus = {
|
|
|
1483
1919
|
};
|
|
1484
1920
|
}
|
|
1485
1921
|
};
|
|
1486
|
-
var decimalOrNull = (value) => value === null ? null : DecimalString(value);
|
|
1487
1922
|
var OndoQuote = {
|
|
1488
1923
|
fromDto: (dto) => {
|
|
1489
1924
|
const assetDecimals = AssetDecimals(dto.asset_decimals);
|
|
@@ -3314,7 +3749,9 @@ var TokenRegistrySnapshot = {
|
|
|
3314
3749
|
}
|
|
3315
3750
|
};
|
|
3316
3751
|
function offerDisplayTokens(offer) {
|
|
3317
|
-
const swaps = offer.tokens.filter(
|
|
3752
|
+
const swaps = offer.tokens.filter(
|
|
3753
|
+
(token) => token.role === "swap" || token.role === "vault"
|
|
3754
|
+
);
|
|
3318
3755
|
const distributions = offer.tokens.filter(
|
|
3319
3756
|
(token) => token.role === "distribution"
|
|
3320
3757
|
);
|
|
@@ -3355,11 +3792,18 @@ var HttpClient = class {
|
|
|
3355
3792
|
);
|
|
3356
3793
|
let response = await this.executeRequest(preparedRequest);
|
|
3357
3794
|
for (const middleware of this.middleware.afterRequest ?? []) {
|
|
3795
|
+
let retried = false;
|
|
3358
3796
|
response = await middleware({
|
|
3359
3797
|
request: preparedRequest,
|
|
3360
3798
|
response,
|
|
3361
|
-
retry: (nextRequest = preparedRequest) =>
|
|
3799
|
+
retry: (nextRequest = preparedRequest) => {
|
|
3800
|
+
retried = true;
|
|
3801
|
+
return this.runRequestWithAfterMiddleware(nextRequest);
|
|
3802
|
+
}
|
|
3362
3803
|
});
|
|
3804
|
+
if (retried) {
|
|
3805
|
+
return response;
|
|
3806
|
+
}
|
|
3363
3807
|
}
|
|
3364
3808
|
return response;
|
|
3365
3809
|
}
|
|
@@ -3833,6 +4277,27 @@ var RedactedWalletError = {
|
|
|
3833
4277
|
fromWalletError: (error) => error.type === "unknown" ? { type: "unknown" } : error
|
|
3834
4278
|
};
|
|
3835
4279
|
|
|
4280
|
+
// src/universal/types/blockchain/wallet-selection.ts
|
|
4281
|
+
var WalletSelection = {
|
|
4282
|
+
/**
|
|
4283
|
+
* Every wallet in display order - embedded first, then the external one -
|
|
4284
|
+
* each address once. Addresses compare case-insensitively, so a host that
|
|
4285
|
+
* hands the same wallet over as both embedded and external sees it once.
|
|
4286
|
+
*/
|
|
4287
|
+
all: (selection) => {
|
|
4288
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4289
|
+
return [
|
|
4290
|
+
...selection.embedded,
|
|
4291
|
+
...selection.external === null ? [] : [selection.external]
|
|
4292
|
+
].filter((wallet) => {
|
|
4293
|
+
const key = wallet.address.toLowerCase();
|
|
4294
|
+
if (seen.has(key)) return false;
|
|
4295
|
+
seen.add(key);
|
|
4296
|
+
return true;
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
};
|
|
4300
|
+
|
|
3836
4301
|
// src/universal/types/oauth-session.ts
|
|
3837
4302
|
var ClientCredentialsOAuth = (value) => value;
|
|
3838
4303
|
var OAuthRefreshToken = (value) => value;
|
|
@@ -3849,6 +4314,54 @@ var OAuthSession = {
|
|
|
3849
4314
|
}
|
|
3850
4315
|
};
|
|
3851
4316
|
|
|
4317
|
+
// src/universal/types/time.ts
|
|
4318
|
+
var MAX_EPOCH_MILLIS = 864e13;
|
|
4319
|
+
var EpochMillis = {
|
|
4320
|
+
/**
|
|
4321
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
4322
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
4323
|
+
*/
|
|
4324
|
+
of: (value) => {
|
|
4325
|
+
if (!Number.isInteger(value) || Math.abs(value) > MAX_EPOCH_MILLIS) {
|
|
4326
|
+
throw new ValidationError(
|
|
4327
|
+
`EpochMillis must be an integer within \xB1${MAX_EPOCH_MILLIS}, got ${value}`
|
|
4328
|
+
);
|
|
4329
|
+
}
|
|
4330
|
+
return value;
|
|
4331
|
+
},
|
|
4332
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
4333
|
+
now: () => EpochMillis.of(Date.now()),
|
|
4334
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
4335
|
+
fromDate: (date) => EpochMillis.of(date.getTime()),
|
|
4336
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
4337
|
+
elapsed: (from, to) => Millis.of(to - from),
|
|
4338
|
+
plus: (at, duration) => EpochMillis.of(at + duration)
|
|
4339
|
+
};
|
|
4340
|
+
var Millis = {
|
|
4341
|
+
of: (value) => value
|
|
4342
|
+
};
|
|
4343
|
+
var Seconds = {
|
|
4344
|
+
/**
|
|
4345
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
4346
|
+
*/
|
|
4347
|
+
of: (value) => {
|
|
4348
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
4349
|
+
throw new ValidationError(
|
|
4350
|
+
`Seconds must be a non-negative integer, got ${value}`
|
|
4351
|
+
);
|
|
4352
|
+
}
|
|
4353
|
+
return value;
|
|
4354
|
+
},
|
|
4355
|
+
toMillis: (value) => Millis.of(value * 1e3)
|
|
4356
|
+
};
|
|
4357
|
+
function isExpired({
|
|
4358
|
+
expiresAt,
|
|
4359
|
+
now,
|
|
4360
|
+
buffer = Millis.of(0)
|
|
4361
|
+
}) {
|
|
4362
|
+
return now >= expiresAt - buffer;
|
|
4363
|
+
}
|
|
4364
|
+
|
|
3852
4365
|
// src/universal/types/user.ts
|
|
3853
4366
|
var UserId = (value) => value;
|
|
3854
4367
|
var UserEmail = (value) => value;
|
|
@@ -3867,11 +4380,22 @@ var User = {
|
|
|
3867
4380
|
AssetIconUrl,
|
|
3868
4381
|
AssetId,
|
|
3869
4382
|
AssetSymbol,
|
|
4383
|
+
AsyncOfferDetail,
|
|
3870
4384
|
AuthorizationCode,
|
|
3871
4385
|
BPS_DENOM,
|
|
3872
4386
|
Blockchain,
|
|
3873
4387
|
BlockchainAmount,
|
|
3874
4388
|
Bps,
|
|
4389
|
+
CENTRIFUGE_POLL_INTERVAL_MS,
|
|
4390
|
+
CentrifugeNamespaceImpl,
|
|
4391
|
+
CentrifugeVaultBuyTransaction,
|
|
4392
|
+
CentrifugeVaultClaimProceedsTransaction,
|
|
4393
|
+
CentrifugeVaultClaimTransaction,
|
|
4394
|
+
CentrifugeVaultLeg,
|
|
4395
|
+
CentrifugeVaultLegId,
|
|
4396
|
+
CentrifugeVaultPosition,
|
|
4397
|
+
CentrifugeVaultRedeemPosition,
|
|
4398
|
+
CentrifugeVaultStatus,
|
|
3875
4399
|
Chain,
|
|
3876
4400
|
ClientCredentialsOAuth,
|
|
3877
4401
|
ClientId,
|
|
@@ -3891,6 +4415,7 @@ var User = {
|
|
|
3891
4415
|
DocumentSubmission,
|
|
3892
4416
|
ERC20_ABI,
|
|
3893
4417
|
ETHEREUM_CHAINS,
|
|
4418
|
+
EpochMillis,
|
|
3894
4419
|
Erc20NamespaceImpl,
|
|
3895
4420
|
EthereumChain,
|
|
3896
4421
|
EvmContractAddress,
|
|
@@ -3911,11 +4436,13 @@ var User = {
|
|
|
3911
4436
|
MAX_UINT_256,
|
|
3912
4437
|
MathError,
|
|
3913
4438
|
Milestone,
|
|
4439
|
+
Millis,
|
|
3914
4440
|
NA_AMOUNT_ASSET_UI,
|
|
3915
4441
|
NotAuthenticatedError,
|
|
3916
4442
|
NotImplementedError,
|
|
3917
4443
|
OAuthRefreshToken,
|
|
3918
4444
|
OAuthSession,
|
|
4445
|
+
ONDO_NOT_TRADABLE_CODE,
|
|
3919
4446
|
ONDO_POLL_INTERVAL_MS,
|
|
3920
4447
|
ONDO_QUOTE_MAX_TTL_MS,
|
|
3921
4448
|
ONDO_SETTLEMENT_ASSET,
|
|
@@ -3932,6 +4459,7 @@ var User = {
|
|
|
3932
4459
|
OfferSlug,
|
|
3933
4460
|
OfferSwapContract,
|
|
3934
4461
|
OfferToken,
|
|
4462
|
+
OfferVaultContract,
|
|
3935
4463
|
OffersNamespaceImpl,
|
|
3936
4464
|
OndoBuyTransaction,
|
|
3937
4465
|
OndoNamespaceImpl,
|
|
@@ -3963,6 +4491,7 @@ var User = {
|
|
|
3963
4491
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
3964
4492
|
SWAP_LEVEL,
|
|
3965
4493
|
SWAP_POLL_INTERVAL_MS,
|
|
4494
|
+
Seconds,
|
|
3966
4495
|
ShortenedWalletAddress,
|
|
3967
4496
|
SolanaChain,
|
|
3968
4497
|
StablecoinSymbol,
|
|
@@ -3989,6 +4518,7 @@ var User = {
|
|
|
3989
4518
|
ValidationError,
|
|
3990
4519
|
WalletAddress,
|
|
3991
4520
|
WalletOwnershipChallenge,
|
|
4521
|
+
WalletSelection,
|
|
3992
4522
|
WalletsNamespaceImpl,
|
|
3993
4523
|
apiErrorCode,
|
|
3994
4524
|
applyBps,
|
|
@@ -4006,18 +4536,22 @@ var User = {
|
|
|
4006
4536
|
formatBpsAsPercent,
|
|
4007
4537
|
formatCompactAmount,
|
|
4008
4538
|
formatRawAmount,
|
|
4539
|
+
formatShareAmount,
|
|
4009
4540
|
formattedPricePerShare,
|
|
4010
4541
|
formattedUsdPrice,
|
|
4011
4542
|
generatePKCEParams,
|
|
4012
4543
|
getChainId,
|
|
4013
4544
|
getNetworkName,
|
|
4014
4545
|
isChain,
|
|
4546
|
+
isExpired,
|
|
4015
4547
|
isOfferType,
|
|
4548
|
+
isOndoNotTradableError,
|
|
4016
4549
|
isSwapAvailable,
|
|
4017
4550
|
offerDisplayTokens,
|
|
4018
4551
|
ondoQuoteOfferDeadline,
|
|
4019
4552
|
parseBlockchainAmount,
|
|
4020
4553
|
parseUint256,
|
|
4554
|
+
resolveCentrifugeVaults,
|
|
4021
4555
|
shortenAddress,
|
|
4022
4556
|
superstateSwapContractAddress,
|
|
4023
4557
|
swapSpender,
|