@coinlist-co/react 0.12.2-rc.31c2f50 → 0.12.2-rc.4851c6a
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/README.md +10 -0
- package/dist/{chunk-4IZ2F732.js → chunk-AYBP3HRJ.js} +10 -10
- package/dist/chunk-AYBP3HRJ.js.map +1 -0
- package/dist/{chunk-NBO5E2RO.js → chunk-GOUUYOPZ.js} +1243 -907
- package/dist/chunk-GOUUYOPZ.js.map +1 -0
- package/dist/{chunk-UJYSXXJF.js → chunk-LBIFCRFP.js} +160 -349
- package/dist/chunk-LBIFCRFP.js.map +1 -0
- package/dist/chunk-MJ6YXZWH.js +22 -0
- package/dist/chunk-MJ6YXZWH.js.map +1 -0
- package/dist/client/index.d.ts +3076 -4318
- package/dist/client/index.js +8571 -5709
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.d.ts +7 -33
- package/dist/server/index.js +8 -4
- package/dist/server/index.js.map +1 -1
- package/dist/{tokens-namespace-D_XSpiS-.d.ts → time-Bzgi6FbG.d.ts} +2163 -2943
- package/dist/{token-registry-snapshot-BsAfBL_b.d.ts → token-registry-snapshot-BmjXOvvg.d.ts} +66 -36
- package/dist/universal/index.d.ts +59 -1313
- package/dist/universal/index.js +26 -42
- package/package.json +18 -14
- package/dist/chunk-4IZ2F732.js.map +0 -1
- package/dist/chunk-NBO5E2RO.js.map +0 -1
- package/dist/chunk-UJYSXXJF.js.map +0 -1
- package/dist/client/index.cjs +0 -17133
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.d.cts +0 -6671
- package/dist/server/index.cjs +0 -4269
- package/dist/server/index.cjs.map +0 -1
- package/dist/server/index.d.cts +0 -378
- package/dist/time-CFocgYyl.d.cts +0 -50
- package/dist/time-DvgN98Q9.d.ts +0 -50
- package/dist/token-registry-snapshot-Cc_eA5zM.d.cts +0 -181
- package/dist/tokens-namespace-D_XSpiS-.d.cts +0 -3436
- package/dist/universal/index.cjs +0 -4321
- package/dist/universal/index.cjs.map +0 -1
- package/dist/universal/index.d.cts +0 -1629
|
@@ -291,166 +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
|
-
// src/universal/api/pagination.ts
|
|
395
|
-
async function fetchAllPages(fetchPage, baseParams) {
|
|
396
|
-
const items = [];
|
|
397
|
-
let cursor = null;
|
|
398
|
-
do {
|
|
399
|
-
const params = {
|
|
400
|
-
...baseParams ?? {},
|
|
401
|
-
after: cursor ?? void 0
|
|
402
|
-
};
|
|
403
|
-
const page = await fetchPage(params);
|
|
404
|
-
items.push(...page.data);
|
|
405
|
-
cursor = page.startingAfter;
|
|
406
|
-
} while (cursor);
|
|
407
|
-
return items;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// src/universal/types/pagination.ts
|
|
411
|
-
var Cursor = (value) => value;
|
|
412
|
-
var PaginatedResponse = {
|
|
413
|
-
fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
|
|
414
|
-
/**
|
|
415
|
-
* For a mapper that decides the page as a whole - one that drops items it
|
|
416
|
-
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
417
|
-
* cursors are the wire's either way: dropping an item changes what the
|
|
418
|
-
* page holds, not where the next page starts.
|
|
419
|
-
*/
|
|
420
|
-
fromDtoPage: (dto, pageMapper) => ({
|
|
421
|
-
data: pageMapper(dto.data),
|
|
422
|
-
startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
|
|
423
|
-
startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
|
|
424
|
-
})
|
|
425
|
-
};
|
|
426
|
-
var PaginationParams = {
|
|
427
|
-
toQueryParams: (params) => {
|
|
428
|
-
const queryParams = {};
|
|
429
|
-
if (params.after) {
|
|
430
|
-
queryParams.starting_after = params.after;
|
|
431
|
-
}
|
|
432
|
-
if (params.before) {
|
|
433
|
-
queryParams.starting_before = params.before;
|
|
434
|
-
}
|
|
435
|
-
if (params.limit) {
|
|
436
|
-
queryParams.limit = params.limit;
|
|
437
|
-
}
|
|
438
|
-
return queryParams;
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
// src/universal/types/asset.ts
|
|
443
|
-
var AssetId = (value) => value;
|
|
444
|
-
var AssetCode = (value) => value;
|
|
445
|
-
var Asset = {
|
|
446
|
-
fromDto: (dto) => ({
|
|
447
|
-
id: AssetId(dto.id),
|
|
448
|
-
code: AssetCode(dto.code),
|
|
449
|
-
name: dto.name,
|
|
450
|
-
fractionalDigits: dto.fractional_digits
|
|
451
|
-
})
|
|
452
|
-
};
|
|
453
|
-
|
|
454
294
|
// src/universal/types/blockchain/core.ts
|
|
455
295
|
var ETHEREUM_CHAINS = {
|
|
456
296
|
ethereum_mainnet: true,
|
|
@@ -513,8 +353,18 @@ var BlockchainAmount = Object.assign(
|
|
|
513
353
|
{
|
|
514
354
|
add: (a, b) => combineAmounts(a, b, (x, y) => x + y),
|
|
515
355
|
sub: (a, b) => combineAmounts(a, b, (x, y) => x - y),
|
|
516
|
-
|
|
517
|
-
|
|
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)
|
|
518
368
|
}
|
|
519
369
|
);
|
|
520
370
|
function multiplyAmounts(a, b) {
|
|
@@ -548,6 +398,66 @@ var StablecoinSymbol = (value) => value;
|
|
|
548
398
|
var KnownAssetSymbol = StablecoinSymbol;
|
|
549
399
|
var Bps = (value) => value;
|
|
550
400
|
|
|
401
|
+
// src/universal/core/shared/blockchain/math.ts
|
|
402
|
+
import { parseUnits } from "viem";
|
|
403
|
+
function blockchainAmountFromRawOrThrow({
|
|
404
|
+
label,
|
|
405
|
+
raw,
|
|
406
|
+
decimals
|
|
407
|
+
}) {
|
|
408
|
+
const trimmed = raw.trim();
|
|
409
|
+
if (trimmed === "") {
|
|
410
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
411
|
+
}
|
|
412
|
+
let value;
|
|
413
|
+
try {
|
|
414
|
+
value = BigInt(trimmed);
|
|
415
|
+
} catch {
|
|
416
|
+
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
417
|
+
}
|
|
418
|
+
try {
|
|
419
|
+
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
420
|
+
} catch {
|
|
421
|
+
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function parseBlockchainAmount(amount, decimals) {
|
|
425
|
+
const trimmed = amount.trim();
|
|
426
|
+
if (trimmed === "") return { valid: false, reason: { type: "empty" } };
|
|
427
|
+
if (trimmed.startsWith("-")) {
|
|
428
|
+
return { valid: false, reason: { type: "negative" } };
|
|
429
|
+
}
|
|
430
|
+
if (/[eE]/.test(trimmed)) {
|
|
431
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
432
|
+
}
|
|
433
|
+
if (trimmed === ".") {
|
|
434
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
435
|
+
}
|
|
436
|
+
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
437
|
+
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
438
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
439
|
+
}
|
|
440
|
+
const [, fraction = ""] = normalised.split(".");
|
|
441
|
+
if (fraction.length > decimals) {
|
|
442
|
+
return {
|
|
443
|
+
valid: false,
|
|
444
|
+
reason: { type: "too-many-decimals", maxDecimals: decimals }
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
try {
|
|
448
|
+
const raw = parseUnits(normalised, decimals);
|
|
449
|
+
if (raw > MAX_UINT_256) {
|
|
450
|
+
return { valid: false, reason: { type: "overflow" } };
|
|
451
|
+
}
|
|
452
|
+
return {
|
|
453
|
+
valid: true,
|
|
454
|
+
amount: BlockchainAmount({ raw, decimals })
|
|
455
|
+
};
|
|
456
|
+
} catch {
|
|
457
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
551
461
|
// src/universal/core/shared/utils/crypto.ts
|
|
552
462
|
async function sha256(data) {
|
|
553
463
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
@@ -638,38 +548,629 @@ function requiredArray(value, field) {
|
|
|
638
548
|
return value;
|
|
639
549
|
}
|
|
640
550
|
|
|
641
|
-
// src/universal/types/
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
551
|
+
// src/universal/types/providers/centrifuge/centrifuge.ts
|
|
552
|
+
var CentrifugeVaultStatus = {
|
|
553
|
+
fromDto: (dto) => ({
|
|
554
|
+
chain: EthereumChain(dto.chain),
|
|
555
|
+
symbol: AssetSymbol(dto.symbol),
|
|
556
|
+
vaultAddress: EvmContractAddress(dto.vault_address),
|
|
557
|
+
linked: dto.linked,
|
|
558
|
+
permissioned: dto.permissioned,
|
|
559
|
+
membershipValidUntil: dateOrNull(
|
|
560
|
+
dto.membership_valid_until,
|
|
561
|
+
"CentrifugeVaultStatus.membership_valid_until"
|
|
562
|
+
),
|
|
563
|
+
halted: dto.halted,
|
|
564
|
+
priceUpdatedAt: dateOrNull(
|
|
565
|
+
dto.price_updated_at,
|
|
566
|
+
"CentrifugeVaultStatus.price_updated_at"
|
|
567
|
+
),
|
|
568
|
+
orderability: parseOrderability(
|
|
569
|
+
dto.can_order,
|
|
570
|
+
dto.reasons,
|
|
571
|
+
"CentrifugeVaultStatus"
|
|
572
|
+
),
|
|
573
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultStatus.as_of")
|
|
660
574
|
})
|
|
661
575
|
};
|
|
662
|
-
var
|
|
576
|
+
var CentrifugeVaultBuyTransaction = {
|
|
663
577
|
fromDto: (dto) => {
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
578
|
+
const spendInputAmount = blockchainAmountFromRawOrThrow({
|
|
579
|
+
label: "spend_input_amount",
|
|
580
|
+
raw: dto.spend_input_amount,
|
|
581
|
+
decimals: AssetDecimals(dto.spend_input_decimals)
|
|
582
|
+
});
|
|
583
|
+
if (spendInputAmount.raw <= 0n) {
|
|
584
|
+
throw new ValidationError(
|
|
585
|
+
`spend_input_amount: must be greater than zero ("${dto.spend_input_amount}") - a deposit of nothing is not a request`
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
|
|
590
|
+
spendInputAmount
|
|
670
591
|
};
|
|
671
|
-
|
|
672
|
-
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
var CentrifugeVaultClaimTransaction = {
|
|
595
|
+
fromDto: (dto) => ({
|
|
596
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimTransaction"),
|
|
597
|
+
claimableShares: blockchainAmountFromRawOrThrow({
|
|
598
|
+
label: "claimable_shares",
|
|
599
|
+
raw: dto.claimable_shares,
|
|
600
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
601
|
+
})
|
|
602
|
+
})
|
|
603
|
+
};
|
|
604
|
+
var CentrifugeVaultPosition = {
|
|
605
|
+
fromDto: (dto) => {
|
|
606
|
+
const assetDecimals = AssetDecimals(dto.asset_decimals);
|
|
607
|
+
const shareDecimals = AssetDecimals(dto.share_decimals);
|
|
608
|
+
const asset = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: assetDecimals });
|
|
609
|
+
const shares = (label, raw) => blockchainAmountFromRawOrThrow({ label, raw, decimals: shareDecimals });
|
|
610
|
+
return {
|
|
611
|
+
chain: EthereumChain(dto.chain),
|
|
612
|
+
symbol: AssetSymbol(dto.symbol),
|
|
613
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
614
|
+
status: dto.status,
|
|
615
|
+
requested: asset("requested", dto.requested),
|
|
616
|
+
pending: asset("pending", dto.pending),
|
|
617
|
+
filledAssets: asset("filled_assets", dto.filled_assets),
|
|
618
|
+
earnedShares: shares("earned_shares", dto.earned_shares),
|
|
619
|
+
claimedShares: shares("claimed_shares", dto.claimed_shares),
|
|
620
|
+
claimableShares: shares("claimable_shares", dto.claimable_shares),
|
|
621
|
+
shareBalance: shares("share_balance", dto.share_balance),
|
|
622
|
+
averagePrice: decimalOrNull(dto.average_price),
|
|
623
|
+
frozen: dto.frozen,
|
|
624
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultPosition.as_of")
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
var CentrifugeVaultRedeemPosition = {
|
|
629
|
+
fromDto: (dto) => ({
|
|
630
|
+
chain: EthereumChain(dto.chain),
|
|
631
|
+
symbol: AssetSymbol(dto.symbol),
|
|
632
|
+
walletAddress: EvmWalletAddress(dto.wallet_address),
|
|
633
|
+
status: dto.status,
|
|
634
|
+
pending: blockchainAmountFromRawOrThrow({
|
|
635
|
+
label: "pending",
|
|
636
|
+
raw: dto.pending,
|
|
637
|
+
decimals: AssetDecimals(dto.share_decimals)
|
|
638
|
+
}),
|
|
639
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
640
|
+
label: "claimable_assets",
|
|
641
|
+
raw: dto.claimable_assets,
|
|
642
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
643
|
+
}),
|
|
644
|
+
frozen: dto.frozen,
|
|
645
|
+
asOf: requiredDate(dto.as_of, "CentrifugeVaultRedeemPosition.as_of")
|
|
646
|
+
})
|
|
647
|
+
};
|
|
648
|
+
var CentrifugeVaultLeg = {
|
|
649
|
+
/**
|
|
650
|
+
* What a claim on the leg would collect: shares for `invest`, the funding
|
|
651
|
+
* token for `redeem`.
|
|
652
|
+
*/
|
|
653
|
+
claimable: (leg) => {
|
|
654
|
+
switch (leg.direction) {
|
|
655
|
+
case "invest":
|
|
656
|
+
return leg.position.claimableShares;
|
|
657
|
+
case "redeem":
|
|
658
|
+
return leg.position.claimableAssets;
|
|
659
|
+
default: {
|
|
660
|
+
const exhaustive = leg;
|
|
661
|
+
return exhaustive;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
/** Whether the leg has anything queued or anything ready to claim. */
|
|
666
|
+
isActive: (leg) => leg.position.pending.raw > 0n || CentrifugeVaultLeg.claimable(leg).raw > 0n
|
|
667
|
+
};
|
|
668
|
+
var CentrifugeVaultLegId = {
|
|
669
|
+
/** Addresses compare case-insensitively: frontline echoes them lower case. */
|
|
670
|
+
of: (leg) => [
|
|
671
|
+
leg.direction,
|
|
672
|
+
leg.position.chain,
|
|
673
|
+
leg.position.walletAddress.toLowerCase()
|
|
674
|
+
].join(":")
|
|
675
|
+
};
|
|
676
|
+
var CentrifugeVaultClaimProceedsTransaction = {
|
|
677
|
+
fromDto: (dto) => ({
|
|
678
|
+
...parseTransactionCore(dto, "CentrifugeVaultClaimProceedsTransaction"),
|
|
679
|
+
claimableAssets: blockchainAmountFromRawOrThrow({
|
|
680
|
+
label: "claimable_assets",
|
|
681
|
+
raw: dto.claimable_assets,
|
|
682
|
+
decimals: AssetDecimals(dto.asset_decimals)
|
|
683
|
+
})
|
|
684
|
+
})
|
|
685
|
+
};
|
|
686
|
+
function parseOrderability(canOrder, reasons, model) {
|
|
687
|
+
const [first, ...rest] = reasons;
|
|
688
|
+
if (canOrder) {
|
|
689
|
+
if (first !== void 0) {
|
|
690
|
+
throw new ValidationError(
|
|
691
|
+
`${model}.reasons: expected none when can_order is true, got ${JSON.stringify(reasons)}`
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
return { type: "orderable" };
|
|
695
|
+
}
|
|
696
|
+
if (first === void 0) {
|
|
697
|
+
throw new ValidationError(
|
|
698
|
+
`${model}.reasons: expected at least one when can_order is false`
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
return { type: "blocked", reasons: [first, ...rest] };
|
|
702
|
+
}
|
|
703
|
+
function parseTransactionCore(dto, model) {
|
|
704
|
+
return {
|
|
705
|
+
tx: {
|
|
706
|
+
to: EvmContractAddress(dto.to),
|
|
707
|
+
data: HexEncodedTransactionData(dto.data)
|
|
708
|
+
},
|
|
709
|
+
expiresAt: dateOrNull(dto.expires_at, `${model}.expires_at`)
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// src/universal/api/frontline/providers/centrifuge/centrifuge.ts
|
|
714
|
+
async function getCentrifugeVaultStatus(api, params) {
|
|
715
|
+
const dto = await api.send({
|
|
716
|
+
method: "GET",
|
|
717
|
+
url: "/v1/centrifuge/vault/status",
|
|
718
|
+
queryParams: {
|
|
719
|
+
symbol: params.symbol,
|
|
720
|
+
chain: params.chain
|
|
721
|
+
},
|
|
722
|
+
attributes: Attributes.protected()
|
|
723
|
+
});
|
|
724
|
+
return CentrifugeVaultStatus.fromDto(dto);
|
|
725
|
+
}
|
|
726
|
+
async function buildCentrifugeVaultBuy(api, params) {
|
|
727
|
+
const dto = await api.send({
|
|
728
|
+
method: "POST",
|
|
729
|
+
url: "/v1/centrifuge/vault/invest",
|
|
730
|
+
body: {
|
|
731
|
+
...walletFields(params),
|
|
732
|
+
amount: params.amount.raw.toString()
|
|
733
|
+
},
|
|
734
|
+
attributes: Attributes.protected()
|
|
735
|
+
});
|
|
736
|
+
if (dto.spend_input_decimals !== params.amount.decimals) {
|
|
737
|
+
throw new ValidationError(
|
|
738
|
+
`spend_input_decimals: the request was priced in ${dto.spend_input_decimals} decimals but the deposit was sized in ${params.amount.decimals}`
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
return CentrifugeVaultBuyTransaction.fromDto(dto);
|
|
742
|
+
}
|
|
743
|
+
async function getCentrifugeVaultPosition(api, params) {
|
|
744
|
+
const dto = await api.send({
|
|
745
|
+
method: "GET",
|
|
746
|
+
url: "/v1/centrifuge/vault/position",
|
|
747
|
+
queryParams: walletFields(params),
|
|
748
|
+
attributes: Attributes.protected()
|
|
749
|
+
});
|
|
750
|
+
return CentrifugeVaultPosition.fromDto(dto);
|
|
751
|
+
}
|
|
752
|
+
async function getCentrifugeVaultRedeemPosition(api, params) {
|
|
753
|
+
const dto = await api.send({
|
|
754
|
+
method: "GET",
|
|
755
|
+
url: "/v1/centrifuge/vault/redeem-position",
|
|
756
|
+
queryParams: walletFields(params),
|
|
757
|
+
attributes: Attributes.protected()
|
|
758
|
+
});
|
|
759
|
+
return CentrifugeVaultRedeemPosition.fromDto(dto);
|
|
760
|
+
}
|
|
761
|
+
async function createCentrifugeVaultClaim(api, params) {
|
|
762
|
+
const dto = await api.send({
|
|
763
|
+
method: "POST",
|
|
764
|
+
url: "/v1/centrifuge/vault/claim",
|
|
765
|
+
body: walletFields(params),
|
|
766
|
+
attributes: Attributes.protected()
|
|
767
|
+
});
|
|
768
|
+
return CentrifugeVaultClaimTransaction.fromDto(dto);
|
|
769
|
+
}
|
|
770
|
+
async function createCentrifugeVaultClaimProceeds(api, params) {
|
|
771
|
+
const dto = await api.send({
|
|
772
|
+
method: "POST",
|
|
773
|
+
url: "/v1/centrifuge/vault/claim-proceeds",
|
|
774
|
+
body: walletFields(params),
|
|
775
|
+
attributes: Attributes.protected()
|
|
776
|
+
});
|
|
777
|
+
return CentrifugeVaultClaimProceedsTransaction.fromDto(dto);
|
|
778
|
+
}
|
|
779
|
+
function walletFields(params) {
|
|
780
|
+
return {
|
|
781
|
+
symbol: params.symbol,
|
|
782
|
+
chain: params.chain,
|
|
783
|
+
wallet_address: params.walletAddress
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// src/universal/core/shared/observability/log-cause.ts
|
|
788
|
+
import {
|
|
789
|
+
BaseError,
|
|
790
|
+
ContractFunctionExecutionError,
|
|
791
|
+
ContractFunctionRevertedError,
|
|
792
|
+
HttpRequestError,
|
|
793
|
+
RpcError,
|
|
794
|
+
SocketClosedError,
|
|
795
|
+
TimeoutError,
|
|
796
|
+
WebSocketRequestError
|
|
797
|
+
} from "viem";
|
|
798
|
+
function classifyLogCause(error) {
|
|
799
|
+
if (error instanceof HttpError) {
|
|
800
|
+
return httpCause(error);
|
|
801
|
+
}
|
|
802
|
+
if (error instanceof ValidationError) {
|
|
803
|
+
return { type: "validation", message: error.message };
|
|
804
|
+
}
|
|
805
|
+
if (error instanceof InvariantError) {
|
|
806
|
+
return { type: "invariant", message: error.message };
|
|
807
|
+
}
|
|
808
|
+
if (error instanceof MathError) {
|
|
809
|
+
return { type: "math", message: error.message };
|
|
810
|
+
}
|
|
811
|
+
if (error instanceof NotAuthenticatedError) {
|
|
812
|
+
return { type: "not-authenticated" };
|
|
813
|
+
}
|
|
814
|
+
if (error instanceof NotImplementedError) {
|
|
815
|
+
return { type: "not-implemented" };
|
|
816
|
+
}
|
|
817
|
+
if (error instanceof BaseError) {
|
|
818
|
+
const http = error.walk((e) => e instanceof HttpError);
|
|
819
|
+
if (http instanceof HttpError) {
|
|
820
|
+
return httpCause(http);
|
|
821
|
+
}
|
|
822
|
+
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
823
|
+
}
|
|
824
|
+
return { type: "generic-error", name: errorName(error) };
|
|
825
|
+
}
|
|
826
|
+
function rpcFailureReason(error) {
|
|
827
|
+
if (error.walk((e) => e instanceof ContractFunctionRevertedError)) {
|
|
828
|
+
return "reverted";
|
|
829
|
+
}
|
|
830
|
+
if (error.walk((e) => e instanceof RpcError)) {
|
|
831
|
+
return "node-rejected";
|
|
832
|
+
}
|
|
833
|
+
if (error.walk(
|
|
834
|
+
(e) => e instanceof HttpRequestError || e instanceof WebSocketRequestError || e instanceof SocketClosedError || e instanceof TimeoutError
|
|
835
|
+
)) {
|
|
836
|
+
return "transport";
|
|
837
|
+
}
|
|
838
|
+
if (error instanceof ContractFunctionExecutionError) {
|
|
839
|
+
return "malformed-response";
|
|
840
|
+
}
|
|
841
|
+
return "unknown";
|
|
842
|
+
}
|
|
843
|
+
function describeErrorUnredacted(error) {
|
|
844
|
+
if (error instanceof HttpError) {
|
|
845
|
+
return describeHttpErrorRedacted(error);
|
|
846
|
+
}
|
|
847
|
+
if (error instanceof Error) {
|
|
848
|
+
return `${error.name}: ${error.message}`;
|
|
849
|
+
}
|
|
850
|
+
return `thrown non-error: ${stringifyUnredacted(error)}`;
|
|
851
|
+
}
|
|
852
|
+
function stringifyUnredacted(value) {
|
|
853
|
+
if (value === void 0) return "";
|
|
854
|
+
try {
|
|
855
|
+
return JSON.stringify(
|
|
856
|
+
value,
|
|
857
|
+
(_key, item) => typeof item === "bigint" ? `${item}` : item
|
|
858
|
+
) ?? String(value);
|
|
859
|
+
} catch (_) {
|
|
860
|
+
return "<unserializable>";
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
function describeHttpErrorRedacted(error) {
|
|
864
|
+
const code = apiErrorCode(error);
|
|
865
|
+
const status = error.response.status;
|
|
866
|
+
return code === null ? `HttpError ${status}` : `HttpError ${status} (${code})`;
|
|
867
|
+
}
|
|
868
|
+
function errorName(error) {
|
|
869
|
+
return error instanceof Error ? error.name : `non-error ${typeof error}`;
|
|
870
|
+
}
|
|
871
|
+
function httpCause(error) {
|
|
872
|
+
return {
|
|
873
|
+
type: "http",
|
|
874
|
+
requestId: error.requestId,
|
|
875
|
+
status: error.response.status,
|
|
876
|
+
code: apiErrorCode(error),
|
|
877
|
+
eventId: apiErrorEventId(error)
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
function apiErrorEventId(error) {
|
|
881
|
+
const body = error.response.body;
|
|
882
|
+
if (typeof body !== "object" || body === null) return null;
|
|
883
|
+
const eventId = body.event_id;
|
|
884
|
+
return typeof eventId === "string" ? eventId : null;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// src/universal/core/shared/observability/internal-logger.ts
|
|
888
|
+
function internalLogger(logger, scope) {
|
|
889
|
+
return logger ? scopedLogger(logger, scope, {}) : noopInternalLogger;
|
|
890
|
+
}
|
|
891
|
+
var LEVEL_RANK = {
|
|
892
|
+
none: 0,
|
|
893
|
+
error: 1,
|
|
894
|
+
warn: 2,
|
|
895
|
+
info: 3,
|
|
896
|
+
debug: 4
|
|
897
|
+
};
|
|
898
|
+
function scopedLogger(logger, scope, bindings) {
|
|
899
|
+
const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
|
|
900
|
+
const safe = (event) => ({
|
|
901
|
+
msg: event.msg,
|
|
902
|
+
scope,
|
|
903
|
+
bindings,
|
|
904
|
+
fields: event.fields ?? {},
|
|
905
|
+
...event.cause === void 0 ? {} : { cause: event.cause }
|
|
906
|
+
});
|
|
907
|
+
const unredacted = (event) => ({
|
|
908
|
+
msg: event.msg,
|
|
909
|
+
scope,
|
|
910
|
+
bindings,
|
|
911
|
+
fields: event.fields ?? {}
|
|
912
|
+
});
|
|
913
|
+
const self = {
|
|
914
|
+
child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
|
|
915
|
+
debug: (event) => {
|
|
916
|
+
if (admits("debug")) logger.debug(() => unredacted(event()));
|
|
917
|
+
},
|
|
918
|
+
info: (event) => {
|
|
919
|
+
if (admits("info")) logger.info(() => safe(event()));
|
|
920
|
+
},
|
|
921
|
+
warn: (event) => {
|
|
922
|
+
if (admits("warn")) logger.warn(() => safe(event()));
|
|
923
|
+
},
|
|
924
|
+
error: (event) => {
|
|
925
|
+
if (admits("error")) logger.error(() => safe(event()));
|
|
926
|
+
},
|
|
927
|
+
failure: (event, error) => {
|
|
928
|
+
if (admits("debug"))
|
|
929
|
+
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
930
|
+
if (admits("error")) logger.error(() => safe(classified(event(), error)));
|
|
931
|
+
},
|
|
932
|
+
warning: (event, error) => {
|
|
933
|
+
if (admits("debug"))
|
|
934
|
+
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
935
|
+
if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
|
|
936
|
+
},
|
|
937
|
+
wrap: async (op, params, run) => {
|
|
938
|
+
const opLog = self.child({ op });
|
|
939
|
+
opLog.debug(() => ({ msg: "call", fields: { params } }));
|
|
940
|
+
try {
|
|
941
|
+
return await run();
|
|
942
|
+
} catch (error) {
|
|
943
|
+
opLog.failure(() => ({ msg: "call failed" }), error);
|
|
944
|
+
throw error;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
return self;
|
|
949
|
+
}
|
|
950
|
+
function verbatim(event, error) {
|
|
951
|
+
return {
|
|
952
|
+
msg: event.msg,
|
|
953
|
+
fields: { ...event.fields, error: describeErrorUnredacted(error) }
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function classified(event, error) {
|
|
957
|
+
return { ...event, cause: event.cause ?? classifyLogCause(error) };
|
|
958
|
+
}
|
|
959
|
+
var noopInternalLogger = {
|
|
960
|
+
child: () => noopInternalLogger,
|
|
961
|
+
debug: () => void 0,
|
|
962
|
+
info: () => void 0,
|
|
963
|
+
warn: () => void 0,
|
|
964
|
+
error: () => void 0,
|
|
965
|
+
failure: () => void 0,
|
|
966
|
+
warning: () => void 0,
|
|
967
|
+
wrap: (_op, _params, run) => run()
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
// src/universal/core/checkout/centrifuge/centrifuge-namespace.ts
|
|
971
|
+
var CentrifugeNamespaceImpl = class {
|
|
972
|
+
constructor(ctx) {
|
|
973
|
+
this.ctx = ctx;
|
|
974
|
+
this.log = internalLogger(ctx.logger, "CENTRIFUGE");
|
|
975
|
+
}
|
|
976
|
+
async getVaultStatus(params) {
|
|
977
|
+
return this.log.wrap("getVaultStatus", params, async () => {
|
|
978
|
+
await this.ctx.ensureUserAuthenticated();
|
|
979
|
+
return getCentrifugeVaultStatus(this.ctx.api, params);
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
async getPosition(params) {
|
|
983
|
+
return this.log.wrap("getPosition", params, async () => {
|
|
984
|
+
await this.ctx.ensureUserAuthenticated();
|
|
985
|
+
return getCentrifugeVaultPosition(this.ctx.api, params);
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
async getRedeemPosition(params) {
|
|
989
|
+
return this.log.wrap("getRedeemPosition", params, async () => {
|
|
990
|
+
await this.ctx.ensureUserAuthenticated();
|
|
991
|
+
return getCentrifugeVaultRedeemPosition(this.ctx.api, params);
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
async createClaim(params) {
|
|
995
|
+
return this.log.wrap("createClaim", params, async () => {
|
|
996
|
+
await this.ctx.ensureUserAuthenticated();
|
|
997
|
+
return createCentrifugeVaultClaim(this.ctx.api, params);
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
async createClaimProceeds(params) {
|
|
1001
|
+
return this.log.wrap("createClaimProceeds", params, async () => {
|
|
1002
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1003
|
+
return createCentrifugeVaultClaimProceeds(this.ctx.api, params);
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
async buildBuyTransaction(params) {
|
|
1007
|
+
return this.log.wrap("buildBuyTransaction", params, async () => {
|
|
1008
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1009
|
+
return buildCentrifugeVaultBuy(this.ctx.api, params);
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
// src/universal/types/blockchain/ui.ts
|
|
1015
|
+
var FormattedAmountUi = (value) => value;
|
|
1016
|
+
var FormattedPercentUi = (value) => value;
|
|
1017
|
+
var TxExplorerUrl = (value) => value;
|
|
1018
|
+
var ShortenedWalletAddress = (value) => value;
|
|
1019
|
+
var FormattedAmountAssetUi = (value) => value;
|
|
1020
|
+
var AssetIconUrl = (value) => value;
|
|
1021
|
+
|
|
1022
|
+
// src/universal/core/shared/blockchain/formatters.ts
|
|
1023
|
+
import { formatUnits } from "viem";
|
|
1024
|
+
function shortenAddress(address) {
|
|
1025
|
+
const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
1026
|
+
return ShortenedWalletAddress(short);
|
|
1027
|
+
}
|
|
1028
|
+
function formatAmount(amount, locale, options) {
|
|
1029
|
+
const decimal = formatRawAmount(amount);
|
|
1030
|
+
let [integerPart, fractionPart = ""] = decimal.split(".");
|
|
1031
|
+
const maxFractionDigits = options?.maxFractionDigits;
|
|
1032
|
+
const minFractionDigits = Math.min(
|
|
1033
|
+
options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
|
|
1034
|
+
maxFractionDigits ?? amount.decimals,
|
|
1035
|
+
amount.decimals
|
|
1036
|
+
);
|
|
1037
|
+
if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
|
|
1038
|
+
({ integerPart, fractionPart } = roundFractionHalfUp(
|
|
1039
|
+
integerPart,
|
|
1040
|
+
fractionPart,
|
|
1041
|
+
maxFractionDigits
|
|
1042
|
+
));
|
|
1043
|
+
}
|
|
1044
|
+
const trimmed = fractionPart.replace(/0+$/, "");
|
|
1045
|
+
const fraction = trimmed.padEnd(minFractionDigits, "0");
|
|
1046
|
+
const integerFormatted = BigInt(integerPart).toLocaleString(locale);
|
|
1047
|
+
if (minFractionDigits === 0 && fraction === "") {
|
|
1048
|
+
return FormattedAmountUi(integerFormatted);
|
|
1049
|
+
}
|
|
1050
|
+
const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1051
|
+
return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
|
|
1052
|
+
}
|
|
1053
|
+
function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
|
|
1054
|
+
if (fractionPart.length <= maxFractionDigits) {
|
|
1055
|
+
return { integerPart, fractionPart };
|
|
1056
|
+
}
|
|
1057
|
+
if (maxFractionDigits === 0) {
|
|
1058
|
+
const roundUp = fractionPart[0] >= "5";
|
|
1059
|
+
const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
|
|
1060
|
+
return { integerPart: integer.toString(), fractionPart: "" };
|
|
1061
|
+
}
|
|
1062
|
+
const trimmed = fractionPart.slice(0, maxFractionDigits);
|
|
1063
|
+
if (fractionPart[maxFractionDigits] < "5") {
|
|
1064
|
+
return { integerPart, fractionPart: trimmed };
|
|
1065
|
+
}
|
|
1066
|
+
const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
|
|
1067
|
+
let carry = 1;
|
|
1068
|
+
for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
|
|
1069
|
+
const sum = digits[i] + carry;
|
|
1070
|
+
if (sum === 10) {
|
|
1071
|
+
digits[i] = 0;
|
|
1072
|
+
carry = 1;
|
|
1073
|
+
} else {
|
|
1074
|
+
digits[i] = sum;
|
|
1075
|
+
carry = 0;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
return {
|
|
1079
|
+
integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
|
|
1080
|
+
fractionPart: digits.join("")
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
function formatRawAmount(amount) {
|
|
1084
|
+
return formatUnits(amount.raw, amount.decimals);
|
|
1085
|
+
}
|
|
1086
|
+
function formatCompactAmount(amount, locale) {
|
|
1087
|
+
const value = Number(formatRawAmount(amount));
|
|
1088
|
+
const formatted = new Intl.NumberFormat(locale, {
|
|
1089
|
+
notation: "compact",
|
|
1090
|
+
maximumFractionDigits: 2
|
|
1091
|
+
}).format(value);
|
|
1092
|
+
return FormattedAmountUi(formatted);
|
|
1093
|
+
}
|
|
1094
|
+
function formatBpsAsPercent(bps, locale) {
|
|
1095
|
+
const whole = bps / 100n;
|
|
1096
|
+
const fraction = bps % 100n;
|
|
1097
|
+
const wholeFormatted = whole.toLocaleString(locale);
|
|
1098
|
+
const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1099
|
+
if (fraction === 0n) {
|
|
1100
|
+
return FormattedPercentUi(`${wholeFormatted}%`);
|
|
1101
|
+
}
|
|
1102
|
+
const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
|
|
1103
|
+
return FormattedPercentUi(
|
|
1104
|
+
`${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
function usdAmount(amount) {
|
|
1108
|
+
return FormattedAmountAssetUi(`$${amount}`);
|
|
1109
|
+
}
|
|
1110
|
+
function assetAmount(amount, symbol) {
|
|
1111
|
+
return FormattedAmountAssetUi(`${amount} ${symbol}`);
|
|
1112
|
+
}
|
|
1113
|
+
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
1114
|
+
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
1115
|
+
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
1116
|
+
function formatShareAmount(amount, locale) {
|
|
1117
|
+
return formatAmount(amount, locale, {
|
|
1118
|
+
maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
|
|
1119
|
+
minFractionDigits: SHARE_MIN_FRACTION_DIGITS
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
1123
|
+
function formattedUsdPrice(amount, locale) {
|
|
1124
|
+
if (!amount) return NA_AMOUNT_ASSET_UI;
|
|
1125
|
+
return usdAmount(
|
|
1126
|
+
formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
// src/universal/types/asset.ts
|
|
1131
|
+
var AssetId = (value) => value;
|
|
1132
|
+
var AssetCode = (value) => value;
|
|
1133
|
+
var Asset = {
|
|
1134
|
+
fromDto: (dto) => ({
|
|
1135
|
+
id: AssetId(dto.id),
|
|
1136
|
+
code: AssetCode(dto.code),
|
|
1137
|
+
name: dto.name,
|
|
1138
|
+
fractionalDigits: dto.fractional_digits
|
|
1139
|
+
})
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// src/universal/types/offer.ts
|
|
1143
|
+
var OfferId = (value) => value;
|
|
1144
|
+
var OfferSlug = (value) => value;
|
|
1145
|
+
var OFFER_TYPES = {
|
|
1146
|
+
"coinlist::token_sale": true,
|
|
1147
|
+
"superstate::swap": true,
|
|
1148
|
+
"ondo::swap": true,
|
|
1149
|
+
"centrifuge::vault": true
|
|
1150
|
+
};
|
|
1151
|
+
var isOfferType = (value) => Object.keys(OFFER_TYPES).includes(value);
|
|
1152
|
+
var OfferEditorial = {
|
|
1153
|
+
/**
|
|
1154
|
+
* `model` prefixes the field in the error (`'Offer'`, `'OfferDetail'`), so
|
|
1155
|
+
* the same three checks name the payload that failed them.
|
|
1156
|
+
*/
|
|
1157
|
+
fromDto: (dto, model) => ({
|
|
1158
|
+
tagline: requiredString(dto.tagline, `${model}.tagline`),
|
|
1159
|
+
bannerUrl: requiredString(dto.banner_url, `${model}.banner_url`),
|
|
1160
|
+
startsAt: requiredDate(dto.starts_at, `${model}.starts_at`)
|
|
1161
|
+
})
|
|
1162
|
+
};
|
|
1163
|
+
var Offer = {
|
|
1164
|
+
fromDto: (dto) => {
|
|
1165
|
+
const tokens = requiredArray(dto.tokens, "Offer.tokens");
|
|
1166
|
+
const base2 = {
|
|
1167
|
+
id: OfferId(dto.id),
|
|
1168
|
+
slug: OfferSlug(dto.slug),
|
|
1169
|
+
endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
|
|
1170
|
+
tokens: OfferToken.listFromDto(tokens)
|
|
1171
|
+
};
|
|
1172
|
+
switch (dto.type) {
|
|
1173
|
+
case "coinlist::token_sale":
|
|
673
1174
|
return {
|
|
674
1175
|
...base2,
|
|
675
1176
|
...OfferEditorial.fromDto(dto, "Offer"),
|
|
@@ -732,6 +1233,30 @@ var Ticker = (value) => value;
|
|
|
732
1233
|
var Isin = (value) => value;
|
|
733
1234
|
|
|
734
1235
|
// src/universal/types/offer-detail.ts
|
|
1236
|
+
var AsyncOfferDetail = {
|
|
1237
|
+
/**
|
|
1238
|
+
* Narrows an offer fetched generically, e.g. on an offer page, to one with
|
|
1239
|
+
* something to claim.
|
|
1240
|
+
*
|
|
1241
|
+
* An exhaustive `switch` rather than a list of async types, so a new offer
|
|
1242
|
+
* type is a compile error here until someone decides whether it settles
|
|
1243
|
+
* later.
|
|
1244
|
+
*/
|
|
1245
|
+
is: (offer) => {
|
|
1246
|
+
switch (offer.type) {
|
|
1247
|
+
case "centrifuge::vault":
|
|
1248
|
+
return true;
|
|
1249
|
+
case "ondo::swap":
|
|
1250
|
+
case "superstate::swap":
|
|
1251
|
+
case "coinlist::token_sale":
|
|
1252
|
+
return false;
|
|
1253
|
+
default: {
|
|
1254
|
+
const exhaustive = offer;
|
|
1255
|
+
return exhaustive;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
735
1260
|
var OfferOptionId = (value) => value;
|
|
736
1261
|
var OfferOptionSlug = (value) => value;
|
|
737
1262
|
var OfferSwapContract = {
|
|
@@ -870,6 +1395,38 @@ var Milestone = {
|
|
|
870
1395
|
})
|
|
871
1396
|
};
|
|
872
1397
|
|
|
1398
|
+
// src/universal/types/pagination.ts
|
|
1399
|
+
var Cursor = (value) => value;
|
|
1400
|
+
var PaginatedResponse = {
|
|
1401
|
+
fromDto: (dto, itemMapper) => PaginatedResponse.fromDtoPage(dto, (items) => items.map(itemMapper)),
|
|
1402
|
+
/**
|
|
1403
|
+
* For a mapper that decides the page as a whole - one that drops items it
|
|
1404
|
+
* cannot map, such as `Offer.listFromDto` - rather than item by item. The
|
|
1405
|
+
* cursors are the wire's either way: dropping an item changes what the
|
|
1406
|
+
* page holds, not where the next page starts.
|
|
1407
|
+
*/
|
|
1408
|
+
fromDtoPage: (dto, pageMapper) => ({
|
|
1409
|
+
data: pageMapper(dto.data),
|
|
1410
|
+
startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
|
|
1411
|
+
startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
|
|
1412
|
+
})
|
|
1413
|
+
};
|
|
1414
|
+
var PaginationParams = {
|
|
1415
|
+
toQueryParams: (params) => {
|
|
1416
|
+
const queryParams = {};
|
|
1417
|
+
if (params.after) {
|
|
1418
|
+
queryParams.starting_after = params.after;
|
|
1419
|
+
}
|
|
1420
|
+
if (params.before) {
|
|
1421
|
+
queryParams.starting_before = params.before;
|
|
1422
|
+
}
|
|
1423
|
+
if (params.limit) {
|
|
1424
|
+
queryParams.limit = params.limit;
|
|
1425
|
+
}
|
|
1426
|
+
return queryParams;
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
|
|
873
1430
|
// src/universal/types/providers/coin-list/token-sale.ts
|
|
874
1431
|
var ParticipationId = (value) => value;
|
|
875
1432
|
var Blockchain = (value) => value;
|
|
@@ -913,226 +1470,59 @@ var CreateParticipationParams = {
|
|
|
913
1470
|
wallet_address: params.walletAddress,
|
|
914
1471
|
amount: params.amount,
|
|
915
1472
|
asset_id: params.assetId,
|
|
916
|
-
approval_transaction_hash: params.approvalTransactionHash
|
|
917
|
-
})
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
// src/universal/api/
|
|
921
|
-
async function
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
|
|
935
|
-
}
|
|
936
|
-
async function fetchParticipation(api, id) {
|
|
937
|
-
const dto = await api.send({
|
|
938
|
-
method: "GET",
|
|
939
|
-
url: `/v1/participations/${id}`,
|
|
940
|
-
attributes: Attributes.protected()
|
|
941
|
-
});
|
|
942
|
-
return Participation.fromDto(dto);
|
|
943
|
-
}
|
|
944
|
-
async function createParticipation(api, params) {
|
|
945
|
-
const dto = await api.send({
|
|
946
|
-
method: "POST",
|
|
947
|
-
url: "/v1/participations",
|
|
948
|
-
body: CreateParticipationParams.toDto(params),
|
|
949
|
-
attributes: Attributes.protected()
|
|
950
|
-
});
|
|
951
|
-
return Participation.fromDto(dto);
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
// src/universal/core/shared/observability/log-cause.ts
|
|
955
|
-
import {
|
|
956
|
-
BaseError,
|
|
957
|
-
ContractFunctionExecutionError,
|
|
958
|
-
ContractFunctionRevertedError,
|
|
959
|
-
HttpRequestError,
|
|
960
|
-
RpcError,
|
|
961
|
-
SocketClosedError,
|
|
962
|
-
TimeoutError,
|
|
963
|
-
WebSocketRequestError
|
|
964
|
-
} from "viem";
|
|
965
|
-
function classifyLogCause(error) {
|
|
966
|
-
if (error instanceof HttpError) {
|
|
967
|
-
return httpCause(error);
|
|
968
|
-
}
|
|
969
|
-
if (error instanceof ValidationError) {
|
|
970
|
-
return { type: "validation", message: error.message };
|
|
971
|
-
}
|
|
972
|
-
if (error instanceof InvariantError) {
|
|
973
|
-
return { type: "invariant", message: error.message };
|
|
974
|
-
}
|
|
975
|
-
if (error instanceof MathError) {
|
|
976
|
-
return { type: "math", message: error.message };
|
|
977
|
-
}
|
|
978
|
-
if (error instanceof NotAuthenticatedError) {
|
|
979
|
-
return { type: "not-authenticated" };
|
|
980
|
-
}
|
|
981
|
-
if (error instanceof NotImplementedError) {
|
|
982
|
-
return { type: "not-implemented" };
|
|
983
|
-
}
|
|
984
|
-
if (error instanceof BaseError) {
|
|
985
|
-
const http = error.walk((e) => e instanceof HttpError);
|
|
986
|
-
if (http instanceof HttpError) {
|
|
987
|
-
return httpCause(http);
|
|
988
|
-
}
|
|
989
|
-
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
990
|
-
}
|
|
991
|
-
return { type: "generic-error", name: errorName(error) };
|
|
992
|
-
}
|
|
993
|
-
function rpcFailureReason(error) {
|
|
994
|
-
if (error.walk((e) => e instanceof ContractFunctionRevertedError)) {
|
|
995
|
-
return "reverted";
|
|
996
|
-
}
|
|
997
|
-
if (error.walk((e) => e instanceof RpcError)) {
|
|
998
|
-
return "node-rejected";
|
|
999
|
-
}
|
|
1000
|
-
if (error.walk(
|
|
1001
|
-
(e) => e instanceof HttpRequestError || e instanceof WebSocketRequestError || e instanceof SocketClosedError || e instanceof TimeoutError
|
|
1002
|
-
)) {
|
|
1003
|
-
return "transport";
|
|
1004
|
-
}
|
|
1005
|
-
if (error instanceof ContractFunctionExecutionError) {
|
|
1006
|
-
return "malformed-response";
|
|
1007
|
-
}
|
|
1008
|
-
return "unknown";
|
|
1009
|
-
}
|
|
1010
|
-
function describeErrorUnredacted(error) {
|
|
1011
|
-
if (error instanceof HttpError) {
|
|
1012
|
-
return describeHttpErrorRedacted(error);
|
|
1013
|
-
}
|
|
1014
|
-
if (error instanceof Error) {
|
|
1015
|
-
return `${error.name}: ${error.message}`;
|
|
1016
|
-
}
|
|
1017
|
-
return `thrown non-error: ${stringifyUnredacted(error)}`;
|
|
1018
|
-
}
|
|
1019
|
-
function stringifyUnredacted(value) {
|
|
1020
|
-
if (value === void 0) return "";
|
|
1021
|
-
try {
|
|
1022
|
-
return JSON.stringify(
|
|
1023
|
-
value,
|
|
1024
|
-
(_key, item) => typeof item === "bigint" ? `${item}` : item
|
|
1025
|
-
) ?? String(value);
|
|
1026
|
-
} catch (_) {
|
|
1027
|
-
return "<unserializable>";
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
function describeHttpErrorRedacted(error) {
|
|
1031
|
-
const code = apiErrorCode(error);
|
|
1032
|
-
const status = error.response.status;
|
|
1033
|
-
return code === null ? `HttpError ${status}` : `HttpError ${status} (${code})`;
|
|
1034
|
-
}
|
|
1035
|
-
function errorName(error) {
|
|
1036
|
-
return error instanceof Error ? error.name : `non-error ${typeof error}`;
|
|
1037
|
-
}
|
|
1038
|
-
function httpCause(error) {
|
|
1039
|
-
return {
|
|
1040
|
-
type: "http",
|
|
1041
|
-
requestId: error.requestId,
|
|
1042
|
-
status: error.response.status,
|
|
1043
|
-
code: apiErrorCode(error),
|
|
1044
|
-
eventId: apiErrorEventId(error)
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
function apiErrorEventId(error) {
|
|
1048
|
-
const body = error.response.body;
|
|
1049
|
-
if (typeof body !== "object" || body === null) return null;
|
|
1050
|
-
const eventId = body.event_id;
|
|
1051
|
-
return typeof eventId === "string" ? eventId : null;
|
|
1473
|
+
approval_transaction_hash: params.approvalTransactionHash
|
|
1474
|
+
})
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
// src/universal/api/pagination.ts
|
|
1478
|
+
async function fetchAllPages(fetchPage, baseParams) {
|
|
1479
|
+
const items = [];
|
|
1480
|
+
let cursor = null;
|
|
1481
|
+
do {
|
|
1482
|
+
const params = {
|
|
1483
|
+
...baseParams ?? {},
|
|
1484
|
+
after: cursor ?? void 0
|
|
1485
|
+
};
|
|
1486
|
+
const page = await fetchPage(params);
|
|
1487
|
+
items.push(...page.data);
|
|
1488
|
+
cursor = page.startingAfter;
|
|
1489
|
+
} while (cursor);
|
|
1490
|
+
return items;
|
|
1052
1491
|
}
|
|
1053
1492
|
|
|
1054
|
-
// src/universal/
|
|
1055
|
-
function
|
|
1056
|
-
return
|
|
1493
|
+
// src/universal/api/frontline/providers/coin-list/token-sale.ts
|
|
1494
|
+
async function fetchParticipations(api, offerId) {
|
|
1495
|
+
return fetchAllPages(
|
|
1496
|
+
(params) => fetchParticipationsPage(api, params),
|
|
1497
|
+
{ offerId }
|
|
1498
|
+
);
|
|
1057
1499
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
};
|
|
1065
|
-
function scopedLogger(logger, scope, bindings) {
|
|
1066
|
-
const admits = (level) => LEVEL_RANK[logger.level()] >= LEVEL_RANK[level];
|
|
1067
|
-
const safe = (event) => ({
|
|
1068
|
-
msg: event.msg,
|
|
1069
|
-
scope,
|
|
1070
|
-
bindings,
|
|
1071
|
-
fields: event.fields ?? {},
|
|
1072
|
-
...event.cause === void 0 ? {} : { cause: event.cause }
|
|
1073
|
-
});
|
|
1074
|
-
const unredacted = (event) => ({
|
|
1075
|
-
msg: event.msg,
|
|
1076
|
-
scope,
|
|
1077
|
-
bindings,
|
|
1078
|
-
fields: event.fields ?? {}
|
|
1500
|
+
async function fetchParticipationsPage(api, params) {
|
|
1501
|
+
const pageDto = await api.send({
|
|
1502
|
+
method: "GET",
|
|
1503
|
+
url: "/v1/participations",
|
|
1504
|
+
queryParams: ParticipationsPaginationParams.toQueryParams(params),
|
|
1505
|
+
attributes: Attributes.protected()
|
|
1079
1506
|
});
|
|
1080
|
-
|
|
1081
|
-
child: (binding) => scopedLogger(logger, scope, { ...bindings, ...binding }),
|
|
1082
|
-
debug: (event) => {
|
|
1083
|
-
if (admits("debug")) logger.debug(() => unredacted(event()));
|
|
1084
|
-
},
|
|
1085
|
-
info: (event) => {
|
|
1086
|
-
if (admits("info")) logger.info(() => safe(event()));
|
|
1087
|
-
},
|
|
1088
|
-
warn: (event) => {
|
|
1089
|
-
if (admits("warn")) logger.warn(() => safe(event()));
|
|
1090
|
-
},
|
|
1091
|
-
error: (event) => {
|
|
1092
|
-
if (admits("error")) logger.error(() => safe(event()));
|
|
1093
|
-
},
|
|
1094
|
-
failure: (event, error) => {
|
|
1095
|
-
if (admits("debug"))
|
|
1096
|
-
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1097
|
-
if (admits("error")) logger.error(() => safe(classified(event(), error)));
|
|
1098
|
-
},
|
|
1099
|
-
warning: (event, error) => {
|
|
1100
|
-
if (admits("debug"))
|
|
1101
|
-
logger.debug(() => unredacted(verbatim(event(), error)));
|
|
1102
|
-
if (admits("warn")) logger.warn(() => safe(classified(event(), error)));
|
|
1103
|
-
},
|
|
1104
|
-
wrap: async (op, params, run) => {
|
|
1105
|
-
const opLog = self.child({ op });
|
|
1106
|
-
opLog.debug(() => ({ msg: "call", fields: { params } }));
|
|
1107
|
-
try {
|
|
1108
|
-
return await run();
|
|
1109
|
-
} catch (error) {
|
|
1110
|
-
opLog.failure(() => ({ msg: "call failed" }), error);
|
|
1111
|
-
throw error;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
};
|
|
1115
|
-
return self;
|
|
1507
|
+
return PaginatedResponse.fromDto(pageDto, Participation.fromDto);
|
|
1116
1508
|
}
|
|
1117
|
-
function
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1509
|
+
async function fetchParticipation(api, id) {
|
|
1510
|
+
const dto = await api.send({
|
|
1511
|
+
method: "GET",
|
|
1512
|
+
url: `/v1/participations/${id}`,
|
|
1513
|
+
attributes: Attributes.protected()
|
|
1514
|
+
});
|
|
1515
|
+
return Participation.fromDto(dto);
|
|
1122
1516
|
}
|
|
1123
|
-
function
|
|
1124
|
-
|
|
1517
|
+
async function createParticipation(api, params) {
|
|
1518
|
+
const dto = await api.send({
|
|
1519
|
+
method: "POST",
|
|
1520
|
+
url: "/v1/participations",
|
|
1521
|
+
body: CreateParticipationParams.toDto(params),
|
|
1522
|
+
attributes: Attributes.protected()
|
|
1523
|
+
});
|
|
1524
|
+
return Participation.fromDto(dto);
|
|
1125
1525
|
}
|
|
1126
|
-
var noopInternalLogger = {
|
|
1127
|
-
child: () => noopInternalLogger,
|
|
1128
|
-
debug: () => void 0,
|
|
1129
|
-
info: () => void 0,
|
|
1130
|
-
warn: () => void 0,
|
|
1131
|
-
error: () => void 0,
|
|
1132
|
-
failure: () => void 0,
|
|
1133
|
-
warning: () => void 0,
|
|
1134
|
-
wrap: (_op, _params, run) => run()
|
|
1135
|
-
};
|
|
1136
1526
|
|
|
1137
1527
|
// src/universal/core/checkout/coin-list/token-sale-namespace.ts
|
|
1138
1528
|
var CoinListTokenSaleNamespaceImpl = class {
|
|
@@ -1148,139 +1538,23 @@ var CoinListTokenSaleNamespaceImpl = class {
|
|
|
1148
1538
|
}
|
|
1149
1539
|
async listPage(params) {
|
|
1150
1540
|
return this.log.wrap("listPage", params, async () => {
|
|
1151
|
-
await this.ctx.ensureUserAuthenticated();
|
|
1152
|
-
return fetchParticipationsPage(this.ctx.api, params);
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
async get(id) {
|
|
1156
|
-
return this.log.wrap("get", id, async () => {
|
|
1157
|
-
await this.ctx.ensureUserAuthenticated();
|
|
1158
|
-
return fetchParticipation(this.ctx.api, id);
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
async createParticipation(params) {
|
|
1162
|
-
return this.log.wrap("createParticipation", params, async () => {
|
|
1163
|
-
await this.ctx.ensureUserAuthenticated();
|
|
1164
|
-
return createParticipation(this.ctx.api, params);
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
};
|
|
1168
|
-
|
|
1169
|
-
// src/universal/types/blockchain/ui.ts
|
|
1170
|
-
var FormattedAmountUi = (value) => value;
|
|
1171
|
-
var FormattedPercentUi = (value) => value;
|
|
1172
|
-
var TxExplorerUrl = (value) => value;
|
|
1173
|
-
var ShortenedWalletAddress = (value) => value;
|
|
1174
|
-
var FormattedAmountAssetUi = (value) => value;
|
|
1175
|
-
var AssetIconUrl = (value) => value;
|
|
1176
|
-
|
|
1177
|
-
// src/universal/core/shared/blockchain/formatters.ts
|
|
1178
|
-
import { formatUnits } from "viem";
|
|
1179
|
-
function shortenAddress(address) {
|
|
1180
|
-
const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
1181
|
-
return ShortenedWalletAddress(short);
|
|
1182
|
-
}
|
|
1183
|
-
function formatAmount(amount, locale, options) {
|
|
1184
|
-
const decimal = formatRawAmount(amount);
|
|
1185
|
-
let [integerPart, fractionPart = ""] = decimal.split(".");
|
|
1186
|
-
const maxFractionDigits = options?.maxFractionDigits;
|
|
1187
|
-
const minFractionDigits = Math.min(
|
|
1188
|
-
options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
|
|
1189
|
-
maxFractionDigits ?? amount.decimals,
|
|
1190
|
-
amount.decimals
|
|
1191
|
-
);
|
|
1192
|
-
if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
|
|
1193
|
-
({ integerPart, fractionPart } = roundFractionHalfUp(
|
|
1194
|
-
integerPart,
|
|
1195
|
-
fractionPart,
|
|
1196
|
-
maxFractionDigits
|
|
1197
|
-
));
|
|
1198
|
-
}
|
|
1199
|
-
const trimmed = fractionPart.replace(/0+$/, "");
|
|
1200
|
-
const fraction = trimmed.padEnd(minFractionDigits, "0");
|
|
1201
|
-
const integerFormatted = BigInt(integerPart).toLocaleString(locale);
|
|
1202
|
-
if (minFractionDigits === 0 && fraction === "") {
|
|
1203
|
-
return FormattedAmountUi(integerFormatted);
|
|
1204
|
-
}
|
|
1205
|
-
const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1206
|
-
return FormattedAmountUi(`${integerFormatted}${decimalSeparator}${fraction}`);
|
|
1207
|
-
}
|
|
1208
|
-
function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
|
|
1209
|
-
if (fractionPart.length <= maxFractionDigits) {
|
|
1210
|
-
return { integerPart, fractionPart };
|
|
1211
|
-
}
|
|
1212
|
-
if (maxFractionDigits === 0) {
|
|
1213
|
-
const roundUp = fractionPart[0] >= "5";
|
|
1214
|
-
const integer = BigInt(integerPart) + (roundUp ? 1n : 0n);
|
|
1215
|
-
return { integerPart: integer.toString(), fractionPart: "" };
|
|
1216
|
-
}
|
|
1217
|
-
const trimmed = fractionPart.slice(0, maxFractionDigits);
|
|
1218
|
-
if (fractionPart[maxFractionDigits] < "5") {
|
|
1219
|
-
return { integerPart, fractionPart: trimmed };
|
|
1220
|
-
}
|
|
1221
|
-
const digits = trimmed.split("").map((digit) => Number.parseInt(digit, 10));
|
|
1222
|
-
let carry = 1;
|
|
1223
|
-
for (let i = digits.length - 1; i >= 0 && carry > 0; i -= 1) {
|
|
1224
|
-
const sum = digits[i] + carry;
|
|
1225
|
-
if (sum === 10) {
|
|
1226
|
-
digits[i] = 0;
|
|
1227
|
-
carry = 1;
|
|
1228
|
-
} else {
|
|
1229
|
-
digits[i] = sum;
|
|
1230
|
-
carry = 0;
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
return {
|
|
1234
|
-
integerPart: carry > 0 ? (BigInt(integerPart) + 1n).toString() : integerPart,
|
|
1235
|
-
fractionPart: digits.join("")
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
function formatRawAmount(amount) {
|
|
1239
|
-
return formatUnits(amount.raw, amount.decimals);
|
|
1240
|
-
}
|
|
1241
|
-
function formatCompactAmount(amount, locale) {
|
|
1242
|
-
const value = Number(formatRawAmount(amount));
|
|
1243
|
-
const formatted = new Intl.NumberFormat(locale, {
|
|
1244
|
-
notation: "compact",
|
|
1245
|
-
maximumFractionDigits: 2
|
|
1246
|
-
}).format(value);
|
|
1247
|
-
return FormattedAmountUi(formatted);
|
|
1248
|
-
}
|
|
1249
|
-
function formatBpsAsPercent(bps, locale) {
|
|
1250
|
-
const whole = bps / 100n;
|
|
1251
|
-
const fraction = bps % 100n;
|
|
1252
|
-
const wholeFormatted = whole.toLocaleString(locale);
|
|
1253
|
-
const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1254
|
-
if (fraction === 0n) {
|
|
1255
|
-
return FormattedPercentUi(`${wholeFormatted}%`);
|
|
1256
|
-
}
|
|
1257
|
-
const fractionFormatted = fraction.toString().padStart(2, "0").replace(/0+$/, "");
|
|
1258
|
-
return FormattedPercentUi(
|
|
1259
|
-
`${wholeFormatted}${decimalSeparator}${fractionFormatted}%`
|
|
1260
|
-
);
|
|
1261
|
-
}
|
|
1262
|
-
function usdAmount(amount) {
|
|
1263
|
-
return FormattedAmountAssetUi(`$${amount}`);
|
|
1264
|
-
}
|
|
1265
|
-
function assetAmount(amount, symbol) {
|
|
1266
|
-
return FormattedAmountAssetUi(`${amount} ${symbol}`);
|
|
1267
|
-
}
|
|
1268
|
-
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
1269
|
-
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
1270
|
-
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
1271
|
-
function formatShareAmount(amount, locale) {
|
|
1272
|
-
return formatAmount(amount, locale, {
|
|
1273
|
-
maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
|
|
1274
|
-
minFractionDigits: SHARE_MIN_FRACTION_DIGITS
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
1278
|
-
function formattedUsdPrice(amount, locale) {
|
|
1279
|
-
if (!amount) return NA_AMOUNT_ASSET_UI;
|
|
1280
|
-
return usdAmount(
|
|
1281
|
-
formatAmount(amount, locale, { maxFractionDigits: USD_FRACTION_DIGITS })
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1541
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1542
|
+
return fetchParticipationsPage(this.ctx.api, params);
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
async get(id) {
|
|
1546
|
+
return this.log.wrap("get", id, async () => {
|
|
1547
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1548
|
+
return fetchParticipation(this.ctx.api, id);
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
async createParticipation(params) {
|
|
1552
|
+
return this.log.wrap("createParticipation", params, async () => {
|
|
1553
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1554
|
+
return createParticipation(this.ctx.api, params);
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1284
1558
|
|
|
1285
1559
|
// src/universal/core/shared/blockchain/chain.ts
|
|
1286
1560
|
import { base, baseSepolia, mainnet, sepolia } from "viem/chains";
|
|
@@ -1340,66 +1614,6 @@ function explorerBaseUrl(chain) {
|
|
|
1340
1614
|
}
|
|
1341
1615
|
}
|
|
1342
1616
|
|
|
1343
|
-
// src/universal/core/shared/blockchain/math.ts
|
|
1344
|
-
import { parseUnits } from "viem";
|
|
1345
|
-
function blockchainAmountFromRawOrThrow({
|
|
1346
|
-
label,
|
|
1347
|
-
raw,
|
|
1348
|
-
decimals
|
|
1349
|
-
}) {
|
|
1350
|
-
const trimmed = raw.trim();
|
|
1351
|
-
if (trimmed === "") {
|
|
1352
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
1353
|
-
}
|
|
1354
|
-
let value;
|
|
1355
|
-
try {
|
|
1356
|
-
value = BigInt(trimmed);
|
|
1357
|
-
} catch {
|
|
1358
|
-
throw new ValidationError(`${label}: not a uint256 integer ("${raw}")`);
|
|
1359
|
-
}
|
|
1360
|
-
try {
|
|
1361
|
-
return BlockchainAmount({ raw: assertUint256(value), decimals });
|
|
1362
|
-
} catch {
|
|
1363
|
-
throw new ValidationError(`${label}: out of uint256 bounds (${value})`);
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
function parseBlockchainAmount(amount, decimals) {
|
|
1367
|
-
const trimmed = amount.trim();
|
|
1368
|
-
if (trimmed === "") return { valid: false, reason: { type: "empty" } };
|
|
1369
|
-
if (trimmed.startsWith("-")) {
|
|
1370
|
-
return { valid: false, reason: { type: "negative" } };
|
|
1371
|
-
}
|
|
1372
|
-
if (/[eE]/.test(trimmed)) {
|
|
1373
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1374
|
-
}
|
|
1375
|
-
if (trimmed === ".") {
|
|
1376
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1377
|
-
}
|
|
1378
|
-
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
1379
|
-
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
1380
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1381
|
-
}
|
|
1382
|
-
const [, fraction = ""] = normalised.split(".");
|
|
1383
|
-
if (fraction.length > decimals) {
|
|
1384
|
-
return {
|
|
1385
|
-
valid: false,
|
|
1386
|
-
reason: { type: "too-many-decimals", maxDecimals: decimals }
|
|
1387
|
-
};
|
|
1388
|
-
}
|
|
1389
|
-
try {
|
|
1390
|
-
const raw = parseUnits(normalised, decimals);
|
|
1391
|
-
if (raw > MAX_UINT_256) {
|
|
1392
|
-
return { valid: false, reason: { type: "overflow" } };
|
|
1393
|
-
}
|
|
1394
|
-
return {
|
|
1395
|
-
valid: true,
|
|
1396
|
-
amount: BlockchainAmount({ raw, decimals })
|
|
1397
|
-
};
|
|
1398
|
-
} catch {
|
|
1399
|
-
return { valid: false, reason: { type: "invalid-format" } };
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
1617
|
// src/universal/types/providers/ondo/ondo.ts
|
|
1404
1618
|
var OndoTradingStatus = {
|
|
1405
1619
|
fromDto: (dto) => {
|
|
@@ -1692,6 +1906,101 @@ var OndoNamespaceImpl = class {
|
|
|
1692
1906
|
}
|
|
1693
1907
|
};
|
|
1694
1908
|
|
|
1909
|
+
// src/universal/types/providers/superstate/swap.ts
|
|
1910
|
+
var SwapPreview = {
|
|
1911
|
+
/** Maps the contract's `Preview { input, fee, output }` struct. */
|
|
1912
|
+
fromContract: (preview) => ({
|
|
1913
|
+
inputAmount: parseUint256(preview.input, "SwapPreview.input"),
|
|
1914
|
+
fee: parseUint256(preview.fee, "SwapPreview.fee"),
|
|
1915
|
+
outputAmount: parseUint256(preview.output, "SwapPreview.output")
|
|
1916
|
+
})
|
|
1917
|
+
};
|
|
1918
|
+
var PauseFlags = (value) => value;
|
|
1919
|
+
var SwapStatus = {
|
|
1920
|
+
/**
|
|
1921
|
+
* Maps the contract's `Status { uint32 flags; State state }` struct, where
|
|
1922
|
+
* `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
|
|
1923
|
+
*
|
|
1924
|
+
* `flags` is carried onto the `paused` arm only. On the other two the
|
|
1925
|
+
* contract sets it to a self-identifying marker rather than to information -
|
|
1926
|
+
* so repeating it would invite a caller to read meaning into a constant.
|
|
1927
|
+
*
|
|
1928
|
+
* @throws ValidationError on a `state` outside the enum. A contract that has
|
|
1929
|
+
* grown a fourth state is one the SDK does not model, and guessing `active`
|
|
1930
|
+
* would let a halted swap read as a live one.
|
|
1931
|
+
*/
|
|
1932
|
+
fromContract: (status) => {
|
|
1933
|
+
switch (status.state) {
|
|
1934
|
+
case 0:
|
|
1935
|
+
return { state: "active" };
|
|
1936
|
+
case 1:
|
|
1937
|
+
return { state: "paused", pausedLevels: PauseFlags(status.flags) };
|
|
1938
|
+
case 2:
|
|
1939
|
+
return { state: "stopped" };
|
|
1940
|
+
default:
|
|
1941
|
+
throw new ValidationError(
|
|
1942
|
+
`SwapStatus.state: unknown contract state (${status.state})`
|
|
1943
|
+
);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
var AllowWalletResponse = {
|
|
1948
|
+
fromDto: (dto) => {
|
|
1949
|
+
switch (dto.action) {
|
|
1950
|
+
case "broadcast_transaction":
|
|
1951
|
+
return {
|
|
1952
|
+
action: "broadcast_transaction",
|
|
1953
|
+
to: EvmContractAddress(dto.to),
|
|
1954
|
+
data: HexEncodedTransactionData(dto.data)
|
|
1955
|
+
};
|
|
1956
|
+
case "none":
|
|
1957
|
+
return {
|
|
1958
|
+
action: "none",
|
|
1959
|
+
alreadyAllowed: dto.already_allowed
|
|
1960
|
+
};
|
|
1961
|
+
default: {
|
|
1962
|
+
const _exhaustive = dto;
|
|
1963
|
+
return _exhaustive;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
|
|
1969
|
+
// src/universal/core/checkout/superstate/blockchain/quote.ts
|
|
1970
|
+
var SwapQuote = {
|
|
1971
|
+
/**
|
|
1972
|
+
* Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
|
|
1973
|
+
* input and fee are denominated in the input token; the output in the output
|
|
1974
|
+
* token.
|
|
1975
|
+
*/
|
|
1976
|
+
fromPreview: (preview, inputDecimals, outputDecimals) => ({
|
|
1977
|
+
inputTokenAmount: BlockchainAmount({
|
|
1978
|
+
raw: preview.inputAmount,
|
|
1979
|
+
decimals: inputDecimals
|
|
1980
|
+
}),
|
|
1981
|
+
fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),
|
|
1982
|
+
outputTokenAmount: BlockchainAmount({
|
|
1983
|
+
raw: preview.outputAmount,
|
|
1984
|
+
decimals: outputDecimals
|
|
1985
|
+
})
|
|
1986
|
+
})
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
// src/universal/api/frontline/providers/superstate/swap.ts
|
|
1990
|
+
async function allowWallet(api, params) {
|
|
1991
|
+
const dto = await api.send({
|
|
1992
|
+
method: "POST",
|
|
1993
|
+
url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
|
|
1994
|
+
body: {
|
|
1995
|
+
wallet_address: params.walletAddress,
|
|
1996
|
+
chain: params.chain,
|
|
1997
|
+
signature: params.signature
|
|
1998
|
+
},
|
|
1999
|
+
attributes: Attributes.protected()
|
|
2000
|
+
});
|
|
2001
|
+
return AllowWalletResponse.fromDto(dto);
|
|
2002
|
+
}
|
|
2003
|
+
|
|
1695
2004
|
// src/universal/core/checkout/superstate/blockchain/abi.ts
|
|
1696
2005
|
var SUPERSTATE_SWAP_ABI = [
|
|
1697
2006
|
{
|
|
@@ -2545,100 +2854,125 @@ var SUPERSTATE_SWAP_ABI = [
|
|
|
2545
2854
|
type: "error",
|
|
2546
2855
|
name: "SwapFailed",
|
|
2547
2856
|
inputs: [
|
|
2548
|
-
{
|
|
2549
|
-
name: "user",
|
|
2550
|
-
type: "address",
|
|
2551
|
-
internalType: "address"
|
|
2552
|
-
},
|
|
2553
|
-
{
|
|
2554
|
-
name: "token",
|
|
2555
|
-
type: "address",
|
|
2556
|
-
internalType: "address"
|
|
2557
|
-
}
|
|
2558
|
-
]
|
|
2857
|
+
{
|
|
2858
|
+
name: "user",
|
|
2859
|
+
type: "address",
|
|
2860
|
+
internalType: "address"
|
|
2861
|
+
},
|
|
2862
|
+
{
|
|
2863
|
+
name: "token",
|
|
2864
|
+
type: "address",
|
|
2865
|
+
internalType: "address"
|
|
2866
|
+
}
|
|
2867
|
+
]
|
|
2868
|
+
},
|
|
2869
|
+
{
|
|
2870
|
+
type: "error",
|
|
2871
|
+
name: "Unauthorized",
|
|
2872
|
+
inputs: []
|
|
2873
|
+
}
|
|
2874
|
+
];
|
|
2875
|
+
|
|
2876
|
+
// src/universal/core/shared/blockchain/erc20/abi.ts
|
|
2877
|
+
var ERC20_ABI = [
|
|
2878
|
+
{
|
|
2879
|
+
type: "function",
|
|
2880
|
+
name: "allowance",
|
|
2881
|
+
inputs: [
|
|
2882
|
+
{ name: "owner", type: "address" },
|
|
2883
|
+
{ name: "spender", type: "address" }
|
|
2884
|
+
],
|
|
2885
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2886
|
+
stateMutability: "view"
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
type: "function",
|
|
2890
|
+
name: "approve",
|
|
2891
|
+
inputs: [
|
|
2892
|
+
{ name: "spender", type: "address" },
|
|
2893
|
+
{ name: "amount", type: "uint256" }
|
|
2894
|
+
],
|
|
2895
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2896
|
+
stateMutability: "nonpayable"
|
|
2897
|
+
},
|
|
2898
|
+
{
|
|
2899
|
+
type: "function",
|
|
2900
|
+
name: "balanceOf",
|
|
2901
|
+
inputs: [{ name: "account", type: "address" }],
|
|
2902
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2903
|
+
stateMutability: "view"
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
type: "function",
|
|
2907
|
+
name: "decimals",
|
|
2908
|
+
inputs: [],
|
|
2909
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
2910
|
+
stateMutability: "view"
|
|
2911
|
+
},
|
|
2912
|
+
{
|
|
2913
|
+
type: "function",
|
|
2914
|
+
name: "name",
|
|
2915
|
+
inputs: [],
|
|
2916
|
+
outputs: [{ name: "", type: "string" }],
|
|
2917
|
+
stateMutability: "view"
|
|
2918
|
+
},
|
|
2919
|
+
{
|
|
2920
|
+
type: "function",
|
|
2921
|
+
name: "symbol",
|
|
2922
|
+
inputs: [],
|
|
2923
|
+
outputs: [{ name: "", type: "string" }],
|
|
2924
|
+
stateMutability: "view"
|
|
2925
|
+
},
|
|
2926
|
+
{
|
|
2927
|
+
type: "function",
|
|
2928
|
+
name: "totalSupply",
|
|
2929
|
+
inputs: [],
|
|
2930
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2931
|
+
stateMutability: "view"
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
type: "function",
|
|
2935
|
+
name: "transfer",
|
|
2936
|
+
inputs: [
|
|
2937
|
+
{ name: "recipient", type: "address" },
|
|
2938
|
+
{ name: "amount", type: "uint256" }
|
|
2939
|
+
],
|
|
2940
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2941
|
+
stateMutability: "nonpayable"
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
type: "function",
|
|
2945
|
+
name: "transferFrom",
|
|
2946
|
+
inputs: [
|
|
2947
|
+
{ name: "sender", type: "address" },
|
|
2948
|
+
{ name: "recipient", type: "address" },
|
|
2949
|
+
{ name: "amount", type: "uint256" }
|
|
2950
|
+
],
|
|
2951
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2952
|
+
stateMutability: "nonpayable"
|
|
2953
|
+
},
|
|
2954
|
+
{
|
|
2955
|
+
type: "event",
|
|
2956
|
+
name: "Approval",
|
|
2957
|
+
inputs: [
|
|
2958
|
+
{ name: "owner", type: "address", indexed: true },
|
|
2959
|
+
{ name: "spender", type: "address", indexed: true },
|
|
2960
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
2961
|
+
],
|
|
2962
|
+
anonymous: false
|
|
2559
2963
|
},
|
|
2560
2964
|
{
|
|
2561
|
-
type: "
|
|
2562
|
-
name: "
|
|
2563
|
-
inputs: [
|
|
2965
|
+
type: "event",
|
|
2966
|
+
name: "Transfer",
|
|
2967
|
+
inputs: [
|
|
2968
|
+
{ name: "from", type: "address", indexed: true },
|
|
2969
|
+
{ name: "to", type: "address", indexed: true },
|
|
2970
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
2971
|
+
],
|
|
2972
|
+
anonymous: false
|
|
2564
2973
|
}
|
|
2565
2974
|
];
|
|
2566
2975
|
|
|
2567
|
-
// src/universal/types/providers/superstate/swap.ts
|
|
2568
|
-
var SwapPreview = {
|
|
2569
|
-
/** Maps the contract's `Preview { input, fee, output }` struct. */
|
|
2570
|
-
fromContract: (preview) => ({
|
|
2571
|
-
inputAmount: parseUint256(preview.input, "SwapPreview.input"),
|
|
2572
|
-
fee: parseUint256(preview.fee, "SwapPreview.fee"),
|
|
2573
|
-
outputAmount: parseUint256(preview.output, "SwapPreview.output")
|
|
2574
|
-
})
|
|
2575
|
-
};
|
|
2576
|
-
var PauseFlags = (value) => value;
|
|
2577
|
-
var SwapStatus = {
|
|
2578
|
-
/**
|
|
2579
|
-
* Maps the contract's `Status { uint32 flags; State state }` struct, where
|
|
2580
|
-
* `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
|
|
2581
|
-
*
|
|
2582
|
-
* `flags` is carried onto the `paused` arm only. On the other two the
|
|
2583
|
-
* contract sets it to a self-identifying marker rather than to information -
|
|
2584
|
-
* so repeating it would invite a caller to read meaning into a constant.
|
|
2585
|
-
*
|
|
2586
|
-
* @throws ValidationError on a `state` outside the enum. A contract that has
|
|
2587
|
-
* grown a fourth state is one the SDK does not model, and guessing `active`
|
|
2588
|
-
* would let a halted swap read as a live one.
|
|
2589
|
-
*/
|
|
2590
|
-
fromContract: (status) => {
|
|
2591
|
-
switch (status.state) {
|
|
2592
|
-
case 0:
|
|
2593
|
-
return { state: "active" };
|
|
2594
|
-
case 1:
|
|
2595
|
-
return { state: "paused", pausedLevels: PauseFlags(status.flags) };
|
|
2596
|
-
case 2:
|
|
2597
|
-
return { state: "stopped" };
|
|
2598
|
-
default:
|
|
2599
|
-
throw new ValidationError(
|
|
2600
|
-
`SwapStatus.state: unknown contract state (${status.state})`
|
|
2601
|
-
);
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
var AllowWalletResponse = {
|
|
2606
|
-
fromDto: (dto) => {
|
|
2607
|
-
switch (dto.action) {
|
|
2608
|
-
case "broadcast_transaction":
|
|
2609
|
-
return {
|
|
2610
|
-
action: "broadcast_transaction",
|
|
2611
|
-
to: EvmContractAddress(dto.to),
|
|
2612
|
-
data: HexEncodedTransactionData(dto.data)
|
|
2613
|
-
};
|
|
2614
|
-
case "none":
|
|
2615
|
-
return {
|
|
2616
|
-
action: "none",
|
|
2617
|
-
alreadyAllowed: dto.already_allowed
|
|
2618
|
-
};
|
|
2619
|
-
default: {
|
|
2620
|
-
const _exhaustive = dto;
|
|
2621
|
-
return _exhaustive;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
};
|
|
2626
|
-
|
|
2627
|
-
// src/universal/api/frontline/providers/superstate/swap.ts
|
|
2628
|
-
async function allowWallet(api, params) {
|
|
2629
|
-
const dto = await api.send({
|
|
2630
|
-
method: "POST",
|
|
2631
|
-
url: `/v1/offers/${encodeURIComponent(params.offerId)}/allow-wallet`,
|
|
2632
|
-
body: {
|
|
2633
|
-
wallet_address: params.walletAddress,
|
|
2634
|
-
chain: params.chain,
|
|
2635
|
-
signature: params.signature
|
|
2636
|
-
},
|
|
2637
|
-
attributes: Attributes.protected()
|
|
2638
|
-
});
|
|
2639
|
-
return AllowWalletResponse.fromDto(dto);
|
|
2640
|
-
}
|
|
2641
|
-
|
|
2642
2976
|
// src/universal/api/rpc/providers/superstate/swap.ts
|
|
2643
2977
|
async function getSwapAuthorization(clients, params) {
|
|
2644
2978
|
return clients(params.chain).readContract({
|
|
@@ -2708,6 +3042,20 @@ var SuperstateSwapNamespaceImpl = class {
|
|
|
2708
3042
|
async () => getSwapPreview(this.ctx.rpc, params)
|
|
2709
3043
|
);
|
|
2710
3044
|
}
|
|
3045
|
+
async getQuote(params) {
|
|
3046
|
+
return this.log.wrap("getQuote", params, async () => {
|
|
3047
|
+
const { amount, outputTokenDecimals, ...ref } = params;
|
|
3048
|
+
const preview = await getSwapPreview(this.ctx.rpc, {
|
|
3049
|
+
...ref,
|
|
3050
|
+
amount: amount.raw
|
|
3051
|
+
});
|
|
3052
|
+
return SwapQuote.fromPreview(
|
|
3053
|
+
preview,
|
|
3054
|
+
amount.decimals,
|
|
3055
|
+
outputTokenDecimals
|
|
3056
|
+
);
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
2711
3059
|
async getStatus(params) {
|
|
2712
3060
|
return this.log.wrap(
|
|
2713
3061
|
"getStatus",
|
|
@@ -2859,47 +3207,188 @@ async function fetchRequirementStatuses(api, offerId) {
|
|
|
2859
3207
|
var RequirementsNamespaceImpl = class {
|
|
2860
3208
|
constructor(ctx) {
|
|
2861
3209
|
this.ctx = ctx;
|
|
2862
|
-
this.log = internalLogger(ctx.logger, "REQUIREMENTS");
|
|
3210
|
+
this.log = internalLogger(ctx.logger, "REQUIREMENTS");
|
|
3211
|
+
}
|
|
3212
|
+
async forOffer(offerId) {
|
|
3213
|
+
return this.log.wrap("forOffer", offerId, async () => {
|
|
3214
|
+
await this.ctx.ensureUserAuthenticated();
|
|
3215
|
+
return fetchOfferRequirements(
|
|
3216
|
+
this.ctx.api,
|
|
3217
|
+
offerId,
|
|
3218
|
+
void 0
|
|
3219
|
+
);
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
async statuses(offerId) {
|
|
3223
|
+
return this.log.wrap("statuses", offerId, async () => {
|
|
3224
|
+
await this.ctx.ensureUserAuthenticated();
|
|
3225
|
+
return fetchRequirementStatuses(this.ctx.api, offerId);
|
|
3226
|
+
});
|
|
3227
|
+
}
|
|
3228
|
+
async createKycToken(params) {
|
|
3229
|
+
return this.log.wrap("createKycToken", params, async () => {
|
|
3230
|
+
await this.ctx.ensureUserAuthenticated();
|
|
3231
|
+
return createKycToken(
|
|
3232
|
+
this.ctx.api,
|
|
3233
|
+
params?.levelName,
|
|
3234
|
+
params?.reset
|
|
3235
|
+
);
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
async getPii() {
|
|
3239
|
+
return this.log.wrap("getPii", void 0, async () => {
|
|
3240
|
+
await this.ctx.ensureUserAuthenticated();
|
|
3241
|
+
return fetchPii(this.ctx.api);
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
async submitDocument(params) {
|
|
3245
|
+
return this.log.wrap("submitDocument", params, async () => {
|
|
3246
|
+
await this.ctx.ensureUserAuthenticated();
|
|
3247
|
+
return submitDocument(
|
|
3248
|
+
this.ctx.api,
|
|
3249
|
+
params.documentType,
|
|
3250
|
+
params.fields
|
|
3251
|
+
);
|
|
3252
|
+
});
|
|
3253
|
+
}
|
|
3254
|
+
};
|
|
3255
|
+
|
|
3256
|
+
// src/universal/types/offer-option-address.ts
|
|
3257
|
+
var OfferOptionAddressId = (value) => value;
|
|
3258
|
+
var OfferOptionAddress = {
|
|
3259
|
+
/** Maps the API DTO into the SDK offer-option-address domain model. */
|
|
3260
|
+
fromDto: (dto) => ({
|
|
3261
|
+
id: OfferOptionAddressId(dto.id),
|
|
3262
|
+
offerOptionId: OfferOptionId(dto.offer_option_id),
|
|
3263
|
+
address: EvmWalletAddress(dto.address),
|
|
3264
|
+
protocol: dto.protocol,
|
|
3265
|
+
createdAt: new Date(dto.created_at)
|
|
3266
|
+
})
|
|
3267
|
+
};
|
|
3268
|
+
var ConnectExternalWalletParams = {
|
|
3269
|
+
/** Maps connect-wallet params into the API DTO payload. */
|
|
3270
|
+
toDto: (params) => ({
|
|
3271
|
+
offer_option_id: params.offerOptionId,
|
|
3272
|
+
wallet_address: params.walletAddress,
|
|
3273
|
+
chain: params.chain,
|
|
3274
|
+
signature: params.signature
|
|
3275
|
+
})
|
|
3276
|
+
};
|
|
3277
|
+
|
|
3278
|
+
// src/universal/types/wallet-ownership-challenge.ts
|
|
3279
|
+
var WalletOwnershipChallenge = {
|
|
3280
|
+
/** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
|
|
3281
|
+
fromDto: (dto) => ({
|
|
3282
|
+
message: dto.message,
|
|
3283
|
+
expiresAt: new Date(dto.expires_at)
|
|
3284
|
+
})
|
|
3285
|
+
};
|
|
3286
|
+
var CreateWalletOwnershipChallengeParams = {
|
|
3287
|
+
/**
|
|
3288
|
+
* Maps challenge-request params into the API DTO payload. The discriminated
|
|
3289
|
+
* union guarantees SIWE fields are present exactly when `challengeType` is
|
|
3290
|
+
* `siwe`, so the mapping narrows on the discriminant.
|
|
3291
|
+
*/
|
|
3292
|
+
toDto: (params) => {
|
|
3293
|
+
switch (params.challengeType) {
|
|
3294
|
+
case "plain":
|
|
3295
|
+
return {
|
|
3296
|
+
wallet_address: params.walletAddress,
|
|
3297
|
+
chain: params.chain,
|
|
3298
|
+
challenge_type: "plain"
|
|
3299
|
+
};
|
|
3300
|
+
case "siwe":
|
|
3301
|
+
return {
|
|
3302
|
+
wallet_address: params.walletAddress,
|
|
3303
|
+
chain: params.chain,
|
|
3304
|
+
challenge_type: "siwe",
|
|
3305
|
+
domain: params.domain,
|
|
3306
|
+
uri: params.uri,
|
|
3307
|
+
statement: params.statement
|
|
3308
|
+
};
|
|
3309
|
+
default: {
|
|
3310
|
+
const _exhaustive = params;
|
|
3311
|
+
return _exhaustive;
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
// src/universal/api/frontline/wallet-connect.ts
|
|
3318
|
+
async function createWalletOwnershipChallenge(api, params) {
|
|
3319
|
+
const dto = await api.send({
|
|
3320
|
+
method: "POST",
|
|
3321
|
+
url: "/v1/wallet-ownership",
|
|
3322
|
+
body: CreateWalletOwnershipChallengeParams.toDto(params),
|
|
3323
|
+
attributes: Attributes.protected()
|
|
3324
|
+
});
|
|
3325
|
+
return WalletOwnershipChallenge.fromDto(dto);
|
|
3326
|
+
}
|
|
3327
|
+
async function connectExternalWallet(api, params) {
|
|
3328
|
+
const dto = await api.send({
|
|
3329
|
+
method: "POST",
|
|
3330
|
+
url: `/v1/offers/${params.offerId}/addresses`,
|
|
3331
|
+
body: ConnectExternalWalletParams.toDto(params),
|
|
3332
|
+
attributes: Attributes.protected()
|
|
3333
|
+
});
|
|
3334
|
+
return OfferOptionAddress.fromDto(dto);
|
|
3335
|
+
}
|
|
3336
|
+
async function listOptionAddresses(api, offerId, offerOptionId) {
|
|
3337
|
+
const { data } = await api.send({
|
|
3338
|
+
method: "GET",
|
|
3339
|
+
url: `/v1/offers/${offerId}/addresses`,
|
|
3340
|
+
queryParams: { offer_option_id: offerOptionId },
|
|
3341
|
+
attributes: Attributes.protected()
|
|
3342
|
+
});
|
|
3343
|
+
return data.map(OfferOptionAddress.fromDto);
|
|
3344
|
+
}
|
|
3345
|
+
async function removeOptionAddress(api, offerId, addressId) {
|
|
3346
|
+
const dto = await api.send({
|
|
3347
|
+
method: "DELETE",
|
|
3348
|
+
url: `/v1/offers/${offerId}/addresses/${addressId}`,
|
|
3349
|
+
attributes: Attributes.protected()
|
|
3350
|
+
});
|
|
3351
|
+
return OfferOptionAddress.fromDto(dto);
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
// src/universal/core/wallets/wallets-namespace.ts
|
|
3355
|
+
var WalletsNamespaceImpl = class {
|
|
3356
|
+
constructor(ctx) {
|
|
3357
|
+
this.ctx = ctx;
|
|
3358
|
+
this.log = internalLogger(ctx.logger, "WALLETS");
|
|
2863
3359
|
}
|
|
2864
|
-
async
|
|
2865
|
-
return this.log.wrap("
|
|
3360
|
+
async createOwnershipChallenge(params) {
|
|
3361
|
+
return this.log.wrap("createOwnershipChallenge", params, async () => {
|
|
2866
3362
|
await this.ctx.ensureUserAuthenticated();
|
|
2867
|
-
return
|
|
3363
|
+
return createWalletOwnershipChallenge(
|
|
2868
3364
|
this.ctx.api,
|
|
2869
|
-
|
|
2870
|
-
void 0
|
|
3365
|
+
params
|
|
2871
3366
|
);
|
|
2872
3367
|
});
|
|
2873
3368
|
}
|
|
2874
|
-
async
|
|
2875
|
-
return this.log.wrap("
|
|
3369
|
+
async connectExternal(params) {
|
|
3370
|
+
return this.log.wrap("connectExternal", params, async () => {
|
|
2876
3371
|
await this.ctx.ensureUserAuthenticated();
|
|
2877
|
-
return
|
|
3372
|
+
return connectExternalWallet(this.ctx.api, params);
|
|
2878
3373
|
});
|
|
2879
3374
|
}
|
|
2880
|
-
async
|
|
2881
|
-
return this.log.wrap("
|
|
3375
|
+
async list(params) {
|
|
3376
|
+
return this.log.wrap("list", params, async () => {
|
|
2882
3377
|
await this.ctx.ensureUserAuthenticated();
|
|
2883
|
-
return
|
|
3378
|
+
return listOptionAddresses(
|
|
2884
3379
|
this.ctx.api,
|
|
2885
|
-
params
|
|
2886
|
-
params
|
|
3380
|
+
params.offerId,
|
|
3381
|
+
params.offerOptionId
|
|
2887
3382
|
);
|
|
2888
3383
|
});
|
|
2889
3384
|
}
|
|
2890
|
-
async
|
|
2891
|
-
return this.log.wrap("
|
|
2892
|
-
await this.ctx.ensureUserAuthenticated();
|
|
2893
|
-
return fetchPii(this.ctx.api);
|
|
2894
|
-
});
|
|
2895
|
-
}
|
|
2896
|
-
async submitDocument(params) {
|
|
2897
|
-
return this.log.wrap("submitDocument", params, async () => {
|
|
3385
|
+
async remove(params) {
|
|
3386
|
+
return this.log.wrap("remove", params, async () => {
|
|
2898
3387
|
await this.ctx.ensureUserAuthenticated();
|
|
2899
|
-
return
|
|
3388
|
+
return removeOptionAddress(
|
|
2900
3389
|
this.ctx.api,
|
|
2901
|
-
params.
|
|
2902
|
-
params.
|
|
3390
|
+
params.offerId,
|
|
3391
|
+
params.addressId
|
|
2903
3392
|
);
|
|
2904
3393
|
});
|
|
2905
3394
|
}
|
|
@@ -3327,163 +3816,6 @@ var TokensNamespaceImpl = class {
|
|
|
3327
3816
|
}
|
|
3328
3817
|
};
|
|
3329
3818
|
|
|
3330
|
-
// src/universal/types/offer-option-address.ts
|
|
3331
|
-
var OfferOptionAddressId = (value) => value;
|
|
3332
|
-
var OfferOptionAddress = {
|
|
3333
|
-
/** Maps the API DTO into the SDK offer-option-address domain model. */
|
|
3334
|
-
fromDto: (dto) => ({
|
|
3335
|
-
id: OfferOptionAddressId(dto.id),
|
|
3336
|
-
offerOptionId: OfferOptionId(dto.offer_option_id),
|
|
3337
|
-
address: EvmWalletAddress(dto.address),
|
|
3338
|
-
protocol: dto.protocol,
|
|
3339
|
-
createdAt: new Date(dto.created_at)
|
|
3340
|
-
})
|
|
3341
|
-
};
|
|
3342
|
-
var ConnectExternalWalletParams = {
|
|
3343
|
-
/** Maps connect-wallet params into the API DTO payload. */
|
|
3344
|
-
toDto: (params) => ({
|
|
3345
|
-
offer_option_id: params.offerOptionId,
|
|
3346
|
-
wallet_address: params.walletAddress,
|
|
3347
|
-
chain: params.chain,
|
|
3348
|
-
signature: params.signature
|
|
3349
|
-
})
|
|
3350
|
-
};
|
|
3351
|
-
|
|
3352
|
-
// src/universal/types/wallet-ownership-challenge.ts
|
|
3353
|
-
var WalletOwnershipChallenge = {
|
|
3354
|
-
/** Maps the API DTO into the SDK wallet-ownership-challenge domain model. */
|
|
3355
|
-
fromDto: (dto) => ({
|
|
3356
|
-
message: dto.message,
|
|
3357
|
-
expiresAt: new Date(dto.expires_at)
|
|
3358
|
-
})
|
|
3359
|
-
};
|
|
3360
|
-
var CreateWalletOwnershipChallengeParams = {
|
|
3361
|
-
/**
|
|
3362
|
-
* Maps challenge-request params into the API DTO payload. The discriminated
|
|
3363
|
-
* union guarantees SIWE fields are present exactly when `challengeType` is
|
|
3364
|
-
* `siwe`, so the mapping narrows on the discriminant.
|
|
3365
|
-
*/
|
|
3366
|
-
toDto: (params) => {
|
|
3367
|
-
switch (params.challengeType) {
|
|
3368
|
-
case "plain":
|
|
3369
|
-
return {
|
|
3370
|
-
wallet_address: params.walletAddress,
|
|
3371
|
-
chain: params.chain,
|
|
3372
|
-
challenge_type: "plain"
|
|
3373
|
-
};
|
|
3374
|
-
case "siwe":
|
|
3375
|
-
return {
|
|
3376
|
-
wallet_address: params.walletAddress,
|
|
3377
|
-
chain: params.chain,
|
|
3378
|
-
challenge_type: "siwe",
|
|
3379
|
-
domain: params.domain,
|
|
3380
|
-
uri: params.uri,
|
|
3381
|
-
statement: params.statement
|
|
3382
|
-
};
|
|
3383
|
-
default: {
|
|
3384
|
-
const _exhaustive = params;
|
|
3385
|
-
return _exhaustive;
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
};
|
|
3390
|
-
|
|
3391
|
-
// src/universal/api/frontline/wallet-connect.ts
|
|
3392
|
-
async function createWalletOwnershipChallenge(api, params) {
|
|
3393
|
-
const dto = await api.send({
|
|
3394
|
-
method: "POST",
|
|
3395
|
-
url: "/v1/wallet-ownership",
|
|
3396
|
-
body: CreateWalletOwnershipChallengeParams.toDto(params),
|
|
3397
|
-
attributes: Attributes.protected()
|
|
3398
|
-
});
|
|
3399
|
-
return WalletOwnershipChallenge.fromDto(dto);
|
|
3400
|
-
}
|
|
3401
|
-
async function connectExternalWallet(api, params) {
|
|
3402
|
-
const dto = await api.send({
|
|
3403
|
-
method: "POST",
|
|
3404
|
-
url: `/v1/offers/${params.offerId}/addresses`,
|
|
3405
|
-
body: ConnectExternalWalletParams.toDto(params),
|
|
3406
|
-
attributes: Attributes.protected()
|
|
3407
|
-
});
|
|
3408
|
-
return OfferOptionAddress.fromDto(dto);
|
|
3409
|
-
}
|
|
3410
|
-
async function listOptionAddresses(api, offerId, offerOptionId) {
|
|
3411
|
-
const { data } = await api.send({
|
|
3412
|
-
method: "GET",
|
|
3413
|
-
url: `/v1/offers/${offerId}/addresses`,
|
|
3414
|
-
queryParams: { offer_option_id: offerOptionId },
|
|
3415
|
-
attributes: Attributes.protected()
|
|
3416
|
-
});
|
|
3417
|
-
return data.map(OfferOptionAddress.fromDto);
|
|
3418
|
-
}
|
|
3419
|
-
async function removeOptionAddress(api, offerId, addressId) {
|
|
3420
|
-
const dto = await api.send({
|
|
3421
|
-
method: "DELETE",
|
|
3422
|
-
url: `/v1/offers/${offerId}/addresses/${addressId}`,
|
|
3423
|
-
attributes: Attributes.protected()
|
|
3424
|
-
});
|
|
3425
|
-
return OfferOptionAddress.fromDto(dto);
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
// src/universal/core/wallets/wallets-namespace.ts
|
|
3429
|
-
var WalletsNamespaceImpl = class {
|
|
3430
|
-
constructor(ctx) {
|
|
3431
|
-
this.ctx = ctx;
|
|
3432
|
-
this.log = internalLogger(ctx.logger, "WALLETS");
|
|
3433
|
-
}
|
|
3434
|
-
async createOwnershipChallenge(params) {
|
|
3435
|
-
return this.log.wrap("createOwnershipChallenge", params, async () => {
|
|
3436
|
-
await this.ctx.ensureUserAuthenticated();
|
|
3437
|
-
return createWalletOwnershipChallenge(
|
|
3438
|
-
this.ctx.api,
|
|
3439
|
-
params
|
|
3440
|
-
);
|
|
3441
|
-
});
|
|
3442
|
-
}
|
|
3443
|
-
async connectExternal(params) {
|
|
3444
|
-
return this.log.wrap("connectExternal", params, async () => {
|
|
3445
|
-
await this.ctx.ensureUserAuthenticated();
|
|
3446
|
-
return connectExternalWallet(this.ctx.api, params);
|
|
3447
|
-
});
|
|
3448
|
-
}
|
|
3449
|
-
async list(params) {
|
|
3450
|
-
return this.log.wrap("list", params, async () => {
|
|
3451
|
-
await this.ctx.ensureUserAuthenticated();
|
|
3452
|
-
return listOptionAddresses(
|
|
3453
|
-
this.ctx.api,
|
|
3454
|
-
params.offerId,
|
|
3455
|
-
params.offerOptionId
|
|
3456
|
-
);
|
|
3457
|
-
});
|
|
3458
|
-
}
|
|
3459
|
-
async remove(params) {
|
|
3460
|
-
return this.log.wrap("remove", params, async () => {
|
|
3461
|
-
await this.ctx.ensureUserAuthenticated();
|
|
3462
|
-
return removeOptionAddress(
|
|
3463
|
-
this.ctx.api,
|
|
3464
|
-
params.offerId,
|
|
3465
|
-
params.addressId
|
|
3466
|
-
);
|
|
3467
|
-
});
|
|
3468
|
-
}
|
|
3469
|
-
};
|
|
3470
|
-
|
|
3471
|
-
// src/universal/types/oauth-session.ts
|
|
3472
|
-
var ClientCredentialsOAuth = (value) => value;
|
|
3473
|
-
var OAuthRefreshToken = (value) => value;
|
|
3474
|
-
var OAuthSession = {
|
|
3475
|
-
fromDto: (dto) => {
|
|
3476
|
-
const expiresAt = new Date(Date.now() + dto.expires_in * 1e3);
|
|
3477
|
-
return {
|
|
3478
|
-
accessToken: {
|
|
3479
|
-
value: dto.access_token,
|
|
3480
|
-
expiresAt
|
|
3481
|
-
},
|
|
3482
|
-
...dto.refresh_token != null && dto.refresh_token !== "" ? { refreshToken: OAuthRefreshToken(dto.refresh_token) } : void 0
|
|
3483
|
-
};
|
|
3484
|
-
}
|
|
3485
|
-
};
|
|
3486
|
-
|
|
3487
3819
|
// src/universal/api/frontline/offers.ts
|
|
3488
3820
|
async function fetchOffers(api, clientCreds) {
|
|
3489
3821
|
return fetchAllPages((params) => fetchOffersPage(api, params, clientCreds));
|
|
@@ -3548,13 +3880,6 @@ export {
|
|
|
3548
3880
|
Seconds,
|
|
3549
3881
|
isExpired,
|
|
3550
3882
|
ERC20_ABI,
|
|
3551
|
-
fetchAllPages,
|
|
3552
|
-
Cursor,
|
|
3553
|
-
PaginatedResponse,
|
|
3554
|
-
PaginationParams,
|
|
3555
|
-
AssetId,
|
|
3556
|
-
AssetCode,
|
|
3557
|
-
Asset,
|
|
3558
3883
|
ETHEREUM_CHAINS,
|
|
3559
3884
|
EthereumChain,
|
|
3560
3885
|
SOLANA_CHAINS,
|
|
@@ -3576,9 +3901,36 @@ export {
|
|
|
3576
3901
|
StablecoinSymbol,
|
|
3577
3902
|
KnownAssetSymbol,
|
|
3578
3903
|
Bps,
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3904
|
+
blockchainAmountFromRawOrThrow,
|
|
3905
|
+
parseBlockchainAmount,
|
|
3906
|
+
CentrifugeVaultStatus,
|
|
3907
|
+
CentrifugeVaultBuyTransaction,
|
|
3908
|
+
CentrifugeVaultClaimTransaction,
|
|
3909
|
+
CentrifugeVaultPosition,
|
|
3910
|
+
CentrifugeVaultRedeemPosition,
|
|
3911
|
+
CentrifugeVaultLeg,
|
|
3912
|
+
CentrifugeVaultLegId,
|
|
3913
|
+
CentrifugeVaultClaimProceedsTransaction,
|
|
3914
|
+
CentrifugeNamespaceImpl,
|
|
3915
|
+
FormattedAmountUi,
|
|
3916
|
+
FormattedPercentUi,
|
|
3917
|
+
TxExplorerUrl,
|
|
3918
|
+
ShortenedWalletAddress,
|
|
3919
|
+
FormattedAmountAssetUi,
|
|
3920
|
+
AssetIconUrl,
|
|
3921
|
+
shortenAddress,
|
|
3922
|
+
formatAmount,
|
|
3923
|
+
formatRawAmount,
|
|
3924
|
+
formatCompactAmount,
|
|
3925
|
+
formatBpsAsPercent,
|
|
3926
|
+
usdAmount,
|
|
3927
|
+
assetAmount,
|
|
3928
|
+
NA_AMOUNT_ASSET_UI,
|
|
3929
|
+
formatShareAmount,
|
|
3930
|
+
formattedUsdPrice,
|
|
3931
|
+
AssetId,
|
|
3932
|
+
AssetCode,
|
|
3933
|
+
Asset,
|
|
3582
3934
|
OfferId,
|
|
3583
3935
|
OfferSlug,
|
|
3584
3936
|
isOfferType,
|
|
@@ -3587,6 +3939,7 @@ export {
|
|
|
3587
3939
|
OfferToken,
|
|
3588
3940
|
Ticker,
|
|
3589
3941
|
Isin,
|
|
3942
|
+
AsyncOfferDetail,
|
|
3590
3943
|
OfferOptionId,
|
|
3591
3944
|
OfferOptionSlug,
|
|
3592
3945
|
OfferSwapContract,
|
|
@@ -3597,6 +3950,9 @@ export {
|
|
|
3597
3950
|
Link,
|
|
3598
3951
|
TermItem,
|
|
3599
3952
|
Milestone,
|
|
3953
|
+
Cursor,
|
|
3954
|
+
PaginatedResponse,
|
|
3955
|
+
PaginationParams,
|
|
3600
3956
|
ParticipationId,
|
|
3601
3957
|
Blockchain,
|
|
3602
3958
|
WalletAddress,
|
|
@@ -3604,29 +3960,11 @@ export {
|
|
|
3604
3960
|
Participation,
|
|
3605
3961
|
CreateParticipationParams,
|
|
3606
3962
|
CoinListTokenSaleNamespaceImpl,
|
|
3607
|
-
FormattedAmountUi,
|
|
3608
|
-
FormattedPercentUi,
|
|
3609
|
-
TxExplorerUrl,
|
|
3610
|
-
ShortenedWalletAddress,
|
|
3611
|
-
FormattedAmountAssetUi,
|
|
3612
|
-
AssetIconUrl,
|
|
3613
|
-
shortenAddress,
|
|
3614
|
-
formatAmount,
|
|
3615
|
-
formatRawAmount,
|
|
3616
|
-
formatCompactAmount,
|
|
3617
|
-
formatBpsAsPercent,
|
|
3618
|
-
usdAmount,
|
|
3619
|
-
assetAmount,
|
|
3620
|
-
NA_AMOUNT_ASSET_UI,
|
|
3621
|
-
formatShareAmount,
|
|
3622
|
-
formattedUsdPrice,
|
|
3623
3963
|
viemChain,
|
|
3624
3964
|
getChainId,
|
|
3625
3965
|
chainFromId,
|
|
3626
3966
|
getNetworkName,
|
|
3627
3967
|
txExplorerUrl,
|
|
3628
|
-
blockchainAmountFromRawOrThrow,
|
|
3629
|
-
parseBlockchainAmount,
|
|
3630
3968
|
OndoTradingStatus,
|
|
3631
3969
|
OndoQuote,
|
|
3632
3970
|
OndoBuyTransaction,
|
|
@@ -3637,10 +3975,8 @@ export {
|
|
|
3637
3975
|
PauseFlags,
|
|
3638
3976
|
SwapStatus,
|
|
3639
3977
|
AllowWalletResponse,
|
|
3978
|
+
SwapQuote,
|
|
3640
3979
|
SuperstateSwapNamespaceImpl,
|
|
3641
|
-
fetchOffers,
|
|
3642
|
-
fetchOffersPage,
|
|
3643
|
-
fetchOfferDetails,
|
|
3644
3980
|
DocumentSubmission,
|
|
3645
3981
|
KycToken,
|
|
3646
3982
|
Iso2CountryCode,
|
|
@@ -3652,19 +3988,19 @@ export {
|
|
|
3652
3988
|
RequirementStatusInfo,
|
|
3653
3989
|
fetchOfferRequirements,
|
|
3654
3990
|
RequirementsNamespaceImpl,
|
|
3655
|
-
Erc20NamespaceImpl,
|
|
3656
|
-
TokenLogoUrl,
|
|
3657
|
-
TokenLogo,
|
|
3658
|
-
TokenMetadata,
|
|
3659
|
-
TokensNamespaceImpl,
|
|
3660
3991
|
OfferOptionAddressId,
|
|
3661
3992
|
OfferOptionAddress,
|
|
3662
3993
|
ConnectExternalWalletParams,
|
|
3663
3994
|
WalletOwnershipChallenge,
|
|
3664
3995
|
CreateWalletOwnershipChallengeParams,
|
|
3665
3996
|
WalletsNamespaceImpl,
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3997
|
+
fetchOffers,
|
|
3998
|
+
fetchOffersPage,
|
|
3999
|
+
fetchOfferDetails,
|
|
4000
|
+
Erc20NamespaceImpl,
|
|
4001
|
+
TokenLogoUrl,
|
|
4002
|
+
TokenLogo,
|
|
4003
|
+
TokenMetadata,
|
|
4004
|
+
TokensNamespaceImpl
|
|
3669
4005
|
};
|
|
3670
|
-
//# sourceMappingURL=chunk-
|
|
4006
|
+
//# sourceMappingURL=chunk-GOUUYOPZ.js.map
|