@coinlist-co/react 0.12.0 → 0.12.1-rc.0fa5c3b
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-ZFBEI3BW.js → chunk-3EOK47CQ.js} +20 -330
- package/dist/chunk-3EOK47CQ.js.map +1 -0
- package/dist/{chunk-F6WGUKZC.js → chunk-I5EHOV7V.js} +129 -3
- package/dist/chunk-I5EHOV7V.js.map +1 -0
- package/dist/{chunk-6CQHDASY.js → chunk-VSYGGTI6.js} +1173 -156
- package/dist/chunk-VSYGGTI6.js.map +1 -0
- package/dist/client/index.cjs +8559 -7690
- 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 +1103 -405
- 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 +1 -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
|
}
|
|
@@ -1017,10 +1166,14 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1017
1166
|
if (/[eE]/.test(trimmed)) {
|
|
1018
1167
|
return { valid: false, reason: { type: "invalid-format" } };
|
|
1019
1168
|
}
|
|
1020
|
-
if (
|
|
1169
|
+
if (trimmed === ".") {
|
|
1170
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
1171
|
+
}
|
|
1172
|
+
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
1173
|
+
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
1021
1174
|
return { valid: false, reason: { type: "invalid-format" } };
|
|
1022
1175
|
}
|
|
1023
|
-
const [, fraction = ""] =
|
|
1176
|
+
const [, fraction = ""] = normalised.split(".");
|
|
1024
1177
|
if (fraction.length > decimals) {
|
|
1025
1178
|
return {
|
|
1026
1179
|
valid: false,
|
|
@@ -1028,7 +1181,7 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1028
1181
|
};
|
|
1029
1182
|
}
|
|
1030
1183
|
try {
|
|
1031
|
-
const raw = parseUnits(
|
|
1184
|
+
const raw = parseUnits(normalised, decimals);
|
|
1032
1185
|
if (raw > MAX_UINT_256) {
|
|
1033
1186
|
return { valid: false, reason: { type: "overflow" } };
|
|
1034
1187
|
}
|
|
@@ -1041,9 +1194,6 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1041
1194
|
}
|
|
1042
1195
|
}
|
|
1043
1196
|
|
|
1044
|
-
// src/universal/types/trading.ts
|
|
1045
|
-
var Ticker = (value) => value;
|
|
1046
|
-
|
|
1047
1197
|
// src/universal/types/providers/ondo/ondo.ts
|
|
1048
1198
|
var OndoTradingStatus = {
|
|
1049
1199
|
fromDto: (dto) => {
|
|
@@ -1337,40 +1487,915 @@ var OndoNamespaceImpl = class {
|
|
|
1337
1487
|
}
|
|
1338
1488
|
};
|
|
1339
1489
|
|
|
1490
|
+
// src/universal/core/checkout/superstate/blockchain/abi.ts
|
|
1491
|
+
var SUPERSTATE_SWAP_ABI = [
|
|
1492
|
+
{
|
|
1493
|
+
type: "function",
|
|
1494
|
+
name: "KIND",
|
|
1495
|
+
inputs: [],
|
|
1496
|
+
outputs: [
|
|
1497
|
+
{
|
|
1498
|
+
name: "",
|
|
1499
|
+
type: "uint16",
|
|
1500
|
+
internalType: "uint16"
|
|
1501
|
+
}
|
|
1502
|
+
],
|
|
1503
|
+
stateMutability: "view"
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
type: "function",
|
|
1507
|
+
name: "ONE_HUNDRED_P",
|
|
1508
|
+
inputs: [],
|
|
1509
|
+
outputs: [
|
|
1510
|
+
{
|
|
1511
|
+
name: "",
|
|
1512
|
+
type: "uint256",
|
|
1513
|
+
internalType: "uint256"
|
|
1514
|
+
}
|
|
1515
|
+
],
|
|
1516
|
+
stateMutability: "view"
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
type: "function",
|
|
1520
|
+
name: "SWAP_LEVEL",
|
|
1521
|
+
inputs: [],
|
|
1522
|
+
outputs: [
|
|
1523
|
+
{
|
|
1524
|
+
name: "",
|
|
1525
|
+
type: "uint32",
|
|
1526
|
+
internalType: "uint32"
|
|
1527
|
+
}
|
|
1528
|
+
],
|
|
1529
|
+
stateMutability: "view"
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
type: "function",
|
|
1533
|
+
name: "VERSION",
|
|
1534
|
+
inputs: [],
|
|
1535
|
+
outputs: [
|
|
1536
|
+
{
|
|
1537
|
+
name: "",
|
|
1538
|
+
type: "uint16",
|
|
1539
|
+
internalType: "uint16"
|
|
1540
|
+
}
|
|
1541
|
+
],
|
|
1542
|
+
stateMutability: "view"
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
type: "function",
|
|
1546
|
+
name: "authorized",
|
|
1547
|
+
inputs: [
|
|
1548
|
+
{
|
|
1549
|
+
name: "user",
|
|
1550
|
+
type: "address",
|
|
1551
|
+
internalType: "address"
|
|
1552
|
+
}
|
|
1553
|
+
],
|
|
1554
|
+
outputs: [
|
|
1555
|
+
{
|
|
1556
|
+
name: "",
|
|
1557
|
+
type: "bool",
|
|
1558
|
+
internalType: "bool"
|
|
1559
|
+
}
|
|
1560
|
+
],
|
|
1561
|
+
stateMutability: "view"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
type: "function",
|
|
1565
|
+
name: "bpp",
|
|
1566
|
+
inputs: [
|
|
1567
|
+
{
|
|
1568
|
+
name: "amount",
|
|
1569
|
+
type: "uint256",
|
|
1570
|
+
internalType: "uint256"
|
|
1571
|
+
}
|
|
1572
|
+
],
|
|
1573
|
+
outputs: [
|
|
1574
|
+
{
|
|
1575
|
+
name: "",
|
|
1576
|
+
type: "uint256",
|
|
1577
|
+
internalType: "uint256"
|
|
1578
|
+
}
|
|
1579
|
+
],
|
|
1580
|
+
stateMutability: "view"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
type: "function",
|
|
1584
|
+
name: "bps",
|
|
1585
|
+
inputs: [],
|
|
1586
|
+
outputs: [
|
|
1587
|
+
{
|
|
1588
|
+
name: "",
|
|
1589
|
+
type: "uint256",
|
|
1590
|
+
internalType: "uint256"
|
|
1591
|
+
}
|
|
1592
|
+
],
|
|
1593
|
+
stateMutability: "view"
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
type: "function",
|
|
1597
|
+
name: "cancelOwnershipHandover",
|
|
1598
|
+
inputs: [],
|
|
1599
|
+
outputs: [],
|
|
1600
|
+
stateMutability: "payable"
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
type: "function",
|
|
1604
|
+
name: "completeOwnershipHandover",
|
|
1605
|
+
inputs: [
|
|
1606
|
+
{
|
|
1607
|
+
name: "pendingOwner",
|
|
1608
|
+
type: "address",
|
|
1609
|
+
internalType: "address"
|
|
1610
|
+
}
|
|
1611
|
+
],
|
|
1612
|
+
outputs: [],
|
|
1613
|
+
stateMutability: "payable"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
type: "function",
|
|
1617
|
+
name: "fee",
|
|
1618
|
+
inputs: [
|
|
1619
|
+
{
|
|
1620
|
+
name: "amount",
|
|
1621
|
+
type: "uint256",
|
|
1622
|
+
internalType: "uint256"
|
|
1623
|
+
}
|
|
1624
|
+
],
|
|
1625
|
+
outputs: [
|
|
1626
|
+
{
|
|
1627
|
+
name: "",
|
|
1628
|
+
type: "uint256",
|
|
1629
|
+
internalType: "uint256"
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
name: "",
|
|
1633
|
+
type: "uint256",
|
|
1634
|
+
internalType: "uint256"
|
|
1635
|
+
}
|
|
1636
|
+
],
|
|
1637
|
+
stateMutability: "view"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
type: "function",
|
|
1641
|
+
name: "id",
|
|
1642
|
+
inputs: [],
|
|
1643
|
+
outputs: [
|
|
1644
|
+
{
|
|
1645
|
+
name: "",
|
|
1646
|
+
type: "bytes32",
|
|
1647
|
+
internalType: "bytes32"
|
|
1648
|
+
}
|
|
1649
|
+
],
|
|
1650
|
+
stateMutability: "view"
|
|
1651
|
+
},
|
|
1652
|
+
{
|
|
1653
|
+
type: "function",
|
|
1654
|
+
name: "inputTokens",
|
|
1655
|
+
inputs: [
|
|
1656
|
+
{
|
|
1657
|
+
name: "",
|
|
1658
|
+
type: "address",
|
|
1659
|
+
internalType: "address"
|
|
1660
|
+
}
|
|
1661
|
+
],
|
|
1662
|
+
outputs: [
|
|
1663
|
+
{
|
|
1664
|
+
name: "",
|
|
1665
|
+
type: "bool",
|
|
1666
|
+
internalType: "bool"
|
|
1667
|
+
}
|
|
1668
|
+
],
|
|
1669
|
+
stateMutability: "view"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
type: "function",
|
|
1673
|
+
name: "outputToken",
|
|
1674
|
+
inputs: [],
|
|
1675
|
+
outputs: [
|
|
1676
|
+
{
|
|
1677
|
+
name: "",
|
|
1678
|
+
type: "address",
|
|
1679
|
+
internalType: "address"
|
|
1680
|
+
}
|
|
1681
|
+
],
|
|
1682
|
+
stateMutability: "view"
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
type: "function",
|
|
1686
|
+
name: "outputTokenBalance",
|
|
1687
|
+
inputs: [],
|
|
1688
|
+
outputs: [
|
|
1689
|
+
{
|
|
1690
|
+
name: "",
|
|
1691
|
+
type: "uint256",
|
|
1692
|
+
internalType: "uint256"
|
|
1693
|
+
}
|
|
1694
|
+
],
|
|
1695
|
+
stateMutability: "view"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
type: "function",
|
|
1699
|
+
name: "owner",
|
|
1700
|
+
inputs: [],
|
|
1701
|
+
outputs: [
|
|
1702
|
+
{
|
|
1703
|
+
name: "result",
|
|
1704
|
+
type: "address",
|
|
1705
|
+
internalType: "address"
|
|
1706
|
+
}
|
|
1707
|
+
],
|
|
1708
|
+
stateMutability: "view"
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
type: "function",
|
|
1712
|
+
name: "ownershipHandoverExpiresAt",
|
|
1713
|
+
inputs: [
|
|
1714
|
+
{
|
|
1715
|
+
name: "pendingOwner",
|
|
1716
|
+
type: "address",
|
|
1717
|
+
internalType: "address"
|
|
1718
|
+
}
|
|
1719
|
+
],
|
|
1720
|
+
outputs: [
|
|
1721
|
+
{
|
|
1722
|
+
name: "result",
|
|
1723
|
+
type: "uint256",
|
|
1724
|
+
internalType: "uint256"
|
|
1725
|
+
}
|
|
1726
|
+
],
|
|
1727
|
+
stateMutability: "view"
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
type: "function",
|
|
1731
|
+
name: "pause",
|
|
1732
|
+
inputs: [
|
|
1733
|
+
{
|
|
1734
|
+
name: "level",
|
|
1735
|
+
type: "uint32",
|
|
1736
|
+
internalType: "uint32"
|
|
1737
|
+
}
|
|
1738
|
+
],
|
|
1739
|
+
outputs: [
|
|
1740
|
+
{
|
|
1741
|
+
name: "",
|
|
1742
|
+
type: "bool",
|
|
1743
|
+
internalType: "bool"
|
|
1744
|
+
}
|
|
1745
|
+
],
|
|
1746
|
+
stateMutability: "nonpayable"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
type: "function",
|
|
1750
|
+
name: "paused",
|
|
1751
|
+
inputs: [],
|
|
1752
|
+
outputs: [
|
|
1753
|
+
{
|
|
1754
|
+
name: "",
|
|
1755
|
+
type: "uint32",
|
|
1756
|
+
internalType: "uint32"
|
|
1757
|
+
}
|
|
1758
|
+
],
|
|
1759
|
+
stateMutability: "view"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
type: "function",
|
|
1763
|
+
name: "preview",
|
|
1764
|
+
inputs: [
|
|
1765
|
+
{
|
|
1766
|
+
name: "token",
|
|
1767
|
+
type: "address",
|
|
1768
|
+
internalType: "address"
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
name: "amount",
|
|
1772
|
+
type: "uint256",
|
|
1773
|
+
internalType: "uint256"
|
|
1774
|
+
}
|
|
1775
|
+
],
|
|
1776
|
+
outputs: [
|
|
1777
|
+
{
|
|
1778
|
+
name: "",
|
|
1779
|
+
type: "tuple",
|
|
1780
|
+
internalType: "struct Preview",
|
|
1781
|
+
components: [
|
|
1782
|
+
{
|
|
1783
|
+
name: "input",
|
|
1784
|
+
type: "uint256",
|
|
1785
|
+
internalType: "uint256"
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
name: "fee",
|
|
1789
|
+
type: "uint256",
|
|
1790
|
+
internalType: "uint256"
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
name: "output",
|
|
1794
|
+
type: "uint256",
|
|
1795
|
+
internalType: "uint256"
|
|
1796
|
+
}
|
|
1797
|
+
]
|
|
1798
|
+
}
|
|
1799
|
+
],
|
|
1800
|
+
stateMutability: "view"
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
type: "function",
|
|
1804
|
+
name: "renounceOwnership",
|
|
1805
|
+
inputs: [],
|
|
1806
|
+
outputs: [],
|
|
1807
|
+
stateMutability: "payable"
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
type: "function",
|
|
1811
|
+
name: "requestOwnershipHandover",
|
|
1812
|
+
inputs: [],
|
|
1813
|
+
outputs: [],
|
|
1814
|
+
stateMutability: "payable"
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
type: "function",
|
|
1818
|
+
name: "setBps",
|
|
1819
|
+
inputs: [
|
|
1820
|
+
{
|
|
1821
|
+
name: "points",
|
|
1822
|
+
type: "uint256",
|
|
1823
|
+
internalType: "uint256"
|
|
1824
|
+
}
|
|
1825
|
+
],
|
|
1826
|
+
outputs: [
|
|
1827
|
+
{
|
|
1828
|
+
name: "",
|
|
1829
|
+
type: "bool",
|
|
1830
|
+
internalType: "bool"
|
|
1831
|
+
}
|
|
1832
|
+
],
|
|
1833
|
+
stateMutability: "nonpayable"
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
type: "function",
|
|
1837
|
+
name: "setInputToken",
|
|
1838
|
+
inputs: [
|
|
1839
|
+
{
|
|
1840
|
+
name: "token",
|
|
1841
|
+
type: "address",
|
|
1842
|
+
internalType: "address"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
name: "val",
|
|
1846
|
+
type: "bool",
|
|
1847
|
+
internalType: "bool"
|
|
1848
|
+
}
|
|
1849
|
+
],
|
|
1850
|
+
outputs: [
|
|
1851
|
+
{
|
|
1852
|
+
name: "",
|
|
1853
|
+
type: "bool",
|
|
1854
|
+
internalType: "bool"
|
|
1855
|
+
}
|
|
1856
|
+
],
|
|
1857
|
+
stateMutability: "nonpayable"
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
type: "function",
|
|
1861
|
+
name: "status",
|
|
1862
|
+
inputs: [],
|
|
1863
|
+
outputs: [
|
|
1864
|
+
{
|
|
1865
|
+
name: "",
|
|
1866
|
+
type: "tuple",
|
|
1867
|
+
internalType: "struct Status",
|
|
1868
|
+
components: [
|
|
1869
|
+
{
|
|
1870
|
+
name: "flags",
|
|
1871
|
+
type: "uint32",
|
|
1872
|
+
internalType: "uint32"
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
name: "state",
|
|
1876
|
+
type: "uint8",
|
|
1877
|
+
internalType: "enum State"
|
|
1878
|
+
}
|
|
1879
|
+
]
|
|
1880
|
+
}
|
|
1881
|
+
],
|
|
1882
|
+
stateMutability: "view"
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
type: "function",
|
|
1886
|
+
name: "stop",
|
|
1887
|
+
inputs: [],
|
|
1888
|
+
outputs: [
|
|
1889
|
+
{
|
|
1890
|
+
name: "",
|
|
1891
|
+
type: "bool",
|
|
1892
|
+
internalType: "bool"
|
|
1893
|
+
}
|
|
1894
|
+
],
|
|
1895
|
+
stateMutability: "nonpayable"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
type: "function",
|
|
1899
|
+
name: "stopped",
|
|
1900
|
+
inputs: [],
|
|
1901
|
+
outputs: [
|
|
1902
|
+
{
|
|
1903
|
+
name: "",
|
|
1904
|
+
type: "bool",
|
|
1905
|
+
internalType: "bool"
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
stateMutability: "view"
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
type: "function",
|
|
1912
|
+
name: "swap",
|
|
1913
|
+
inputs: [
|
|
1914
|
+
{
|
|
1915
|
+
name: "token",
|
|
1916
|
+
type: "address",
|
|
1917
|
+
internalType: "address"
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
name: "amount",
|
|
1921
|
+
type: "uint256",
|
|
1922
|
+
internalType: "uint256"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
name: "slip",
|
|
1926
|
+
type: "uint256",
|
|
1927
|
+
internalType: "uint256"
|
|
1928
|
+
}
|
|
1929
|
+
],
|
|
1930
|
+
outputs: [
|
|
1931
|
+
{
|
|
1932
|
+
name: "",
|
|
1933
|
+
type: "uint256",
|
|
1934
|
+
internalType: "uint256"
|
|
1935
|
+
}
|
|
1936
|
+
],
|
|
1937
|
+
stateMutability: "nonpayable"
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
type: "function",
|
|
1941
|
+
name: "tokenBalance",
|
|
1942
|
+
inputs: [
|
|
1943
|
+
{
|
|
1944
|
+
name: "token",
|
|
1945
|
+
type: "address",
|
|
1946
|
+
internalType: "address"
|
|
1947
|
+
}
|
|
1948
|
+
],
|
|
1949
|
+
outputs: [
|
|
1950
|
+
{
|
|
1951
|
+
name: "",
|
|
1952
|
+
type: "uint256",
|
|
1953
|
+
internalType: "uint256"
|
|
1954
|
+
}
|
|
1955
|
+
],
|
|
1956
|
+
stateMutability: "view"
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
type: "function",
|
|
1960
|
+
name: "totals",
|
|
1961
|
+
inputs: [
|
|
1962
|
+
{
|
|
1963
|
+
name: "user",
|
|
1964
|
+
type: "address",
|
|
1965
|
+
internalType: "address"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
name: "token",
|
|
1969
|
+
type: "address",
|
|
1970
|
+
internalType: "address"
|
|
1971
|
+
}
|
|
1972
|
+
],
|
|
1973
|
+
outputs: [
|
|
1974
|
+
{
|
|
1975
|
+
name: "",
|
|
1976
|
+
type: "tuple",
|
|
1977
|
+
internalType: "struct SwapTotal",
|
|
1978
|
+
components: [
|
|
1979
|
+
{
|
|
1980
|
+
name: "inputSum",
|
|
1981
|
+
type: "uint256",
|
|
1982
|
+
internalType: "uint256"
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
name: "feeSum",
|
|
1986
|
+
type: "uint256",
|
|
1987
|
+
internalType: "uint256"
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
name: "outputSum",
|
|
1991
|
+
type: "uint256",
|
|
1992
|
+
internalType: "uint256"
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
name: "count",
|
|
1996
|
+
type: "uint256",
|
|
1997
|
+
internalType: "uint256"
|
|
1998
|
+
}
|
|
1999
|
+
]
|
|
2000
|
+
}
|
|
2001
|
+
],
|
|
2002
|
+
stateMutability: "view"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
type: "function",
|
|
2006
|
+
name: "totals",
|
|
2007
|
+
inputs: [
|
|
2008
|
+
{
|
|
2009
|
+
name: "token",
|
|
2010
|
+
type: "address",
|
|
2011
|
+
internalType: "address"
|
|
2012
|
+
}
|
|
2013
|
+
],
|
|
2014
|
+
outputs: [
|
|
2015
|
+
{
|
|
2016
|
+
name: "",
|
|
2017
|
+
type: "tuple",
|
|
2018
|
+
internalType: "struct SwapTotal",
|
|
2019
|
+
components: [
|
|
2020
|
+
{
|
|
2021
|
+
name: "inputSum",
|
|
2022
|
+
type: "uint256",
|
|
2023
|
+
internalType: "uint256"
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
name: "feeSum",
|
|
2027
|
+
type: "uint256",
|
|
2028
|
+
internalType: "uint256"
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
name: "outputSum",
|
|
2032
|
+
type: "uint256",
|
|
2033
|
+
internalType: "uint256"
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
name: "count",
|
|
2037
|
+
type: "uint256",
|
|
2038
|
+
internalType: "uint256"
|
|
2039
|
+
}
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
],
|
|
2043
|
+
stateMutability: "view"
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
type: "function",
|
|
2047
|
+
name: "transfer",
|
|
2048
|
+
inputs: [
|
|
2049
|
+
{
|
|
2050
|
+
name: "to",
|
|
2051
|
+
type: "address",
|
|
2052
|
+
internalType: "address"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
name: "amount",
|
|
2056
|
+
type: "uint256",
|
|
2057
|
+
internalType: "uint256"
|
|
2058
|
+
}
|
|
2059
|
+
],
|
|
2060
|
+
outputs: [
|
|
2061
|
+
{
|
|
2062
|
+
name: "",
|
|
2063
|
+
type: "bool",
|
|
2064
|
+
internalType: "bool"
|
|
2065
|
+
}
|
|
2066
|
+
],
|
|
2067
|
+
stateMutability: "nonpayable"
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
type: "function",
|
|
2071
|
+
name: "transfer",
|
|
2072
|
+
inputs: [
|
|
2073
|
+
{
|
|
2074
|
+
name: "to",
|
|
2075
|
+
type: "address",
|
|
2076
|
+
internalType: "address"
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
name: "token",
|
|
2080
|
+
type: "address",
|
|
2081
|
+
internalType: "address"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
name: "amount",
|
|
2085
|
+
type: "uint256",
|
|
2086
|
+
internalType: "uint256"
|
|
2087
|
+
}
|
|
2088
|
+
],
|
|
2089
|
+
outputs: [
|
|
2090
|
+
{
|
|
2091
|
+
name: "",
|
|
2092
|
+
type: "bool",
|
|
2093
|
+
internalType: "bool"
|
|
2094
|
+
}
|
|
2095
|
+
],
|
|
2096
|
+
stateMutability: "nonpayable"
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
type: "function",
|
|
2100
|
+
name: "transferOwnership",
|
|
2101
|
+
inputs: [
|
|
2102
|
+
{
|
|
2103
|
+
name: "newOwner",
|
|
2104
|
+
type: "address",
|
|
2105
|
+
internalType: "address"
|
|
2106
|
+
}
|
|
2107
|
+
],
|
|
2108
|
+
outputs: [],
|
|
2109
|
+
stateMutability: "payable"
|
|
2110
|
+
},
|
|
2111
|
+
{
|
|
2112
|
+
type: "event",
|
|
2113
|
+
name: "BpsUpdated",
|
|
2114
|
+
inputs: [
|
|
2115
|
+
{
|
|
2116
|
+
name: "prev",
|
|
2117
|
+
type: "uint256",
|
|
2118
|
+
indexed: false,
|
|
2119
|
+
internalType: "uint256"
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
name: "next",
|
|
2123
|
+
type: "uint256",
|
|
2124
|
+
indexed: false,
|
|
2125
|
+
internalType: "uint256"
|
|
2126
|
+
}
|
|
2127
|
+
],
|
|
2128
|
+
anonymous: false
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
type: "event",
|
|
2132
|
+
name: "InputTokenUpdated",
|
|
2133
|
+
inputs: [
|
|
2134
|
+
{
|
|
2135
|
+
name: "token",
|
|
2136
|
+
type: "address",
|
|
2137
|
+
indexed: true,
|
|
2138
|
+
internalType: "address"
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
name: "prev",
|
|
2142
|
+
type: "bool",
|
|
2143
|
+
indexed: false,
|
|
2144
|
+
internalType: "bool"
|
|
2145
|
+
},
|
|
2146
|
+
{
|
|
2147
|
+
name: "next",
|
|
2148
|
+
type: "bool",
|
|
2149
|
+
indexed: false,
|
|
2150
|
+
internalType: "bool"
|
|
2151
|
+
}
|
|
2152
|
+
],
|
|
2153
|
+
anonymous: false
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
type: "event",
|
|
2157
|
+
name: "OwnershipHandoverCanceled",
|
|
2158
|
+
inputs: [
|
|
2159
|
+
{
|
|
2160
|
+
name: "pendingOwner",
|
|
2161
|
+
type: "address",
|
|
2162
|
+
indexed: true,
|
|
2163
|
+
internalType: "address"
|
|
2164
|
+
}
|
|
2165
|
+
],
|
|
2166
|
+
anonymous: false
|
|
2167
|
+
},
|
|
2168
|
+
{
|
|
2169
|
+
type: "event",
|
|
2170
|
+
name: "OwnershipHandoverRequested",
|
|
2171
|
+
inputs: [
|
|
2172
|
+
{
|
|
2173
|
+
name: "pendingOwner",
|
|
2174
|
+
type: "address",
|
|
2175
|
+
indexed: true,
|
|
2176
|
+
internalType: "address"
|
|
2177
|
+
}
|
|
2178
|
+
],
|
|
2179
|
+
anonymous: false
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
type: "event",
|
|
2183
|
+
name: "OwnershipTransferred",
|
|
2184
|
+
inputs: [
|
|
2185
|
+
{
|
|
2186
|
+
name: "oldOwner",
|
|
2187
|
+
type: "address",
|
|
2188
|
+
indexed: true,
|
|
2189
|
+
internalType: "address"
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
name: "newOwner",
|
|
2193
|
+
type: "address",
|
|
2194
|
+
indexed: true,
|
|
2195
|
+
internalType: "address"
|
|
2196
|
+
}
|
|
2197
|
+
],
|
|
2198
|
+
anonymous: false
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
type: "event",
|
|
2202
|
+
name: "Paused",
|
|
2203
|
+
inputs: [
|
|
2204
|
+
{
|
|
2205
|
+
name: "previous",
|
|
2206
|
+
type: "uint32",
|
|
2207
|
+
indexed: false,
|
|
2208
|
+
internalType: "uint32"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
name: "next",
|
|
2212
|
+
type: "uint32",
|
|
2213
|
+
indexed: false,
|
|
2214
|
+
internalType: "uint32"
|
|
2215
|
+
}
|
|
2216
|
+
],
|
|
2217
|
+
anonymous: false
|
|
2218
|
+
},
|
|
2219
|
+
{
|
|
2220
|
+
type: "event",
|
|
2221
|
+
name: "Stopped",
|
|
2222
|
+
inputs: [],
|
|
2223
|
+
anonymous: false
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
type: "event",
|
|
2227
|
+
name: "Swapped",
|
|
2228
|
+
inputs: [
|
|
2229
|
+
{
|
|
2230
|
+
name: "user",
|
|
2231
|
+
type: "address",
|
|
2232
|
+
indexed: true,
|
|
2233
|
+
internalType: "address"
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
name: "inputToken",
|
|
2237
|
+
type: "address",
|
|
2238
|
+
indexed: true,
|
|
2239
|
+
internalType: "address"
|
|
2240
|
+
},
|
|
2241
|
+
{
|
|
2242
|
+
name: "outputToken",
|
|
2243
|
+
type: "address",
|
|
2244
|
+
indexed: true,
|
|
2245
|
+
internalType: "address"
|
|
2246
|
+
},
|
|
2247
|
+
{
|
|
2248
|
+
name: "inputAmount",
|
|
2249
|
+
type: "uint256",
|
|
2250
|
+
indexed: false,
|
|
2251
|
+
internalType: "uint256"
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
name: "fee",
|
|
2255
|
+
type: "uint256",
|
|
2256
|
+
indexed: false,
|
|
2257
|
+
internalType: "uint256"
|
|
2258
|
+
},
|
|
2259
|
+
{
|
|
2260
|
+
name: "outputAmount",
|
|
2261
|
+
type: "uint256",
|
|
2262
|
+
indexed: false,
|
|
2263
|
+
internalType: "uint256"
|
|
2264
|
+
}
|
|
2265
|
+
],
|
|
2266
|
+
anonymous: false
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
type: "event",
|
|
2270
|
+
name: "Transferred",
|
|
2271
|
+
inputs: [
|
|
2272
|
+
{
|
|
2273
|
+
name: "to",
|
|
2274
|
+
type: "address",
|
|
2275
|
+
indexed: true,
|
|
2276
|
+
internalType: "address"
|
|
2277
|
+
},
|
|
2278
|
+
{
|
|
2279
|
+
name: "token",
|
|
2280
|
+
type: "address",
|
|
2281
|
+
indexed: true,
|
|
2282
|
+
internalType: "address"
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
name: "amount",
|
|
2286
|
+
type: "uint256",
|
|
2287
|
+
indexed: false,
|
|
2288
|
+
internalType: "uint256"
|
|
2289
|
+
}
|
|
2290
|
+
],
|
|
2291
|
+
anonymous: false
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
type: "error",
|
|
2295
|
+
name: "AlreadyInitialized",
|
|
2296
|
+
inputs: []
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
type: "error",
|
|
2300
|
+
name: "InsufficientAmount",
|
|
2301
|
+
inputs: []
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
type: "error",
|
|
2305
|
+
name: "InvalidAddress",
|
|
2306
|
+
inputs: []
|
|
2307
|
+
},
|
|
2308
|
+
{
|
|
2309
|
+
type: "error",
|
|
2310
|
+
name: "InvalidAmount",
|
|
2311
|
+
inputs: []
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
type: "error",
|
|
2315
|
+
name: "IsPaused",
|
|
2316
|
+
inputs: [
|
|
2317
|
+
{
|
|
2318
|
+
name: "level",
|
|
2319
|
+
type: "uint32",
|
|
2320
|
+
internalType: "uint32"
|
|
2321
|
+
}
|
|
2322
|
+
]
|
|
2323
|
+
},
|
|
2324
|
+
{
|
|
2325
|
+
type: "error",
|
|
2326
|
+
name: "IsStopped",
|
|
2327
|
+
inputs: []
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
type: "error",
|
|
2331
|
+
name: "NewOwnerIsZeroAddress",
|
|
2332
|
+
inputs: []
|
|
2333
|
+
},
|
|
2334
|
+
{
|
|
2335
|
+
type: "error",
|
|
2336
|
+
name: "NoHandoverRequest",
|
|
2337
|
+
inputs: []
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
type: "error",
|
|
2341
|
+
name: "SwapFailed",
|
|
2342
|
+
inputs: [
|
|
2343
|
+
{
|
|
2344
|
+
name: "user",
|
|
2345
|
+
type: "address",
|
|
2346
|
+
internalType: "address"
|
|
2347
|
+
},
|
|
2348
|
+
{
|
|
2349
|
+
name: "token",
|
|
2350
|
+
type: "address",
|
|
2351
|
+
internalType: "address"
|
|
2352
|
+
}
|
|
2353
|
+
]
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
type: "error",
|
|
2357
|
+
name: "Unauthorized",
|
|
2358
|
+
inputs: []
|
|
2359
|
+
}
|
|
2360
|
+
];
|
|
2361
|
+
|
|
1340
2362
|
// src/universal/types/providers/superstate/swap.ts
|
|
1341
|
-
var SwapAuthorization = {
|
|
1342
|
-
fromDto: (dto) => ({
|
|
1343
|
-
authorized: dto.authorized
|
|
1344
|
-
})
|
|
1345
|
-
};
|
|
1346
2363
|
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
|
-
)
|
|
2364
|
+
/** Maps the contract's `Preview { input, fee, output }` struct. */
|
|
2365
|
+
fromContract: (preview) => ({
|
|
2366
|
+
inputAmount: parseUint256(preview.input, "SwapPreview.input"),
|
|
2367
|
+
fee: parseUint256(preview.fee, "SwapPreview.fee"),
|
|
2368
|
+
outputAmount: parseUint256(preview.output, "SwapPreview.output")
|
|
1357
2369
|
})
|
|
1358
2370
|
};
|
|
2371
|
+
var PauseFlags = (value) => value;
|
|
1359
2372
|
var SwapStatus = {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
2373
|
+
/**
|
|
2374
|
+
* Maps the contract's `Status { uint32 flags; State state }` struct, where
|
|
2375
|
+
* `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
|
|
2376
|
+
*
|
|
2377
|
+
* `flags` is carried onto the `paused` arm only. On the other two the
|
|
2378
|
+
* contract sets it to a self-identifying marker rather than to information -
|
|
2379
|
+
* so repeating it would invite a caller to read meaning into a constant.
|
|
2380
|
+
*
|
|
2381
|
+
* @throws ValidationError on a `state` outside the enum. A contract that has
|
|
2382
|
+
* grown a fourth state is one the SDK does not model, and guessing `active`
|
|
2383
|
+
* would let a halted swap read as a live one.
|
|
2384
|
+
*/
|
|
2385
|
+
fromContract: (status) => {
|
|
2386
|
+
switch (status.state) {
|
|
2387
|
+
case 0:
|
|
2388
|
+
return { state: "active" };
|
|
2389
|
+
case 1:
|
|
2390
|
+
return { state: "paused", pausedLevels: PauseFlags(status.flags) };
|
|
2391
|
+
case 2:
|
|
2392
|
+
return { state: "stopped" };
|
|
2393
|
+
default:
|
|
2394
|
+
throw new ValidationError(
|
|
2395
|
+
`SwapStatus.state: unknown contract state (${status.state})`
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
1374
2399
|
};
|
|
1375
2400
|
var AllowWalletResponse = {
|
|
1376
2401
|
fromDto: (dto) => {
|
|
@@ -1395,84 +2420,6 @@ var AllowWalletResponse = {
|
|
|
1395
2420
|
};
|
|
1396
2421
|
|
|
1397
2422
|
// 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
2423
|
async function allowWallet(api, params) {
|
|
1477
2424
|
const dto = await api.send({
|
|
1478
2425
|
method: "POST",
|
|
@@ -1486,11 +2433,53 @@ async function allowWallet(api, params) {
|
|
|
1486
2433
|
});
|
|
1487
2434
|
return AllowWalletResponse.fromDto(dto);
|
|
1488
2435
|
}
|
|
1489
|
-
|
|
2436
|
+
|
|
2437
|
+
// src/universal/api/rpc/providers/superstate/swap.ts
|
|
2438
|
+
async function getSwapAuthorization(clients, params) {
|
|
2439
|
+
return clients(params.chain).readContract({
|
|
2440
|
+
address: params.contractAddress,
|
|
2441
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2442
|
+
functionName: "authorized",
|
|
2443
|
+
args: [params.walletAddress]
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
async function getSwapPreview(clients, params) {
|
|
2447
|
+
const preview = await clients(params.chain).readContract({
|
|
2448
|
+
address: params.contractAddress,
|
|
2449
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2450
|
+
functionName: "preview",
|
|
2451
|
+
args: [params.inputToken, params.amount]
|
|
2452
|
+
});
|
|
2453
|
+
return SwapPreview.fromContract(preview);
|
|
2454
|
+
}
|
|
2455
|
+
async function getSwapStatus(clients, params) {
|
|
2456
|
+
const status = await clients(params.chain).readContract({
|
|
2457
|
+
address: params.contractAddress,
|
|
2458
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2459
|
+
functionName: "status"
|
|
2460
|
+
});
|
|
2461
|
+
return SwapStatus.fromContract(status);
|
|
2462
|
+
}
|
|
2463
|
+
async function getSwapOutputToken(clients, params) {
|
|
2464
|
+
const client = clients(params.chain);
|
|
2465
|
+
const tokenAddress = await client.readContract({
|
|
2466
|
+
address: params.contractAddress,
|
|
2467
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2468
|
+
functionName: "outputToken"
|
|
2469
|
+
});
|
|
2470
|
+
const token = { address: EvmContractAddress(tokenAddress), abi: ERC20_ABI };
|
|
2471
|
+
const [name, symbol, decimals] = await client.multicall({
|
|
2472
|
+
contracts: [
|
|
2473
|
+
{ ...token, functionName: "name" },
|
|
2474
|
+
{ ...token, functionName: "symbol" },
|
|
2475
|
+
{ ...token, functionName: "decimals" }
|
|
2476
|
+
],
|
|
2477
|
+
allowFailure: false
|
|
2478
|
+
});
|
|
1490
2479
|
return {
|
|
1491
|
-
name
|
|
1492
|
-
symbol: AssetSymbol(
|
|
1493
|
-
decimals: AssetDecimals(
|
|
2480
|
+
name,
|
|
2481
|
+
symbol: AssetSymbol(symbol),
|
|
2482
|
+
decimals: AssetDecimals(decimals)
|
|
1494
2483
|
};
|
|
1495
2484
|
}
|
|
1496
2485
|
|
|
@@ -1501,28 +2490,32 @@ var SuperstateSwapNamespaceImpl = class {
|
|
|
1501
2490
|
this.log = internalLogger(ctx.logger, "SUPERSTATE");
|
|
1502
2491
|
}
|
|
1503
2492
|
async getAuthorization(params) {
|
|
1504
|
-
return this.log.wrap(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
2493
|
+
return this.log.wrap(
|
|
2494
|
+
"getAuthorization",
|
|
2495
|
+
params,
|
|
2496
|
+
async () => getSwapAuthorization(this.ctx.rpc, params)
|
|
2497
|
+
);
|
|
1508
2498
|
}
|
|
1509
2499
|
async getPreview(params) {
|
|
1510
|
-
return this.log.wrap(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2500
|
+
return this.log.wrap(
|
|
2501
|
+
"getPreview",
|
|
2502
|
+
params,
|
|
2503
|
+
async () => getSwapPreview(this.ctx.rpc, params)
|
|
2504
|
+
);
|
|
1514
2505
|
}
|
|
1515
2506
|
async getStatus(params) {
|
|
1516
|
-
return this.log.wrap(
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
2507
|
+
return this.log.wrap(
|
|
2508
|
+
"getStatus",
|
|
2509
|
+
params,
|
|
2510
|
+
async () => getSwapStatus(this.ctx.rpc, params)
|
|
2511
|
+
);
|
|
1520
2512
|
}
|
|
1521
2513
|
async getOutputToken(params) {
|
|
1522
|
-
return this.log.wrap(
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
2514
|
+
return this.log.wrap(
|
|
2515
|
+
"getOutputToken",
|
|
2516
|
+
params,
|
|
2517
|
+
async () => getSwapOutputToken(this.ctx.rpc, params)
|
|
2518
|
+
);
|
|
1526
2519
|
}
|
|
1527
2520
|
async allowWallet(params) {
|
|
1528
2521
|
return this.log.wrap("allowWallet", params, async () => {
|
|
@@ -1707,6 +2700,26 @@ var RequirementsNamespaceImpl = class {
|
|
|
1707
2700
|
}
|
|
1708
2701
|
};
|
|
1709
2702
|
|
|
2703
|
+
// src/universal/api/rpc/erc20.ts
|
|
2704
|
+
async function getTokenAllowance(clients, params) {
|
|
2705
|
+
const allowance = await clients(params.chain).readContract({
|
|
2706
|
+
address: params.tokenAddress,
|
|
2707
|
+
abi: ERC20_ABI,
|
|
2708
|
+
functionName: "allowance",
|
|
2709
|
+
args: [params.owner, params.spender]
|
|
2710
|
+
});
|
|
2711
|
+
return parseUint256(allowance, "allowance");
|
|
2712
|
+
}
|
|
2713
|
+
async function getTokenBalance(clients, params) {
|
|
2714
|
+
const balance = await clients(params.chain).readContract({
|
|
2715
|
+
address: params.tokenAddress,
|
|
2716
|
+
abi: ERC20_ABI,
|
|
2717
|
+
functionName: "balanceOf",
|
|
2718
|
+
args: [params.owner]
|
|
2719
|
+
});
|
|
2720
|
+
return parseUint256(balance, "balanceOf");
|
|
2721
|
+
}
|
|
2722
|
+
|
|
1710
2723
|
// src/universal/core/shared/blockchain/erc20/erc20-namespace.ts
|
|
1711
2724
|
var Erc20NamespaceImpl = class {
|
|
1712
2725
|
constructor(ctx) {
|
|
@@ -1714,16 +2727,18 @@ var Erc20NamespaceImpl = class {
|
|
|
1714
2727
|
this.log = internalLogger(ctx.logger, "ERC20");
|
|
1715
2728
|
}
|
|
1716
2729
|
async getAllowance(params) {
|
|
1717
|
-
return this.log.wrap(
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
2730
|
+
return this.log.wrap(
|
|
2731
|
+
"getAllowance",
|
|
2732
|
+
params,
|
|
2733
|
+
async () => getTokenAllowance(this.ctx.rpc, params)
|
|
2734
|
+
);
|
|
1721
2735
|
}
|
|
1722
2736
|
async getBalance(params) {
|
|
1723
|
-
return this.log.wrap(
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
2737
|
+
return this.log.wrap(
|
|
2738
|
+
"getBalance",
|
|
2739
|
+
params,
|
|
2740
|
+
async () => getTokenBalance(this.ctx.rpc, params)
|
|
2741
|
+
);
|
|
1727
2742
|
}
|
|
1728
2743
|
};
|
|
1729
2744
|
|
|
@@ -1887,9 +2902,9 @@ var HttpClient = class {
|
|
|
1887
2902
|
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
1888
2903
|
return url;
|
|
1889
2904
|
}
|
|
1890
|
-
const
|
|
2905
|
+
const base2 = this.config.baseUrl.replace(/\/$/, "");
|
|
1891
2906
|
const path = url.startsWith("/") ? url : `/${url}`;
|
|
1892
|
-
return
|
|
2907
|
+
return base2 + path;
|
|
1893
2908
|
}
|
|
1894
2909
|
async runBeforeRequestMiddleware(initialRequest) {
|
|
1895
2910
|
let request = initialRequest;
|
|
@@ -2313,6 +3328,7 @@ export {
|
|
|
2313
3328
|
describeErrorUnredacted,
|
|
2314
3329
|
internalLogger,
|
|
2315
3330
|
HttpClient,
|
|
3331
|
+
ERC20_ABI,
|
|
2316
3332
|
fetchAllPages,
|
|
2317
3333
|
Cursor,
|
|
2318
3334
|
PaginatedResponse,
|
|
@@ -2345,6 +3361,8 @@ export {
|
|
|
2345
3361
|
OfferSlug,
|
|
2346
3362
|
Offer,
|
|
2347
3363
|
OfferToken,
|
|
3364
|
+
Ticker,
|
|
3365
|
+
Isin,
|
|
2348
3366
|
OfferOptionId,
|
|
2349
3367
|
OfferOptionSlug,
|
|
2350
3368
|
OfferSwapContract,
|
|
@@ -2376,23 +3394,22 @@ export {
|
|
|
2376
3394
|
assetAmount,
|
|
2377
3395
|
NA_AMOUNT_ASSET_UI,
|
|
2378
3396
|
formattedUsdPrice,
|
|
3397
|
+
viemChain,
|
|
2379
3398
|
getChainId,
|
|
2380
3399
|
chainFromId,
|
|
2381
3400
|
getNetworkName,
|
|
2382
3401
|
txExplorerUrl,
|
|
2383
3402
|
blockchainAmountFromRawOrThrow,
|
|
2384
3403
|
parseBlockchainAmount,
|
|
2385
|
-
Ticker,
|
|
2386
3404
|
OndoTradingStatus,
|
|
2387
3405
|
OndoQuote,
|
|
2388
3406
|
OndoBuyTransaction,
|
|
2389
3407
|
OndoSellTransaction,
|
|
2390
3408
|
OndoNamespaceImpl,
|
|
2391
|
-
|
|
3409
|
+
SUPERSTATE_SWAP_ABI,
|
|
2392
3410
|
SwapPreview,
|
|
3411
|
+
PauseFlags,
|
|
2393
3412
|
SwapStatus,
|
|
2394
|
-
TokenAllowance,
|
|
2395
|
-
TokenBalance,
|
|
2396
3413
|
AllowWalletResponse,
|
|
2397
3414
|
SuperstateSwapNamespaceImpl,
|
|
2398
3415
|
fetchOffers,
|
|
@@ -2424,4 +3441,4 @@ export {
|
|
|
2424
3441
|
OAuthRefreshToken,
|
|
2425
3442
|
OAuthSession
|
|
2426
3443
|
};
|
|
2427
|
-
//# sourceMappingURL=chunk-
|
|
3444
|
+
//# sourceMappingURL=chunk-VSYGGTI6.js.map
|