@coinlist-co/react 0.12.1-rc.139e98c → 0.12.1-rc.6b77fc6
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-6CQHDASY.js → chunk-2YEJXE2V.js} +1166 -153
- package/dist/chunk-2YEJXE2V.js.map +1 -0
- package/dist/{chunk-F6WGUKZC.js → chunk-DOSABR7Q.js} +129 -3
- package/dist/chunk-DOSABR7Q.js.map +1 -0
- package/dist/{chunk-ZFBEI3BW.js → chunk-DX4VTV7L.js} +20 -330
- package/dist/chunk-DX4VTV7L.js.map +1 -0
- package/dist/client/index.cjs +8554 -7689
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +116 -48
- package/dist/client/index.d.ts +116 -48
- package/dist/client/index.js +4059 -4007
- package/dist/client/index.js.map +1 -1
- package/dist/{collections-DOm9VKVm.d.cts → collections-C6b-rJpx.d.ts} +1 -1
- package/dist/{collections-aCv-Wr2a.d.ts → collections-UYVlXbEh.d.cts} +1 -1
- package/dist/server/index.cjs +1291 -166
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +5 -3
- package/dist/server/index.js.map +1 -1
- package/dist/{config-DIaFzrMW.d.cts → tokens-namespace-C-BxcYMj.d.cts} +362 -188
- package/dist/{config-DIaFzrMW.d.ts → tokens-namespace-C-BxcYMj.d.ts} +362 -188
- package/dist/universal/index.cjs +1087 -393
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +427 -45
- package/dist/universal/index.d.ts +427 -45
- package/dist/universal/index.js +16 -14
- package/package.json +2 -1
- package/dist/chunk-6CQHDASY.js.map +0 -1
- package/dist/chunk-F6WGUKZC.js.map +0 -1
- package/dist/chunk-ZFBEI3BW.js.map +0 -1
|
@@ -209,6 +209,106 @@ var MathError = class extends Error {
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
+
// src/universal/core/shared/blockchain/erc20/abi.ts
|
|
213
|
+
var ERC20_ABI = [
|
|
214
|
+
{
|
|
215
|
+
type: "function",
|
|
216
|
+
name: "allowance",
|
|
217
|
+
inputs: [
|
|
218
|
+
{ name: "owner", type: "address" },
|
|
219
|
+
{ name: "spender", type: "address" }
|
|
220
|
+
],
|
|
221
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
222
|
+
stateMutability: "view"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
type: "function",
|
|
226
|
+
name: "approve",
|
|
227
|
+
inputs: [
|
|
228
|
+
{ name: "spender", type: "address" },
|
|
229
|
+
{ name: "amount", type: "uint256" }
|
|
230
|
+
],
|
|
231
|
+
outputs: [{ name: "", type: "bool" }],
|
|
232
|
+
stateMutability: "nonpayable"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: "function",
|
|
236
|
+
name: "balanceOf",
|
|
237
|
+
inputs: [{ name: "account", type: "address" }],
|
|
238
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
239
|
+
stateMutability: "view"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: "function",
|
|
243
|
+
name: "decimals",
|
|
244
|
+
inputs: [],
|
|
245
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
246
|
+
stateMutability: "view"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
type: "function",
|
|
250
|
+
name: "name",
|
|
251
|
+
inputs: [],
|
|
252
|
+
outputs: [{ name: "", type: "string" }],
|
|
253
|
+
stateMutability: "view"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
type: "function",
|
|
257
|
+
name: "symbol",
|
|
258
|
+
inputs: [],
|
|
259
|
+
outputs: [{ name: "", type: "string" }],
|
|
260
|
+
stateMutability: "view"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: "function",
|
|
264
|
+
name: "totalSupply",
|
|
265
|
+
inputs: [],
|
|
266
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
267
|
+
stateMutability: "view"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
type: "function",
|
|
271
|
+
name: "transfer",
|
|
272
|
+
inputs: [
|
|
273
|
+
{ name: "recipient", type: "address" },
|
|
274
|
+
{ name: "amount", type: "uint256" }
|
|
275
|
+
],
|
|
276
|
+
outputs: [{ name: "", type: "bool" }],
|
|
277
|
+
stateMutability: "nonpayable"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: "function",
|
|
281
|
+
name: "transferFrom",
|
|
282
|
+
inputs: [
|
|
283
|
+
{ name: "sender", type: "address" },
|
|
284
|
+
{ name: "recipient", type: "address" },
|
|
285
|
+
{ name: "amount", type: "uint256" }
|
|
286
|
+
],
|
|
287
|
+
outputs: [{ name: "", type: "bool" }],
|
|
288
|
+
stateMutability: "nonpayable"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
type: "event",
|
|
292
|
+
name: "Approval",
|
|
293
|
+
inputs: [
|
|
294
|
+
{ name: "owner", type: "address", indexed: true },
|
|
295
|
+
{ name: "spender", type: "address", indexed: true },
|
|
296
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
297
|
+
],
|
|
298
|
+
anonymous: false
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
type: "event",
|
|
302
|
+
name: "Transfer",
|
|
303
|
+
inputs: [
|
|
304
|
+
{ name: "from", type: "address", indexed: true },
|
|
305
|
+
{ name: "to", type: "address", indexed: true },
|
|
306
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
307
|
+
],
|
|
308
|
+
anonymous: false
|
|
309
|
+
}
|
|
310
|
+
];
|
|
311
|
+
|
|
212
312
|
// src/universal/api/pagination.ts
|
|
213
313
|
async function fetchAllPages(fetchPage, baseParams) {
|
|
214
314
|
const items = [];
|
|
@@ -402,6 +502,10 @@ var OfferToken = {
|
|
|
402
502
|
listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferToken.fromDto)
|
|
403
503
|
};
|
|
404
504
|
|
|
505
|
+
// src/universal/types/trading.ts
|
|
506
|
+
var Ticker = (value) => value;
|
|
507
|
+
var Isin = (value) => value;
|
|
508
|
+
|
|
405
509
|
// src/universal/core/shared/utils/crypto.ts
|
|
406
510
|
async function sha256(data) {
|
|
407
511
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
@@ -504,6 +608,8 @@ var OfferDetail = {
|
|
|
504
608
|
`OfferDetail.swap_contracts: expected an array, got ${typeof swapContracts}`
|
|
505
609
|
);
|
|
506
610
|
}
|
|
611
|
+
const isin = notBlankStringOrNull(dto.isin);
|
|
612
|
+
const ticker = notBlankStringOrNull(dto.ticker);
|
|
507
613
|
return {
|
|
508
614
|
id: OfferId(dto.id),
|
|
509
615
|
slug: OfferSlug(dto.slug),
|
|
@@ -518,6 +624,11 @@ var OfferDetail = {
|
|
|
518
624
|
bannerUrl: dto.banner_url,
|
|
519
625
|
logoUrl: dto.logo_url,
|
|
520
626
|
category: dto.category,
|
|
627
|
+
issuer: notBlankStringOrNull(dto.issuer),
|
|
628
|
+
isin: isin === null ? null : Isin(isin),
|
|
629
|
+
ticker: ticker === null ? null : Ticker(ticker),
|
|
630
|
+
instrumentType: notBlankStringOrNull(dto.instrument_type),
|
|
631
|
+
listingVenue: notBlankStringOrNull(dto.listing_venue),
|
|
521
632
|
startsAt: new Date(dto.starts_at),
|
|
522
633
|
endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
|
|
523
634
|
faqs: dto.faqs.map(FaqItem.fromDto),
|
|
@@ -648,6 +759,16 @@ async function createParticipation(api, params) {
|
|
|
648
759
|
}
|
|
649
760
|
|
|
650
761
|
// src/universal/core/shared/observability/log-cause.ts
|
|
762
|
+
import {
|
|
763
|
+
BaseError,
|
|
764
|
+
ContractFunctionExecutionError,
|
|
765
|
+
ContractFunctionRevertedError,
|
|
766
|
+
HttpRequestError,
|
|
767
|
+
RpcError,
|
|
768
|
+
SocketClosedError,
|
|
769
|
+
TimeoutError,
|
|
770
|
+
WebSocketRequestError
|
|
771
|
+
} from "viem";
|
|
651
772
|
function classifyLogCause(error) {
|
|
652
773
|
if (error instanceof HttpError) {
|
|
653
774
|
return httpCause(error);
|
|
@@ -667,8 +788,32 @@ function classifyLogCause(error) {
|
|
|
667
788
|
if (error instanceof NotImplementedError) {
|
|
668
789
|
return { type: "not-implemented" };
|
|
669
790
|
}
|
|
791
|
+
if (error instanceof BaseError) {
|
|
792
|
+
const http = error.walk((e) => e instanceof HttpError);
|
|
793
|
+
if (http instanceof HttpError) {
|
|
794
|
+
return httpCause(http);
|
|
795
|
+
}
|
|
796
|
+
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
797
|
+
}
|
|
670
798
|
return { type: "generic-error", name: errorName(error) };
|
|
671
799
|
}
|
|
800
|
+
function rpcFailureReason(error) {
|
|
801
|
+
if (error.walk((e) => e instanceof ContractFunctionRevertedError)) {
|
|
802
|
+
return "reverted";
|
|
803
|
+
}
|
|
804
|
+
if (error.walk((e) => e instanceof RpcError)) {
|
|
805
|
+
return "node-rejected";
|
|
806
|
+
}
|
|
807
|
+
if (error.walk(
|
|
808
|
+
(e) => e instanceof HttpRequestError || e instanceof WebSocketRequestError || e instanceof SocketClosedError || e instanceof TimeoutError
|
|
809
|
+
)) {
|
|
810
|
+
return "transport";
|
|
811
|
+
}
|
|
812
|
+
if (error instanceof ContractFunctionExecutionError) {
|
|
813
|
+
return "malformed-response";
|
|
814
|
+
}
|
|
815
|
+
return "unknown";
|
|
816
|
+
}
|
|
672
817
|
function describeErrorUnredacted(error) {
|
|
673
818
|
if (error instanceof HttpError) {
|
|
674
819
|
return describeHttpErrorRedacted(error);
|
|
@@ -932,18 +1077,22 @@ function formattedUsdPrice(amount, locale) {
|
|
|
932
1077
|
}
|
|
933
1078
|
|
|
934
1079
|
// src/universal/core/shared/blockchain/chain.ts
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1080
|
+
import { base, baseSepolia, mainnet, sepolia } from "viem/chains";
|
|
1081
|
+
var VIEM_CHAINS = {
|
|
1082
|
+
ethereum_mainnet: mainnet,
|
|
1083
|
+
ethereum_sepolia: sepolia,
|
|
1084
|
+
base_mainnet: base,
|
|
1085
|
+
base_sepolia: baseSepolia
|
|
940
1086
|
};
|
|
1087
|
+
function viemChain(chain) {
|
|
1088
|
+
return VIEM_CHAINS[chain];
|
|
1089
|
+
}
|
|
941
1090
|
function getChainId(chain) {
|
|
942
|
-
return
|
|
1091
|
+
return VIEM_CHAINS[chain].id;
|
|
943
1092
|
}
|
|
944
1093
|
function chainFromId(chainId) {
|
|
945
|
-
const chains = Object.keys(
|
|
946
|
-
const chain = chains.find((c) => String(
|
|
1094
|
+
const chains = Object.keys(VIEM_CHAINS);
|
|
1095
|
+
const chain = chains.find((c) => String(VIEM_CHAINS[c].id) === chainId);
|
|
947
1096
|
if (!chain) {
|
|
948
1097
|
throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
|
|
949
1098
|
}
|
|
@@ -1041,9 +1190,6 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1041
1190
|
}
|
|
1042
1191
|
}
|
|
1043
1192
|
|
|
1044
|
-
// src/universal/types/trading.ts
|
|
1045
|
-
var Ticker = (value) => value;
|
|
1046
|
-
|
|
1047
1193
|
// src/universal/types/providers/ondo/ondo.ts
|
|
1048
1194
|
var OndoTradingStatus = {
|
|
1049
1195
|
fromDto: (dto) => {
|
|
@@ -1337,40 +1483,915 @@ var OndoNamespaceImpl = class {
|
|
|
1337
1483
|
}
|
|
1338
1484
|
};
|
|
1339
1485
|
|
|
1486
|
+
// src/universal/core/checkout/superstate/blockchain/abi.ts
|
|
1487
|
+
var SUPERSTATE_SWAP_ABI = [
|
|
1488
|
+
{
|
|
1489
|
+
type: "function",
|
|
1490
|
+
name: "KIND",
|
|
1491
|
+
inputs: [],
|
|
1492
|
+
outputs: [
|
|
1493
|
+
{
|
|
1494
|
+
name: "",
|
|
1495
|
+
type: "uint16",
|
|
1496
|
+
internalType: "uint16"
|
|
1497
|
+
}
|
|
1498
|
+
],
|
|
1499
|
+
stateMutability: "view"
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
type: "function",
|
|
1503
|
+
name: "ONE_HUNDRED_P",
|
|
1504
|
+
inputs: [],
|
|
1505
|
+
outputs: [
|
|
1506
|
+
{
|
|
1507
|
+
name: "",
|
|
1508
|
+
type: "uint256",
|
|
1509
|
+
internalType: "uint256"
|
|
1510
|
+
}
|
|
1511
|
+
],
|
|
1512
|
+
stateMutability: "view"
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
type: "function",
|
|
1516
|
+
name: "SWAP_LEVEL",
|
|
1517
|
+
inputs: [],
|
|
1518
|
+
outputs: [
|
|
1519
|
+
{
|
|
1520
|
+
name: "",
|
|
1521
|
+
type: "uint32",
|
|
1522
|
+
internalType: "uint32"
|
|
1523
|
+
}
|
|
1524
|
+
],
|
|
1525
|
+
stateMutability: "view"
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
type: "function",
|
|
1529
|
+
name: "VERSION",
|
|
1530
|
+
inputs: [],
|
|
1531
|
+
outputs: [
|
|
1532
|
+
{
|
|
1533
|
+
name: "",
|
|
1534
|
+
type: "uint16",
|
|
1535
|
+
internalType: "uint16"
|
|
1536
|
+
}
|
|
1537
|
+
],
|
|
1538
|
+
stateMutability: "view"
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
type: "function",
|
|
1542
|
+
name: "authorized",
|
|
1543
|
+
inputs: [
|
|
1544
|
+
{
|
|
1545
|
+
name: "user",
|
|
1546
|
+
type: "address",
|
|
1547
|
+
internalType: "address"
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
outputs: [
|
|
1551
|
+
{
|
|
1552
|
+
name: "",
|
|
1553
|
+
type: "bool",
|
|
1554
|
+
internalType: "bool"
|
|
1555
|
+
}
|
|
1556
|
+
],
|
|
1557
|
+
stateMutability: "view"
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
type: "function",
|
|
1561
|
+
name: "bpp",
|
|
1562
|
+
inputs: [
|
|
1563
|
+
{
|
|
1564
|
+
name: "amount",
|
|
1565
|
+
type: "uint256",
|
|
1566
|
+
internalType: "uint256"
|
|
1567
|
+
}
|
|
1568
|
+
],
|
|
1569
|
+
outputs: [
|
|
1570
|
+
{
|
|
1571
|
+
name: "",
|
|
1572
|
+
type: "uint256",
|
|
1573
|
+
internalType: "uint256"
|
|
1574
|
+
}
|
|
1575
|
+
],
|
|
1576
|
+
stateMutability: "view"
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
type: "function",
|
|
1580
|
+
name: "bps",
|
|
1581
|
+
inputs: [],
|
|
1582
|
+
outputs: [
|
|
1583
|
+
{
|
|
1584
|
+
name: "",
|
|
1585
|
+
type: "uint256",
|
|
1586
|
+
internalType: "uint256"
|
|
1587
|
+
}
|
|
1588
|
+
],
|
|
1589
|
+
stateMutability: "view"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
type: "function",
|
|
1593
|
+
name: "cancelOwnershipHandover",
|
|
1594
|
+
inputs: [],
|
|
1595
|
+
outputs: [],
|
|
1596
|
+
stateMutability: "payable"
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
type: "function",
|
|
1600
|
+
name: "completeOwnershipHandover",
|
|
1601
|
+
inputs: [
|
|
1602
|
+
{
|
|
1603
|
+
name: "pendingOwner",
|
|
1604
|
+
type: "address",
|
|
1605
|
+
internalType: "address"
|
|
1606
|
+
}
|
|
1607
|
+
],
|
|
1608
|
+
outputs: [],
|
|
1609
|
+
stateMutability: "payable"
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
type: "function",
|
|
1613
|
+
name: "fee",
|
|
1614
|
+
inputs: [
|
|
1615
|
+
{
|
|
1616
|
+
name: "amount",
|
|
1617
|
+
type: "uint256",
|
|
1618
|
+
internalType: "uint256"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
outputs: [
|
|
1622
|
+
{
|
|
1623
|
+
name: "",
|
|
1624
|
+
type: "uint256",
|
|
1625
|
+
internalType: "uint256"
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
name: "",
|
|
1629
|
+
type: "uint256",
|
|
1630
|
+
internalType: "uint256"
|
|
1631
|
+
}
|
|
1632
|
+
],
|
|
1633
|
+
stateMutability: "view"
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
type: "function",
|
|
1637
|
+
name: "id",
|
|
1638
|
+
inputs: [],
|
|
1639
|
+
outputs: [
|
|
1640
|
+
{
|
|
1641
|
+
name: "",
|
|
1642
|
+
type: "bytes32",
|
|
1643
|
+
internalType: "bytes32"
|
|
1644
|
+
}
|
|
1645
|
+
],
|
|
1646
|
+
stateMutability: "view"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
type: "function",
|
|
1650
|
+
name: "inputTokens",
|
|
1651
|
+
inputs: [
|
|
1652
|
+
{
|
|
1653
|
+
name: "",
|
|
1654
|
+
type: "address",
|
|
1655
|
+
internalType: "address"
|
|
1656
|
+
}
|
|
1657
|
+
],
|
|
1658
|
+
outputs: [
|
|
1659
|
+
{
|
|
1660
|
+
name: "",
|
|
1661
|
+
type: "bool",
|
|
1662
|
+
internalType: "bool"
|
|
1663
|
+
}
|
|
1664
|
+
],
|
|
1665
|
+
stateMutability: "view"
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
type: "function",
|
|
1669
|
+
name: "outputToken",
|
|
1670
|
+
inputs: [],
|
|
1671
|
+
outputs: [
|
|
1672
|
+
{
|
|
1673
|
+
name: "",
|
|
1674
|
+
type: "address",
|
|
1675
|
+
internalType: "address"
|
|
1676
|
+
}
|
|
1677
|
+
],
|
|
1678
|
+
stateMutability: "view"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
type: "function",
|
|
1682
|
+
name: "outputTokenBalance",
|
|
1683
|
+
inputs: [],
|
|
1684
|
+
outputs: [
|
|
1685
|
+
{
|
|
1686
|
+
name: "",
|
|
1687
|
+
type: "uint256",
|
|
1688
|
+
internalType: "uint256"
|
|
1689
|
+
}
|
|
1690
|
+
],
|
|
1691
|
+
stateMutability: "view"
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
type: "function",
|
|
1695
|
+
name: "owner",
|
|
1696
|
+
inputs: [],
|
|
1697
|
+
outputs: [
|
|
1698
|
+
{
|
|
1699
|
+
name: "result",
|
|
1700
|
+
type: "address",
|
|
1701
|
+
internalType: "address"
|
|
1702
|
+
}
|
|
1703
|
+
],
|
|
1704
|
+
stateMutability: "view"
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
type: "function",
|
|
1708
|
+
name: "ownershipHandoverExpiresAt",
|
|
1709
|
+
inputs: [
|
|
1710
|
+
{
|
|
1711
|
+
name: "pendingOwner",
|
|
1712
|
+
type: "address",
|
|
1713
|
+
internalType: "address"
|
|
1714
|
+
}
|
|
1715
|
+
],
|
|
1716
|
+
outputs: [
|
|
1717
|
+
{
|
|
1718
|
+
name: "result",
|
|
1719
|
+
type: "uint256",
|
|
1720
|
+
internalType: "uint256"
|
|
1721
|
+
}
|
|
1722
|
+
],
|
|
1723
|
+
stateMutability: "view"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
type: "function",
|
|
1727
|
+
name: "pause",
|
|
1728
|
+
inputs: [
|
|
1729
|
+
{
|
|
1730
|
+
name: "level",
|
|
1731
|
+
type: "uint32",
|
|
1732
|
+
internalType: "uint32"
|
|
1733
|
+
}
|
|
1734
|
+
],
|
|
1735
|
+
outputs: [
|
|
1736
|
+
{
|
|
1737
|
+
name: "",
|
|
1738
|
+
type: "bool",
|
|
1739
|
+
internalType: "bool"
|
|
1740
|
+
}
|
|
1741
|
+
],
|
|
1742
|
+
stateMutability: "nonpayable"
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
type: "function",
|
|
1746
|
+
name: "paused",
|
|
1747
|
+
inputs: [],
|
|
1748
|
+
outputs: [
|
|
1749
|
+
{
|
|
1750
|
+
name: "",
|
|
1751
|
+
type: "uint32",
|
|
1752
|
+
internalType: "uint32"
|
|
1753
|
+
}
|
|
1754
|
+
],
|
|
1755
|
+
stateMutability: "view"
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
type: "function",
|
|
1759
|
+
name: "preview",
|
|
1760
|
+
inputs: [
|
|
1761
|
+
{
|
|
1762
|
+
name: "token",
|
|
1763
|
+
type: "address",
|
|
1764
|
+
internalType: "address"
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
name: "amount",
|
|
1768
|
+
type: "uint256",
|
|
1769
|
+
internalType: "uint256"
|
|
1770
|
+
}
|
|
1771
|
+
],
|
|
1772
|
+
outputs: [
|
|
1773
|
+
{
|
|
1774
|
+
name: "",
|
|
1775
|
+
type: "tuple",
|
|
1776
|
+
internalType: "struct Preview",
|
|
1777
|
+
components: [
|
|
1778
|
+
{
|
|
1779
|
+
name: "input",
|
|
1780
|
+
type: "uint256",
|
|
1781
|
+
internalType: "uint256"
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
name: "fee",
|
|
1785
|
+
type: "uint256",
|
|
1786
|
+
internalType: "uint256"
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
name: "output",
|
|
1790
|
+
type: "uint256",
|
|
1791
|
+
internalType: "uint256"
|
|
1792
|
+
}
|
|
1793
|
+
]
|
|
1794
|
+
}
|
|
1795
|
+
],
|
|
1796
|
+
stateMutability: "view"
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
type: "function",
|
|
1800
|
+
name: "renounceOwnership",
|
|
1801
|
+
inputs: [],
|
|
1802
|
+
outputs: [],
|
|
1803
|
+
stateMutability: "payable"
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
type: "function",
|
|
1807
|
+
name: "requestOwnershipHandover",
|
|
1808
|
+
inputs: [],
|
|
1809
|
+
outputs: [],
|
|
1810
|
+
stateMutability: "payable"
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
type: "function",
|
|
1814
|
+
name: "setBps",
|
|
1815
|
+
inputs: [
|
|
1816
|
+
{
|
|
1817
|
+
name: "points",
|
|
1818
|
+
type: "uint256",
|
|
1819
|
+
internalType: "uint256"
|
|
1820
|
+
}
|
|
1821
|
+
],
|
|
1822
|
+
outputs: [
|
|
1823
|
+
{
|
|
1824
|
+
name: "",
|
|
1825
|
+
type: "bool",
|
|
1826
|
+
internalType: "bool"
|
|
1827
|
+
}
|
|
1828
|
+
],
|
|
1829
|
+
stateMutability: "nonpayable"
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
type: "function",
|
|
1833
|
+
name: "setInputToken",
|
|
1834
|
+
inputs: [
|
|
1835
|
+
{
|
|
1836
|
+
name: "token",
|
|
1837
|
+
type: "address",
|
|
1838
|
+
internalType: "address"
|
|
1839
|
+
},
|
|
1840
|
+
{
|
|
1841
|
+
name: "val",
|
|
1842
|
+
type: "bool",
|
|
1843
|
+
internalType: "bool"
|
|
1844
|
+
}
|
|
1845
|
+
],
|
|
1846
|
+
outputs: [
|
|
1847
|
+
{
|
|
1848
|
+
name: "",
|
|
1849
|
+
type: "bool",
|
|
1850
|
+
internalType: "bool"
|
|
1851
|
+
}
|
|
1852
|
+
],
|
|
1853
|
+
stateMutability: "nonpayable"
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
type: "function",
|
|
1857
|
+
name: "status",
|
|
1858
|
+
inputs: [],
|
|
1859
|
+
outputs: [
|
|
1860
|
+
{
|
|
1861
|
+
name: "",
|
|
1862
|
+
type: "tuple",
|
|
1863
|
+
internalType: "struct Status",
|
|
1864
|
+
components: [
|
|
1865
|
+
{
|
|
1866
|
+
name: "flags",
|
|
1867
|
+
type: "uint32",
|
|
1868
|
+
internalType: "uint32"
|
|
1869
|
+
},
|
|
1870
|
+
{
|
|
1871
|
+
name: "state",
|
|
1872
|
+
type: "uint8",
|
|
1873
|
+
internalType: "enum State"
|
|
1874
|
+
}
|
|
1875
|
+
]
|
|
1876
|
+
}
|
|
1877
|
+
],
|
|
1878
|
+
stateMutability: "view"
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
type: "function",
|
|
1882
|
+
name: "stop",
|
|
1883
|
+
inputs: [],
|
|
1884
|
+
outputs: [
|
|
1885
|
+
{
|
|
1886
|
+
name: "",
|
|
1887
|
+
type: "bool",
|
|
1888
|
+
internalType: "bool"
|
|
1889
|
+
}
|
|
1890
|
+
],
|
|
1891
|
+
stateMutability: "nonpayable"
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
type: "function",
|
|
1895
|
+
name: "stopped",
|
|
1896
|
+
inputs: [],
|
|
1897
|
+
outputs: [
|
|
1898
|
+
{
|
|
1899
|
+
name: "",
|
|
1900
|
+
type: "bool",
|
|
1901
|
+
internalType: "bool"
|
|
1902
|
+
}
|
|
1903
|
+
],
|
|
1904
|
+
stateMutability: "view"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
type: "function",
|
|
1908
|
+
name: "swap",
|
|
1909
|
+
inputs: [
|
|
1910
|
+
{
|
|
1911
|
+
name: "token",
|
|
1912
|
+
type: "address",
|
|
1913
|
+
internalType: "address"
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
name: "amount",
|
|
1917
|
+
type: "uint256",
|
|
1918
|
+
internalType: "uint256"
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
name: "slip",
|
|
1922
|
+
type: "uint256",
|
|
1923
|
+
internalType: "uint256"
|
|
1924
|
+
}
|
|
1925
|
+
],
|
|
1926
|
+
outputs: [
|
|
1927
|
+
{
|
|
1928
|
+
name: "",
|
|
1929
|
+
type: "uint256",
|
|
1930
|
+
internalType: "uint256"
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
stateMutability: "nonpayable"
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
type: "function",
|
|
1937
|
+
name: "tokenBalance",
|
|
1938
|
+
inputs: [
|
|
1939
|
+
{
|
|
1940
|
+
name: "token",
|
|
1941
|
+
type: "address",
|
|
1942
|
+
internalType: "address"
|
|
1943
|
+
}
|
|
1944
|
+
],
|
|
1945
|
+
outputs: [
|
|
1946
|
+
{
|
|
1947
|
+
name: "",
|
|
1948
|
+
type: "uint256",
|
|
1949
|
+
internalType: "uint256"
|
|
1950
|
+
}
|
|
1951
|
+
],
|
|
1952
|
+
stateMutability: "view"
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
type: "function",
|
|
1956
|
+
name: "totals",
|
|
1957
|
+
inputs: [
|
|
1958
|
+
{
|
|
1959
|
+
name: "user",
|
|
1960
|
+
type: "address",
|
|
1961
|
+
internalType: "address"
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
name: "token",
|
|
1965
|
+
type: "address",
|
|
1966
|
+
internalType: "address"
|
|
1967
|
+
}
|
|
1968
|
+
],
|
|
1969
|
+
outputs: [
|
|
1970
|
+
{
|
|
1971
|
+
name: "",
|
|
1972
|
+
type: "tuple",
|
|
1973
|
+
internalType: "struct SwapTotal",
|
|
1974
|
+
components: [
|
|
1975
|
+
{
|
|
1976
|
+
name: "inputSum",
|
|
1977
|
+
type: "uint256",
|
|
1978
|
+
internalType: "uint256"
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
name: "feeSum",
|
|
1982
|
+
type: "uint256",
|
|
1983
|
+
internalType: "uint256"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
name: "outputSum",
|
|
1987
|
+
type: "uint256",
|
|
1988
|
+
internalType: "uint256"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
name: "count",
|
|
1992
|
+
type: "uint256",
|
|
1993
|
+
internalType: "uint256"
|
|
1994
|
+
}
|
|
1995
|
+
]
|
|
1996
|
+
}
|
|
1997
|
+
],
|
|
1998
|
+
stateMutability: "view"
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
type: "function",
|
|
2002
|
+
name: "totals",
|
|
2003
|
+
inputs: [
|
|
2004
|
+
{
|
|
2005
|
+
name: "token",
|
|
2006
|
+
type: "address",
|
|
2007
|
+
internalType: "address"
|
|
2008
|
+
}
|
|
2009
|
+
],
|
|
2010
|
+
outputs: [
|
|
2011
|
+
{
|
|
2012
|
+
name: "",
|
|
2013
|
+
type: "tuple",
|
|
2014
|
+
internalType: "struct SwapTotal",
|
|
2015
|
+
components: [
|
|
2016
|
+
{
|
|
2017
|
+
name: "inputSum",
|
|
2018
|
+
type: "uint256",
|
|
2019
|
+
internalType: "uint256"
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
name: "feeSum",
|
|
2023
|
+
type: "uint256",
|
|
2024
|
+
internalType: "uint256"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
name: "outputSum",
|
|
2028
|
+
type: "uint256",
|
|
2029
|
+
internalType: "uint256"
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
name: "count",
|
|
2033
|
+
type: "uint256",
|
|
2034
|
+
internalType: "uint256"
|
|
2035
|
+
}
|
|
2036
|
+
]
|
|
2037
|
+
}
|
|
2038
|
+
],
|
|
2039
|
+
stateMutability: "view"
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
type: "function",
|
|
2043
|
+
name: "transfer",
|
|
2044
|
+
inputs: [
|
|
2045
|
+
{
|
|
2046
|
+
name: "to",
|
|
2047
|
+
type: "address",
|
|
2048
|
+
internalType: "address"
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
name: "amount",
|
|
2052
|
+
type: "uint256",
|
|
2053
|
+
internalType: "uint256"
|
|
2054
|
+
}
|
|
2055
|
+
],
|
|
2056
|
+
outputs: [
|
|
2057
|
+
{
|
|
2058
|
+
name: "",
|
|
2059
|
+
type: "bool",
|
|
2060
|
+
internalType: "bool"
|
|
2061
|
+
}
|
|
2062
|
+
],
|
|
2063
|
+
stateMutability: "nonpayable"
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
type: "function",
|
|
2067
|
+
name: "transfer",
|
|
2068
|
+
inputs: [
|
|
2069
|
+
{
|
|
2070
|
+
name: "to",
|
|
2071
|
+
type: "address",
|
|
2072
|
+
internalType: "address"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
name: "token",
|
|
2076
|
+
type: "address",
|
|
2077
|
+
internalType: "address"
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
name: "amount",
|
|
2081
|
+
type: "uint256",
|
|
2082
|
+
internalType: "uint256"
|
|
2083
|
+
}
|
|
2084
|
+
],
|
|
2085
|
+
outputs: [
|
|
2086
|
+
{
|
|
2087
|
+
name: "",
|
|
2088
|
+
type: "bool",
|
|
2089
|
+
internalType: "bool"
|
|
2090
|
+
}
|
|
2091
|
+
],
|
|
2092
|
+
stateMutability: "nonpayable"
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
type: "function",
|
|
2096
|
+
name: "transferOwnership",
|
|
2097
|
+
inputs: [
|
|
2098
|
+
{
|
|
2099
|
+
name: "newOwner",
|
|
2100
|
+
type: "address",
|
|
2101
|
+
internalType: "address"
|
|
2102
|
+
}
|
|
2103
|
+
],
|
|
2104
|
+
outputs: [],
|
|
2105
|
+
stateMutability: "payable"
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
type: "event",
|
|
2109
|
+
name: "BpsUpdated",
|
|
2110
|
+
inputs: [
|
|
2111
|
+
{
|
|
2112
|
+
name: "prev",
|
|
2113
|
+
type: "uint256",
|
|
2114
|
+
indexed: false,
|
|
2115
|
+
internalType: "uint256"
|
|
2116
|
+
},
|
|
2117
|
+
{
|
|
2118
|
+
name: "next",
|
|
2119
|
+
type: "uint256",
|
|
2120
|
+
indexed: false,
|
|
2121
|
+
internalType: "uint256"
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
2124
|
+
anonymous: false
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
type: "event",
|
|
2128
|
+
name: "InputTokenUpdated",
|
|
2129
|
+
inputs: [
|
|
2130
|
+
{
|
|
2131
|
+
name: "token",
|
|
2132
|
+
type: "address",
|
|
2133
|
+
indexed: true,
|
|
2134
|
+
internalType: "address"
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
name: "prev",
|
|
2138
|
+
type: "bool",
|
|
2139
|
+
indexed: false,
|
|
2140
|
+
internalType: "bool"
|
|
2141
|
+
},
|
|
2142
|
+
{
|
|
2143
|
+
name: "next",
|
|
2144
|
+
type: "bool",
|
|
2145
|
+
indexed: false,
|
|
2146
|
+
internalType: "bool"
|
|
2147
|
+
}
|
|
2148
|
+
],
|
|
2149
|
+
anonymous: false
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
type: "event",
|
|
2153
|
+
name: "OwnershipHandoverCanceled",
|
|
2154
|
+
inputs: [
|
|
2155
|
+
{
|
|
2156
|
+
name: "pendingOwner",
|
|
2157
|
+
type: "address",
|
|
2158
|
+
indexed: true,
|
|
2159
|
+
internalType: "address"
|
|
2160
|
+
}
|
|
2161
|
+
],
|
|
2162
|
+
anonymous: false
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
type: "event",
|
|
2166
|
+
name: "OwnershipHandoverRequested",
|
|
2167
|
+
inputs: [
|
|
2168
|
+
{
|
|
2169
|
+
name: "pendingOwner",
|
|
2170
|
+
type: "address",
|
|
2171
|
+
indexed: true,
|
|
2172
|
+
internalType: "address"
|
|
2173
|
+
}
|
|
2174
|
+
],
|
|
2175
|
+
anonymous: false
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
type: "event",
|
|
2179
|
+
name: "OwnershipTransferred",
|
|
2180
|
+
inputs: [
|
|
2181
|
+
{
|
|
2182
|
+
name: "oldOwner",
|
|
2183
|
+
type: "address",
|
|
2184
|
+
indexed: true,
|
|
2185
|
+
internalType: "address"
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
name: "newOwner",
|
|
2189
|
+
type: "address",
|
|
2190
|
+
indexed: true,
|
|
2191
|
+
internalType: "address"
|
|
2192
|
+
}
|
|
2193
|
+
],
|
|
2194
|
+
anonymous: false
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
type: "event",
|
|
2198
|
+
name: "Paused",
|
|
2199
|
+
inputs: [
|
|
2200
|
+
{
|
|
2201
|
+
name: "previous",
|
|
2202
|
+
type: "uint32",
|
|
2203
|
+
indexed: false,
|
|
2204
|
+
internalType: "uint32"
|
|
2205
|
+
},
|
|
2206
|
+
{
|
|
2207
|
+
name: "next",
|
|
2208
|
+
type: "uint32",
|
|
2209
|
+
indexed: false,
|
|
2210
|
+
internalType: "uint32"
|
|
2211
|
+
}
|
|
2212
|
+
],
|
|
2213
|
+
anonymous: false
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
type: "event",
|
|
2217
|
+
name: "Stopped",
|
|
2218
|
+
inputs: [],
|
|
2219
|
+
anonymous: false
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
type: "event",
|
|
2223
|
+
name: "Swapped",
|
|
2224
|
+
inputs: [
|
|
2225
|
+
{
|
|
2226
|
+
name: "user",
|
|
2227
|
+
type: "address",
|
|
2228
|
+
indexed: true,
|
|
2229
|
+
internalType: "address"
|
|
2230
|
+
},
|
|
2231
|
+
{
|
|
2232
|
+
name: "inputToken",
|
|
2233
|
+
type: "address",
|
|
2234
|
+
indexed: true,
|
|
2235
|
+
internalType: "address"
|
|
2236
|
+
},
|
|
2237
|
+
{
|
|
2238
|
+
name: "outputToken",
|
|
2239
|
+
type: "address",
|
|
2240
|
+
indexed: true,
|
|
2241
|
+
internalType: "address"
|
|
2242
|
+
},
|
|
2243
|
+
{
|
|
2244
|
+
name: "inputAmount",
|
|
2245
|
+
type: "uint256",
|
|
2246
|
+
indexed: false,
|
|
2247
|
+
internalType: "uint256"
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
name: "fee",
|
|
2251
|
+
type: "uint256",
|
|
2252
|
+
indexed: false,
|
|
2253
|
+
internalType: "uint256"
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
name: "outputAmount",
|
|
2257
|
+
type: "uint256",
|
|
2258
|
+
indexed: false,
|
|
2259
|
+
internalType: "uint256"
|
|
2260
|
+
}
|
|
2261
|
+
],
|
|
2262
|
+
anonymous: false
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
type: "event",
|
|
2266
|
+
name: "Transferred",
|
|
2267
|
+
inputs: [
|
|
2268
|
+
{
|
|
2269
|
+
name: "to",
|
|
2270
|
+
type: "address",
|
|
2271
|
+
indexed: true,
|
|
2272
|
+
internalType: "address"
|
|
2273
|
+
},
|
|
2274
|
+
{
|
|
2275
|
+
name: "token",
|
|
2276
|
+
type: "address",
|
|
2277
|
+
indexed: true,
|
|
2278
|
+
internalType: "address"
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
name: "amount",
|
|
2282
|
+
type: "uint256",
|
|
2283
|
+
indexed: false,
|
|
2284
|
+
internalType: "uint256"
|
|
2285
|
+
}
|
|
2286
|
+
],
|
|
2287
|
+
anonymous: false
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
type: "error",
|
|
2291
|
+
name: "AlreadyInitialized",
|
|
2292
|
+
inputs: []
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
type: "error",
|
|
2296
|
+
name: "InsufficientAmount",
|
|
2297
|
+
inputs: []
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
type: "error",
|
|
2301
|
+
name: "InvalidAddress",
|
|
2302
|
+
inputs: []
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
type: "error",
|
|
2306
|
+
name: "InvalidAmount",
|
|
2307
|
+
inputs: []
|
|
2308
|
+
},
|
|
2309
|
+
{
|
|
2310
|
+
type: "error",
|
|
2311
|
+
name: "IsPaused",
|
|
2312
|
+
inputs: [
|
|
2313
|
+
{
|
|
2314
|
+
name: "level",
|
|
2315
|
+
type: "uint32",
|
|
2316
|
+
internalType: "uint32"
|
|
2317
|
+
}
|
|
2318
|
+
]
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
type: "error",
|
|
2322
|
+
name: "IsStopped",
|
|
2323
|
+
inputs: []
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
type: "error",
|
|
2327
|
+
name: "NewOwnerIsZeroAddress",
|
|
2328
|
+
inputs: []
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
type: "error",
|
|
2332
|
+
name: "NoHandoverRequest",
|
|
2333
|
+
inputs: []
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
type: "error",
|
|
2337
|
+
name: "SwapFailed",
|
|
2338
|
+
inputs: [
|
|
2339
|
+
{
|
|
2340
|
+
name: "user",
|
|
2341
|
+
type: "address",
|
|
2342
|
+
internalType: "address"
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
name: "token",
|
|
2346
|
+
type: "address",
|
|
2347
|
+
internalType: "address"
|
|
2348
|
+
}
|
|
2349
|
+
]
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
type: "error",
|
|
2353
|
+
name: "Unauthorized",
|
|
2354
|
+
inputs: []
|
|
2355
|
+
}
|
|
2356
|
+
];
|
|
2357
|
+
|
|
1340
2358
|
// src/universal/types/providers/superstate/swap.ts
|
|
1341
|
-
var SwapAuthorization = {
|
|
1342
|
-
fromDto: (dto) => ({
|
|
1343
|
-
authorized: dto.authorized
|
|
1344
|
-
})
|
|
1345
|
-
};
|
|
1346
2359
|
var SwapPreview = {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
)
|
|
1352
|
-
fee: parseUint256(BigInt(dto.fee), "SwapPreview.fee"),
|
|
1353
|
-
outputAmount: parseUint256(
|
|
1354
|
-
BigInt(dto.receive_output_amount),
|
|
1355
|
-
"SwapPreview.receive_output_amount"
|
|
1356
|
-
)
|
|
2360
|
+
/** Maps the contract's `Preview { input, fee, output }` struct. */
|
|
2361
|
+
fromContract: (preview) => ({
|
|
2362
|
+
inputAmount: parseUint256(preview.input, "SwapPreview.input"),
|
|
2363
|
+
fee: parseUint256(preview.fee, "SwapPreview.fee"),
|
|
2364
|
+
outputAmount: parseUint256(preview.output, "SwapPreview.output")
|
|
1357
2365
|
})
|
|
1358
2366
|
};
|
|
2367
|
+
var PauseFlags = (value) => value;
|
|
1359
2368
|
var SwapStatus = {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
2369
|
+
/**
|
|
2370
|
+
* Maps the contract's `Status { uint32 flags; State state }` struct, where
|
|
2371
|
+
* `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
|
|
2372
|
+
*
|
|
2373
|
+
* `flags` is carried onto the `paused` arm only. On the other two the
|
|
2374
|
+
* contract sets it to a self-identifying marker rather than to information -
|
|
2375
|
+
* so repeating it would invite a caller to read meaning into a constant.
|
|
2376
|
+
*
|
|
2377
|
+
* @throws ValidationError on a `state` outside the enum. A contract that has
|
|
2378
|
+
* grown a fourth state is one the SDK does not model, and guessing `active`
|
|
2379
|
+
* would let a halted swap read as a live one.
|
|
2380
|
+
*/
|
|
2381
|
+
fromContract: (status) => {
|
|
2382
|
+
switch (status.state) {
|
|
2383
|
+
case 0:
|
|
2384
|
+
return { state: "active" };
|
|
2385
|
+
case 1:
|
|
2386
|
+
return { state: "paused", pausedLevels: PauseFlags(status.flags) };
|
|
2387
|
+
case 2:
|
|
2388
|
+
return { state: "stopped" };
|
|
2389
|
+
default:
|
|
2390
|
+
throw new ValidationError(
|
|
2391
|
+
`SwapStatus.state: unknown contract state (${status.state})`
|
|
2392
|
+
);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
1374
2395
|
};
|
|
1375
2396
|
var AllowWalletResponse = {
|
|
1376
2397
|
fromDto: (dto) => {
|
|
@@ -1395,84 +2416,6 @@ var AllowWalletResponse = {
|
|
|
1395
2416
|
};
|
|
1396
2417
|
|
|
1397
2418
|
// src/universal/api/frontline/providers/superstate/swap.ts
|
|
1398
|
-
async function getSwapAuthorization(api, params) {
|
|
1399
|
-
const dto = await api.send({
|
|
1400
|
-
method: "GET",
|
|
1401
|
-
url: "/v1/wallet/authorized",
|
|
1402
|
-
queryParams: {
|
|
1403
|
-
chain: params.chain,
|
|
1404
|
-
contract_address: params.contractAddress,
|
|
1405
|
-
wallet_address: params.walletAddress
|
|
1406
|
-
},
|
|
1407
|
-
attributes: Attributes.protected()
|
|
1408
|
-
});
|
|
1409
|
-
return SwapAuthorization.fromDto(dto);
|
|
1410
|
-
}
|
|
1411
|
-
async function getSwapOutputToken(api, params) {
|
|
1412
|
-
const dto = await api.send({
|
|
1413
|
-
method: "GET",
|
|
1414
|
-
url: "/v1/swap/output-token",
|
|
1415
|
-
queryParams: {
|
|
1416
|
-
chain: params.chain,
|
|
1417
|
-
contract_address: params.contractAddress
|
|
1418
|
-
},
|
|
1419
|
-
attributes: Attributes.protected()
|
|
1420
|
-
});
|
|
1421
|
-
return toErc20Asset(dto);
|
|
1422
|
-
}
|
|
1423
|
-
async function getSwapPreview(api, params) {
|
|
1424
|
-
const dto = await api.send({
|
|
1425
|
-
method: "GET",
|
|
1426
|
-
url: "/v1/swap/preview",
|
|
1427
|
-
queryParams: {
|
|
1428
|
-
chain: params.chain,
|
|
1429
|
-
contract_address: params.contractAddress,
|
|
1430
|
-
input_token: params.inputToken,
|
|
1431
|
-
amount: params.amount.toString()
|
|
1432
|
-
},
|
|
1433
|
-
attributes: Attributes.protected()
|
|
1434
|
-
});
|
|
1435
|
-
return SwapPreview.fromDto(dto);
|
|
1436
|
-
}
|
|
1437
|
-
async function getSwapStatus(api, params) {
|
|
1438
|
-
const dto = await api.send({
|
|
1439
|
-
method: "GET",
|
|
1440
|
-
url: "/v1/swap/status",
|
|
1441
|
-
queryParams: {
|
|
1442
|
-
chain: params.chain,
|
|
1443
|
-
contract_address: params.contractAddress
|
|
1444
|
-
},
|
|
1445
|
-
attributes: Attributes.protected()
|
|
1446
|
-
});
|
|
1447
|
-
return SwapStatus.fromDto(dto);
|
|
1448
|
-
}
|
|
1449
|
-
async function getTokenAllowance(api, params) {
|
|
1450
|
-
const dto = await api.send({
|
|
1451
|
-
method: "GET",
|
|
1452
|
-
url: "/v1/token/allowance",
|
|
1453
|
-
queryParams: {
|
|
1454
|
-
chain: params.chain,
|
|
1455
|
-
token_address: params.tokenAddress,
|
|
1456
|
-
owner: params.owner,
|
|
1457
|
-
spender: params.spender
|
|
1458
|
-
},
|
|
1459
|
-
attributes: Attributes.protected()
|
|
1460
|
-
});
|
|
1461
|
-
return TokenAllowance.fromDto(dto);
|
|
1462
|
-
}
|
|
1463
|
-
async function getTokenBalance(api, params) {
|
|
1464
|
-
const dto = await api.send({
|
|
1465
|
-
method: "GET",
|
|
1466
|
-
url: "/v1/token/balance",
|
|
1467
|
-
queryParams: {
|
|
1468
|
-
chain: params.chain,
|
|
1469
|
-
token_address: params.tokenAddress,
|
|
1470
|
-
owner: params.owner
|
|
1471
|
-
},
|
|
1472
|
-
attributes: Attributes.protected()
|
|
1473
|
-
});
|
|
1474
|
-
return TokenBalance.fromDto(dto);
|
|
1475
|
-
}
|
|
1476
2419
|
async function allowWallet(api, params) {
|
|
1477
2420
|
const dto = await api.send({
|
|
1478
2421
|
method: "POST",
|
|
@@ -1486,11 +2429,53 @@ async function allowWallet(api, params) {
|
|
|
1486
2429
|
});
|
|
1487
2430
|
return AllowWalletResponse.fromDto(dto);
|
|
1488
2431
|
}
|
|
1489
|
-
|
|
2432
|
+
|
|
2433
|
+
// src/universal/api/rpc/providers/superstate/swap.ts
|
|
2434
|
+
async function getSwapAuthorization(clients, params) {
|
|
2435
|
+
return clients(params.chain).readContract({
|
|
2436
|
+
address: params.contractAddress,
|
|
2437
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2438
|
+
functionName: "authorized",
|
|
2439
|
+
args: [params.walletAddress]
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
async function getSwapPreview(clients, params) {
|
|
2443
|
+
const preview = await clients(params.chain).readContract({
|
|
2444
|
+
address: params.contractAddress,
|
|
2445
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2446
|
+
functionName: "preview",
|
|
2447
|
+
args: [params.inputToken, params.amount]
|
|
2448
|
+
});
|
|
2449
|
+
return SwapPreview.fromContract(preview);
|
|
2450
|
+
}
|
|
2451
|
+
async function getSwapStatus(clients, params) {
|
|
2452
|
+
const status = await clients(params.chain).readContract({
|
|
2453
|
+
address: params.contractAddress,
|
|
2454
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2455
|
+
functionName: "status"
|
|
2456
|
+
});
|
|
2457
|
+
return SwapStatus.fromContract(status);
|
|
2458
|
+
}
|
|
2459
|
+
async function getSwapOutputToken(clients, params) {
|
|
2460
|
+
const client = clients(params.chain);
|
|
2461
|
+
const tokenAddress = await client.readContract({
|
|
2462
|
+
address: params.contractAddress,
|
|
2463
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2464
|
+
functionName: "outputToken"
|
|
2465
|
+
});
|
|
2466
|
+
const token = { address: EvmContractAddress(tokenAddress), abi: ERC20_ABI };
|
|
2467
|
+
const [name, symbol, decimals] = await client.multicall({
|
|
2468
|
+
contracts: [
|
|
2469
|
+
{ ...token, functionName: "name" },
|
|
2470
|
+
{ ...token, functionName: "symbol" },
|
|
2471
|
+
{ ...token, functionName: "decimals" }
|
|
2472
|
+
],
|
|
2473
|
+
allowFailure: false
|
|
2474
|
+
});
|
|
1490
2475
|
return {
|
|
1491
|
-
name
|
|
1492
|
-
symbol: AssetSymbol(
|
|
1493
|
-
decimals: AssetDecimals(
|
|
2476
|
+
name,
|
|
2477
|
+
symbol: AssetSymbol(symbol),
|
|
2478
|
+
decimals: AssetDecimals(decimals)
|
|
1494
2479
|
};
|
|
1495
2480
|
}
|
|
1496
2481
|
|
|
@@ -1501,28 +2486,32 @@ var SuperstateSwapNamespaceImpl = class {
|
|
|
1501
2486
|
this.log = internalLogger(ctx.logger, "SUPERSTATE");
|
|
1502
2487
|
}
|
|
1503
2488
|
async getAuthorization(params) {
|
|
1504
|
-
return this.log.wrap(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
2489
|
+
return this.log.wrap(
|
|
2490
|
+
"getAuthorization",
|
|
2491
|
+
params,
|
|
2492
|
+
async () => getSwapAuthorization(this.ctx.rpc, params)
|
|
2493
|
+
);
|
|
1508
2494
|
}
|
|
1509
2495
|
async getPreview(params) {
|
|
1510
|
-
return this.log.wrap(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2496
|
+
return this.log.wrap(
|
|
2497
|
+
"getPreview",
|
|
2498
|
+
params,
|
|
2499
|
+
async () => getSwapPreview(this.ctx.rpc, params)
|
|
2500
|
+
);
|
|
1514
2501
|
}
|
|
1515
2502
|
async getStatus(params) {
|
|
1516
|
-
return this.log.wrap(
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
2503
|
+
return this.log.wrap(
|
|
2504
|
+
"getStatus",
|
|
2505
|
+
params,
|
|
2506
|
+
async () => getSwapStatus(this.ctx.rpc, params)
|
|
2507
|
+
);
|
|
1520
2508
|
}
|
|
1521
2509
|
async getOutputToken(params) {
|
|
1522
|
-
return this.log.wrap(
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
2510
|
+
return this.log.wrap(
|
|
2511
|
+
"getOutputToken",
|
|
2512
|
+
params,
|
|
2513
|
+
async () => getSwapOutputToken(this.ctx.rpc, params)
|
|
2514
|
+
);
|
|
1526
2515
|
}
|
|
1527
2516
|
async allowWallet(params) {
|
|
1528
2517
|
return this.log.wrap("allowWallet", params, async () => {
|
|
@@ -1707,6 +2696,26 @@ var RequirementsNamespaceImpl = class {
|
|
|
1707
2696
|
}
|
|
1708
2697
|
};
|
|
1709
2698
|
|
|
2699
|
+
// src/universal/api/rpc/erc20.ts
|
|
2700
|
+
async function getTokenAllowance(clients, params) {
|
|
2701
|
+
const allowance = await clients(params.chain).readContract({
|
|
2702
|
+
address: params.tokenAddress,
|
|
2703
|
+
abi: ERC20_ABI,
|
|
2704
|
+
functionName: "allowance",
|
|
2705
|
+
args: [params.owner, params.spender]
|
|
2706
|
+
});
|
|
2707
|
+
return parseUint256(allowance, "allowance");
|
|
2708
|
+
}
|
|
2709
|
+
async function getTokenBalance(clients, params) {
|
|
2710
|
+
const balance = await clients(params.chain).readContract({
|
|
2711
|
+
address: params.tokenAddress,
|
|
2712
|
+
abi: ERC20_ABI,
|
|
2713
|
+
functionName: "balanceOf",
|
|
2714
|
+
args: [params.owner]
|
|
2715
|
+
});
|
|
2716
|
+
return parseUint256(balance, "balanceOf");
|
|
2717
|
+
}
|
|
2718
|
+
|
|
1710
2719
|
// src/universal/core/shared/blockchain/erc20/erc20-namespace.ts
|
|
1711
2720
|
var Erc20NamespaceImpl = class {
|
|
1712
2721
|
constructor(ctx) {
|
|
@@ -1714,16 +2723,18 @@ var Erc20NamespaceImpl = class {
|
|
|
1714
2723
|
this.log = internalLogger(ctx.logger, "ERC20");
|
|
1715
2724
|
}
|
|
1716
2725
|
async getAllowance(params) {
|
|
1717
|
-
return this.log.wrap(
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
2726
|
+
return this.log.wrap(
|
|
2727
|
+
"getAllowance",
|
|
2728
|
+
params,
|
|
2729
|
+
async () => getTokenAllowance(this.ctx.rpc, params)
|
|
2730
|
+
);
|
|
1721
2731
|
}
|
|
1722
2732
|
async getBalance(params) {
|
|
1723
|
-
return this.log.wrap(
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
2733
|
+
return this.log.wrap(
|
|
2734
|
+
"getBalance",
|
|
2735
|
+
params,
|
|
2736
|
+
async () => getTokenBalance(this.ctx.rpc, params)
|
|
2737
|
+
);
|
|
1727
2738
|
}
|
|
1728
2739
|
};
|
|
1729
2740
|
|
|
@@ -1887,9 +2898,9 @@ var HttpClient = class {
|
|
|
1887
2898
|
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
1888
2899
|
return url;
|
|
1889
2900
|
}
|
|
1890
|
-
const
|
|
2901
|
+
const base2 = this.config.baseUrl.replace(/\/$/, "");
|
|
1891
2902
|
const path = url.startsWith("/") ? url : `/${url}`;
|
|
1892
|
-
return
|
|
2903
|
+
return base2 + path;
|
|
1893
2904
|
}
|
|
1894
2905
|
async runBeforeRequestMiddleware(initialRequest) {
|
|
1895
2906
|
let request = initialRequest;
|
|
@@ -2313,6 +3324,7 @@ export {
|
|
|
2313
3324
|
describeErrorUnredacted,
|
|
2314
3325
|
internalLogger,
|
|
2315
3326
|
HttpClient,
|
|
3327
|
+
ERC20_ABI,
|
|
2316
3328
|
fetchAllPages,
|
|
2317
3329
|
Cursor,
|
|
2318
3330
|
PaginatedResponse,
|
|
@@ -2345,6 +3357,8 @@ export {
|
|
|
2345
3357
|
OfferSlug,
|
|
2346
3358
|
Offer,
|
|
2347
3359
|
OfferToken,
|
|
3360
|
+
Ticker,
|
|
3361
|
+
Isin,
|
|
2348
3362
|
OfferOptionId,
|
|
2349
3363
|
OfferOptionSlug,
|
|
2350
3364
|
OfferSwapContract,
|
|
@@ -2376,23 +3390,22 @@ export {
|
|
|
2376
3390
|
assetAmount,
|
|
2377
3391
|
NA_AMOUNT_ASSET_UI,
|
|
2378
3392
|
formattedUsdPrice,
|
|
3393
|
+
viemChain,
|
|
2379
3394
|
getChainId,
|
|
2380
3395
|
chainFromId,
|
|
2381
3396
|
getNetworkName,
|
|
2382
3397
|
txExplorerUrl,
|
|
2383
3398
|
blockchainAmountFromRawOrThrow,
|
|
2384
3399
|
parseBlockchainAmount,
|
|
2385
|
-
Ticker,
|
|
2386
3400
|
OndoTradingStatus,
|
|
2387
3401
|
OndoQuote,
|
|
2388
3402
|
OndoBuyTransaction,
|
|
2389
3403
|
OndoSellTransaction,
|
|
2390
3404
|
OndoNamespaceImpl,
|
|
2391
|
-
|
|
3405
|
+
SUPERSTATE_SWAP_ABI,
|
|
2392
3406
|
SwapPreview,
|
|
3407
|
+
PauseFlags,
|
|
2393
3408
|
SwapStatus,
|
|
2394
|
-
TokenAllowance,
|
|
2395
|
-
TokenBalance,
|
|
2396
3409
|
AllowWalletResponse,
|
|
2397
3410
|
SuperstateSwapNamespaceImpl,
|
|
2398
3411
|
fetchOffers,
|
|
@@ -2424,4 +3437,4 @@ export {
|
|
|
2424
3437
|
OAuthRefreshToken,
|
|
2425
3438
|
OAuthSession
|
|
2426
3439
|
};
|
|
2427
|
-
//# sourceMappingURL=chunk-
|
|
3440
|
+
//# sourceMappingURL=chunk-2YEJXE2V.js.map
|