@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
package/dist/universal/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(universal_exports, {
|
|
|
62
62
|
HexEncodedTransactionData: () => HexEncodedTransactionData,
|
|
63
63
|
HttpError: () => HttpError,
|
|
64
64
|
InvariantError: () => InvariantError,
|
|
65
|
+
Isin: () => Isin,
|
|
65
66
|
Iso2CountryCode: () => Iso2CountryCode,
|
|
66
67
|
KnownAssetSymbol: () => KnownAssetSymbol,
|
|
67
68
|
KycToken: () => KycToken,
|
|
@@ -102,6 +103,7 @@ __export(universal_exports, {
|
|
|
102
103
|
Participation: () => Participation,
|
|
103
104
|
ParticipationId: () => ParticipationId,
|
|
104
105
|
ParticipationsPaginationParams: () => ParticipationsPaginationParams,
|
|
106
|
+
PauseFlags: () => PauseFlags,
|
|
105
107
|
Pii: () => Pii,
|
|
106
108
|
PiiAddress: () => PiiAddress,
|
|
107
109
|
PiiJurisdiction: () => PiiJurisdiction,
|
|
@@ -118,20 +120,18 @@ __export(universal_exports, {
|
|
|
118
120
|
SUPERSTATE_SUPPORTED_INPUT_ASSETS: () => SUPERSTATE_SUPPORTED_INPUT_ASSETS,
|
|
119
121
|
SUPERSTATE_SWAP_ABI: () => SUPERSTATE_SWAP_ABI,
|
|
120
122
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: () => SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
123
|
+
SWAP_LEVEL: () => SWAP_LEVEL,
|
|
121
124
|
SWAP_POLL_INTERVAL_MS: () => SWAP_POLL_INTERVAL_MS,
|
|
122
125
|
ShortenedWalletAddress: () => ShortenedWalletAddress,
|
|
123
126
|
SolanaChain: () => SolanaChain,
|
|
124
127
|
StablecoinSymbol: () => StablecoinSymbol,
|
|
125
128
|
SuperstateSwapNamespaceImpl: () => SuperstateSwapNamespaceImpl,
|
|
126
|
-
SwapAuthorization: () => SwapAuthorization,
|
|
127
129
|
SwapPreview: () => SwapPreview,
|
|
128
130
|
SwapQuote: () => SwapQuote,
|
|
129
131
|
SwapStatus: () => SwapStatus,
|
|
130
132
|
TOKEN_REGISTRY: () => TOKEN_REGISTRY,
|
|
131
133
|
TermItem: () => TermItem,
|
|
132
134
|
Ticker: () => Ticker,
|
|
133
|
-
TokenAllowance: () => TokenAllowance,
|
|
134
|
-
TokenBalance: () => TokenBalance,
|
|
135
135
|
TokenLogo: () => TokenLogo,
|
|
136
136
|
TokenLogoUrl: () => TokenLogoUrl,
|
|
137
137
|
TokenMetadata: () => TokenMetadata,
|
|
@@ -170,14 +170,15 @@ __export(universal_exports, {
|
|
|
170
170
|
getChainId: () => getChainId,
|
|
171
171
|
getNetworkName: () => getNetworkName,
|
|
172
172
|
isChain: () => isChain,
|
|
173
|
-
|
|
173
|
+
isSwapAvailable: () => isSwapAvailable,
|
|
174
174
|
parseBlockchainAmount: () => parseBlockchainAmount,
|
|
175
175
|
parseUint256: () => parseUint256,
|
|
176
176
|
shortenAddress: () => shortenAddress,
|
|
177
177
|
superstateSwapContractAddress: () => superstateSwapContractAddress,
|
|
178
178
|
swapSpender: () => swapSpender,
|
|
179
179
|
txExplorerUrl: () => txExplorerUrl,
|
|
180
|
-
usdAmount: () => usdAmount
|
|
180
|
+
usdAmount: () => usdAmount,
|
|
181
|
+
viemChain: () => viemChain
|
|
181
182
|
});
|
|
182
183
|
module.exports = __toCommonJS(universal_exports);
|
|
183
184
|
|
|
@@ -633,6 +634,10 @@ var OfferToken = {
|
|
|
633
634
|
listFromDto: (dtos) => dtos.filter((dto) => isChain(dto.chain)).map(OfferToken.fromDto)
|
|
634
635
|
};
|
|
635
636
|
|
|
637
|
+
// src/universal/types/trading.ts
|
|
638
|
+
var Ticker = (value) => value;
|
|
639
|
+
var Isin = (value) => value;
|
|
640
|
+
|
|
636
641
|
// src/universal/types/offer-detail.ts
|
|
637
642
|
var OfferOptionId = (value) => value;
|
|
638
643
|
var OfferOptionSlug = (value) => value;
|
|
@@ -685,6 +690,8 @@ var OfferDetail = {
|
|
|
685
690
|
`OfferDetail.swap_contracts: expected an array, got ${typeof swapContracts}`
|
|
686
691
|
);
|
|
687
692
|
}
|
|
693
|
+
const isin = notBlankStringOrNull(dto.isin);
|
|
694
|
+
const ticker = notBlankStringOrNull(dto.ticker);
|
|
688
695
|
return {
|
|
689
696
|
id: OfferId(dto.id),
|
|
690
697
|
slug: OfferSlug(dto.slug),
|
|
@@ -699,6 +706,11 @@ var OfferDetail = {
|
|
|
699
706
|
bannerUrl: dto.banner_url,
|
|
700
707
|
logoUrl: dto.logo_url,
|
|
701
708
|
category: dto.category,
|
|
709
|
+
issuer: notBlankStringOrNull(dto.issuer),
|
|
710
|
+
isin: isin === null ? null : Isin(isin),
|
|
711
|
+
ticker: ticker === null ? null : Ticker(ticker),
|
|
712
|
+
instrumentType: notBlankStringOrNull(dto.instrument_type),
|
|
713
|
+
listingVenue: notBlankStringOrNull(dto.listing_venue),
|
|
702
714
|
startsAt: new Date(dto.starts_at),
|
|
703
715
|
endsAt: dto.ends_at ? new Date(dto.ends_at) : null,
|
|
704
716
|
faqs: dto.faqs.map(FaqItem.fromDto),
|
|
@@ -829,6 +841,7 @@ async function createParticipation(api, params) {
|
|
|
829
841
|
}
|
|
830
842
|
|
|
831
843
|
// src/universal/core/shared/observability/log-cause.ts
|
|
844
|
+
var import_viem = require("viem");
|
|
832
845
|
function classifyLogCause(error) {
|
|
833
846
|
if (error instanceof HttpError) {
|
|
834
847
|
return httpCause(error);
|
|
@@ -848,8 +861,32 @@ function classifyLogCause(error) {
|
|
|
848
861
|
if (error instanceof NotImplementedError) {
|
|
849
862
|
return { type: "not-implemented" };
|
|
850
863
|
}
|
|
864
|
+
if (error instanceof import_viem.BaseError) {
|
|
865
|
+
const http = error.walk((e) => e instanceof HttpError);
|
|
866
|
+
if (http instanceof HttpError) {
|
|
867
|
+
return httpCause(http);
|
|
868
|
+
}
|
|
869
|
+
return { type: "rpc", reason: rpcFailureReason(error) };
|
|
870
|
+
}
|
|
851
871
|
return { type: "generic-error", name: errorName(error) };
|
|
852
872
|
}
|
|
873
|
+
function rpcFailureReason(error) {
|
|
874
|
+
if (error.walk((e) => e instanceof import_viem.ContractFunctionRevertedError)) {
|
|
875
|
+
return "reverted";
|
|
876
|
+
}
|
|
877
|
+
if (error.walk((e) => e instanceof import_viem.RpcError)) {
|
|
878
|
+
return "node-rejected";
|
|
879
|
+
}
|
|
880
|
+
if (error.walk(
|
|
881
|
+
(e) => e instanceof import_viem.HttpRequestError || e instanceof import_viem.WebSocketRequestError || e instanceof import_viem.SocketClosedError || e instanceof import_viem.TimeoutError
|
|
882
|
+
)) {
|
|
883
|
+
return "transport";
|
|
884
|
+
}
|
|
885
|
+
if (error instanceof import_viem.ContractFunctionExecutionError) {
|
|
886
|
+
return "malformed-response";
|
|
887
|
+
}
|
|
888
|
+
return "unknown";
|
|
889
|
+
}
|
|
853
890
|
function describeErrorUnredacted(error) {
|
|
854
891
|
if (error instanceof HttpError) {
|
|
855
892
|
return describeHttpErrorRedacted(error);
|
|
@@ -1123,7 +1160,7 @@ function assertPriceFits(raw) {
|
|
|
1123
1160
|
}
|
|
1124
1161
|
|
|
1125
1162
|
// src/universal/core/shared/blockchain/formatters.ts
|
|
1126
|
-
var
|
|
1163
|
+
var import_viem2 = require("viem");
|
|
1127
1164
|
|
|
1128
1165
|
// src/universal/types/blockchain/ui.ts
|
|
1129
1166
|
var FormattedAmountUi = (value) => value;
|
|
@@ -1189,7 +1226,7 @@ function roundFractionHalfUp(integerPart, fractionPart, maxFractionDigits) {
|
|
|
1189
1226
|
};
|
|
1190
1227
|
}
|
|
1191
1228
|
function formatRawAmount(amount) {
|
|
1192
|
-
return (0,
|
|
1229
|
+
return (0, import_viem2.formatUnits)(amount.raw, amount.decimals);
|
|
1193
1230
|
}
|
|
1194
1231
|
function formatCompactAmount(amount, locale) {
|
|
1195
1232
|
const value = Number(formatRawAmount(amount));
|
|
@@ -1228,18 +1265,22 @@ function formattedUsdPrice(amount, locale) {
|
|
|
1228
1265
|
}
|
|
1229
1266
|
|
|
1230
1267
|
// src/universal/core/shared/blockchain/chain.ts
|
|
1231
|
-
var
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1268
|
+
var import_chains = require("viem/chains");
|
|
1269
|
+
var VIEM_CHAINS = {
|
|
1270
|
+
ethereum_mainnet: import_chains.mainnet,
|
|
1271
|
+
ethereum_sepolia: import_chains.sepolia,
|
|
1272
|
+
base_mainnet: import_chains.base,
|
|
1273
|
+
base_sepolia: import_chains.baseSepolia
|
|
1236
1274
|
};
|
|
1275
|
+
function viemChain(chain) {
|
|
1276
|
+
return VIEM_CHAINS[chain];
|
|
1277
|
+
}
|
|
1237
1278
|
function getChainId(chain) {
|
|
1238
|
-
return
|
|
1279
|
+
return VIEM_CHAINS[chain].id;
|
|
1239
1280
|
}
|
|
1240
1281
|
function chainFromId(chainId) {
|
|
1241
|
-
const chains = Object.keys(
|
|
1242
|
-
const chain = chains.find((c) => String(
|
|
1282
|
+
const chains = Object.keys(VIEM_CHAINS);
|
|
1283
|
+
const chain = chains.find((c) => String(VIEM_CHAINS[c].id) === chainId);
|
|
1243
1284
|
if (!chain) {
|
|
1244
1285
|
throw new ValidationError(`Unsupported EIP-155 chain id: "${chainId}"`);
|
|
1245
1286
|
}
|
|
@@ -1282,7 +1323,7 @@ function explorerBaseUrl(chain) {
|
|
|
1282
1323
|
}
|
|
1283
1324
|
|
|
1284
1325
|
// src/universal/core/shared/blockchain/math.ts
|
|
1285
|
-
var
|
|
1326
|
+
var import_viem3 = require("viem");
|
|
1286
1327
|
function blockchainAmountFromRawOrThrow({
|
|
1287
1328
|
label,
|
|
1288
1329
|
raw,
|
|
@@ -1313,10 +1354,14 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1313
1354
|
if (/[eE]/.test(trimmed)) {
|
|
1314
1355
|
return { valid: false, reason: { type: "invalid-format" } };
|
|
1315
1356
|
}
|
|
1316
|
-
if (
|
|
1357
|
+
if (trimmed === ".") {
|
|
1317
1358
|
return { valid: false, reason: { type: "invalid-format" } };
|
|
1318
1359
|
}
|
|
1319
|
-
const
|
|
1360
|
+
const normalised = trimmed.replace(/^\./, "0.").replace(/\.$/, "");
|
|
1361
|
+
if (!/^\d+(\.\d+)?$/.test(normalised)) {
|
|
1362
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
1363
|
+
}
|
|
1364
|
+
const [, fraction = ""] = normalised.split(".");
|
|
1320
1365
|
if (fraction.length > decimals) {
|
|
1321
1366
|
return {
|
|
1322
1367
|
valid: false,
|
|
@@ -1324,7 +1369,7 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1324
1369
|
};
|
|
1325
1370
|
}
|
|
1326
1371
|
try {
|
|
1327
|
-
const raw = (0,
|
|
1372
|
+
const raw = (0, import_viem3.parseUnits)(normalised, decimals);
|
|
1328
1373
|
if (raw > MAX_UINT_256) {
|
|
1329
1374
|
return { valid: false, reason: { type: "overflow" } };
|
|
1330
1375
|
}
|
|
@@ -1337,9 +1382,6 @@ function parseBlockchainAmount(amount, decimals) {
|
|
|
1337
1382
|
}
|
|
1338
1383
|
}
|
|
1339
1384
|
|
|
1340
|
-
// src/universal/types/trading.ts
|
|
1341
|
-
var Ticker = (value) => value;
|
|
1342
|
-
|
|
1343
1385
|
// src/universal/types/providers/ondo/ondo.ts
|
|
1344
1386
|
var OndoTradingStatus = {
|
|
1345
1387
|
fromDto: (dto) => {
|
|
@@ -1637,226 +1679,876 @@ var OndoNamespaceImpl = class {
|
|
|
1637
1679
|
var SUPERSTATE_SWAP_ABI = [
|
|
1638
1680
|
{
|
|
1639
1681
|
type: "function",
|
|
1640
|
-
name: "
|
|
1641
|
-
inputs: [
|
|
1642
|
-
outputs: [
|
|
1682
|
+
name: "KIND",
|
|
1683
|
+
inputs: [],
|
|
1684
|
+
outputs: [
|
|
1685
|
+
{
|
|
1686
|
+
name: "",
|
|
1687
|
+
type: "uint16",
|
|
1688
|
+
internalType: "uint16"
|
|
1689
|
+
}
|
|
1690
|
+
],
|
|
1643
1691
|
stateMutability: "view"
|
|
1644
1692
|
},
|
|
1645
1693
|
{
|
|
1646
1694
|
type: "function",
|
|
1647
|
-
name: "
|
|
1695
|
+
name: "ONE_HUNDRED_P",
|
|
1648
1696
|
inputs: [],
|
|
1649
|
-
outputs: [
|
|
1697
|
+
outputs: [
|
|
1698
|
+
{
|
|
1699
|
+
name: "",
|
|
1700
|
+
type: "uint256",
|
|
1701
|
+
internalType: "uint256"
|
|
1702
|
+
}
|
|
1703
|
+
],
|
|
1650
1704
|
stateMutability: "view"
|
|
1651
1705
|
},
|
|
1652
1706
|
{
|
|
1653
1707
|
type: "function",
|
|
1654
1708
|
name: "SWAP_LEVEL",
|
|
1655
1709
|
inputs: [],
|
|
1656
|
-
outputs: [
|
|
1710
|
+
outputs: [
|
|
1711
|
+
{
|
|
1712
|
+
name: "",
|
|
1713
|
+
type: "uint32",
|
|
1714
|
+
internalType: "uint32"
|
|
1715
|
+
}
|
|
1716
|
+
],
|
|
1657
1717
|
stateMutability: "view"
|
|
1658
1718
|
},
|
|
1659
1719
|
{
|
|
1660
1720
|
type: "function",
|
|
1661
|
-
name: "
|
|
1662
|
-
inputs: [
|
|
1663
|
-
{ name: "token", type: "address", internalType: "address" },
|
|
1664
|
-
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
1665
|
-
],
|
|
1721
|
+
name: "VERSION",
|
|
1722
|
+
inputs: [],
|
|
1666
1723
|
outputs: [
|
|
1667
1724
|
{
|
|
1668
1725
|
name: "",
|
|
1669
|
-
type: "
|
|
1670
|
-
internalType: "
|
|
1671
|
-
components: [
|
|
1672
|
-
{ name: "input", type: "uint256", internalType: "uint256" },
|
|
1673
|
-
{ name: "fee", type: "uint256", internalType: "uint256" },
|
|
1674
|
-
{ name: "output", type: "uint256", internalType: "uint256" }
|
|
1675
|
-
]
|
|
1726
|
+
type: "uint16",
|
|
1727
|
+
internalType: "uint16"
|
|
1676
1728
|
}
|
|
1677
1729
|
],
|
|
1678
1730
|
stateMutability: "view"
|
|
1679
1731
|
},
|
|
1680
1732
|
{
|
|
1681
1733
|
type: "function",
|
|
1682
|
-
name: "
|
|
1734
|
+
name: "authorized",
|
|
1683
1735
|
inputs: [
|
|
1684
|
-
{
|
|
1685
|
-
|
|
1686
|
-
|
|
1736
|
+
{
|
|
1737
|
+
name: "user",
|
|
1738
|
+
type: "address",
|
|
1739
|
+
internalType: "address"
|
|
1740
|
+
}
|
|
1687
1741
|
],
|
|
1688
|
-
outputs: [
|
|
1689
|
-
|
|
1742
|
+
outputs: [
|
|
1743
|
+
{
|
|
1744
|
+
name: "",
|
|
1745
|
+
type: "bool",
|
|
1746
|
+
internalType: "bool"
|
|
1747
|
+
}
|
|
1748
|
+
],
|
|
1749
|
+
stateMutability: "view"
|
|
1690
1750
|
},
|
|
1691
1751
|
{
|
|
1692
1752
|
type: "function",
|
|
1693
|
-
name: "
|
|
1694
|
-
inputs: [
|
|
1695
|
-
|
|
1753
|
+
name: "bpp",
|
|
1754
|
+
inputs: [
|
|
1755
|
+
{
|
|
1756
|
+
name: "amount",
|
|
1757
|
+
type: "uint256",
|
|
1758
|
+
internalType: "uint256"
|
|
1759
|
+
}
|
|
1760
|
+
],
|
|
1761
|
+
outputs: [
|
|
1762
|
+
{
|
|
1763
|
+
name: "",
|
|
1764
|
+
type: "uint256",
|
|
1765
|
+
internalType: "uint256"
|
|
1766
|
+
}
|
|
1767
|
+
],
|
|
1696
1768
|
stateMutability: "view"
|
|
1697
1769
|
},
|
|
1698
1770
|
{
|
|
1699
1771
|
type: "function",
|
|
1700
|
-
name: "
|
|
1772
|
+
name: "bps",
|
|
1701
1773
|
inputs: [],
|
|
1702
|
-
outputs: [
|
|
1774
|
+
outputs: [
|
|
1775
|
+
{
|
|
1776
|
+
name: "",
|
|
1777
|
+
type: "uint256",
|
|
1778
|
+
internalType: "uint256"
|
|
1779
|
+
}
|
|
1780
|
+
],
|
|
1703
1781
|
stateMutability: "view"
|
|
1704
1782
|
},
|
|
1705
1783
|
{
|
|
1706
1784
|
type: "function",
|
|
1707
|
-
name: "
|
|
1785
|
+
name: "cancelOwnershipHandover",
|
|
1708
1786
|
inputs: [],
|
|
1709
|
-
outputs: [
|
|
1710
|
-
stateMutability: "
|
|
1787
|
+
outputs: [],
|
|
1788
|
+
stateMutability: "payable"
|
|
1711
1789
|
},
|
|
1712
1790
|
{
|
|
1713
1791
|
type: "function",
|
|
1714
|
-
name: "
|
|
1715
|
-
inputs: [
|
|
1792
|
+
name: "completeOwnershipHandover",
|
|
1793
|
+
inputs: [
|
|
1794
|
+
{
|
|
1795
|
+
name: "pendingOwner",
|
|
1796
|
+
type: "address",
|
|
1797
|
+
internalType: "address"
|
|
1798
|
+
}
|
|
1799
|
+
],
|
|
1800
|
+
outputs: [],
|
|
1801
|
+
stateMutability: "payable"
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
type: "function",
|
|
1805
|
+
name: "fee",
|
|
1806
|
+
inputs: [
|
|
1807
|
+
{
|
|
1808
|
+
name: "amount",
|
|
1809
|
+
type: "uint256",
|
|
1810
|
+
internalType: "uint256"
|
|
1811
|
+
}
|
|
1812
|
+
],
|
|
1716
1813
|
outputs: [
|
|
1717
1814
|
{
|
|
1718
1815
|
name: "",
|
|
1719
|
-
type: "
|
|
1720
|
-
internalType: "
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
]
|
|
1816
|
+
type: "uint256",
|
|
1817
|
+
internalType: "uint256"
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
name: "",
|
|
1821
|
+
type: "uint256",
|
|
1822
|
+
internalType: "uint256"
|
|
1727
1823
|
}
|
|
1728
1824
|
],
|
|
1729
1825
|
stateMutability: "view"
|
|
1730
1826
|
},
|
|
1731
1827
|
{
|
|
1732
1828
|
type: "function",
|
|
1733
|
-
name: "
|
|
1734
|
-
inputs: [
|
|
1735
|
-
{ name: "user", type: "address", internalType: "address" },
|
|
1736
|
-
{ name: "token", type: "address", internalType: "address" }
|
|
1737
|
-
],
|
|
1829
|
+
name: "id",
|
|
1830
|
+
inputs: [],
|
|
1738
1831
|
outputs: [
|
|
1739
1832
|
{
|
|
1740
1833
|
name: "",
|
|
1741
|
-
type: "
|
|
1742
|
-
internalType: "
|
|
1743
|
-
components: [
|
|
1744
|
-
{ name: "inputSum", type: "uint256", internalType: "uint256" },
|
|
1745
|
-
{ name: "feeSum", type: "uint256", internalType: "uint256" },
|
|
1746
|
-
{ name: "outputSum", type: "uint256", internalType: "uint256" },
|
|
1747
|
-
{ name: "count", type: "uint256", internalType: "uint256" }
|
|
1748
|
-
]
|
|
1834
|
+
type: "bytes32",
|
|
1835
|
+
internalType: "bytes32"
|
|
1749
1836
|
}
|
|
1750
1837
|
],
|
|
1751
1838
|
stateMutability: "view"
|
|
1752
1839
|
},
|
|
1753
1840
|
{
|
|
1754
1841
|
type: "function",
|
|
1755
|
-
name: "
|
|
1842
|
+
name: "inputTokens",
|
|
1756
1843
|
inputs: [
|
|
1757
|
-
{
|
|
1758
|
-
|
|
1844
|
+
{
|
|
1845
|
+
name: "",
|
|
1846
|
+
type: "address",
|
|
1847
|
+
internalType: "address"
|
|
1848
|
+
}
|
|
1759
1849
|
],
|
|
1760
|
-
outputs: [
|
|
1761
|
-
|
|
1850
|
+
outputs: [
|
|
1851
|
+
{
|
|
1852
|
+
name: "",
|
|
1853
|
+
type: "bool",
|
|
1854
|
+
internalType: "bool"
|
|
1855
|
+
}
|
|
1856
|
+
],
|
|
1857
|
+
stateMutability: "view"
|
|
1762
1858
|
},
|
|
1763
1859
|
{
|
|
1764
1860
|
type: "function",
|
|
1765
|
-
name: "
|
|
1766
|
-
inputs: [
|
|
1767
|
-
|
|
1768
|
-
{
|
|
1769
|
-
|
|
1861
|
+
name: "outputToken",
|
|
1862
|
+
inputs: [],
|
|
1863
|
+
outputs: [
|
|
1864
|
+
{
|
|
1865
|
+
name: "",
|
|
1866
|
+
type: "address",
|
|
1867
|
+
internalType: "address"
|
|
1868
|
+
}
|
|
1770
1869
|
],
|
|
1771
|
-
|
|
1772
|
-
stateMutability: "nonpayable"
|
|
1870
|
+
stateMutability: "view"
|
|
1773
1871
|
},
|
|
1774
1872
|
{
|
|
1775
1873
|
type: "function",
|
|
1776
|
-
name: "
|
|
1777
|
-
inputs: [
|
|
1778
|
-
outputs: [
|
|
1779
|
-
|
|
1874
|
+
name: "outputTokenBalance",
|
|
1875
|
+
inputs: [],
|
|
1876
|
+
outputs: [
|
|
1877
|
+
{
|
|
1878
|
+
name: "",
|
|
1879
|
+
type: "uint256",
|
|
1880
|
+
internalType: "uint256"
|
|
1881
|
+
}
|
|
1882
|
+
],
|
|
1883
|
+
stateMutability: "view"
|
|
1780
1884
|
},
|
|
1781
1885
|
{
|
|
1782
|
-
type: "
|
|
1783
|
-
name: "
|
|
1784
|
-
inputs: [
|
|
1785
|
-
|
|
1886
|
+
type: "function",
|
|
1887
|
+
name: "owner",
|
|
1888
|
+
inputs: [],
|
|
1889
|
+
outputs: [
|
|
1786
1890
|
{
|
|
1787
|
-
name: "
|
|
1891
|
+
name: "result",
|
|
1788
1892
|
type: "address",
|
|
1789
|
-
indexed: true,
|
|
1790
1893
|
internalType: "address"
|
|
1791
|
-
}
|
|
1894
|
+
}
|
|
1895
|
+
],
|
|
1896
|
+
stateMutability: "view"
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
type: "function",
|
|
1900
|
+
name: "ownershipHandoverExpiresAt",
|
|
1901
|
+
inputs: [
|
|
1792
1902
|
{
|
|
1793
|
-
name: "
|
|
1903
|
+
name: "pendingOwner",
|
|
1794
1904
|
type: "address",
|
|
1795
|
-
indexed: true,
|
|
1796
1905
|
internalType: "address"
|
|
1797
|
-
}
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
outputs: [
|
|
1798
1909
|
{
|
|
1799
|
-
name: "
|
|
1910
|
+
name: "result",
|
|
1800
1911
|
type: "uint256",
|
|
1801
|
-
indexed: false,
|
|
1802
1912
|
internalType: "uint256"
|
|
1803
|
-
}
|
|
1913
|
+
}
|
|
1914
|
+
],
|
|
1915
|
+
stateMutability: "view"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
type: "function",
|
|
1919
|
+
name: "pause",
|
|
1920
|
+
inputs: [
|
|
1804
1921
|
{
|
|
1805
|
-
name: "
|
|
1806
|
-
type: "
|
|
1807
|
-
|
|
1808
|
-
internalType: "uint256"
|
|
1922
|
+
name: "level",
|
|
1923
|
+
type: "uint32",
|
|
1924
|
+
internalType: "uint32"
|
|
1809
1925
|
}
|
|
1810
1926
|
],
|
|
1811
|
-
|
|
1927
|
+
outputs: [
|
|
1928
|
+
{
|
|
1929
|
+
name: "",
|
|
1930
|
+
type: "bool",
|
|
1931
|
+
internalType: "bool"
|
|
1932
|
+
}
|
|
1933
|
+
],
|
|
1934
|
+
stateMutability: "nonpayable"
|
|
1812
1935
|
},
|
|
1813
1936
|
{
|
|
1814
|
-
type: "
|
|
1815
|
-
name: "
|
|
1937
|
+
type: "function",
|
|
1938
|
+
name: "paused",
|
|
1939
|
+
inputs: [],
|
|
1940
|
+
outputs: [
|
|
1941
|
+
{
|
|
1942
|
+
name: "",
|
|
1943
|
+
type: "uint32",
|
|
1944
|
+
internalType: "uint32"
|
|
1945
|
+
}
|
|
1946
|
+
],
|
|
1947
|
+
stateMutability: "view"
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
type: "function",
|
|
1951
|
+
name: "preview",
|
|
1816
1952
|
inputs: [
|
|
1817
|
-
{ name: "to", type: "address", indexed: true, internalType: "address" },
|
|
1818
1953
|
{
|
|
1819
1954
|
name: "token",
|
|
1820
1955
|
type: "address",
|
|
1821
|
-
indexed: true,
|
|
1822
1956
|
internalType: "address"
|
|
1823
1957
|
},
|
|
1824
1958
|
{
|
|
1825
1959
|
name: "amount",
|
|
1826
1960
|
type: "uint256",
|
|
1827
|
-
indexed: false,
|
|
1828
1961
|
internalType: "uint256"
|
|
1829
1962
|
}
|
|
1830
1963
|
],
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1964
|
+
outputs: [
|
|
1965
|
+
{
|
|
1966
|
+
name: "",
|
|
1967
|
+
type: "tuple",
|
|
1968
|
+
internalType: "struct Preview",
|
|
1969
|
+
components: [
|
|
1970
|
+
{
|
|
1971
|
+
name: "input",
|
|
1972
|
+
type: "uint256",
|
|
1973
|
+
internalType: "uint256"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
name: "fee",
|
|
1977
|
+
type: "uint256",
|
|
1978
|
+
internalType: "uint256"
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
name: "output",
|
|
1982
|
+
type: "uint256",
|
|
1983
|
+
internalType: "uint256"
|
|
1984
|
+
}
|
|
1985
|
+
]
|
|
1986
|
+
}
|
|
1987
|
+
],
|
|
1988
|
+
stateMutability: "view"
|
|
1837
1989
|
},
|
|
1838
1990
|
{
|
|
1839
|
-
type: "
|
|
1840
|
-
name: "
|
|
1841
|
-
inputs: []
|
|
1991
|
+
type: "function",
|
|
1992
|
+
name: "renounceOwnership",
|
|
1993
|
+
inputs: [],
|
|
1994
|
+
outputs: [],
|
|
1995
|
+
stateMutability: "payable"
|
|
1842
1996
|
},
|
|
1843
1997
|
{
|
|
1844
|
-
type: "
|
|
1845
|
-
name: "
|
|
1846
|
-
inputs: []
|
|
1998
|
+
type: "function",
|
|
1999
|
+
name: "requestOwnershipHandover",
|
|
2000
|
+
inputs: [],
|
|
2001
|
+
outputs: [],
|
|
2002
|
+
stateMutability: "payable"
|
|
1847
2003
|
},
|
|
1848
2004
|
{
|
|
1849
|
-
type: "
|
|
1850
|
-
name: "
|
|
2005
|
+
type: "function",
|
|
2006
|
+
name: "setBps",
|
|
1851
2007
|
inputs: [
|
|
1852
|
-
{
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
2008
|
+
{
|
|
2009
|
+
name: "points",
|
|
2010
|
+
type: "uint256",
|
|
2011
|
+
internalType: "uint256"
|
|
2012
|
+
}
|
|
2013
|
+
],
|
|
2014
|
+
outputs: [
|
|
2015
|
+
{
|
|
2016
|
+
name: "",
|
|
2017
|
+
type: "bool",
|
|
2018
|
+
internalType: "bool"
|
|
2019
|
+
}
|
|
2020
|
+
],
|
|
2021
|
+
stateMutability: "nonpayable"
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
type: "function",
|
|
2025
|
+
name: "setInputToken",
|
|
2026
|
+
inputs: [
|
|
2027
|
+
{
|
|
2028
|
+
name: "token",
|
|
2029
|
+
type: "address",
|
|
2030
|
+
internalType: "address"
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
name: "val",
|
|
2034
|
+
type: "bool",
|
|
2035
|
+
internalType: "bool"
|
|
2036
|
+
}
|
|
2037
|
+
],
|
|
2038
|
+
outputs: [
|
|
2039
|
+
{
|
|
2040
|
+
name: "",
|
|
2041
|
+
type: "bool",
|
|
2042
|
+
internalType: "bool"
|
|
2043
|
+
}
|
|
2044
|
+
],
|
|
2045
|
+
stateMutability: "nonpayable"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
type: "function",
|
|
2049
|
+
name: "status",
|
|
2050
|
+
inputs: [],
|
|
2051
|
+
outputs: [
|
|
2052
|
+
{
|
|
2053
|
+
name: "",
|
|
2054
|
+
type: "tuple",
|
|
2055
|
+
internalType: "struct Status",
|
|
2056
|
+
components: [
|
|
2057
|
+
{
|
|
2058
|
+
name: "flags",
|
|
2059
|
+
type: "uint32",
|
|
2060
|
+
internalType: "uint32"
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
name: "state",
|
|
2064
|
+
type: "uint8",
|
|
2065
|
+
internalType: "enum State"
|
|
2066
|
+
}
|
|
2067
|
+
]
|
|
2068
|
+
}
|
|
2069
|
+
],
|
|
2070
|
+
stateMutability: "view"
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
type: "function",
|
|
2074
|
+
name: "stop",
|
|
2075
|
+
inputs: [],
|
|
2076
|
+
outputs: [
|
|
2077
|
+
{
|
|
2078
|
+
name: "",
|
|
2079
|
+
type: "bool",
|
|
2080
|
+
internalType: "bool"
|
|
2081
|
+
}
|
|
2082
|
+
],
|
|
2083
|
+
stateMutability: "nonpayable"
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
type: "function",
|
|
2087
|
+
name: "stopped",
|
|
2088
|
+
inputs: [],
|
|
2089
|
+
outputs: [
|
|
2090
|
+
{
|
|
2091
|
+
name: "",
|
|
2092
|
+
type: "bool",
|
|
2093
|
+
internalType: "bool"
|
|
2094
|
+
}
|
|
2095
|
+
],
|
|
2096
|
+
stateMutability: "view"
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
type: "function",
|
|
2100
|
+
name: "swap",
|
|
2101
|
+
inputs: [
|
|
2102
|
+
{
|
|
2103
|
+
name: "token",
|
|
2104
|
+
type: "address",
|
|
2105
|
+
internalType: "address"
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
name: "amount",
|
|
2109
|
+
type: "uint256",
|
|
2110
|
+
internalType: "uint256"
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
name: "slip",
|
|
2114
|
+
type: "uint256",
|
|
2115
|
+
internalType: "uint256"
|
|
2116
|
+
}
|
|
2117
|
+
],
|
|
2118
|
+
outputs: [
|
|
2119
|
+
{
|
|
2120
|
+
name: "",
|
|
2121
|
+
type: "uint256",
|
|
2122
|
+
internalType: "uint256"
|
|
2123
|
+
}
|
|
2124
|
+
],
|
|
2125
|
+
stateMutability: "nonpayable"
|
|
2126
|
+
},
|
|
2127
|
+
{
|
|
2128
|
+
type: "function",
|
|
2129
|
+
name: "tokenBalance",
|
|
2130
|
+
inputs: [
|
|
2131
|
+
{
|
|
2132
|
+
name: "token",
|
|
2133
|
+
type: "address",
|
|
2134
|
+
internalType: "address"
|
|
2135
|
+
}
|
|
2136
|
+
],
|
|
2137
|
+
outputs: [
|
|
2138
|
+
{
|
|
2139
|
+
name: "",
|
|
2140
|
+
type: "uint256",
|
|
2141
|
+
internalType: "uint256"
|
|
2142
|
+
}
|
|
2143
|
+
],
|
|
2144
|
+
stateMutability: "view"
|
|
2145
|
+
},
|
|
2146
|
+
{
|
|
2147
|
+
type: "function",
|
|
2148
|
+
name: "totals",
|
|
2149
|
+
inputs: [
|
|
2150
|
+
{
|
|
2151
|
+
name: "user",
|
|
2152
|
+
type: "address",
|
|
2153
|
+
internalType: "address"
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
name: "token",
|
|
2157
|
+
type: "address",
|
|
2158
|
+
internalType: "address"
|
|
2159
|
+
}
|
|
2160
|
+
],
|
|
2161
|
+
outputs: [
|
|
2162
|
+
{
|
|
2163
|
+
name: "",
|
|
2164
|
+
type: "tuple",
|
|
2165
|
+
internalType: "struct SwapTotal",
|
|
2166
|
+
components: [
|
|
2167
|
+
{
|
|
2168
|
+
name: "inputSum",
|
|
2169
|
+
type: "uint256",
|
|
2170
|
+
internalType: "uint256"
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
name: "feeSum",
|
|
2174
|
+
type: "uint256",
|
|
2175
|
+
internalType: "uint256"
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
name: "outputSum",
|
|
2179
|
+
type: "uint256",
|
|
2180
|
+
internalType: "uint256"
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
name: "count",
|
|
2184
|
+
type: "uint256",
|
|
2185
|
+
internalType: "uint256"
|
|
2186
|
+
}
|
|
2187
|
+
]
|
|
2188
|
+
}
|
|
2189
|
+
],
|
|
2190
|
+
stateMutability: "view"
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
type: "function",
|
|
2194
|
+
name: "totals",
|
|
2195
|
+
inputs: [
|
|
2196
|
+
{
|
|
2197
|
+
name: "token",
|
|
2198
|
+
type: "address",
|
|
2199
|
+
internalType: "address"
|
|
2200
|
+
}
|
|
2201
|
+
],
|
|
2202
|
+
outputs: [
|
|
2203
|
+
{
|
|
2204
|
+
name: "",
|
|
2205
|
+
type: "tuple",
|
|
2206
|
+
internalType: "struct SwapTotal",
|
|
2207
|
+
components: [
|
|
2208
|
+
{
|
|
2209
|
+
name: "inputSum",
|
|
2210
|
+
type: "uint256",
|
|
2211
|
+
internalType: "uint256"
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
name: "feeSum",
|
|
2215
|
+
type: "uint256",
|
|
2216
|
+
internalType: "uint256"
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
name: "outputSum",
|
|
2220
|
+
type: "uint256",
|
|
2221
|
+
internalType: "uint256"
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
name: "count",
|
|
2225
|
+
type: "uint256",
|
|
2226
|
+
internalType: "uint256"
|
|
2227
|
+
}
|
|
2228
|
+
]
|
|
2229
|
+
}
|
|
2230
|
+
],
|
|
2231
|
+
stateMutability: "view"
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
type: "function",
|
|
2235
|
+
name: "transfer",
|
|
2236
|
+
inputs: [
|
|
2237
|
+
{
|
|
2238
|
+
name: "to",
|
|
2239
|
+
type: "address",
|
|
2240
|
+
internalType: "address"
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
name: "amount",
|
|
2244
|
+
type: "uint256",
|
|
2245
|
+
internalType: "uint256"
|
|
2246
|
+
}
|
|
2247
|
+
],
|
|
2248
|
+
outputs: [
|
|
2249
|
+
{
|
|
2250
|
+
name: "",
|
|
2251
|
+
type: "bool",
|
|
2252
|
+
internalType: "bool"
|
|
2253
|
+
}
|
|
2254
|
+
],
|
|
2255
|
+
stateMutability: "nonpayable"
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
type: "function",
|
|
2259
|
+
name: "transfer",
|
|
2260
|
+
inputs: [
|
|
2261
|
+
{
|
|
2262
|
+
name: "to",
|
|
2263
|
+
type: "address",
|
|
2264
|
+
internalType: "address"
|
|
2265
|
+
},
|
|
2266
|
+
{
|
|
2267
|
+
name: "token",
|
|
2268
|
+
type: "address",
|
|
2269
|
+
internalType: "address"
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
name: "amount",
|
|
2273
|
+
type: "uint256",
|
|
2274
|
+
internalType: "uint256"
|
|
2275
|
+
}
|
|
2276
|
+
],
|
|
2277
|
+
outputs: [
|
|
2278
|
+
{
|
|
2279
|
+
name: "",
|
|
2280
|
+
type: "bool",
|
|
2281
|
+
internalType: "bool"
|
|
2282
|
+
}
|
|
2283
|
+
],
|
|
2284
|
+
stateMutability: "nonpayable"
|
|
2285
|
+
},
|
|
2286
|
+
{
|
|
2287
|
+
type: "function",
|
|
2288
|
+
name: "transferOwnership",
|
|
2289
|
+
inputs: [
|
|
2290
|
+
{
|
|
2291
|
+
name: "newOwner",
|
|
2292
|
+
type: "address",
|
|
2293
|
+
internalType: "address"
|
|
2294
|
+
}
|
|
2295
|
+
],
|
|
2296
|
+
outputs: [],
|
|
2297
|
+
stateMutability: "payable"
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
type: "event",
|
|
2301
|
+
name: "BpsUpdated",
|
|
2302
|
+
inputs: [
|
|
2303
|
+
{
|
|
2304
|
+
name: "prev",
|
|
2305
|
+
type: "uint256",
|
|
2306
|
+
indexed: false,
|
|
2307
|
+
internalType: "uint256"
|
|
2308
|
+
},
|
|
2309
|
+
{
|
|
2310
|
+
name: "next",
|
|
2311
|
+
type: "uint256",
|
|
2312
|
+
indexed: false,
|
|
2313
|
+
internalType: "uint256"
|
|
2314
|
+
}
|
|
2315
|
+
],
|
|
2316
|
+
anonymous: false
|
|
2317
|
+
},
|
|
2318
|
+
{
|
|
2319
|
+
type: "event",
|
|
2320
|
+
name: "InputTokenUpdated",
|
|
2321
|
+
inputs: [
|
|
2322
|
+
{
|
|
2323
|
+
name: "token",
|
|
2324
|
+
type: "address",
|
|
2325
|
+
indexed: true,
|
|
2326
|
+
internalType: "address"
|
|
2327
|
+
},
|
|
2328
|
+
{
|
|
2329
|
+
name: "prev",
|
|
2330
|
+
type: "bool",
|
|
2331
|
+
indexed: false,
|
|
2332
|
+
internalType: "bool"
|
|
2333
|
+
},
|
|
2334
|
+
{
|
|
2335
|
+
name: "next",
|
|
2336
|
+
type: "bool",
|
|
2337
|
+
indexed: false,
|
|
2338
|
+
internalType: "bool"
|
|
2339
|
+
}
|
|
2340
|
+
],
|
|
2341
|
+
anonymous: false
|
|
2342
|
+
},
|
|
2343
|
+
{
|
|
2344
|
+
type: "event",
|
|
2345
|
+
name: "OwnershipHandoverCanceled",
|
|
2346
|
+
inputs: [
|
|
2347
|
+
{
|
|
2348
|
+
name: "pendingOwner",
|
|
2349
|
+
type: "address",
|
|
2350
|
+
indexed: true,
|
|
2351
|
+
internalType: "address"
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
anonymous: false
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
type: "event",
|
|
2358
|
+
name: "OwnershipHandoverRequested",
|
|
2359
|
+
inputs: [
|
|
2360
|
+
{
|
|
2361
|
+
name: "pendingOwner",
|
|
2362
|
+
type: "address",
|
|
2363
|
+
indexed: true,
|
|
2364
|
+
internalType: "address"
|
|
2365
|
+
}
|
|
2366
|
+
],
|
|
2367
|
+
anonymous: false
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
type: "event",
|
|
2371
|
+
name: "OwnershipTransferred",
|
|
2372
|
+
inputs: [
|
|
2373
|
+
{
|
|
2374
|
+
name: "oldOwner",
|
|
2375
|
+
type: "address",
|
|
2376
|
+
indexed: true,
|
|
2377
|
+
internalType: "address"
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
name: "newOwner",
|
|
2381
|
+
type: "address",
|
|
2382
|
+
indexed: true,
|
|
2383
|
+
internalType: "address"
|
|
2384
|
+
}
|
|
2385
|
+
],
|
|
2386
|
+
anonymous: false
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
type: "event",
|
|
2390
|
+
name: "Paused",
|
|
2391
|
+
inputs: [
|
|
2392
|
+
{
|
|
2393
|
+
name: "previous",
|
|
2394
|
+
type: "uint32",
|
|
2395
|
+
indexed: false,
|
|
2396
|
+
internalType: "uint32"
|
|
2397
|
+
},
|
|
2398
|
+
{
|
|
2399
|
+
name: "next",
|
|
2400
|
+
type: "uint32",
|
|
2401
|
+
indexed: false,
|
|
2402
|
+
internalType: "uint32"
|
|
2403
|
+
}
|
|
2404
|
+
],
|
|
2405
|
+
anonymous: false
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
type: "event",
|
|
2409
|
+
name: "Stopped",
|
|
2410
|
+
inputs: [],
|
|
2411
|
+
anonymous: false
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
type: "event",
|
|
2415
|
+
name: "Swapped",
|
|
2416
|
+
inputs: [
|
|
2417
|
+
{
|
|
2418
|
+
name: "user",
|
|
2419
|
+
type: "address",
|
|
2420
|
+
indexed: true,
|
|
2421
|
+
internalType: "address"
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
name: "inputToken",
|
|
2425
|
+
type: "address",
|
|
2426
|
+
indexed: true,
|
|
2427
|
+
internalType: "address"
|
|
2428
|
+
},
|
|
2429
|
+
{
|
|
2430
|
+
name: "outputToken",
|
|
2431
|
+
type: "address",
|
|
2432
|
+
indexed: true,
|
|
2433
|
+
internalType: "address"
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
name: "inputAmount",
|
|
2437
|
+
type: "uint256",
|
|
2438
|
+
indexed: false,
|
|
2439
|
+
internalType: "uint256"
|
|
2440
|
+
},
|
|
2441
|
+
{
|
|
2442
|
+
name: "fee",
|
|
2443
|
+
type: "uint256",
|
|
2444
|
+
indexed: false,
|
|
2445
|
+
internalType: "uint256"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
name: "outputAmount",
|
|
2449
|
+
type: "uint256",
|
|
2450
|
+
indexed: false,
|
|
2451
|
+
internalType: "uint256"
|
|
2452
|
+
}
|
|
2453
|
+
],
|
|
2454
|
+
anonymous: false
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
type: "event",
|
|
2458
|
+
name: "Transferred",
|
|
2459
|
+
inputs: [
|
|
2460
|
+
{
|
|
2461
|
+
name: "to",
|
|
2462
|
+
type: "address",
|
|
2463
|
+
indexed: true,
|
|
2464
|
+
internalType: "address"
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
name: "token",
|
|
2468
|
+
type: "address",
|
|
2469
|
+
indexed: true,
|
|
2470
|
+
internalType: "address"
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
name: "amount",
|
|
2474
|
+
type: "uint256",
|
|
2475
|
+
indexed: false,
|
|
2476
|
+
internalType: "uint256"
|
|
2477
|
+
}
|
|
2478
|
+
],
|
|
2479
|
+
anonymous: false
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
type: "error",
|
|
2483
|
+
name: "AlreadyInitialized",
|
|
2484
|
+
inputs: []
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
type: "error",
|
|
2488
|
+
name: "InsufficientAmount",
|
|
2489
|
+
inputs: []
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
type: "error",
|
|
2493
|
+
name: "InvalidAddress",
|
|
2494
|
+
inputs: []
|
|
2495
|
+
},
|
|
2496
|
+
{
|
|
2497
|
+
type: "error",
|
|
2498
|
+
name: "InvalidAmount",
|
|
2499
|
+
inputs: []
|
|
2500
|
+
},
|
|
2501
|
+
{
|
|
2502
|
+
type: "error",
|
|
2503
|
+
name: "IsPaused",
|
|
2504
|
+
inputs: [
|
|
2505
|
+
{
|
|
2506
|
+
name: "level",
|
|
2507
|
+
type: "uint32",
|
|
2508
|
+
internalType: "uint32"
|
|
2509
|
+
}
|
|
2510
|
+
]
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
type: "error",
|
|
2514
|
+
name: "IsStopped",
|
|
2515
|
+
inputs: []
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
type: "error",
|
|
2519
|
+
name: "NewOwnerIsZeroAddress",
|
|
2520
|
+
inputs: []
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
type: "error",
|
|
2524
|
+
name: "NoHandoverRequest",
|
|
2525
|
+
inputs: []
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
type: "error",
|
|
2529
|
+
name: "SwapFailed",
|
|
2530
|
+
inputs: [
|
|
2531
|
+
{
|
|
2532
|
+
name: "user",
|
|
2533
|
+
type: "address",
|
|
2534
|
+
internalType: "address"
|
|
2535
|
+
},
|
|
2536
|
+
{
|
|
2537
|
+
name: "token",
|
|
2538
|
+
type: "address",
|
|
2539
|
+
internalType: "address"
|
|
2540
|
+
}
|
|
2541
|
+
]
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
type: "error",
|
|
2545
|
+
name: "Unauthorized",
|
|
2546
|
+
inputs: []
|
|
2547
|
+
}
|
|
2548
|
+
];
|
|
2549
|
+
|
|
2550
|
+
// src/universal/core/shared/blockchain/bps.ts
|
|
2551
|
+
var BPS_DENOM = Bps(10000n);
|
|
1860
2552
|
function applyBps(amount, bps) {
|
|
1861
2553
|
return assertUint256(amount * bps / BPS_DENOM);
|
|
1862
2554
|
}
|
|
@@ -1900,15 +2592,27 @@ var SwapQuote = {
|
|
|
1900
2592
|
};
|
|
1901
2593
|
|
|
1902
2594
|
// src/universal/core/checkout/superstate/blockchain/status.ts
|
|
1903
|
-
|
|
1904
|
-
|
|
2595
|
+
var SWAP_LEVEL = 2;
|
|
2596
|
+
function isSwapAvailable(status) {
|
|
2597
|
+
switch (status.state) {
|
|
2598
|
+
case "active":
|
|
2599
|
+
return true;
|
|
2600
|
+
case "stopped":
|
|
2601
|
+
return false;
|
|
2602
|
+
case "paused":
|
|
2603
|
+
return (status.pausedLevels & SWAP_LEVEL) === 0;
|
|
2604
|
+
default: {
|
|
2605
|
+
const _exhaustive = status;
|
|
2606
|
+
return _exhaustive;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
1905
2609
|
}
|
|
1906
2610
|
|
|
1907
2611
|
// src/universal/core/checkout/superstate/blockchain/swapped-event.ts
|
|
1908
|
-
var
|
|
2612
|
+
var import_viem4 = require("viem");
|
|
1909
2613
|
function decodeSwappedOutputAmount(receipt, outputDecimals) {
|
|
1910
2614
|
try {
|
|
1911
|
-
const [swapped] = (0,
|
|
2615
|
+
const [swapped] = (0, import_viem4.parseEventLogs)({
|
|
1912
2616
|
abi: SUPERSTATE_SWAP_ABI,
|
|
1913
2617
|
eventName: "Swapped",
|
|
1914
2618
|
logs: receipt.logs
|
|
@@ -1931,7 +2635,7 @@ var SLIPPAGE_OPTIONS_BPS = [25n, 50n, 100n, 200n, 500n].map(
|
|
|
1931
2635
|
(n) => Bps(n)
|
|
1932
2636
|
);
|
|
1933
2637
|
var DEFAULT_SLIPPAGE_BPS = Bps(50n);
|
|
1934
|
-
var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("
|
|
2638
|
+
var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("0x27E8CE9Ca1A1E98Bc4009F08Dc596bFcf88aCED1");
|
|
1935
2639
|
var SUPERSTATE_SWAP_CONTRACT_ADDRESSES = {
|
|
1936
2640
|
ethereum_sepolia: SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA
|
|
1937
2641
|
};
|
|
@@ -1946,141 +2650,66 @@ function formattedPricePerShare(quote, locale) {
|
|
|
1946
2650
|
}
|
|
1947
2651
|
|
|
1948
2652
|
// src/universal/types/providers/superstate/swap.ts
|
|
1949
|
-
var SwapAuthorization = {
|
|
1950
|
-
fromDto: (dto) => ({
|
|
1951
|
-
authorized: dto.authorized
|
|
1952
|
-
})
|
|
1953
|
-
};
|
|
1954
2653
|
var SwapPreview = {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
)
|
|
1960
|
-
fee: parseUint256(BigInt(dto.fee), "SwapPreview.fee"),
|
|
1961
|
-
outputAmount: parseUint256(
|
|
1962
|
-
BigInt(dto.receive_output_amount),
|
|
1963
|
-
"SwapPreview.receive_output_amount"
|
|
1964
|
-
)
|
|
2654
|
+
/** Maps the contract's `Preview { input, fee, output }` struct. */
|
|
2655
|
+
fromContract: (preview) => ({
|
|
2656
|
+
inputAmount: parseUint256(preview.input, "SwapPreview.input"),
|
|
2657
|
+
fee: parseUint256(preview.fee, "SwapPreview.fee"),
|
|
2658
|
+
outputAmount: parseUint256(preview.output, "SwapPreview.output")
|
|
1965
2659
|
})
|
|
1966
2660
|
};
|
|
2661
|
+
var PauseFlags = (value) => value;
|
|
1967
2662
|
var SwapStatus = {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2663
|
+
/**
|
|
2664
|
+
* Maps the contract's `Status { uint32 flags; State state }` struct, where
|
|
2665
|
+
* `State` is `0 = Active | 1 = Paused | 2 = Stopped`.
|
|
2666
|
+
*
|
|
2667
|
+
* `flags` is carried onto the `paused` arm only. On the other two the
|
|
2668
|
+
* contract sets it to a self-identifying marker rather than to information -
|
|
2669
|
+
* so repeating it would invite a caller to read meaning into a constant.
|
|
2670
|
+
*
|
|
2671
|
+
* @throws ValidationError on a `state` outside the enum. A contract that has
|
|
2672
|
+
* grown a fourth state is one the SDK does not model, and guessing `active`
|
|
2673
|
+
* would let a halted swap read as a live one.
|
|
2674
|
+
*/
|
|
2675
|
+
fromContract: (status) => {
|
|
2676
|
+
switch (status.state) {
|
|
2677
|
+
case 0:
|
|
2678
|
+
return { state: "active" };
|
|
2679
|
+
case 1:
|
|
2680
|
+
return { state: "paused", pausedLevels: PauseFlags(status.flags) };
|
|
2681
|
+
case 2:
|
|
2682
|
+
return { state: "stopped" };
|
|
2683
|
+
default:
|
|
2684
|
+
throw new ValidationError(
|
|
2685
|
+
`SwapStatus.state: unknown contract state (${status.state})`
|
|
2686
|
+
);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
1982
2689
|
};
|
|
1983
2690
|
var AllowWalletResponse = {
|
|
1984
2691
|
fromDto: (dto) => {
|
|
1985
2692
|
switch (dto.action) {
|
|
1986
2693
|
case "broadcast_transaction":
|
|
1987
|
-
return {
|
|
1988
|
-
action: "broadcast_transaction",
|
|
1989
|
-
to: EvmContractAddress(dto.to),
|
|
1990
|
-
data: HexEncodedTransactionData(dto.data)
|
|
1991
|
-
};
|
|
1992
|
-
case "none":
|
|
1993
|
-
return {
|
|
1994
|
-
action: "none",
|
|
1995
|
-
alreadyAllowed: dto.already_allowed
|
|
1996
|
-
};
|
|
1997
|
-
default: {
|
|
1998
|
-
const _exhaustive = dto;
|
|
1999
|
-
return _exhaustive;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
};
|
|
2004
|
-
|
|
2005
|
-
// src/universal/api/frontline/providers/superstate/swap.ts
|
|
2006
|
-
async function getSwapAuthorization(api, params) {
|
|
2007
|
-
const dto = await api.send({
|
|
2008
|
-
method: "GET",
|
|
2009
|
-
url: "/v1/wallet/authorized",
|
|
2010
|
-
queryParams: {
|
|
2011
|
-
chain: params.chain,
|
|
2012
|
-
contract_address: params.contractAddress,
|
|
2013
|
-
wallet_address: params.walletAddress
|
|
2014
|
-
},
|
|
2015
|
-
attributes: Attributes.protected()
|
|
2016
|
-
});
|
|
2017
|
-
return SwapAuthorization.fromDto(dto);
|
|
2018
|
-
}
|
|
2019
|
-
async function getSwapOutputToken(api, params) {
|
|
2020
|
-
const dto = await api.send({
|
|
2021
|
-
method: "GET",
|
|
2022
|
-
url: "/v1/swap/output-token",
|
|
2023
|
-
queryParams: {
|
|
2024
|
-
chain: params.chain,
|
|
2025
|
-
contract_address: params.contractAddress
|
|
2026
|
-
},
|
|
2027
|
-
attributes: Attributes.protected()
|
|
2028
|
-
});
|
|
2029
|
-
return toErc20Asset(dto);
|
|
2030
|
-
}
|
|
2031
|
-
async function getSwapPreview(api, params) {
|
|
2032
|
-
const dto = await api.send({
|
|
2033
|
-
method: "GET",
|
|
2034
|
-
url: "/v1/swap/preview",
|
|
2035
|
-
queryParams: {
|
|
2036
|
-
chain: params.chain,
|
|
2037
|
-
contract_address: params.contractAddress,
|
|
2038
|
-
input_token: params.inputToken,
|
|
2039
|
-
amount: params.amount.toString()
|
|
2040
|
-
},
|
|
2041
|
-
attributes: Attributes.protected()
|
|
2042
|
-
});
|
|
2043
|
-
return SwapPreview.fromDto(dto);
|
|
2044
|
-
}
|
|
2045
|
-
async function getSwapStatus(api, params) {
|
|
2046
|
-
const dto = await api.send({
|
|
2047
|
-
method: "GET",
|
|
2048
|
-
url: "/v1/swap/status",
|
|
2049
|
-
queryParams: {
|
|
2050
|
-
chain: params.chain,
|
|
2051
|
-
contract_address: params.contractAddress
|
|
2052
|
-
},
|
|
2053
|
-
attributes: Attributes.protected()
|
|
2054
|
-
});
|
|
2055
|
-
return SwapStatus.fromDto(dto);
|
|
2056
|
-
}
|
|
2057
|
-
async function getTokenAllowance(api, params) {
|
|
2058
|
-
const dto = await api.send({
|
|
2059
|
-
method: "GET",
|
|
2060
|
-
url: "/v1/token/allowance",
|
|
2061
|
-
queryParams: {
|
|
2062
|
-
chain: params.chain,
|
|
2063
|
-
token_address: params.tokenAddress,
|
|
2064
|
-
owner: params.owner,
|
|
2065
|
-
spender: params.spender
|
|
2066
|
-
},
|
|
2067
|
-
attributes: Attributes.protected()
|
|
2068
|
-
});
|
|
2069
|
-
return TokenAllowance.fromDto(dto);
|
|
2070
|
-
}
|
|
2071
|
-
async function getTokenBalance(api, params) {
|
|
2072
|
-
const dto = await api.send({
|
|
2073
|
-
method: "GET",
|
|
2074
|
-
url: "/v1/token/balance",
|
|
2075
|
-
queryParams: {
|
|
2076
|
-
chain: params.chain,
|
|
2077
|
-
token_address: params.tokenAddress,
|
|
2078
|
-
owner: params.owner
|
|
2079
|
-
},
|
|
2080
|
-
attributes: Attributes.protected()
|
|
2081
|
-
});
|
|
2082
|
-
return TokenBalance.fromDto(dto);
|
|
2083
|
-
}
|
|
2694
|
+
return {
|
|
2695
|
+
action: "broadcast_transaction",
|
|
2696
|
+
to: EvmContractAddress(dto.to),
|
|
2697
|
+
data: HexEncodedTransactionData(dto.data)
|
|
2698
|
+
};
|
|
2699
|
+
case "none":
|
|
2700
|
+
return {
|
|
2701
|
+
action: "none",
|
|
2702
|
+
alreadyAllowed: dto.already_allowed
|
|
2703
|
+
};
|
|
2704
|
+
default: {
|
|
2705
|
+
const _exhaustive = dto;
|
|
2706
|
+
return _exhaustive;
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
};
|
|
2711
|
+
|
|
2712
|
+
// src/universal/api/frontline/providers/superstate/swap.ts
|
|
2084
2713
|
async function allowWallet(api, params) {
|
|
2085
2714
|
const dto = await api.send({
|
|
2086
2715
|
method: "POST",
|
|
@@ -2094,11 +2723,153 @@ async function allowWallet(api, params) {
|
|
|
2094
2723
|
});
|
|
2095
2724
|
return AllowWalletResponse.fromDto(dto);
|
|
2096
2725
|
}
|
|
2097
|
-
|
|
2726
|
+
|
|
2727
|
+
// src/universal/core/shared/blockchain/erc20/abi.ts
|
|
2728
|
+
var ERC20_ABI = [
|
|
2729
|
+
{
|
|
2730
|
+
type: "function",
|
|
2731
|
+
name: "allowance",
|
|
2732
|
+
inputs: [
|
|
2733
|
+
{ name: "owner", type: "address" },
|
|
2734
|
+
{ name: "spender", type: "address" }
|
|
2735
|
+
],
|
|
2736
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2737
|
+
stateMutability: "view"
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
type: "function",
|
|
2741
|
+
name: "approve",
|
|
2742
|
+
inputs: [
|
|
2743
|
+
{ name: "spender", type: "address" },
|
|
2744
|
+
{ name: "amount", type: "uint256" }
|
|
2745
|
+
],
|
|
2746
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2747
|
+
stateMutability: "nonpayable"
|
|
2748
|
+
},
|
|
2749
|
+
{
|
|
2750
|
+
type: "function",
|
|
2751
|
+
name: "balanceOf",
|
|
2752
|
+
inputs: [{ name: "account", type: "address" }],
|
|
2753
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2754
|
+
stateMutability: "view"
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
type: "function",
|
|
2758
|
+
name: "decimals",
|
|
2759
|
+
inputs: [],
|
|
2760
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
2761
|
+
stateMutability: "view"
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
type: "function",
|
|
2765
|
+
name: "name",
|
|
2766
|
+
inputs: [],
|
|
2767
|
+
outputs: [{ name: "", type: "string" }],
|
|
2768
|
+
stateMutability: "view"
|
|
2769
|
+
},
|
|
2770
|
+
{
|
|
2771
|
+
type: "function",
|
|
2772
|
+
name: "symbol",
|
|
2773
|
+
inputs: [],
|
|
2774
|
+
outputs: [{ name: "", type: "string" }],
|
|
2775
|
+
stateMutability: "view"
|
|
2776
|
+
},
|
|
2777
|
+
{
|
|
2778
|
+
type: "function",
|
|
2779
|
+
name: "totalSupply",
|
|
2780
|
+
inputs: [],
|
|
2781
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2782
|
+
stateMutability: "view"
|
|
2783
|
+
},
|
|
2784
|
+
{
|
|
2785
|
+
type: "function",
|
|
2786
|
+
name: "transfer",
|
|
2787
|
+
inputs: [
|
|
2788
|
+
{ name: "recipient", type: "address" },
|
|
2789
|
+
{ name: "amount", type: "uint256" }
|
|
2790
|
+
],
|
|
2791
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2792
|
+
stateMutability: "nonpayable"
|
|
2793
|
+
},
|
|
2794
|
+
{
|
|
2795
|
+
type: "function",
|
|
2796
|
+
name: "transferFrom",
|
|
2797
|
+
inputs: [
|
|
2798
|
+
{ name: "sender", type: "address" },
|
|
2799
|
+
{ name: "recipient", type: "address" },
|
|
2800
|
+
{ name: "amount", type: "uint256" }
|
|
2801
|
+
],
|
|
2802
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2803
|
+
stateMutability: "nonpayable"
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
type: "event",
|
|
2807
|
+
name: "Approval",
|
|
2808
|
+
inputs: [
|
|
2809
|
+
{ name: "owner", type: "address", indexed: true },
|
|
2810
|
+
{ name: "spender", type: "address", indexed: true },
|
|
2811
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
2812
|
+
],
|
|
2813
|
+
anonymous: false
|
|
2814
|
+
},
|
|
2815
|
+
{
|
|
2816
|
+
type: "event",
|
|
2817
|
+
name: "Transfer",
|
|
2818
|
+
inputs: [
|
|
2819
|
+
{ name: "from", type: "address", indexed: true },
|
|
2820
|
+
{ name: "to", type: "address", indexed: true },
|
|
2821
|
+
{ name: "value", type: "uint256", indexed: false }
|
|
2822
|
+
],
|
|
2823
|
+
anonymous: false
|
|
2824
|
+
}
|
|
2825
|
+
];
|
|
2826
|
+
|
|
2827
|
+
// src/universal/api/rpc/providers/superstate/swap.ts
|
|
2828
|
+
async function getSwapAuthorization(clients, params) {
|
|
2829
|
+
return clients(params.chain).readContract({
|
|
2830
|
+
address: params.contractAddress,
|
|
2831
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2832
|
+
functionName: "authorized",
|
|
2833
|
+
args: [params.walletAddress]
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2836
|
+
async function getSwapPreview(clients, params) {
|
|
2837
|
+
const preview = await clients(params.chain).readContract({
|
|
2838
|
+
address: params.contractAddress,
|
|
2839
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2840
|
+
functionName: "preview",
|
|
2841
|
+
args: [params.inputToken, params.amount]
|
|
2842
|
+
});
|
|
2843
|
+
return SwapPreview.fromContract(preview);
|
|
2844
|
+
}
|
|
2845
|
+
async function getSwapStatus(clients, params) {
|
|
2846
|
+
const status = await clients(params.chain).readContract({
|
|
2847
|
+
address: params.contractAddress,
|
|
2848
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2849
|
+
functionName: "status"
|
|
2850
|
+
});
|
|
2851
|
+
return SwapStatus.fromContract(status);
|
|
2852
|
+
}
|
|
2853
|
+
async function getSwapOutputToken(clients, params) {
|
|
2854
|
+
const client = clients(params.chain);
|
|
2855
|
+
const tokenAddress = await client.readContract({
|
|
2856
|
+
address: params.contractAddress,
|
|
2857
|
+
abi: SUPERSTATE_SWAP_ABI,
|
|
2858
|
+
functionName: "outputToken"
|
|
2859
|
+
});
|
|
2860
|
+
const token = { address: EvmContractAddress(tokenAddress), abi: ERC20_ABI };
|
|
2861
|
+
const [name, symbol, decimals] = await client.multicall({
|
|
2862
|
+
contracts: [
|
|
2863
|
+
{ ...token, functionName: "name" },
|
|
2864
|
+
{ ...token, functionName: "symbol" },
|
|
2865
|
+
{ ...token, functionName: "decimals" }
|
|
2866
|
+
],
|
|
2867
|
+
allowFailure: false
|
|
2868
|
+
});
|
|
2098
2869
|
return {
|
|
2099
|
-
name
|
|
2100
|
-
symbol: AssetSymbol(
|
|
2101
|
-
decimals: AssetDecimals(
|
|
2870
|
+
name,
|
|
2871
|
+
symbol: AssetSymbol(symbol),
|
|
2872
|
+
decimals: AssetDecimals(decimals)
|
|
2102
2873
|
};
|
|
2103
2874
|
}
|
|
2104
2875
|
|
|
@@ -2109,28 +2880,32 @@ var SuperstateSwapNamespaceImpl = class {
|
|
|
2109
2880
|
this.log = internalLogger(ctx.logger, "SUPERSTATE");
|
|
2110
2881
|
}
|
|
2111
2882
|
async getAuthorization(params) {
|
|
2112
|
-
return this.log.wrap(
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2883
|
+
return this.log.wrap(
|
|
2884
|
+
"getAuthorization",
|
|
2885
|
+
params,
|
|
2886
|
+
async () => getSwapAuthorization(this.ctx.rpc, params)
|
|
2887
|
+
);
|
|
2116
2888
|
}
|
|
2117
2889
|
async getPreview(params) {
|
|
2118
|
-
return this.log.wrap(
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2890
|
+
return this.log.wrap(
|
|
2891
|
+
"getPreview",
|
|
2892
|
+
params,
|
|
2893
|
+
async () => getSwapPreview(this.ctx.rpc, params)
|
|
2894
|
+
);
|
|
2122
2895
|
}
|
|
2123
2896
|
async getStatus(params) {
|
|
2124
|
-
return this.log.wrap(
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2897
|
+
return this.log.wrap(
|
|
2898
|
+
"getStatus",
|
|
2899
|
+
params,
|
|
2900
|
+
async () => getSwapStatus(this.ctx.rpc, params)
|
|
2901
|
+
);
|
|
2128
2902
|
}
|
|
2129
2903
|
async getOutputToken(params) {
|
|
2130
|
-
return this.log.wrap(
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2904
|
+
return this.log.wrap(
|
|
2905
|
+
"getOutputToken",
|
|
2906
|
+
params,
|
|
2907
|
+
async () => getSwapOutputToken(this.ctx.rpc, params)
|
|
2908
|
+
);
|
|
2134
2909
|
}
|
|
2135
2910
|
async allowWallet(params) {
|
|
2136
2911
|
return this.log.wrap("allowWallet", params, async () => {
|
|
@@ -2375,105 +3150,25 @@ var RequirementsNamespaceImpl = class {
|
|
|
2375
3150
|
}
|
|
2376
3151
|
};
|
|
2377
3152
|
|
|
2378
|
-
// src/universal/
|
|
2379
|
-
|
|
2380
|
-
{
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
outputs: [{ name: "", type: "bool" }],
|
|
2398
|
-
stateMutability: "nonpayable"
|
|
2399
|
-
},
|
|
2400
|
-
{
|
|
2401
|
-
type: "function",
|
|
2402
|
-
name: "balanceOf",
|
|
2403
|
-
inputs: [{ name: "account", type: "address" }],
|
|
2404
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
2405
|
-
stateMutability: "view"
|
|
2406
|
-
},
|
|
2407
|
-
{
|
|
2408
|
-
type: "function",
|
|
2409
|
-
name: "decimals",
|
|
2410
|
-
inputs: [],
|
|
2411
|
-
outputs: [{ name: "", type: "uint8" }],
|
|
2412
|
-
stateMutability: "view"
|
|
2413
|
-
},
|
|
2414
|
-
{
|
|
2415
|
-
type: "function",
|
|
2416
|
-
name: "name",
|
|
2417
|
-
inputs: [],
|
|
2418
|
-
outputs: [{ name: "", type: "string" }],
|
|
2419
|
-
stateMutability: "view"
|
|
2420
|
-
},
|
|
2421
|
-
{
|
|
2422
|
-
type: "function",
|
|
2423
|
-
name: "symbol",
|
|
2424
|
-
inputs: [],
|
|
2425
|
-
outputs: [{ name: "", type: "string" }],
|
|
2426
|
-
stateMutability: "view"
|
|
2427
|
-
},
|
|
2428
|
-
{
|
|
2429
|
-
type: "function",
|
|
2430
|
-
name: "totalSupply",
|
|
2431
|
-
inputs: [],
|
|
2432
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
2433
|
-
stateMutability: "view"
|
|
2434
|
-
},
|
|
2435
|
-
{
|
|
2436
|
-
type: "function",
|
|
2437
|
-
name: "transfer",
|
|
2438
|
-
inputs: [
|
|
2439
|
-
{ name: "recipient", type: "address" },
|
|
2440
|
-
{ name: "amount", type: "uint256" }
|
|
2441
|
-
],
|
|
2442
|
-
outputs: [{ name: "", type: "bool" }],
|
|
2443
|
-
stateMutability: "nonpayable"
|
|
2444
|
-
},
|
|
2445
|
-
{
|
|
2446
|
-
type: "function",
|
|
2447
|
-
name: "transferFrom",
|
|
2448
|
-
inputs: [
|
|
2449
|
-
{ name: "sender", type: "address" },
|
|
2450
|
-
{ name: "recipient", type: "address" },
|
|
2451
|
-
{ name: "amount", type: "uint256" }
|
|
2452
|
-
],
|
|
2453
|
-
outputs: [{ name: "", type: "bool" }],
|
|
2454
|
-
stateMutability: "nonpayable"
|
|
2455
|
-
},
|
|
2456
|
-
{
|
|
2457
|
-
type: "event",
|
|
2458
|
-
name: "Approval",
|
|
2459
|
-
inputs: [
|
|
2460
|
-
{ name: "owner", type: "address", indexed: true },
|
|
2461
|
-
{ name: "spender", type: "address", indexed: true },
|
|
2462
|
-
{ name: "value", type: "uint256", indexed: false }
|
|
2463
|
-
],
|
|
2464
|
-
anonymous: false
|
|
2465
|
-
},
|
|
2466
|
-
{
|
|
2467
|
-
type: "event",
|
|
2468
|
-
name: "Transfer",
|
|
2469
|
-
inputs: [
|
|
2470
|
-
{ name: "from", type: "address", indexed: true },
|
|
2471
|
-
{ name: "to", type: "address", indexed: true },
|
|
2472
|
-
{ name: "value", type: "uint256", indexed: false }
|
|
2473
|
-
],
|
|
2474
|
-
anonymous: false
|
|
2475
|
-
}
|
|
2476
|
-
];
|
|
3153
|
+
// src/universal/api/rpc/erc20.ts
|
|
3154
|
+
async function getTokenAllowance(clients, params) {
|
|
3155
|
+
const allowance = await clients(params.chain).readContract({
|
|
3156
|
+
address: params.tokenAddress,
|
|
3157
|
+
abi: ERC20_ABI,
|
|
3158
|
+
functionName: "allowance",
|
|
3159
|
+
args: [params.owner, params.spender]
|
|
3160
|
+
});
|
|
3161
|
+
return parseUint256(allowance, "allowance");
|
|
3162
|
+
}
|
|
3163
|
+
async function getTokenBalance(clients, params) {
|
|
3164
|
+
const balance = await clients(params.chain).readContract({
|
|
3165
|
+
address: params.tokenAddress,
|
|
3166
|
+
abi: ERC20_ABI,
|
|
3167
|
+
functionName: "balanceOf",
|
|
3168
|
+
args: [params.owner]
|
|
3169
|
+
});
|
|
3170
|
+
return parseUint256(balance, "balanceOf");
|
|
3171
|
+
}
|
|
2477
3172
|
|
|
2478
3173
|
// src/universal/core/shared/blockchain/erc20/erc20-namespace.ts
|
|
2479
3174
|
var Erc20NamespaceImpl = class {
|
|
@@ -2482,21 +3177,23 @@ var Erc20NamespaceImpl = class {
|
|
|
2482
3177
|
this.log = internalLogger(ctx.logger, "ERC20");
|
|
2483
3178
|
}
|
|
2484
3179
|
async getAllowance(params) {
|
|
2485
|
-
return this.log.wrap(
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
3180
|
+
return this.log.wrap(
|
|
3181
|
+
"getAllowance",
|
|
3182
|
+
params,
|
|
3183
|
+
async () => getTokenAllowance(this.ctx.rpc, params)
|
|
3184
|
+
);
|
|
2489
3185
|
}
|
|
2490
3186
|
async getBalance(params) {
|
|
2491
|
-
return this.log.wrap(
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
3187
|
+
return this.log.wrap(
|
|
3188
|
+
"getBalance",
|
|
3189
|
+
params,
|
|
3190
|
+
async () => getTokenBalance(this.ctx.rpc, params)
|
|
3191
|
+
);
|
|
2495
3192
|
}
|
|
2496
3193
|
};
|
|
2497
3194
|
|
|
2498
3195
|
// src/universal/api/nabu/tokens.ts
|
|
2499
|
-
var
|
|
3196
|
+
var import_viem5 = require("viem");
|
|
2500
3197
|
|
|
2501
3198
|
// src/universal/api/frontline/config.ts
|
|
2502
3199
|
var HEADER_API_VERSION = "X-API-Version";
|
|
@@ -2562,9 +3259,9 @@ var HttpClient = class {
|
|
|
2562
3259
|
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
2563
3260
|
return url;
|
|
2564
3261
|
}
|
|
2565
|
-
const
|
|
3262
|
+
const base2 = this.config.baseUrl.replace(/\/$/, "");
|
|
2566
3263
|
const path = url.startsWith("/") ? url : `/${url}`;
|
|
2567
|
-
return
|
|
3264
|
+
return base2 + path;
|
|
2568
3265
|
}
|
|
2569
3266
|
async runBeforeRequestMiddleware(initialRequest) {
|
|
2570
3267
|
let request = initialRequest;
|
|
@@ -2825,7 +3522,7 @@ function assertOk(response) {
|
|
|
2825
3522
|
}
|
|
2826
3523
|
function checksummed(address) {
|
|
2827
3524
|
try {
|
|
2828
|
-
return (0,
|
|
3525
|
+
return (0, import_viem5.getAddress)(address);
|
|
2829
3526
|
} catch (_) {
|
|
2830
3527
|
throw new ValidationError(`Invalid EVM contract address: "${address}"`);
|
|
2831
3528
|
}
|
|
@@ -3073,6 +3770,7 @@ var User = {
|
|
|
3073
3770
|
HexEncodedTransactionData,
|
|
3074
3771
|
HttpError,
|
|
3075
3772
|
InvariantError,
|
|
3773
|
+
Isin,
|
|
3076
3774
|
Iso2CountryCode,
|
|
3077
3775
|
KnownAssetSymbol,
|
|
3078
3776
|
KycToken,
|
|
@@ -3113,6 +3811,7 @@ var User = {
|
|
|
3113
3811
|
Participation,
|
|
3114
3812
|
ParticipationId,
|
|
3115
3813
|
ParticipationsPaginationParams,
|
|
3814
|
+
PauseFlags,
|
|
3116
3815
|
Pii,
|
|
3117
3816
|
PiiAddress,
|
|
3118
3817
|
PiiJurisdiction,
|
|
@@ -3129,20 +3828,18 @@ var User = {
|
|
|
3129
3828
|
SUPERSTATE_SUPPORTED_INPUT_ASSETS,
|
|
3130
3829
|
SUPERSTATE_SWAP_ABI,
|
|
3131
3830
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
3831
|
+
SWAP_LEVEL,
|
|
3132
3832
|
SWAP_POLL_INTERVAL_MS,
|
|
3133
3833
|
ShortenedWalletAddress,
|
|
3134
3834
|
SolanaChain,
|
|
3135
3835
|
StablecoinSymbol,
|
|
3136
3836
|
SuperstateSwapNamespaceImpl,
|
|
3137
|
-
SwapAuthorization,
|
|
3138
3837
|
SwapPreview,
|
|
3139
3838
|
SwapQuote,
|
|
3140
3839
|
SwapStatus,
|
|
3141
3840
|
TOKEN_REGISTRY,
|
|
3142
3841
|
TermItem,
|
|
3143
3842
|
Ticker,
|
|
3144
|
-
TokenAllowance,
|
|
3145
|
-
TokenBalance,
|
|
3146
3843
|
TokenLogo,
|
|
3147
3844
|
TokenLogoUrl,
|
|
3148
3845
|
TokenMetadata,
|
|
@@ -3181,13 +3878,14 @@ var User = {
|
|
|
3181
3878
|
getChainId,
|
|
3182
3879
|
getNetworkName,
|
|
3183
3880
|
isChain,
|
|
3184
|
-
|
|
3881
|
+
isSwapAvailable,
|
|
3185
3882
|
parseBlockchainAmount,
|
|
3186
3883
|
parseUint256,
|
|
3187
3884
|
shortenAddress,
|
|
3188
3885
|
superstateSwapContractAddress,
|
|
3189
3886
|
swapSpender,
|
|
3190
3887
|
txExplorerUrl,
|
|
3191
|
-
usdAmount
|
|
3888
|
+
usdAmount,
|
|
3889
|
+
viemChain
|
|
3192
3890
|
});
|
|
3193
3891
|
//# sourceMappingURL=index.cjs.map
|