@hyperbridge/sdk 1.3.21 → 1.3.25
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/browser/index.d.ts +132 -9
- package/dist/browser/index.js +1843 -1987
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +132 -9
- package/dist/node/index.js +1843 -1987
- package/dist/node/index.js.map +1 -1
- package/package.json +2 -2
package/dist/node/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'util';
|
|
4
4
|
import { createConsola, LogLevels } from 'consola';
|
|
5
5
|
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
|
|
6
|
-
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, hexToString as hexToString$1 } from 'viem';
|
|
6
|
+
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, parseAbiParameters, hexToString as hexToString$1 } from 'viem';
|
|
7
7
|
import mergeRace from '@async-generator/merge-race';
|
|
8
8
|
import { unichain, polygon, gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
|
|
9
9
|
import { hasWindow, isNode, env } from 'std-env';
|
|
@@ -3451,71 +3451,43 @@ var addresses = {
|
|
|
3451
3451
|
["EVM-137" /* POLYGON_MAINNET */]: "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
|
|
3452
3452
|
["EVM-130" /* UNICHAIN_MAINNET */]: "0x1F98400000000000000000000000000000000002"
|
|
3453
3453
|
},
|
|
3454
|
-
BatchExecutor: {
|
|
3455
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x4CC58B5D8FBf838d062E4b21F75C327835B5F0ef",
|
|
3456
|
-
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3457
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3458
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3459
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3460
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3461
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3462
|
-
},
|
|
3463
3454
|
UniversalRouter: {
|
|
3464
3455
|
["EVM-97" /* BSC_CHAPEL */]: "0xcc6d5ece3d4a57245bf5a2f64f3ed9179b81f714",
|
|
3465
|
-
["EVM-1" /* MAINNET */]: "
|
|
3466
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3467
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3468
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3469
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3470
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3471
|
-
},
|
|
3472
|
-
UniswapV3Router: {
|
|
3473
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3474
|
-
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3475
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3476
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3477
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3478
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3479
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3480
|
-
},
|
|
3481
|
-
UniswapV3Factory: {
|
|
3482
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3483
|
-
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3484
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3485
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3486
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3487
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3488
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3456
|
+
["EVM-1" /* MAINNET */]: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
|
|
3457
|
+
["EVM-56" /* BSC_MAINNET */]: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",
|
|
3458
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
|
|
3459
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x6ff5693b99212da76ad316178a184ab56d299b43",
|
|
3460
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
|
|
3461
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3"
|
|
3489
3462
|
},
|
|
3490
3463
|
UniswapV3Quoter: {
|
|
3491
3464
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3492
3465
|
["EVM-1" /* MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3493
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3494
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3495
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3496
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3497
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3498
|
-
},
|
|
3499
|
-
UniswapV4PoolManager: {
|
|
3500
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3501
|
-
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3502
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3503
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3504
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3505
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3506
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3466
|
+
["EVM-56" /* BSC_MAINNET */]: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997",
|
|
3467
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3468
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
|
|
3469
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3470
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x385a5cf5f83e99f7bb2852b6a19c3538b9fa7658"
|
|
3507
3471
|
},
|
|
3508
3472
|
UniswapV4Quoter: {
|
|
3509
3473
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3510
3474
|
["EVM-1" /* MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
3511
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3512
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3513
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3514
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3515
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3475
|
+
["EVM-56" /* BSC_MAINNET */]: "0xd0737C9762912dD34c3271197E362Aa736Df0926",
|
|
3476
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x3972c00f7ed4885e145823eb7c655375d275a1c5",
|
|
3477
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0d5e0f971ed27fbff6c2837bf31316121532048d",
|
|
3478
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9",
|
|
3479
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203"
|
|
3516
3480
|
},
|
|
3517
3481
|
Calldispatcher: {
|
|
3518
3482
|
["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155"
|
|
3483
|
+
},
|
|
3484
|
+
Permit2: {
|
|
3485
|
+
["EVM-1" /* MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3486
|
+
["EVM-56" /* BSC_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3487
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3488
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3489
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3490
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
|
|
3519
3491
|
}
|
|
3520
3492
|
};
|
|
3521
3493
|
var createRpcUrls = (env2) => ({
|
|
@@ -3607,30 +3579,24 @@ var ChainConfigService = class {
|
|
|
3607
3579
|
getUniswapV2FactoryAddress(chain) {
|
|
3608
3580
|
return addresses.UniswapV2Factory[chain];
|
|
3609
3581
|
}
|
|
3610
|
-
getBatchExecutorAddress(chain) {
|
|
3611
|
-
return addresses.BatchExecutor[chain];
|
|
3612
|
-
}
|
|
3613
3582
|
getUniversalRouterAddress(chain) {
|
|
3614
3583
|
return addresses.UniversalRouter[chain];
|
|
3615
3584
|
}
|
|
3616
|
-
getUniswapV3RouterAddress(chain) {
|
|
3617
|
-
return addresses.UniswapV3Router[chain];
|
|
3618
|
-
}
|
|
3619
|
-
getUniswapV3FactoryAddress(chain) {
|
|
3620
|
-
return addresses.UniswapV3Factory[chain];
|
|
3621
|
-
}
|
|
3622
3585
|
getUniswapV3QuoterAddress(chain) {
|
|
3623
3586
|
return addresses.UniswapV3Quoter[chain];
|
|
3624
3587
|
}
|
|
3625
|
-
getUniswapV4PoolManagerAddress(chain) {
|
|
3626
|
-
return addresses.UniswapV4PoolManager[chain];
|
|
3627
|
-
}
|
|
3628
3588
|
getUniswapV4QuoterAddress(chain) {
|
|
3629
3589
|
return addresses.UniswapV4Quoter[chain];
|
|
3630
3590
|
}
|
|
3591
|
+
getPermit2Address(chain) {
|
|
3592
|
+
return addresses.Permit2[chain];
|
|
3593
|
+
}
|
|
3631
3594
|
getCoingeckoId(chain) {
|
|
3632
3595
|
return coingeckoIds[chain];
|
|
3633
3596
|
}
|
|
3597
|
+
getEtherscanApiKey() {
|
|
3598
|
+
return typeof process !== "undefined" ? process?.env?.ETHERSCAN_API_KEY : void 0;
|
|
3599
|
+
}
|
|
3634
3600
|
};
|
|
3635
3601
|
function getPeakPosByHeight(height) {
|
|
3636
3602
|
return (1n << BigInt(height + 1)) - 2n;
|
|
@@ -3736,8 +3702,8 @@ function calculateMMRSize(numberOfLeaves) {
|
|
|
3736
3702
|
}
|
|
3737
3703
|
async function generateRootWithProof(postRequest, treeSize) {
|
|
3738
3704
|
const { generate_root_with_proof: generate_root_with_proof2 } = await load_ckb_mmr();
|
|
3739
|
-
const { commitment: hash, encodePacked:
|
|
3740
|
-
const result = JSON.parse(generate_root_with_proof2(hexToBytes(
|
|
3705
|
+
const { commitment: hash, encodePacked: encodePacked3 } = postRequestCommitment(postRequest);
|
|
3706
|
+
const result = JSON.parse(generate_root_with_proof2(hexToBytes(encodePacked3), treeSize));
|
|
3741
3707
|
const { root, proof, mmr_size, leaf_positions, keccak_hash_calldata } = result;
|
|
3742
3708
|
if (keccak_hash_calldata !== hash) {
|
|
3743
3709
|
console.log("keccak_hash", keccak_hash_calldata);
|
|
@@ -4513,6 +4479,24 @@ async function fetchPrice(identifier, chainId = 1, apiKey) {
|
|
|
4513
4479
|
}
|
|
4514
4480
|
return data[key].usd;
|
|
4515
4481
|
}
|
|
4482
|
+
async function getGasPriceFromEtherscan(chainId, apiKey) {
|
|
4483
|
+
let parsedChainId = Number(chainId.split("-")[1]);
|
|
4484
|
+
const url = apiKey ? `https://api.etherscan.io/v2/api?chainid=${parsedChainId}&module=gastracker&action=gasoracle&apikey=${apiKey}` : `https://api.etherscan.io/v2/api?chainid=${parsedChainId}&module=gastracker&action=gasoracle`;
|
|
4485
|
+
const response = await fetch(url);
|
|
4486
|
+
const data = await response.json();
|
|
4487
|
+
return gweiToWei(data.result.ProposeGasPrice);
|
|
4488
|
+
}
|
|
4489
|
+
function gweiToWei(gwei) {
|
|
4490
|
+
if (!gwei || typeof gwei !== "string") {
|
|
4491
|
+
throw new Error(`Invalid gwei value: ${gwei}`);
|
|
4492
|
+
}
|
|
4493
|
+
const [intPart, fracPartRaw] = gwei.split(".");
|
|
4494
|
+
const fracPart = (fracPartRaw || "").slice(0, 9);
|
|
4495
|
+
const fracPadded = fracPart.padEnd(9, "0");
|
|
4496
|
+
const whole = BigInt(intPart || "0") * 1000000000n;
|
|
4497
|
+
const fractional = BigInt(fracPadded || "0");
|
|
4498
|
+
return whole + fractional;
|
|
4499
|
+
}
|
|
4516
4500
|
var ERC20Method = /* @__PURE__ */ ((ERC20Method2) => {
|
|
4517
4501
|
ERC20Method2["BALANCE_OF"] = "0x70a08231";
|
|
4518
4502
|
ERC20Method2["ALLOWANCE"] = "0xdd62ed3e";
|
|
@@ -4619,6 +4603,8 @@ function adjustFeeDecimals(feeInFeeToken, fromDecimals, toDecimals) {
|
|
|
4619
4603
|
return (feeInFeeToken + scaleFactor - 1n) / scaleFactor;
|
|
4620
4604
|
}
|
|
4621
4605
|
}
|
|
4606
|
+
var USE_ETHERSCAN_CHAINS = /* @__PURE__ */ new Set(["EVM-137", "EVM-56", "EVM-1"]);
|
|
4607
|
+
var TESTNET_CHAINS = /* @__PURE__ */ new Set(["EVM-10200", "EVM-97"]);
|
|
4622
4608
|
function replaceWebsocketWithHttp(url) {
|
|
4623
4609
|
if (url.startsWith("ws://")) {
|
|
4624
4610
|
return url.replace("ws://", "http://");
|
|
@@ -6704,6 +6690,30 @@ query StateMachineUpdatesByTimestamp($statemachineId: String!, $commitmentTimest
|
|
|
6704
6690
|
}
|
|
6705
6691
|
}
|
|
6706
6692
|
`;
|
|
6693
|
+
var LATEST_STATE_MACHINE_UPDATE = `
|
|
6694
|
+
query LatestStateMachineUpdate($statemachineId: String!, $chain: String!) {
|
|
6695
|
+
stateMachineUpdateEvents(
|
|
6696
|
+
filter: {
|
|
6697
|
+
and: [
|
|
6698
|
+
{ stateMachineId: { equalTo: $statemachineId } }
|
|
6699
|
+
{ chain: { equalTo: $chain } }
|
|
6700
|
+
]
|
|
6701
|
+
}
|
|
6702
|
+
orderBy: HEIGHT_DESC
|
|
6703
|
+
first: 1
|
|
6704
|
+
) {
|
|
6705
|
+
nodes {
|
|
6706
|
+
height
|
|
6707
|
+
stateMachineId
|
|
6708
|
+
chain
|
|
6709
|
+
blockHash
|
|
6710
|
+
blockNumber
|
|
6711
|
+
transactionHash
|
|
6712
|
+
createdAt
|
|
6713
|
+
}
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
`;
|
|
6707
6717
|
var ASSET_TELEPORTED_BY_PARAMS = `
|
|
6708
6718
|
query AssetTeleportedByParams($id: String!) {
|
|
6709
6719
|
assetTeleported(id: $id) {
|
|
@@ -7093,6 +7103,32 @@ var IndexerClient = class {
|
|
|
7093
7103
|
logger.trace("Response >", first_node);
|
|
7094
7104
|
return first_node;
|
|
7095
7105
|
}
|
|
7106
|
+
/**
|
|
7107
|
+
* Query for the latest state machine update height
|
|
7108
|
+
* @params statemachineId - ID of the state machine
|
|
7109
|
+
* @params chain - The identifier for the chain where the state machine update should be queried (corresponds to a stateMachineId)
|
|
7110
|
+
* @returns Latest height or undefined if no updates found
|
|
7111
|
+
*/
|
|
7112
|
+
async queryLatestStateMachineHeight({
|
|
7113
|
+
statemachineId,
|
|
7114
|
+
chain
|
|
7115
|
+
}) {
|
|
7116
|
+
const logger = this.logger.withTag("[queryLatestStateMachineHeight]()");
|
|
7117
|
+
const message = `querying latest StateMachineId(${statemachineId}) height in chain Chain(${chain})`;
|
|
7118
|
+
const response = await this.withRetry(
|
|
7119
|
+
() => {
|
|
7120
|
+
return this.client.request(LATEST_STATE_MACHINE_UPDATE, {
|
|
7121
|
+
statemachineId,
|
|
7122
|
+
chain
|
|
7123
|
+
});
|
|
7124
|
+
},
|
|
7125
|
+
{ logger, logMessage: message }
|
|
7126
|
+
);
|
|
7127
|
+
const first_node = response?.stateMachineUpdateEvents?.nodes[0];
|
|
7128
|
+
if (!first_node) return void 0;
|
|
7129
|
+
logger.trace("Latest height >", first_node.height);
|
|
7130
|
+
return BigInt(first_node.height);
|
|
7131
|
+
}
|
|
7096
7132
|
/**
|
|
7097
7133
|
* Queries a request by CommitmentHash
|
|
7098
7134
|
*
|
|
@@ -9818,1950 +9854,985 @@ var ABI4 = [
|
|
|
9818
9854
|
];
|
|
9819
9855
|
var IntentGateway_default = { ABI: ABI4 };
|
|
9820
9856
|
|
|
9821
|
-
// src/abis/
|
|
9857
|
+
// src/abis/uniswapV3Quoter.ts
|
|
9822
9858
|
var ABI5 = [
|
|
9823
9859
|
{
|
|
9824
9860
|
inputs: [
|
|
9825
9861
|
{
|
|
9826
|
-
internalType: "
|
|
9827
|
-
name: "
|
|
9828
|
-
type: "
|
|
9862
|
+
internalType: "bytes",
|
|
9863
|
+
name: "path",
|
|
9864
|
+
type: "bytes"
|
|
9865
|
+
},
|
|
9866
|
+
{
|
|
9867
|
+
internalType: "uint256",
|
|
9868
|
+
name: "amountIn",
|
|
9869
|
+
type: "uint256"
|
|
9829
9870
|
}
|
|
9830
9871
|
],
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
},
|
|
9834
|
-
{
|
|
9835
|
-
anonymous: false,
|
|
9836
|
-
inputs: [
|
|
9872
|
+
name: "quoteExactInput",
|
|
9873
|
+
outputs: [
|
|
9837
9874
|
{
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
type: "address"
|
|
9875
|
+
internalType: "uint256",
|
|
9876
|
+
name: "amountOut",
|
|
9877
|
+
type: "uint256"
|
|
9842
9878
|
},
|
|
9843
9879
|
{
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
type: "address"
|
|
9880
|
+
internalType: "uint160[]",
|
|
9881
|
+
name: "sqrtPriceX96AfterList",
|
|
9882
|
+
type: "uint160[]"
|
|
9848
9883
|
},
|
|
9849
9884
|
{
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
type: "address"
|
|
9885
|
+
internalType: "uint32[]",
|
|
9886
|
+
name: "initializedTicksCrossedList",
|
|
9887
|
+
type: "uint32[]"
|
|
9854
9888
|
},
|
|
9855
9889
|
{
|
|
9856
|
-
indexed: false,
|
|
9857
9890
|
internalType: "uint256",
|
|
9858
|
-
name: "",
|
|
9891
|
+
name: "gasEstimate",
|
|
9859
9892
|
type: "uint256"
|
|
9860
9893
|
}
|
|
9861
9894
|
],
|
|
9862
|
-
|
|
9863
|
-
type: "
|
|
9864
|
-
},
|
|
9865
|
-
{
|
|
9866
|
-
anonymous: false,
|
|
9867
|
-
inputs: [
|
|
9868
|
-
{
|
|
9869
|
-
indexed: false,
|
|
9870
|
-
internalType: "address",
|
|
9871
|
-
name: "feeCollector_",
|
|
9872
|
-
type: "address"
|
|
9873
|
-
}
|
|
9874
|
-
],
|
|
9875
|
-
name: "SetFeeCollector",
|
|
9876
|
-
type: "event"
|
|
9877
|
-
},
|
|
9878
|
-
{
|
|
9879
|
-
anonymous: false,
|
|
9880
|
-
inputs: [
|
|
9881
|
-
{
|
|
9882
|
-
indexed: false,
|
|
9883
|
-
internalType: "address",
|
|
9884
|
-
name: "feeCollectorSetter_",
|
|
9885
|
-
type: "address"
|
|
9886
|
-
}
|
|
9887
|
-
],
|
|
9888
|
-
name: "SetFeeCollectorSetter",
|
|
9889
|
-
type: "event"
|
|
9895
|
+
stateMutability: "nonpayable",
|
|
9896
|
+
type: "function"
|
|
9890
9897
|
},
|
|
9891
9898
|
{
|
|
9892
|
-
anonymous: false,
|
|
9893
9899
|
inputs: [
|
|
9894
9900
|
{
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9901
|
+
components: [
|
|
9902
|
+
{
|
|
9903
|
+
internalType: "address",
|
|
9904
|
+
name: "tokenIn",
|
|
9905
|
+
type: "address"
|
|
9906
|
+
},
|
|
9907
|
+
{
|
|
9908
|
+
internalType: "address",
|
|
9909
|
+
name: "tokenOut",
|
|
9910
|
+
type: "address"
|
|
9911
|
+
},
|
|
9912
|
+
{
|
|
9913
|
+
internalType: "uint256",
|
|
9914
|
+
name: "amountIn",
|
|
9915
|
+
type: "uint256"
|
|
9916
|
+
},
|
|
9917
|
+
{
|
|
9918
|
+
internalType: "uint24",
|
|
9919
|
+
name: "fee",
|
|
9920
|
+
type: "uint24"
|
|
9921
|
+
},
|
|
9922
|
+
{
|
|
9923
|
+
internalType: "uint160",
|
|
9924
|
+
name: "sqrtPriceLimitX96",
|
|
9925
|
+
type: "uint160"
|
|
9926
|
+
}
|
|
9927
|
+
],
|
|
9928
|
+
internalType: "struct IQuoterV2.QuoteExactInputSingleParams",
|
|
9929
|
+
name: "params",
|
|
9930
|
+
type: "tuple"
|
|
9899
9931
|
}
|
|
9900
9932
|
],
|
|
9901
|
-
name: "
|
|
9902
|
-
|
|
9903
|
-
},
|
|
9904
|
-
{
|
|
9905
|
-
inputs: [
|
|
9933
|
+
name: "quoteExactInputSingle",
|
|
9934
|
+
outputs: [
|
|
9906
9935
|
{
|
|
9907
9936
|
internalType: "uint256",
|
|
9908
|
-
name: "",
|
|
9937
|
+
name: "amountOut",
|
|
9909
9938
|
type: "uint256"
|
|
9910
|
-
}
|
|
9911
|
-
],
|
|
9912
|
-
name: "allPairs",
|
|
9913
|
-
outputs: [
|
|
9939
|
+
},
|
|
9914
9940
|
{
|
|
9915
|
-
internalType: "
|
|
9916
|
-
name: "",
|
|
9917
|
-
type: "
|
|
9918
|
-
}
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
inputs: [],
|
|
9925
|
-
name: "allPairsLength",
|
|
9926
|
-
outputs: [
|
|
9941
|
+
internalType: "uint160",
|
|
9942
|
+
name: "sqrtPriceX96After",
|
|
9943
|
+
type: "uint160"
|
|
9944
|
+
},
|
|
9945
|
+
{
|
|
9946
|
+
internalType: "uint32",
|
|
9947
|
+
name: "initializedTicksCrossed",
|
|
9948
|
+
type: "uint32"
|
|
9949
|
+
},
|
|
9927
9950
|
{
|
|
9928
9951
|
internalType: "uint256",
|
|
9929
|
-
name: "",
|
|
9952
|
+
name: "gasEstimate",
|
|
9930
9953
|
type: "uint256"
|
|
9931
9954
|
}
|
|
9932
9955
|
],
|
|
9933
|
-
stateMutability: "
|
|
9956
|
+
stateMutability: "nonpayable",
|
|
9934
9957
|
type: "function"
|
|
9935
9958
|
},
|
|
9936
9959
|
{
|
|
9937
9960
|
inputs: [
|
|
9938
9961
|
{
|
|
9939
|
-
internalType: "
|
|
9940
|
-
name: "
|
|
9941
|
-
type: "
|
|
9962
|
+
internalType: "bytes",
|
|
9963
|
+
name: "path",
|
|
9964
|
+
type: "bytes"
|
|
9942
9965
|
},
|
|
9943
9966
|
{
|
|
9944
|
-
internalType: "
|
|
9945
|
-
name: "
|
|
9946
|
-
type: "
|
|
9967
|
+
internalType: "uint256",
|
|
9968
|
+
name: "amountOut",
|
|
9969
|
+
type: "uint256"
|
|
9947
9970
|
}
|
|
9948
9971
|
],
|
|
9949
|
-
name: "
|
|
9972
|
+
name: "quoteExactOutput",
|
|
9950
9973
|
outputs: [
|
|
9951
9974
|
{
|
|
9952
|
-
internalType: "
|
|
9953
|
-
name: "
|
|
9954
|
-
type: "
|
|
9975
|
+
internalType: "uint256",
|
|
9976
|
+
name: "amountIn",
|
|
9977
|
+
type: "uint256"
|
|
9978
|
+
},
|
|
9979
|
+
{
|
|
9980
|
+
internalType: "uint160[]",
|
|
9981
|
+
name: "sqrtPriceX96AfterList",
|
|
9982
|
+
type: "uint160[]"
|
|
9983
|
+
},
|
|
9984
|
+
{
|
|
9985
|
+
internalType: "uint32[]",
|
|
9986
|
+
name: "initializedTicksCrossedList",
|
|
9987
|
+
type: "uint32[]"
|
|
9988
|
+
},
|
|
9989
|
+
{
|
|
9990
|
+
internalType: "uint256",
|
|
9991
|
+
name: "gasEstimate",
|
|
9992
|
+
type: "uint256"
|
|
9955
9993
|
}
|
|
9956
9994
|
],
|
|
9957
9995
|
stateMutability: "nonpayable",
|
|
9958
9996
|
type: "function"
|
|
9959
9997
|
},
|
|
9960
9998
|
{
|
|
9961
|
-
inputs: [
|
|
9962
|
-
name: "feeCollector",
|
|
9963
|
-
outputs: [
|
|
9999
|
+
inputs: [
|
|
9964
10000
|
{
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
10001
|
+
components: [
|
|
10002
|
+
{
|
|
10003
|
+
internalType: "address",
|
|
10004
|
+
name: "tokenIn",
|
|
10005
|
+
type: "address"
|
|
10006
|
+
},
|
|
10007
|
+
{
|
|
10008
|
+
internalType: "address",
|
|
10009
|
+
name: "tokenOut",
|
|
10010
|
+
type: "address"
|
|
10011
|
+
},
|
|
10012
|
+
{
|
|
10013
|
+
internalType: "uint256",
|
|
10014
|
+
name: "amount",
|
|
10015
|
+
type: "uint256"
|
|
10016
|
+
},
|
|
10017
|
+
{
|
|
10018
|
+
internalType: "uint24",
|
|
10019
|
+
name: "fee",
|
|
10020
|
+
type: "uint24"
|
|
10021
|
+
},
|
|
10022
|
+
{
|
|
10023
|
+
internalType: "uint160",
|
|
10024
|
+
name: "sqrtPriceLimitX96",
|
|
10025
|
+
type: "uint160"
|
|
10026
|
+
}
|
|
10027
|
+
],
|
|
10028
|
+
internalType: "struct IQuoterV2.QuoteExactOutputSingleParams",
|
|
10029
|
+
name: "params",
|
|
10030
|
+
type: "tuple"
|
|
9968
10031
|
}
|
|
9969
10032
|
],
|
|
9970
|
-
|
|
9971
|
-
type: "function"
|
|
9972
|
-
},
|
|
9973
|
-
{
|
|
9974
|
-
inputs: [],
|
|
9975
|
-
name: "feeCollectorSetter",
|
|
10033
|
+
name: "quoteExactOutputSingle",
|
|
9976
10034
|
outputs: [
|
|
9977
10035
|
{
|
|
9978
|
-
internalType: "
|
|
9979
|
-
name: "",
|
|
9980
|
-
type: "
|
|
9981
|
-
}
|
|
9982
|
-
],
|
|
9983
|
-
stateMutability: "view",
|
|
9984
|
-
type: "function"
|
|
9985
|
-
},
|
|
9986
|
-
{
|
|
9987
|
-
inputs: [
|
|
10036
|
+
internalType: "uint256",
|
|
10037
|
+
name: "amountIn",
|
|
10038
|
+
type: "uint256"
|
|
10039
|
+
},
|
|
9988
10040
|
{
|
|
9989
|
-
internalType: "
|
|
9990
|
-
name: "",
|
|
9991
|
-
type: "
|
|
10041
|
+
internalType: "uint160",
|
|
10042
|
+
name: "sqrtPriceX96After",
|
|
10043
|
+
type: "uint160"
|
|
9992
10044
|
},
|
|
9993
10045
|
{
|
|
9994
|
-
internalType: "
|
|
9995
|
-
name: "",
|
|
9996
|
-
type: "
|
|
9997
|
-
}
|
|
9998
|
-
],
|
|
9999
|
-
name: "getPair",
|
|
10000
|
-
outputs: [
|
|
10046
|
+
internalType: "uint32",
|
|
10047
|
+
name: "initializedTicksCrossed",
|
|
10048
|
+
type: "uint32"
|
|
10049
|
+
},
|
|
10001
10050
|
{
|
|
10002
|
-
internalType: "
|
|
10003
|
-
name: "",
|
|
10004
|
-
type: "
|
|
10051
|
+
internalType: "uint256",
|
|
10052
|
+
name: "gasEstimate",
|
|
10053
|
+
type: "uint256"
|
|
10005
10054
|
}
|
|
10006
10055
|
],
|
|
10007
|
-
stateMutability: "
|
|
10056
|
+
stateMutability: "nonpayable",
|
|
10008
10057
|
type: "function"
|
|
10058
|
+
}
|
|
10059
|
+
];
|
|
10060
|
+
var uniswapV3Quoter_default = { ABI: ABI5 };
|
|
10061
|
+
|
|
10062
|
+
// src/abis/uniswapV4Quoter.ts
|
|
10063
|
+
var UNISWAP_V4_QUOTER_ABI = [
|
|
10064
|
+
{
|
|
10065
|
+
type: "constructor",
|
|
10066
|
+
inputs: [{ name: "_poolManager", type: "address", internalType: "contract IPoolManager" }],
|
|
10067
|
+
stateMutability: "nonpayable"
|
|
10009
10068
|
},
|
|
10010
10069
|
{
|
|
10011
|
-
|
|
10012
|
-
name: "
|
|
10013
|
-
|
|
10070
|
+
type: "function",
|
|
10071
|
+
name: "_quoteExactInput",
|
|
10072
|
+
inputs: [
|
|
10014
10073
|
{
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10074
|
+
name: "params",
|
|
10075
|
+
type: "tuple",
|
|
10076
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10077
|
+
components: [
|
|
10078
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10079
|
+
{
|
|
10080
|
+
name: "path",
|
|
10081
|
+
type: "tuple[]",
|
|
10082
|
+
internalType: "struct PathKey[]",
|
|
10083
|
+
components: [
|
|
10084
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10085
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10086
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10087
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10088
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10089
|
+
]
|
|
10090
|
+
},
|
|
10091
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10092
|
+
]
|
|
10018
10093
|
}
|
|
10019
10094
|
],
|
|
10020
|
-
|
|
10021
|
-
|
|
10095
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10096
|
+
stateMutability: "nonpayable"
|
|
10022
10097
|
},
|
|
10023
10098
|
{
|
|
10024
|
-
|
|
10025
|
-
name: "
|
|
10026
|
-
|
|
10099
|
+
type: "function",
|
|
10100
|
+
name: "_quoteExactInputSingle",
|
|
10101
|
+
inputs: [
|
|
10027
10102
|
{
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10103
|
+
name: "params",
|
|
10104
|
+
type: "tuple",
|
|
10105
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10106
|
+
components: [
|
|
10107
|
+
{
|
|
10108
|
+
name: "poolKey",
|
|
10109
|
+
type: "tuple",
|
|
10110
|
+
internalType: "struct PoolKey",
|
|
10111
|
+
components: [
|
|
10112
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10113
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10114
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10115
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10116
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10117
|
+
]
|
|
10118
|
+
},
|
|
10119
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10120
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10121
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10122
|
+
]
|
|
10031
10123
|
}
|
|
10032
10124
|
],
|
|
10033
|
-
|
|
10034
|
-
|
|
10125
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10126
|
+
stateMutability: "nonpayable"
|
|
10035
10127
|
},
|
|
10036
10128
|
{
|
|
10129
|
+
type: "function",
|
|
10130
|
+
name: "_quoteExactOutput",
|
|
10037
10131
|
inputs: [
|
|
10038
10132
|
{
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10133
|
+
name: "params",
|
|
10134
|
+
type: "tuple",
|
|
10135
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10136
|
+
components: [
|
|
10137
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10138
|
+
{
|
|
10139
|
+
name: "path",
|
|
10140
|
+
type: "tuple[]",
|
|
10141
|
+
internalType: "struct PathKey[]",
|
|
10142
|
+
components: [
|
|
10143
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10144
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10145
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10146
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10147
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10148
|
+
]
|
|
10149
|
+
},
|
|
10150
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10151
|
+
]
|
|
10042
10152
|
}
|
|
10043
10153
|
],
|
|
10044
|
-
name: "
|
|
10045
|
-
|
|
10046
|
-
stateMutability: "nonpayable",
|
|
10047
|
-
type: "function"
|
|
10154
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10155
|
+
stateMutability: "nonpayable"
|
|
10048
10156
|
},
|
|
10049
10157
|
{
|
|
10158
|
+
type: "function",
|
|
10159
|
+
name: "_quoteExactOutputSingle",
|
|
10050
10160
|
inputs: [
|
|
10051
10161
|
{
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10162
|
+
name: "params",
|
|
10163
|
+
type: "tuple",
|
|
10164
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10165
|
+
components: [
|
|
10166
|
+
{
|
|
10167
|
+
name: "poolKey",
|
|
10168
|
+
type: "tuple",
|
|
10169
|
+
internalType: "struct PoolKey",
|
|
10170
|
+
components: [
|
|
10171
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10172
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10173
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10174
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10175
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10176
|
+
]
|
|
10177
|
+
},
|
|
10178
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10179
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10180
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10181
|
+
]
|
|
10055
10182
|
}
|
|
10056
10183
|
],
|
|
10057
|
-
name: "
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10184
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10185
|
+
stateMutability: "nonpayable"
|
|
10186
|
+
},
|
|
10187
|
+
{
|
|
10188
|
+
type: "function",
|
|
10189
|
+
name: "msgSender",
|
|
10190
|
+
inputs: [],
|
|
10191
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
10192
|
+
stateMutability: "view"
|
|
10193
|
+
},
|
|
10194
|
+
{
|
|
10195
|
+
type: "function",
|
|
10196
|
+
name: "poolManager",
|
|
10197
|
+
inputs: [],
|
|
10198
|
+
outputs: [{ name: "", type: "address", internalType: "contract IPoolManager" }],
|
|
10199
|
+
stateMutability: "view"
|
|
10061
10200
|
},
|
|
10062
10201
|
{
|
|
10202
|
+
type: "function",
|
|
10203
|
+
name: "quoteExactInput",
|
|
10063
10204
|
inputs: [
|
|
10064
10205
|
{
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10206
|
+
name: "params",
|
|
10207
|
+
type: "tuple",
|
|
10208
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10209
|
+
components: [
|
|
10210
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10211
|
+
{
|
|
10212
|
+
name: "path",
|
|
10213
|
+
type: "tuple[]",
|
|
10214
|
+
internalType: "struct PathKey[]",
|
|
10215
|
+
components: [
|
|
10216
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10217
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10218
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10219
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10220
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10221
|
+
]
|
|
10222
|
+
},
|
|
10223
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10224
|
+
]
|
|
10068
10225
|
}
|
|
10069
10226
|
],
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
var uniswapV2Factory_default = { ABI: ABI5 };
|
|
10077
|
-
|
|
10078
|
-
// src/abis/uniswapV3Factory.ts
|
|
10079
|
-
var ABI6 = [
|
|
10227
|
+
outputs: [
|
|
10228
|
+
{ name: "amountOut", type: "uint256", internalType: "uint256" },
|
|
10229
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10230
|
+
],
|
|
10231
|
+
stateMutability: "nonpayable"
|
|
10232
|
+
},
|
|
10080
10233
|
{
|
|
10081
|
-
|
|
10234
|
+
type: "function",
|
|
10235
|
+
name: "quoteExactInputSingle",
|
|
10082
10236
|
inputs: [
|
|
10083
10237
|
{
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10238
|
+
name: "params",
|
|
10239
|
+
type: "tuple",
|
|
10240
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10241
|
+
components: [
|
|
10242
|
+
{
|
|
10243
|
+
name: "poolKey",
|
|
10244
|
+
type: "tuple",
|
|
10245
|
+
internalType: "struct PoolKey",
|
|
10246
|
+
components: [
|
|
10247
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10248
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10249
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10250
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10251
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10252
|
+
]
|
|
10253
|
+
},
|
|
10254
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10255
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10256
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10257
|
+
]
|
|
10094
10258
|
}
|
|
10095
10259
|
],
|
|
10096
|
-
|
|
10097
|
-
|
|
10260
|
+
outputs: [
|
|
10261
|
+
{ name: "amountOut", type: "uint256", internalType: "uint256" },
|
|
10262
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10263
|
+
],
|
|
10264
|
+
stateMutability: "nonpayable"
|
|
10098
10265
|
},
|
|
10099
10266
|
{
|
|
10100
|
-
|
|
10267
|
+
type: "function",
|
|
10268
|
+
name: "quoteExactOutput",
|
|
10101
10269
|
inputs: [
|
|
10102
10270
|
{
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10271
|
+
name: "params",
|
|
10272
|
+
type: "tuple",
|
|
10273
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10274
|
+
components: [
|
|
10275
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10276
|
+
{
|
|
10277
|
+
name: "path",
|
|
10278
|
+
type: "tuple[]",
|
|
10279
|
+
internalType: "struct PathKey[]",
|
|
10280
|
+
components: [
|
|
10281
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10282
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10283
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10284
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10285
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10286
|
+
]
|
|
10287
|
+
},
|
|
10288
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10289
|
+
]
|
|
10113
10290
|
}
|
|
10114
10291
|
],
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
{
|
|
10119
|
-
anonymous: false,
|
|
10120
|
-
inputs: [
|
|
10121
|
-
{
|
|
10122
|
-
indexed: true,
|
|
10123
|
-
internalType: "address",
|
|
10124
|
-
name: "token0",
|
|
10125
|
-
type: "address"
|
|
10126
|
-
},
|
|
10127
|
-
{
|
|
10128
|
-
indexed: true,
|
|
10129
|
-
internalType: "address",
|
|
10130
|
-
name: "token1",
|
|
10131
|
-
type: "address"
|
|
10132
|
-
},
|
|
10133
|
-
{
|
|
10134
|
-
indexed: true,
|
|
10135
|
-
internalType: "uint24",
|
|
10136
|
-
name: "fee",
|
|
10137
|
-
type: "uint24"
|
|
10138
|
-
},
|
|
10139
|
-
{
|
|
10140
|
-
indexed: false,
|
|
10141
|
-
internalType: "int24",
|
|
10142
|
-
name: "tickSpacing",
|
|
10143
|
-
type: "int24"
|
|
10144
|
-
},
|
|
10145
|
-
{
|
|
10146
|
-
indexed: false,
|
|
10147
|
-
internalType: "address",
|
|
10148
|
-
name: "pool",
|
|
10149
|
-
type: "address"
|
|
10150
|
-
}
|
|
10292
|
+
outputs: [
|
|
10293
|
+
{ name: "amountIn", type: "uint256", internalType: "uint256" },
|
|
10294
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10151
10295
|
],
|
|
10152
|
-
|
|
10153
|
-
type: "event"
|
|
10296
|
+
stateMutability: "nonpayable"
|
|
10154
10297
|
},
|
|
10155
10298
|
{
|
|
10299
|
+
type: "function",
|
|
10300
|
+
name: "quoteExactOutputSingle",
|
|
10156
10301
|
inputs: [
|
|
10157
10302
|
{
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10303
|
+
name: "params",
|
|
10304
|
+
type: "tuple",
|
|
10305
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10306
|
+
components: [
|
|
10307
|
+
{
|
|
10308
|
+
name: "poolKey",
|
|
10309
|
+
type: "tuple",
|
|
10310
|
+
internalType: "struct PoolKey",
|
|
10311
|
+
components: [
|
|
10312
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10313
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10314
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10315
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10316
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10317
|
+
]
|
|
10318
|
+
},
|
|
10319
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10320
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10321
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10322
|
+
]
|
|
10171
10323
|
}
|
|
10172
10324
|
],
|
|
10173
|
-
name: "createPool",
|
|
10174
10325
|
outputs: [
|
|
10175
|
-
{
|
|
10176
|
-
|
|
10177
|
-
name: "pool",
|
|
10178
|
-
type: "address"
|
|
10179
|
-
}
|
|
10180
|
-
],
|
|
10181
|
-
stateMutability: "nonpayable",
|
|
10182
|
-
type: "function"
|
|
10183
|
-
},
|
|
10184
|
-
{
|
|
10185
|
-
inputs: [
|
|
10186
|
-
{
|
|
10187
|
-
internalType: "uint24",
|
|
10188
|
-
name: "fee",
|
|
10189
|
-
type: "uint24"
|
|
10190
|
-
},
|
|
10191
|
-
{
|
|
10192
|
-
internalType: "int24",
|
|
10193
|
-
name: "tickSpacing",
|
|
10194
|
-
type: "int24"
|
|
10195
|
-
}
|
|
10326
|
+
{ name: "amountIn", type: "uint256", internalType: "uint256" },
|
|
10327
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10196
10328
|
],
|
|
10197
|
-
|
|
10198
|
-
outputs: [],
|
|
10199
|
-
stateMutability: "nonpayable",
|
|
10200
|
-
type: "function"
|
|
10329
|
+
stateMutability: "nonpayable"
|
|
10201
10330
|
},
|
|
10202
10331
|
{
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
}
|
|
10209
|
-
],
|
|
10210
|
-
name: "feeAmountTickSpacing",
|
|
10211
|
-
outputs: [
|
|
10212
|
-
{
|
|
10213
|
-
internalType: "int24",
|
|
10214
|
-
name: "",
|
|
10215
|
-
type: "int24"
|
|
10216
|
-
}
|
|
10217
|
-
],
|
|
10218
|
-
stateMutability: "view",
|
|
10219
|
-
type: "function"
|
|
10332
|
+
type: "function",
|
|
10333
|
+
name: "unlockCallback",
|
|
10334
|
+
inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
|
|
10335
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10336
|
+
stateMutability: "nonpayable"
|
|
10220
10337
|
},
|
|
10221
10338
|
{
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
name: "tokenA",
|
|
10226
|
-
type: "address"
|
|
10227
|
-
},
|
|
10228
|
-
{
|
|
10229
|
-
internalType: "address",
|
|
10230
|
-
name: "tokenB",
|
|
10231
|
-
type: "address"
|
|
10232
|
-
},
|
|
10233
|
-
{
|
|
10234
|
-
internalType: "uint24",
|
|
10235
|
-
name: "fee",
|
|
10236
|
-
type: "uint24"
|
|
10237
|
-
}
|
|
10238
|
-
],
|
|
10239
|
-
name: "getPool",
|
|
10240
|
-
outputs: [
|
|
10241
|
-
{
|
|
10242
|
-
internalType: "address",
|
|
10243
|
-
name: "pool",
|
|
10244
|
-
type: "address"
|
|
10245
|
-
}
|
|
10246
|
-
],
|
|
10247
|
-
stateMutability: "view",
|
|
10248
|
-
type: "function"
|
|
10339
|
+
type: "error",
|
|
10340
|
+
name: "NotEnoughLiquidity",
|
|
10341
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }]
|
|
10249
10342
|
},
|
|
10343
|
+
{ type: "error", name: "NotPoolManager", inputs: [] },
|
|
10344
|
+
{ type: "error", name: "NotSelf", inputs: [] },
|
|
10250
10345
|
{
|
|
10251
|
-
|
|
10252
|
-
name: "
|
|
10253
|
-
|
|
10254
|
-
{
|
|
10255
|
-
internalType: "address",
|
|
10256
|
-
name: "",
|
|
10257
|
-
type: "address"
|
|
10258
|
-
}
|
|
10259
|
-
],
|
|
10260
|
-
stateMutability: "view",
|
|
10261
|
-
type: "function"
|
|
10346
|
+
type: "error",
|
|
10347
|
+
name: "QuoteSwap",
|
|
10348
|
+
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }]
|
|
10262
10349
|
},
|
|
10350
|
+
{ type: "error", name: "UnexpectedCallSuccess", inputs: [] },
|
|
10263
10351
|
{
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
name: "_owner",
|
|
10268
|
-
type: "address"
|
|
10269
|
-
}
|
|
10270
|
-
],
|
|
10271
|
-
name: "setOwner",
|
|
10272
|
-
outputs: [],
|
|
10273
|
-
stateMutability: "nonpayable",
|
|
10274
|
-
type: "function"
|
|
10352
|
+
type: "error",
|
|
10353
|
+
name: "UnexpectedRevertBytes",
|
|
10354
|
+
inputs: [{ name: "revertData", type: "bytes", internalType: "bytes" }]
|
|
10275
10355
|
}
|
|
10276
10356
|
];
|
|
10277
|
-
var uniswapV3Factory_default = { ABI: ABI6 };
|
|
10278
10357
|
|
|
10279
|
-
// src/abis/
|
|
10280
|
-
var
|
|
10281
|
-
{
|
|
10282
|
-
anonymous: false,
|
|
10283
|
-
inputs: [
|
|
10284
|
-
{
|
|
10285
|
-
indexed: true,
|
|
10286
|
-
internalType: "address",
|
|
10287
|
-
name: "owner",
|
|
10288
|
-
type: "address"
|
|
10289
|
-
},
|
|
10290
|
-
{
|
|
10291
|
-
indexed: true,
|
|
10292
|
-
internalType: "int24",
|
|
10293
|
-
name: "tickLower",
|
|
10294
|
-
type: "int24"
|
|
10295
|
-
},
|
|
10296
|
-
{
|
|
10297
|
-
indexed: true,
|
|
10298
|
-
internalType: "int24",
|
|
10299
|
-
name: "tickUpper",
|
|
10300
|
-
type: "int24"
|
|
10301
|
-
},
|
|
10302
|
-
{
|
|
10303
|
-
indexed: false,
|
|
10304
|
-
internalType: "uint128",
|
|
10305
|
-
name: "amount",
|
|
10306
|
-
type: "uint128"
|
|
10307
|
-
},
|
|
10308
|
-
{
|
|
10309
|
-
indexed: false,
|
|
10310
|
-
internalType: "uint256",
|
|
10311
|
-
name: "amount0",
|
|
10312
|
-
type: "uint256"
|
|
10313
|
-
},
|
|
10314
|
-
{
|
|
10315
|
-
indexed: false,
|
|
10316
|
-
internalType: "uint256",
|
|
10317
|
-
name: "amount1",
|
|
10318
|
-
type: "uint256"
|
|
10319
|
-
}
|
|
10320
|
-
],
|
|
10321
|
-
name: "Burn",
|
|
10322
|
-
type: "event"
|
|
10323
|
-
},
|
|
10358
|
+
// src/abis/permit2.ts
|
|
10359
|
+
var PERMIT2_ABI = [
|
|
10324
10360
|
{
|
|
10325
|
-
anonymous: false,
|
|
10326
10361
|
inputs: [
|
|
10327
|
-
{
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
type: "address"
|
|
10332
|
-
},
|
|
10333
|
-
{
|
|
10334
|
-
indexed: false,
|
|
10335
|
-
internalType: "address",
|
|
10336
|
-
name: "recipient",
|
|
10337
|
-
type: "address"
|
|
10338
|
-
},
|
|
10339
|
-
{
|
|
10340
|
-
indexed: true,
|
|
10341
|
-
internalType: "int24",
|
|
10342
|
-
name: "tickLower",
|
|
10343
|
-
type: "int24"
|
|
10344
|
-
},
|
|
10345
|
-
{
|
|
10346
|
-
indexed: true,
|
|
10347
|
-
internalType: "int24",
|
|
10348
|
-
name: "tickUpper",
|
|
10349
|
-
type: "int24"
|
|
10350
|
-
},
|
|
10351
|
-
{
|
|
10352
|
-
indexed: false,
|
|
10353
|
-
internalType: "uint128",
|
|
10354
|
-
name: "amount0",
|
|
10355
|
-
type: "uint128"
|
|
10356
|
-
},
|
|
10357
|
-
{
|
|
10358
|
-
indexed: false,
|
|
10359
|
-
internalType: "uint128",
|
|
10360
|
-
name: "amount1",
|
|
10361
|
-
type: "uint128"
|
|
10362
|
-
}
|
|
10362
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
10363
|
+
{ internalType: "address", name: "spender", type: "address" },
|
|
10364
|
+
{ internalType: "uint160", name: "amount", type: "uint160" },
|
|
10365
|
+
{ internalType: "uint48", name: "expiration", type: "uint48" }
|
|
10363
10366
|
],
|
|
10364
|
-
name: "
|
|
10365
|
-
type: "event"
|
|
10366
|
-
},
|
|
10367
|
-
{
|
|
10368
|
-
anonymous: false,
|
|
10369
|
-
inputs: [
|
|
10370
|
-
{
|
|
10371
|
-
indexed: true,
|
|
10372
|
-
internalType: "address",
|
|
10373
|
-
name: "sender",
|
|
10374
|
-
type: "address"
|
|
10375
|
-
},
|
|
10376
|
-
{
|
|
10377
|
-
indexed: true,
|
|
10378
|
-
internalType: "address",
|
|
10379
|
-
name: "recipient",
|
|
10380
|
-
type: "address"
|
|
10381
|
-
},
|
|
10382
|
-
{
|
|
10383
|
-
indexed: false,
|
|
10384
|
-
internalType: "uint128",
|
|
10385
|
-
name: "amount0",
|
|
10386
|
-
type: "uint128"
|
|
10387
|
-
},
|
|
10388
|
-
{
|
|
10389
|
-
indexed: false,
|
|
10390
|
-
internalType: "uint128",
|
|
10391
|
-
name: "amount1",
|
|
10392
|
-
type: "uint128"
|
|
10393
|
-
}
|
|
10394
|
-
],
|
|
10395
|
-
name: "CollectProtocol",
|
|
10396
|
-
type: "event"
|
|
10397
|
-
},
|
|
10398
|
-
{
|
|
10399
|
-
anonymous: false,
|
|
10400
|
-
inputs: [
|
|
10401
|
-
{
|
|
10402
|
-
indexed: true,
|
|
10403
|
-
internalType: "address",
|
|
10404
|
-
name: "sender",
|
|
10405
|
-
type: "address"
|
|
10406
|
-
},
|
|
10407
|
-
{
|
|
10408
|
-
indexed: true,
|
|
10409
|
-
internalType: "address",
|
|
10410
|
-
name: "recipient",
|
|
10411
|
-
type: "address"
|
|
10412
|
-
},
|
|
10413
|
-
{
|
|
10414
|
-
indexed: false,
|
|
10415
|
-
internalType: "uint256",
|
|
10416
|
-
name: "amount0",
|
|
10417
|
-
type: "uint256"
|
|
10418
|
-
},
|
|
10419
|
-
{
|
|
10420
|
-
indexed: false,
|
|
10421
|
-
internalType: "uint256",
|
|
10422
|
-
name: "amount1",
|
|
10423
|
-
type: "uint256"
|
|
10424
|
-
},
|
|
10425
|
-
{
|
|
10426
|
-
indexed: false,
|
|
10427
|
-
internalType: "uint256",
|
|
10428
|
-
name: "paid0",
|
|
10429
|
-
type: "uint256"
|
|
10430
|
-
},
|
|
10431
|
-
{
|
|
10432
|
-
indexed: false,
|
|
10433
|
-
internalType: "uint256",
|
|
10434
|
-
name: "paid1",
|
|
10435
|
-
type: "uint256"
|
|
10436
|
-
}
|
|
10437
|
-
],
|
|
10438
|
-
name: "Flash",
|
|
10439
|
-
type: "event"
|
|
10440
|
-
},
|
|
10441
|
-
{
|
|
10442
|
-
anonymous: false,
|
|
10443
|
-
inputs: [
|
|
10444
|
-
{
|
|
10445
|
-
indexed: false,
|
|
10446
|
-
internalType: "uint16",
|
|
10447
|
-
name: "observationCardinalityNextOld",
|
|
10448
|
-
type: "uint16"
|
|
10449
|
-
},
|
|
10450
|
-
{
|
|
10451
|
-
indexed: false,
|
|
10452
|
-
internalType: "uint16",
|
|
10453
|
-
name: "observationCardinalityNextNew",
|
|
10454
|
-
type: "uint16"
|
|
10455
|
-
}
|
|
10456
|
-
],
|
|
10457
|
-
name: "IncreaseObservationCardinalityNext",
|
|
10458
|
-
type: "event"
|
|
10459
|
-
},
|
|
10460
|
-
{
|
|
10461
|
-
anonymous: false,
|
|
10462
|
-
inputs: [
|
|
10463
|
-
{
|
|
10464
|
-
indexed: false,
|
|
10465
|
-
internalType: "uint160",
|
|
10466
|
-
name: "sqrtPriceX96",
|
|
10467
|
-
type: "uint160"
|
|
10468
|
-
},
|
|
10469
|
-
{
|
|
10470
|
-
indexed: false,
|
|
10471
|
-
internalType: "int24",
|
|
10472
|
-
name: "tick",
|
|
10473
|
-
type: "int24"
|
|
10474
|
-
}
|
|
10475
|
-
],
|
|
10476
|
-
name: "Initialize",
|
|
10477
|
-
type: "event"
|
|
10478
|
-
},
|
|
10479
|
-
{
|
|
10480
|
-
anonymous: false,
|
|
10481
|
-
inputs: [
|
|
10482
|
-
{
|
|
10483
|
-
indexed: false,
|
|
10484
|
-
internalType: "address",
|
|
10485
|
-
name: "sender",
|
|
10486
|
-
type: "address"
|
|
10487
|
-
},
|
|
10488
|
-
{
|
|
10489
|
-
indexed: true,
|
|
10490
|
-
internalType: "address",
|
|
10491
|
-
name: "owner",
|
|
10492
|
-
type: "address"
|
|
10493
|
-
},
|
|
10494
|
-
{
|
|
10495
|
-
indexed: true,
|
|
10496
|
-
internalType: "int24",
|
|
10497
|
-
name: "tickLower",
|
|
10498
|
-
type: "int24"
|
|
10499
|
-
},
|
|
10500
|
-
{
|
|
10501
|
-
indexed: true,
|
|
10502
|
-
internalType: "int24",
|
|
10503
|
-
name: "tickUpper",
|
|
10504
|
-
type: "int24"
|
|
10505
|
-
},
|
|
10506
|
-
{
|
|
10507
|
-
indexed: false,
|
|
10508
|
-
internalType: "uint128",
|
|
10509
|
-
name: "amount",
|
|
10510
|
-
type: "uint128"
|
|
10511
|
-
},
|
|
10512
|
-
{
|
|
10513
|
-
indexed: false,
|
|
10514
|
-
internalType: "uint256",
|
|
10515
|
-
name: "amount0",
|
|
10516
|
-
type: "uint256"
|
|
10517
|
-
},
|
|
10518
|
-
{
|
|
10519
|
-
indexed: false,
|
|
10520
|
-
internalType: "uint256",
|
|
10521
|
-
name: "amount1",
|
|
10522
|
-
type: "uint256"
|
|
10523
|
-
}
|
|
10524
|
-
],
|
|
10525
|
-
name: "Mint",
|
|
10526
|
-
type: "event"
|
|
10527
|
-
},
|
|
10528
|
-
{
|
|
10529
|
-
anonymous: false,
|
|
10530
|
-
inputs: [
|
|
10531
|
-
{
|
|
10532
|
-
indexed: false,
|
|
10533
|
-
internalType: "uint8",
|
|
10534
|
-
name: "feeProtocol0Old",
|
|
10535
|
-
type: "uint8"
|
|
10536
|
-
},
|
|
10537
|
-
{
|
|
10538
|
-
indexed: false,
|
|
10539
|
-
internalType: "uint8",
|
|
10540
|
-
name: "feeProtocol1Old",
|
|
10541
|
-
type: "uint8"
|
|
10542
|
-
},
|
|
10543
|
-
{
|
|
10544
|
-
indexed: false,
|
|
10545
|
-
internalType: "uint8",
|
|
10546
|
-
name: "feeProtocol0New",
|
|
10547
|
-
type: "uint8"
|
|
10548
|
-
},
|
|
10549
|
-
{
|
|
10550
|
-
indexed: false,
|
|
10551
|
-
internalType: "uint8",
|
|
10552
|
-
name: "feeProtocol1New",
|
|
10553
|
-
type: "uint8"
|
|
10554
|
-
}
|
|
10555
|
-
],
|
|
10556
|
-
name: "SetFeeProtocol",
|
|
10557
|
-
type: "event"
|
|
10558
|
-
},
|
|
10559
|
-
{
|
|
10560
|
-
anonymous: false,
|
|
10561
|
-
inputs: [
|
|
10562
|
-
{
|
|
10563
|
-
indexed: true,
|
|
10564
|
-
internalType: "address",
|
|
10565
|
-
name: "sender",
|
|
10566
|
-
type: "address"
|
|
10567
|
-
},
|
|
10568
|
-
{
|
|
10569
|
-
indexed: true,
|
|
10570
|
-
internalType: "address",
|
|
10571
|
-
name: "recipient",
|
|
10572
|
-
type: "address"
|
|
10573
|
-
},
|
|
10574
|
-
{
|
|
10575
|
-
indexed: false,
|
|
10576
|
-
internalType: "int256",
|
|
10577
|
-
name: "amount0",
|
|
10578
|
-
type: "int256"
|
|
10579
|
-
},
|
|
10580
|
-
{
|
|
10581
|
-
indexed: false,
|
|
10582
|
-
internalType: "int256",
|
|
10583
|
-
name: "amount1",
|
|
10584
|
-
type: "int256"
|
|
10585
|
-
},
|
|
10586
|
-
{
|
|
10587
|
-
indexed: false,
|
|
10588
|
-
internalType: "uint160",
|
|
10589
|
-
name: "sqrtPriceX96",
|
|
10590
|
-
type: "uint160"
|
|
10591
|
-
},
|
|
10592
|
-
{
|
|
10593
|
-
indexed: false,
|
|
10594
|
-
internalType: "uint128",
|
|
10595
|
-
name: "liquidity",
|
|
10596
|
-
type: "uint128"
|
|
10597
|
-
},
|
|
10598
|
-
{
|
|
10599
|
-
indexed: false,
|
|
10600
|
-
internalType: "int24",
|
|
10601
|
-
name: "tick",
|
|
10602
|
-
type: "int24"
|
|
10603
|
-
}
|
|
10604
|
-
],
|
|
10605
|
-
name: "Swap",
|
|
10606
|
-
type: "event"
|
|
10607
|
-
},
|
|
10608
|
-
{
|
|
10609
|
-
inputs: [
|
|
10610
|
-
{
|
|
10611
|
-
internalType: "int24",
|
|
10612
|
-
name: "tickLower",
|
|
10613
|
-
type: "int24"
|
|
10614
|
-
},
|
|
10615
|
-
{
|
|
10616
|
-
internalType: "int24",
|
|
10617
|
-
name: "tickUpper",
|
|
10618
|
-
type: "int24"
|
|
10619
|
-
},
|
|
10620
|
-
{
|
|
10621
|
-
internalType: "uint128",
|
|
10622
|
-
name: "amount",
|
|
10623
|
-
type: "uint128"
|
|
10624
|
-
}
|
|
10625
|
-
],
|
|
10626
|
-
name: "burn",
|
|
10627
|
-
outputs: [
|
|
10628
|
-
{
|
|
10629
|
-
internalType: "uint256",
|
|
10630
|
-
name: "amount0",
|
|
10631
|
-
type: "uint256"
|
|
10632
|
-
},
|
|
10633
|
-
{
|
|
10634
|
-
internalType: "uint256",
|
|
10635
|
-
name: "amount1",
|
|
10636
|
-
type: "uint256"
|
|
10637
|
-
}
|
|
10638
|
-
],
|
|
10639
|
-
stateMutability: "nonpayable",
|
|
10640
|
-
type: "function"
|
|
10641
|
-
},
|
|
10642
|
-
{
|
|
10643
|
-
inputs: [
|
|
10644
|
-
{
|
|
10645
|
-
internalType: "address",
|
|
10646
|
-
name: "recipient",
|
|
10647
|
-
type: "address"
|
|
10648
|
-
},
|
|
10649
|
-
{
|
|
10650
|
-
internalType: "int24",
|
|
10651
|
-
name: "tickLower",
|
|
10652
|
-
type: "int24"
|
|
10653
|
-
},
|
|
10654
|
-
{
|
|
10655
|
-
internalType: "int24",
|
|
10656
|
-
name: "tickUpper",
|
|
10657
|
-
type: "int24"
|
|
10658
|
-
},
|
|
10659
|
-
{
|
|
10660
|
-
internalType: "uint128",
|
|
10661
|
-
name: "amount0Requested",
|
|
10662
|
-
type: "uint128"
|
|
10663
|
-
},
|
|
10664
|
-
{
|
|
10665
|
-
internalType: "uint128",
|
|
10666
|
-
name: "amount1Requested",
|
|
10667
|
-
type: "uint128"
|
|
10668
|
-
}
|
|
10669
|
-
],
|
|
10670
|
-
name: "collect",
|
|
10671
|
-
outputs: [
|
|
10672
|
-
{
|
|
10673
|
-
internalType: "uint128",
|
|
10674
|
-
name: "amount0",
|
|
10675
|
-
type: "uint128"
|
|
10676
|
-
},
|
|
10677
|
-
{
|
|
10678
|
-
internalType: "uint128",
|
|
10679
|
-
name: "amount1",
|
|
10680
|
-
type: "uint128"
|
|
10681
|
-
}
|
|
10682
|
-
],
|
|
10683
|
-
stateMutability: "nonpayable",
|
|
10684
|
-
type: "function"
|
|
10685
|
-
},
|
|
10686
|
-
{
|
|
10687
|
-
inputs: [
|
|
10688
|
-
{
|
|
10689
|
-
internalType: "address",
|
|
10690
|
-
name: "recipient",
|
|
10691
|
-
type: "address"
|
|
10692
|
-
},
|
|
10693
|
-
{
|
|
10694
|
-
internalType: "uint128",
|
|
10695
|
-
name: "amount0Requested",
|
|
10696
|
-
type: "uint128"
|
|
10697
|
-
},
|
|
10698
|
-
{
|
|
10699
|
-
internalType: "uint128",
|
|
10700
|
-
name: "amount1Requested",
|
|
10701
|
-
type: "uint128"
|
|
10702
|
-
}
|
|
10703
|
-
],
|
|
10704
|
-
name: "collectProtocol",
|
|
10705
|
-
outputs: [
|
|
10706
|
-
{
|
|
10707
|
-
internalType: "uint128",
|
|
10708
|
-
name: "amount0",
|
|
10709
|
-
type: "uint128"
|
|
10710
|
-
},
|
|
10711
|
-
{
|
|
10712
|
-
internalType: "uint128",
|
|
10713
|
-
name: "amount1",
|
|
10714
|
-
type: "uint128"
|
|
10715
|
-
}
|
|
10716
|
-
],
|
|
10717
|
-
stateMutability: "nonpayable",
|
|
10718
|
-
type: "function"
|
|
10719
|
-
},
|
|
10720
|
-
{
|
|
10721
|
-
inputs: [],
|
|
10722
|
-
name: "factory",
|
|
10723
|
-
outputs: [
|
|
10724
|
-
{
|
|
10725
|
-
internalType: "address",
|
|
10726
|
-
name: "",
|
|
10727
|
-
type: "address"
|
|
10728
|
-
}
|
|
10729
|
-
],
|
|
10730
|
-
stateMutability: "view",
|
|
10731
|
-
type: "function"
|
|
10732
|
-
},
|
|
10733
|
-
{
|
|
10734
|
-
inputs: [],
|
|
10735
|
-
name: "fee",
|
|
10736
|
-
outputs: [
|
|
10737
|
-
{
|
|
10738
|
-
internalType: "uint24",
|
|
10739
|
-
name: "",
|
|
10740
|
-
type: "uint24"
|
|
10741
|
-
}
|
|
10742
|
-
],
|
|
10743
|
-
stateMutability: "view",
|
|
10744
|
-
type: "function"
|
|
10745
|
-
},
|
|
10746
|
-
{
|
|
10747
|
-
inputs: [],
|
|
10748
|
-
name: "feeGrowthGlobal0X128",
|
|
10749
|
-
outputs: [
|
|
10750
|
-
{
|
|
10751
|
-
internalType: "uint256",
|
|
10752
|
-
name: "",
|
|
10753
|
-
type: "uint256"
|
|
10754
|
-
}
|
|
10755
|
-
],
|
|
10756
|
-
stateMutability: "view",
|
|
10757
|
-
type: "function"
|
|
10758
|
-
},
|
|
10759
|
-
{
|
|
10760
|
-
inputs: [],
|
|
10761
|
-
name: "feeGrowthGlobal1X128",
|
|
10762
|
-
outputs: [
|
|
10763
|
-
{
|
|
10764
|
-
internalType: "uint256",
|
|
10765
|
-
name: "",
|
|
10766
|
-
type: "uint256"
|
|
10767
|
-
}
|
|
10768
|
-
],
|
|
10769
|
-
stateMutability: "view",
|
|
10770
|
-
type: "function"
|
|
10771
|
-
},
|
|
10772
|
-
{
|
|
10773
|
-
inputs: [
|
|
10774
|
-
{
|
|
10775
|
-
internalType: "address",
|
|
10776
|
-
name: "recipient",
|
|
10777
|
-
type: "address"
|
|
10778
|
-
},
|
|
10779
|
-
{
|
|
10780
|
-
internalType: "uint256",
|
|
10781
|
-
name: "amount0",
|
|
10782
|
-
type: "uint256"
|
|
10783
|
-
},
|
|
10784
|
-
{
|
|
10785
|
-
internalType: "uint256",
|
|
10786
|
-
name: "amount1",
|
|
10787
|
-
type: "uint256"
|
|
10788
|
-
},
|
|
10789
|
-
{
|
|
10790
|
-
internalType: "bytes",
|
|
10791
|
-
name: "data",
|
|
10792
|
-
type: "bytes"
|
|
10793
|
-
}
|
|
10794
|
-
],
|
|
10795
|
-
name: "flash",
|
|
10796
|
-
outputs: [],
|
|
10797
|
-
stateMutability: "nonpayable",
|
|
10798
|
-
type: "function"
|
|
10799
|
-
},
|
|
10800
|
-
{
|
|
10801
|
-
inputs: [
|
|
10802
|
-
{
|
|
10803
|
-
internalType: "uint16",
|
|
10804
|
-
name: "observationCardinalityNext",
|
|
10805
|
-
type: "uint16"
|
|
10806
|
-
}
|
|
10807
|
-
],
|
|
10808
|
-
name: "increaseObservationCardinalityNext",
|
|
10809
|
-
outputs: [],
|
|
10810
|
-
stateMutability: "nonpayable",
|
|
10811
|
-
type: "function"
|
|
10812
|
-
},
|
|
10813
|
-
{
|
|
10814
|
-
inputs: [
|
|
10815
|
-
{
|
|
10816
|
-
internalType: "uint160",
|
|
10817
|
-
name: "sqrtPriceX96",
|
|
10818
|
-
type: "uint160"
|
|
10819
|
-
}
|
|
10820
|
-
],
|
|
10821
|
-
name: "initialize",
|
|
10822
|
-
outputs: [],
|
|
10823
|
-
stateMutability: "nonpayable",
|
|
10824
|
-
type: "function"
|
|
10825
|
-
},
|
|
10826
|
-
{
|
|
10827
|
-
inputs: [],
|
|
10828
|
-
name: "liquidity",
|
|
10829
|
-
outputs: [
|
|
10830
|
-
{
|
|
10831
|
-
internalType: "uint128",
|
|
10832
|
-
name: "",
|
|
10833
|
-
type: "uint128"
|
|
10834
|
-
}
|
|
10835
|
-
],
|
|
10836
|
-
stateMutability: "view",
|
|
10837
|
-
type: "function"
|
|
10838
|
-
},
|
|
10839
|
-
{
|
|
10840
|
-
inputs: [],
|
|
10841
|
-
name: "maxLiquidityPerTick",
|
|
10842
|
-
outputs: [
|
|
10843
|
-
{
|
|
10844
|
-
internalType: "uint128",
|
|
10845
|
-
name: "",
|
|
10846
|
-
type: "uint128"
|
|
10847
|
-
}
|
|
10848
|
-
],
|
|
10849
|
-
stateMutability: "view",
|
|
10850
|
-
type: "function"
|
|
10851
|
-
},
|
|
10852
|
-
{
|
|
10853
|
-
inputs: [
|
|
10854
|
-
{
|
|
10855
|
-
internalType: "address",
|
|
10856
|
-
name: "recipient",
|
|
10857
|
-
type: "address"
|
|
10858
|
-
},
|
|
10859
|
-
{
|
|
10860
|
-
internalType: "int24",
|
|
10861
|
-
name: "tickLower",
|
|
10862
|
-
type: "int24"
|
|
10863
|
-
},
|
|
10864
|
-
{
|
|
10865
|
-
internalType: "int24",
|
|
10866
|
-
name: "tickUpper",
|
|
10867
|
-
type: "int24"
|
|
10868
|
-
},
|
|
10869
|
-
{
|
|
10870
|
-
internalType: "uint128",
|
|
10871
|
-
name: "amount",
|
|
10872
|
-
type: "uint128"
|
|
10873
|
-
},
|
|
10874
|
-
{
|
|
10875
|
-
internalType: "bytes",
|
|
10876
|
-
name: "data",
|
|
10877
|
-
type: "bytes"
|
|
10878
|
-
}
|
|
10879
|
-
],
|
|
10880
|
-
name: "mint",
|
|
10881
|
-
outputs: [
|
|
10882
|
-
{
|
|
10883
|
-
internalType: "uint256",
|
|
10884
|
-
name: "amount0",
|
|
10885
|
-
type: "uint256"
|
|
10886
|
-
},
|
|
10887
|
-
{
|
|
10888
|
-
internalType: "uint256",
|
|
10889
|
-
name: "amount1",
|
|
10890
|
-
type: "uint256"
|
|
10891
|
-
}
|
|
10892
|
-
],
|
|
10893
|
-
stateMutability: "nonpayable",
|
|
10894
|
-
type: "function"
|
|
10895
|
-
},
|
|
10896
|
-
{
|
|
10897
|
-
inputs: [
|
|
10898
|
-
{
|
|
10899
|
-
internalType: "uint256",
|
|
10900
|
-
name: "index",
|
|
10901
|
-
type: "uint256"
|
|
10902
|
-
}
|
|
10903
|
-
],
|
|
10904
|
-
name: "observations",
|
|
10905
|
-
outputs: [
|
|
10906
|
-
{
|
|
10907
|
-
internalType: "uint32",
|
|
10908
|
-
name: "blockTimestamp",
|
|
10909
|
-
type: "uint32"
|
|
10910
|
-
},
|
|
10911
|
-
{
|
|
10912
|
-
internalType: "int56",
|
|
10913
|
-
name: "tickCumulative",
|
|
10914
|
-
type: "int56"
|
|
10915
|
-
},
|
|
10916
|
-
{
|
|
10917
|
-
internalType: "uint160",
|
|
10918
|
-
name: "secondsPerLiquidityCumulativeX128",
|
|
10919
|
-
type: "uint160"
|
|
10920
|
-
},
|
|
10921
|
-
{
|
|
10922
|
-
internalType: "bool",
|
|
10923
|
-
name: "initialized",
|
|
10924
|
-
type: "bool"
|
|
10925
|
-
}
|
|
10926
|
-
],
|
|
10927
|
-
stateMutability: "view",
|
|
10928
|
-
type: "function"
|
|
10929
|
-
},
|
|
10930
|
-
{
|
|
10931
|
-
inputs: [
|
|
10932
|
-
{
|
|
10933
|
-
internalType: "uint32[]",
|
|
10934
|
-
name: "secondsAgos",
|
|
10935
|
-
type: "uint32[]"
|
|
10936
|
-
}
|
|
10937
|
-
],
|
|
10938
|
-
name: "observe",
|
|
10939
|
-
outputs: [
|
|
10940
|
-
{
|
|
10941
|
-
internalType: "int56[]",
|
|
10942
|
-
name: "tickCumulatives",
|
|
10943
|
-
type: "int56[]"
|
|
10944
|
-
},
|
|
10945
|
-
{
|
|
10946
|
-
internalType: "uint160[]",
|
|
10947
|
-
name: "secondsPerLiquidityCumulativeX128s",
|
|
10948
|
-
type: "uint160[]"
|
|
10949
|
-
}
|
|
10950
|
-
],
|
|
10951
|
-
stateMutability: "view",
|
|
10952
|
-
type: "function"
|
|
10953
|
-
},
|
|
10954
|
-
{
|
|
10955
|
-
inputs: [
|
|
10956
|
-
{
|
|
10957
|
-
internalType: "bytes32",
|
|
10958
|
-
name: "key",
|
|
10959
|
-
type: "bytes32"
|
|
10960
|
-
}
|
|
10961
|
-
],
|
|
10962
|
-
name: "positions",
|
|
10963
|
-
outputs: [
|
|
10964
|
-
{
|
|
10965
|
-
internalType: "uint128",
|
|
10966
|
-
name: "_liquidity",
|
|
10967
|
-
type: "uint128"
|
|
10968
|
-
},
|
|
10969
|
-
{
|
|
10970
|
-
internalType: "uint256",
|
|
10971
|
-
name: "feeGrowthInside0LastX128",
|
|
10972
|
-
type: "uint256"
|
|
10973
|
-
},
|
|
10974
|
-
{
|
|
10975
|
-
internalType: "uint256",
|
|
10976
|
-
name: "feeGrowthInside1LastX128",
|
|
10977
|
-
type: "uint256"
|
|
10978
|
-
},
|
|
10979
|
-
{
|
|
10980
|
-
internalType: "uint128",
|
|
10981
|
-
name: "tokensOwed0",
|
|
10982
|
-
type: "uint128"
|
|
10983
|
-
},
|
|
10984
|
-
{
|
|
10985
|
-
internalType: "uint128",
|
|
10986
|
-
name: "tokensOwed1",
|
|
10987
|
-
type: "uint128"
|
|
10988
|
-
}
|
|
10989
|
-
],
|
|
10990
|
-
stateMutability: "view",
|
|
10991
|
-
type: "function"
|
|
10992
|
-
},
|
|
10993
|
-
{
|
|
10994
|
-
inputs: [],
|
|
10995
|
-
name: "protocolFees",
|
|
10996
|
-
outputs: [
|
|
10997
|
-
{
|
|
10998
|
-
internalType: "uint128",
|
|
10999
|
-
name: "token0",
|
|
11000
|
-
type: "uint128"
|
|
11001
|
-
},
|
|
11002
|
-
{
|
|
11003
|
-
internalType: "uint128",
|
|
11004
|
-
name: "token1",
|
|
11005
|
-
type: "uint128"
|
|
11006
|
-
}
|
|
11007
|
-
],
|
|
11008
|
-
stateMutability: "view",
|
|
11009
|
-
type: "function"
|
|
11010
|
-
},
|
|
11011
|
-
{
|
|
11012
|
-
inputs: [
|
|
11013
|
-
{
|
|
11014
|
-
internalType: "uint8",
|
|
11015
|
-
name: "feeProtocol0",
|
|
11016
|
-
type: "uint8"
|
|
11017
|
-
},
|
|
11018
|
-
{
|
|
11019
|
-
internalType: "uint8",
|
|
11020
|
-
name: "feeProtocol1",
|
|
11021
|
-
type: "uint8"
|
|
11022
|
-
}
|
|
11023
|
-
],
|
|
11024
|
-
name: "setFeeProtocol",
|
|
10367
|
+
name: "approve",
|
|
11025
10368
|
outputs: [],
|
|
11026
|
-
stateMutability: "nonpayable",
|
|
11027
|
-
type: "function"
|
|
11028
|
-
},
|
|
11029
|
-
{
|
|
11030
|
-
inputs: [],
|
|
11031
|
-
name: "slot0",
|
|
11032
|
-
outputs: [
|
|
11033
|
-
{
|
|
11034
|
-
internalType: "uint160",
|
|
11035
|
-
name: "sqrtPriceX96",
|
|
11036
|
-
type: "uint160"
|
|
11037
|
-
},
|
|
11038
|
-
{
|
|
11039
|
-
internalType: "int24",
|
|
11040
|
-
name: "tick",
|
|
11041
|
-
type: "int24"
|
|
11042
|
-
},
|
|
11043
|
-
{
|
|
11044
|
-
internalType: "uint16",
|
|
11045
|
-
name: "observationIndex",
|
|
11046
|
-
type: "uint16"
|
|
11047
|
-
},
|
|
11048
|
-
{
|
|
11049
|
-
internalType: "uint16",
|
|
11050
|
-
name: "observationCardinality",
|
|
11051
|
-
type: "uint16"
|
|
11052
|
-
},
|
|
11053
|
-
{
|
|
11054
|
-
internalType: "uint16",
|
|
11055
|
-
name: "observationCardinalityNext",
|
|
11056
|
-
type: "uint16"
|
|
11057
|
-
},
|
|
11058
|
-
{
|
|
11059
|
-
internalType: "uint8",
|
|
11060
|
-
name: "feeProtocol",
|
|
11061
|
-
type: "uint8"
|
|
11062
|
-
},
|
|
11063
|
-
{
|
|
11064
|
-
internalType: "bool",
|
|
11065
|
-
name: "unlocked",
|
|
11066
|
-
type: "bool"
|
|
11067
|
-
}
|
|
11068
|
-
],
|
|
11069
|
-
stateMutability: "view",
|
|
11070
|
-
type: "function"
|
|
11071
|
-
},
|
|
11072
|
-
{
|
|
11073
|
-
inputs: [
|
|
11074
|
-
{
|
|
11075
|
-
internalType: "int24",
|
|
11076
|
-
name: "tickLower",
|
|
11077
|
-
type: "int24"
|
|
11078
|
-
},
|
|
11079
|
-
{
|
|
11080
|
-
internalType: "int24",
|
|
11081
|
-
name: "tickUpper",
|
|
11082
|
-
type: "int24"
|
|
11083
|
-
}
|
|
11084
|
-
],
|
|
11085
|
-
name: "snapshotCumulativesInside",
|
|
11086
|
-
outputs: [
|
|
11087
|
-
{
|
|
11088
|
-
internalType: "int56",
|
|
11089
|
-
name: "tickCumulativeInside",
|
|
11090
|
-
type: "int56"
|
|
11091
|
-
},
|
|
11092
|
-
{
|
|
11093
|
-
internalType: "uint160",
|
|
11094
|
-
name: "secondsPerLiquidityInsideX128",
|
|
11095
|
-
type: "uint160"
|
|
11096
|
-
},
|
|
11097
|
-
{
|
|
11098
|
-
internalType: "uint32",
|
|
11099
|
-
name: "secondsInside",
|
|
11100
|
-
type: "uint32"
|
|
11101
|
-
}
|
|
11102
|
-
],
|
|
11103
|
-
stateMutability: "view",
|
|
11104
|
-
type: "function"
|
|
11105
|
-
},
|
|
11106
|
-
{
|
|
11107
|
-
inputs: [
|
|
11108
|
-
{
|
|
11109
|
-
internalType: "address",
|
|
11110
|
-
name: "recipient",
|
|
11111
|
-
type: "address"
|
|
11112
|
-
},
|
|
11113
|
-
{
|
|
11114
|
-
internalType: "bool",
|
|
11115
|
-
name: "zeroForOne",
|
|
11116
|
-
type: "bool"
|
|
11117
|
-
},
|
|
11118
|
-
{
|
|
11119
|
-
internalType: "int256",
|
|
11120
|
-
name: "amountSpecified",
|
|
11121
|
-
type: "int256"
|
|
11122
|
-
},
|
|
11123
|
-
{
|
|
11124
|
-
internalType: "uint160",
|
|
11125
|
-
name: "sqrtPriceLimitX96",
|
|
11126
|
-
type: "uint160"
|
|
11127
|
-
},
|
|
11128
|
-
{
|
|
11129
|
-
internalType: "bytes",
|
|
11130
|
-
name: "data",
|
|
11131
|
-
type: "bytes"
|
|
11132
|
-
}
|
|
11133
|
-
],
|
|
11134
|
-
name: "swap",
|
|
11135
|
-
outputs: [
|
|
11136
|
-
{
|
|
11137
|
-
internalType: "int256",
|
|
11138
|
-
name: "amount0",
|
|
11139
|
-
type: "int256"
|
|
11140
|
-
},
|
|
11141
|
-
{
|
|
11142
|
-
internalType: "int256",
|
|
11143
|
-
name: "amount1",
|
|
11144
|
-
type: "int256"
|
|
11145
|
-
}
|
|
11146
|
-
],
|
|
11147
|
-
stateMutability: "nonpayable",
|
|
11148
|
-
type: "function"
|
|
11149
|
-
},
|
|
11150
|
-
{
|
|
11151
|
-
inputs: [
|
|
11152
|
-
{
|
|
11153
|
-
internalType: "int16",
|
|
11154
|
-
name: "wordPosition",
|
|
11155
|
-
type: "int16"
|
|
11156
|
-
}
|
|
11157
|
-
],
|
|
11158
|
-
name: "tickBitmap",
|
|
11159
|
-
outputs: [
|
|
11160
|
-
{
|
|
11161
|
-
internalType: "uint256",
|
|
11162
|
-
name: "",
|
|
11163
|
-
type: "uint256"
|
|
11164
|
-
}
|
|
11165
|
-
],
|
|
11166
|
-
stateMutability: "view",
|
|
11167
|
-
type: "function"
|
|
11168
|
-
},
|
|
11169
|
-
{
|
|
11170
|
-
inputs: [],
|
|
11171
|
-
name: "tickSpacing",
|
|
11172
|
-
outputs: [
|
|
11173
|
-
{
|
|
11174
|
-
internalType: "int24",
|
|
11175
|
-
name: "",
|
|
11176
|
-
type: "int24"
|
|
11177
|
-
}
|
|
11178
|
-
],
|
|
11179
|
-
stateMutability: "view",
|
|
11180
|
-
type: "function"
|
|
11181
|
-
},
|
|
11182
|
-
{
|
|
11183
|
-
inputs: [
|
|
11184
|
-
{
|
|
11185
|
-
internalType: "int24",
|
|
11186
|
-
name: "tick",
|
|
11187
|
-
type: "int24"
|
|
11188
|
-
}
|
|
11189
|
-
],
|
|
11190
|
-
name: "ticks",
|
|
11191
|
-
outputs: [
|
|
11192
|
-
{
|
|
11193
|
-
internalType: "uint128",
|
|
11194
|
-
name: "liquidityGross",
|
|
11195
|
-
type: "uint128"
|
|
11196
|
-
},
|
|
11197
|
-
{
|
|
11198
|
-
internalType: "int128",
|
|
11199
|
-
name: "liquidityNet",
|
|
11200
|
-
type: "int128"
|
|
11201
|
-
},
|
|
11202
|
-
{
|
|
11203
|
-
internalType: "uint256",
|
|
11204
|
-
name: "feeGrowthOutside0X128",
|
|
11205
|
-
type: "uint256"
|
|
11206
|
-
},
|
|
11207
|
-
{
|
|
11208
|
-
internalType: "uint256",
|
|
11209
|
-
name: "feeGrowthOutside1X128",
|
|
11210
|
-
type: "uint256"
|
|
11211
|
-
},
|
|
11212
|
-
{
|
|
11213
|
-
internalType: "int56",
|
|
11214
|
-
name: "tickCumulativeOutside",
|
|
11215
|
-
type: "int56"
|
|
11216
|
-
},
|
|
11217
|
-
{
|
|
11218
|
-
internalType: "uint160",
|
|
11219
|
-
name: "secondsPerLiquidityOutsideX128",
|
|
11220
|
-
type: "uint160"
|
|
11221
|
-
},
|
|
11222
|
-
{
|
|
11223
|
-
internalType: "uint32",
|
|
11224
|
-
name: "secondsOutside",
|
|
11225
|
-
type: "uint32"
|
|
11226
|
-
},
|
|
11227
|
-
{
|
|
11228
|
-
internalType: "bool",
|
|
11229
|
-
name: "initialized",
|
|
11230
|
-
type: "bool"
|
|
11231
|
-
}
|
|
11232
|
-
],
|
|
11233
|
-
stateMutability: "view",
|
|
11234
|
-
type: "function"
|
|
11235
|
-
},
|
|
11236
|
-
{
|
|
11237
|
-
inputs: [],
|
|
11238
|
-
name: "token0",
|
|
11239
|
-
outputs: [
|
|
11240
|
-
{
|
|
11241
|
-
internalType: "address",
|
|
11242
|
-
name: "",
|
|
11243
|
-
type: "address"
|
|
11244
|
-
}
|
|
11245
|
-
],
|
|
11246
|
-
stateMutability: "view",
|
|
10369
|
+
stateMutability: "nonpayable",
|
|
11247
10370
|
type: "function"
|
|
11248
10371
|
},
|
|
11249
10372
|
{
|
|
11250
|
-
inputs: [
|
|
11251
|
-
|
|
10373
|
+
inputs: [
|
|
10374
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
10375
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
10376
|
+
{ internalType: "address", name: "spender", type: "address" }
|
|
10377
|
+
],
|
|
10378
|
+
name: "allowance",
|
|
11252
10379
|
outputs: [
|
|
11253
|
-
{
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
type: "address"
|
|
11257
|
-
}
|
|
10380
|
+
{ internalType: "uint160", name: "amount", type: "uint160" },
|
|
10381
|
+
{ internalType: "uint48", name: "expiration", type: "uint48" },
|
|
10382
|
+
{ internalType: "uint48", name: "nonce", type: "uint48" }
|
|
11258
10383
|
],
|
|
11259
10384
|
stateMutability: "view",
|
|
11260
10385
|
type: "function"
|
|
11261
10386
|
}
|
|
11262
10387
|
];
|
|
11263
|
-
var uniswapV3Pool_default = { ABI: ABI7 };
|
|
11264
10388
|
|
|
11265
|
-
// src/abis/
|
|
11266
|
-
var
|
|
11267
|
-
{
|
|
11268
|
-
inputs: [
|
|
11269
|
-
{
|
|
11270
|
-
internalType: "bytes",
|
|
11271
|
-
name: "path",
|
|
11272
|
-
type: "bytes"
|
|
11273
|
-
},
|
|
11274
|
-
{
|
|
11275
|
-
internalType: "uint256",
|
|
11276
|
-
name: "amountIn",
|
|
11277
|
-
type: "uint256"
|
|
11278
|
-
}
|
|
11279
|
-
],
|
|
11280
|
-
name: "quoteExactInput",
|
|
11281
|
-
outputs: [
|
|
11282
|
-
{
|
|
11283
|
-
internalType: "uint256",
|
|
11284
|
-
name: "amountOut",
|
|
11285
|
-
type: "uint256"
|
|
11286
|
-
},
|
|
11287
|
-
{
|
|
11288
|
-
internalType: "uint160[]",
|
|
11289
|
-
name: "sqrtPriceX96AfterList",
|
|
11290
|
-
type: "uint160[]"
|
|
11291
|
-
},
|
|
11292
|
-
{
|
|
11293
|
-
internalType: "uint32[]",
|
|
11294
|
-
name: "initializedTicksCrossedList",
|
|
11295
|
-
type: "uint32[]"
|
|
11296
|
-
},
|
|
11297
|
-
{
|
|
11298
|
-
internalType: "uint256",
|
|
11299
|
-
name: "gasEstimate",
|
|
11300
|
-
type: "uint256"
|
|
11301
|
-
}
|
|
11302
|
-
],
|
|
11303
|
-
stateMutability: "nonpayable",
|
|
11304
|
-
type: "function"
|
|
11305
|
-
},
|
|
10389
|
+
// src/abis/universalRouter.ts
|
|
10390
|
+
var ABI6 = [
|
|
11306
10391
|
{
|
|
11307
10392
|
inputs: [
|
|
11308
10393
|
{
|
|
11309
10394
|
components: [
|
|
11310
10395
|
{
|
|
11311
10396
|
internalType: "address",
|
|
11312
|
-
name: "
|
|
10397
|
+
name: "permit2",
|
|
11313
10398
|
type: "address"
|
|
11314
10399
|
},
|
|
11315
10400
|
{
|
|
11316
10401
|
internalType: "address",
|
|
11317
|
-
name: "
|
|
10402
|
+
name: "weth9",
|
|
11318
10403
|
type: "address"
|
|
11319
10404
|
},
|
|
11320
10405
|
{
|
|
11321
|
-
internalType: "
|
|
11322
|
-
name: "
|
|
11323
|
-
type: "
|
|
10406
|
+
internalType: "address",
|
|
10407
|
+
name: "v2Factory",
|
|
10408
|
+
type: "address"
|
|
11324
10409
|
},
|
|
11325
10410
|
{
|
|
11326
|
-
internalType: "
|
|
11327
|
-
name: "
|
|
11328
|
-
type: "
|
|
10411
|
+
internalType: "address",
|
|
10412
|
+
name: "v3Factory",
|
|
10413
|
+
type: "address"
|
|
11329
10414
|
},
|
|
11330
10415
|
{
|
|
11331
|
-
internalType: "
|
|
11332
|
-
name: "
|
|
11333
|
-
type: "
|
|
10416
|
+
internalType: "bytes32",
|
|
10417
|
+
name: "pairInitCodeHash",
|
|
10418
|
+
type: "bytes32"
|
|
10419
|
+
},
|
|
10420
|
+
{
|
|
10421
|
+
internalType: "bytes32",
|
|
10422
|
+
name: "poolInitCodeHash",
|
|
10423
|
+
type: "bytes32"
|
|
10424
|
+
},
|
|
10425
|
+
{
|
|
10426
|
+
internalType: "address",
|
|
10427
|
+
name: "v4PoolManager",
|
|
10428
|
+
type: "address"
|
|
10429
|
+
},
|
|
10430
|
+
{
|
|
10431
|
+
internalType: "address",
|
|
10432
|
+
name: "v3NFTPositionManager",
|
|
10433
|
+
type: "address"
|
|
10434
|
+
},
|
|
10435
|
+
{
|
|
10436
|
+
internalType: "address",
|
|
10437
|
+
name: "v4PositionManager",
|
|
10438
|
+
type: "address"
|
|
11334
10439
|
}
|
|
11335
10440
|
],
|
|
11336
|
-
internalType: "struct
|
|
10441
|
+
internalType: "struct RouterParameters",
|
|
11337
10442
|
name: "params",
|
|
11338
10443
|
type: "tuple"
|
|
11339
10444
|
}
|
|
11340
10445
|
],
|
|
11341
|
-
|
|
11342
|
-
|
|
10446
|
+
stateMutability: "nonpayable",
|
|
10447
|
+
type: "constructor"
|
|
10448
|
+
},
|
|
10449
|
+
{
|
|
10450
|
+
inputs: [],
|
|
10451
|
+
name: "BalanceTooLow",
|
|
10452
|
+
type: "error"
|
|
10453
|
+
},
|
|
10454
|
+
{
|
|
10455
|
+
inputs: [],
|
|
10456
|
+
name: "ContractLocked",
|
|
10457
|
+
type: "error"
|
|
10458
|
+
},
|
|
10459
|
+
{
|
|
10460
|
+
inputs: [
|
|
10461
|
+
{
|
|
10462
|
+
internalType: "Currency",
|
|
10463
|
+
name: "currency",
|
|
10464
|
+
type: "address"
|
|
10465
|
+
}
|
|
10466
|
+
],
|
|
10467
|
+
name: "DeltaNotNegative",
|
|
10468
|
+
type: "error"
|
|
10469
|
+
},
|
|
10470
|
+
{
|
|
10471
|
+
inputs: [
|
|
10472
|
+
{
|
|
10473
|
+
internalType: "Currency",
|
|
10474
|
+
name: "currency",
|
|
10475
|
+
type: "address"
|
|
10476
|
+
}
|
|
10477
|
+
],
|
|
10478
|
+
name: "DeltaNotPositive",
|
|
10479
|
+
type: "error"
|
|
10480
|
+
},
|
|
10481
|
+
{
|
|
10482
|
+
inputs: [],
|
|
10483
|
+
name: "ETHNotAccepted",
|
|
10484
|
+
type: "error"
|
|
10485
|
+
},
|
|
10486
|
+
{
|
|
10487
|
+
inputs: [
|
|
11343
10488
|
{
|
|
11344
10489
|
internalType: "uint256",
|
|
11345
|
-
name: "
|
|
10490
|
+
name: "commandIndex",
|
|
11346
10491
|
type: "uint256"
|
|
11347
10492
|
},
|
|
11348
10493
|
{
|
|
11349
|
-
internalType: "
|
|
11350
|
-
name: "
|
|
11351
|
-
type: "
|
|
11352
|
-
}
|
|
10494
|
+
internalType: "bytes",
|
|
10495
|
+
name: "message",
|
|
10496
|
+
type: "bytes"
|
|
10497
|
+
}
|
|
10498
|
+
],
|
|
10499
|
+
name: "ExecutionFailed",
|
|
10500
|
+
type: "error"
|
|
10501
|
+
},
|
|
10502
|
+
{
|
|
10503
|
+
inputs: [],
|
|
10504
|
+
name: "FromAddressIsNotOwner",
|
|
10505
|
+
type: "error"
|
|
10506
|
+
},
|
|
10507
|
+
{
|
|
10508
|
+
inputs: [],
|
|
10509
|
+
name: "InputLengthMismatch",
|
|
10510
|
+
type: "error"
|
|
10511
|
+
},
|
|
10512
|
+
{
|
|
10513
|
+
inputs: [],
|
|
10514
|
+
name: "InsufficientBalance",
|
|
10515
|
+
type: "error"
|
|
10516
|
+
},
|
|
10517
|
+
{
|
|
10518
|
+
inputs: [],
|
|
10519
|
+
name: "InsufficientETH",
|
|
10520
|
+
type: "error"
|
|
10521
|
+
},
|
|
10522
|
+
{
|
|
10523
|
+
inputs: [],
|
|
10524
|
+
name: "InsufficientToken",
|
|
10525
|
+
type: "error"
|
|
10526
|
+
},
|
|
10527
|
+
{
|
|
10528
|
+
inputs: [
|
|
11353
10529
|
{
|
|
11354
|
-
internalType: "
|
|
11355
|
-
name: "
|
|
11356
|
-
type: "
|
|
11357
|
-
}
|
|
10530
|
+
internalType: "bytes4",
|
|
10531
|
+
name: "action",
|
|
10532
|
+
type: "bytes4"
|
|
10533
|
+
}
|
|
10534
|
+
],
|
|
10535
|
+
name: "InvalidAction",
|
|
10536
|
+
type: "error"
|
|
10537
|
+
},
|
|
10538
|
+
{
|
|
10539
|
+
inputs: [],
|
|
10540
|
+
name: "InvalidBips",
|
|
10541
|
+
type: "error"
|
|
10542
|
+
},
|
|
10543
|
+
{
|
|
10544
|
+
inputs: [
|
|
11358
10545
|
{
|
|
11359
10546
|
internalType: "uint256",
|
|
11360
|
-
name: "
|
|
10547
|
+
name: "commandType",
|
|
11361
10548
|
type: "uint256"
|
|
11362
10549
|
}
|
|
11363
10550
|
],
|
|
11364
|
-
|
|
11365
|
-
type: "
|
|
10551
|
+
name: "InvalidCommandType",
|
|
10552
|
+
type: "error"
|
|
10553
|
+
},
|
|
10554
|
+
{
|
|
10555
|
+
inputs: [],
|
|
10556
|
+
name: "InvalidEthSender",
|
|
10557
|
+
type: "error"
|
|
10558
|
+
},
|
|
10559
|
+
{
|
|
10560
|
+
inputs: [],
|
|
10561
|
+
name: "InvalidPath",
|
|
10562
|
+
type: "error"
|
|
10563
|
+
},
|
|
10564
|
+
{
|
|
10565
|
+
inputs: [],
|
|
10566
|
+
name: "InvalidReserves",
|
|
10567
|
+
type: "error"
|
|
10568
|
+
},
|
|
10569
|
+
{
|
|
10570
|
+
inputs: [],
|
|
10571
|
+
name: "LengthMismatch",
|
|
10572
|
+
type: "error"
|
|
11366
10573
|
},
|
|
11367
10574
|
{
|
|
11368
10575
|
inputs: [
|
|
11369
10576
|
{
|
|
11370
|
-
internalType: "
|
|
11371
|
-
name: "
|
|
11372
|
-
type: "
|
|
11373
|
-
}
|
|
10577
|
+
internalType: "uint256",
|
|
10578
|
+
name: "tokenId",
|
|
10579
|
+
type: "uint256"
|
|
10580
|
+
}
|
|
10581
|
+
],
|
|
10582
|
+
name: "NotAuthorizedForToken",
|
|
10583
|
+
type: "error"
|
|
10584
|
+
},
|
|
10585
|
+
{
|
|
10586
|
+
inputs: [],
|
|
10587
|
+
name: "NotPoolManager",
|
|
10588
|
+
type: "error"
|
|
10589
|
+
},
|
|
10590
|
+
{
|
|
10591
|
+
inputs: [],
|
|
10592
|
+
name: "OnlyMintAllowed",
|
|
10593
|
+
type: "error"
|
|
10594
|
+
},
|
|
10595
|
+
{
|
|
10596
|
+
inputs: [],
|
|
10597
|
+
name: "SliceOutOfBounds",
|
|
10598
|
+
type: "error"
|
|
10599
|
+
},
|
|
10600
|
+
{
|
|
10601
|
+
inputs: [],
|
|
10602
|
+
name: "TransactionDeadlinePassed",
|
|
10603
|
+
type: "error"
|
|
10604
|
+
},
|
|
10605
|
+
{
|
|
10606
|
+
inputs: [],
|
|
10607
|
+
name: "UnsafeCast",
|
|
10608
|
+
type: "error"
|
|
10609
|
+
},
|
|
10610
|
+
{
|
|
10611
|
+
inputs: [
|
|
11374
10612
|
{
|
|
11375
10613
|
internalType: "uint256",
|
|
11376
|
-
name: "
|
|
10614
|
+
name: "action",
|
|
11377
10615
|
type: "uint256"
|
|
11378
10616
|
}
|
|
11379
10617
|
],
|
|
11380
|
-
name: "
|
|
11381
|
-
|
|
10618
|
+
name: "UnsupportedAction",
|
|
10619
|
+
type: "error"
|
|
10620
|
+
},
|
|
10621
|
+
{
|
|
10622
|
+
inputs: [],
|
|
10623
|
+
name: "V2InvalidPath",
|
|
10624
|
+
type: "error"
|
|
10625
|
+
},
|
|
10626
|
+
{
|
|
10627
|
+
inputs: [],
|
|
10628
|
+
name: "V2TooLittleReceived",
|
|
10629
|
+
type: "error"
|
|
10630
|
+
},
|
|
10631
|
+
{
|
|
10632
|
+
inputs: [],
|
|
10633
|
+
name: "V2TooMuchRequested",
|
|
10634
|
+
type: "error"
|
|
10635
|
+
},
|
|
10636
|
+
{
|
|
10637
|
+
inputs: [],
|
|
10638
|
+
name: "V3InvalidAmountOut",
|
|
10639
|
+
type: "error"
|
|
10640
|
+
},
|
|
10641
|
+
{
|
|
10642
|
+
inputs: [],
|
|
10643
|
+
name: "V3InvalidCaller",
|
|
10644
|
+
type: "error"
|
|
10645
|
+
},
|
|
10646
|
+
{
|
|
10647
|
+
inputs: [],
|
|
10648
|
+
name: "V3InvalidSwap",
|
|
10649
|
+
type: "error"
|
|
10650
|
+
},
|
|
10651
|
+
{
|
|
10652
|
+
inputs: [],
|
|
10653
|
+
name: "V3TooLittleReceived",
|
|
10654
|
+
type: "error"
|
|
10655
|
+
},
|
|
10656
|
+
{
|
|
10657
|
+
inputs: [],
|
|
10658
|
+
name: "V3TooMuchRequested",
|
|
10659
|
+
type: "error"
|
|
10660
|
+
},
|
|
10661
|
+
{
|
|
10662
|
+
inputs: [
|
|
11382
10663
|
{
|
|
11383
10664
|
internalType: "uint256",
|
|
11384
|
-
name: "
|
|
10665
|
+
name: "minAmountOutReceived",
|
|
11385
10666
|
type: "uint256"
|
|
11386
10667
|
},
|
|
11387
|
-
{
|
|
11388
|
-
internalType: "uint160[]",
|
|
11389
|
-
name: "sqrtPriceX96AfterList",
|
|
11390
|
-
type: "uint160[]"
|
|
11391
|
-
},
|
|
11392
|
-
{
|
|
11393
|
-
internalType: "uint32[]",
|
|
11394
|
-
name: "initializedTicksCrossedList",
|
|
11395
|
-
type: "uint32[]"
|
|
11396
|
-
},
|
|
11397
10668
|
{
|
|
11398
10669
|
internalType: "uint256",
|
|
11399
|
-
name: "
|
|
10670
|
+
name: "amountReceived",
|
|
11400
10671
|
type: "uint256"
|
|
11401
10672
|
}
|
|
11402
10673
|
],
|
|
11403
|
-
|
|
11404
|
-
type: "
|
|
10674
|
+
name: "V4TooLittleReceived",
|
|
10675
|
+
type: "error"
|
|
11405
10676
|
},
|
|
11406
10677
|
{
|
|
11407
10678
|
inputs: [
|
|
11408
|
-
{
|
|
11409
|
-
components: [
|
|
11410
|
-
{
|
|
11411
|
-
internalType: "address",
|
|
11412
|
-
name: "tokenIn",
|
|
11413
|
-
type: "address"
|
|
11414
|
-
},
|
|
11415
|
-
{
|
|
11416
|
-
internalType: "address",
|
|
11417
|
-
name: "tokenOut",
|
|
11418
|
-
type: "address"
|
|
11419
|
-
},
|
|
11420
|
-
{
|
|
11421
|
-
internalType: "uint256",
|
|
11422
|
-
name: "amount",
|
|
11423
|
-
type: "uint256"
|
|
11424
|
-
},
|
|
11425
|
-
{
|
|
11426
|
-
internalType: "uint24",
|
|
11427
|
-
name: "fee",
|
|
11428
|
-
type: "uint24"
|
|
11429
|
-
},
|
|
11430
|
-
{
|
|
11431
|
-
internalType: "uint160",
|
|
11432
|
-
name: "sqrtPriceLimitX96",
|
|
11433
|
-
type: "uint160"
|
|
11434
|
-
}
|
|
11435
|
-
],
|
|
11436
|
-
internalType: "struct IQuoterV2.QuoteExactOutputSingleParams",
|
|
11437
|
-
name: "params",
|
|
11438
|
-
type: "tuple"
|
|
11439
|
-
}
|
|
11440
|
-
],
|
|
11441
|
-
name: "quoteExactOutputSingle",
|
|
11442
|
-
outputs: [
|
|
11443
10679
|
{
|
|
11444
10680
|
internalType: "uint256",
|
|
11445
|
-
name: "
|
|
10681
|
+
name: "maxAmountInRequested",
|
|
11446
10682
|
type: "uint256"
|
|
11447
10683
|
},
|
|
11448
|
-
{
|
|
11449
|
-
internalType: "uint160",
|
|
11450
|
-
name: "sqrtPriceX96After",
|
|
11451
|
-
type: "uint160"
|
|
11452
|
-
},
|
|
11453
|
-
{
|
|
11454
|
-
internalType: "uint32",
|
|
11455
|
-
name: "initializedTicksCrossed",
|
|
11456
|
-
type: "uint32"
|
|
11457
|
-
},
|
|
11458
10684
|
{
|
|
11459
10685
|
internalType: "uint256",
|
|
11460
|
-
name: "
|
|
10686
|
+
name: "amountRequested",
|
|
11461
10687
|
type: "uint256"
|
|
11462
10688
|
}
|
|
11463
10689
|
],
|
|
11464
|
-
|
|
11465
|
-
type: "
|
|
11466
|
-
}
|
|
11467
|
-
];
|
|
11468
|
-
var uniswapV3Quoter_default = { ABI: ABI8 };
|
|
11469
|
-
|
|
11470
|
-
// src/abis/uniswapV4Quoter.ts
|
|
11471
|
-
var UNISWAP_V4_QUOTER_ABI = [
|
|
11472
|
-
{
|
|
11473
|
-
type: "constructor",
|
|
11474
|
-
inputs: [{ name: "_poolManager", type: "address", internalType: "contract IPoolManager" }],
|
|
11475
|
-
stateMutability: "nonpayable"
|
|
10690
|
+
name: "V4TooMuchRequested",
|
|
10691
|
+
type: "error"
|
|
11476
10692
|
},
|
|
11477
10693
|
{
|
|
11478
|
-
|
|
11479
|
-
name: "
|
|
11480
|
-
|
|
10694
|
+
inputs: [],
|
|
10695
|
+
name: "V3_POSITION_MANAGER",
|
|
10696
|
+
outputs: [
|
|
11481
10697
|
{
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
components: [
|
|
11486
|
-
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
11487
|
-
{
|
|
11488
|
-
name: "path",
|
|
11489
|
-
type: "tuple[]",
|
|
11490
|
-
internalType: "struct PathKey[]",
|
|
11491
|
-
components: [
|
|
11492
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11493
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11494
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11495
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11496
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11497
|
-
]
|
|
11498
|
-
},
|
|
11499
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11500
|
-
]
|
|
10698
|
+
internalType: "contract INonfungiblePositionManager",
|
|
10699
|
+
name: "",
|
|
10700
|
+
type: "address"
|
|
11501
10701
|
}
|
|
11502
10702
|
],
|
|
11503
|
-
|
|
11504
|
-
|
|
10703
|
+
stateMutability: "view",
|
|
10704
|
+
type: "function"
|
|
11505
10705
|
},
|
|
11506
10706
|
{
|
|
11507
|
-
|
|
11508
|
-
name: "
|
|
11509
|
-
|
|
10707
|
+
inputs: [],
|
|
10708
|
+
name: "V4_POSITION_MANAGER",
|
|
10709
|
+
outputs: [
|
|
11510
10710
|
{
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
components: [
|
|
11515
|
-
{
|
|
11516
|
-
name: "poolKey",
|
|
11517
|
-
type: "tuple",
|
|
11518
|
-
internalType: "struct PoolKey",
|
|
11519
|
-
components: [
|
|
11520
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11521
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11522
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11523
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11524
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11525
|
-
]
|
|
11526
|
-
},
|
|
11527
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11528
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11529
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11530
|
-
]
|
|
10711
|
+
internalType: "contract IPositionManager",
|
|
10712
|
+
name: "",
|
|
10713
|
+
type: "address"
|
|
11531
10714
|
}
|
|
11532
10715
|
],
|
|
11533
|
-
|
|
11534
|
-
|
|
10716
|
+
stateMutability: "view",
|
|
10717
|
+
type: "function"
|
|
11535
10718
|
},
|
|
11536
10719
|
{
|
|
11537
|
-
type: "function",
|
|
11538
|
-
name: "_quoteExactOutput",
|
|
11539
10720
|
inputs: [
|
|
11540
10721
|
{
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
internalType: "struct PathKey[]",
|
|
11550
|
-
components: [
|
|
11551
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11552
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11553
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11554
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11555
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11556
|
-
]
|
|
11557
|
-
},
|
|
11558
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11559
|
-
]
|
|
10722
|
+
internalType: "bytes",
|
|
10723
|
+
name: "commands",
|
|
10724
|
+
type: "bytes"
|
|
10725
|
+
},
|
|
10726
|
+
{
|
|
10727
|
+
internalType: "bytes[]",
|
|
10728
|
+
name: "inputs",
|
|
10729
|
+
type: "bytes[]"
|
|
11560
10730
|
}
|
|
11561
10731
|
],
|
|
11562
|
-
|
|
11563
|
-
|
|
10732
|
+
name: "execute",
|
|
10733
|
+
outputs: [],
|
|
10734
|
+
stateMutability: "payable",
|
|
10735
|
+
type: "function"
|
|
11564
10736
|
},
|
|
11565
10737
|
{
|
|
11566
|
-
type: "function",
|
|
11567
|
-
name: "_quoteExactOutputSingle",
|
|
11568
10738
|
inputs: [
|
|
11569
10739
|
{
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11584
|
-
]
|
|
11585
|
-
},
|
|
11586
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11587
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11588
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11589
|
-
]
|
|
10740
|
+
internalType: "bytes",
|
|
10741
|
+
name: "commands",
|
|
10742
|
+
type: "bytes"
|
|
10743
|
+
},
|
|
10744
|
+
{
|
|
10745
|
+
internalType: "bytes[]",
|
|
10746
|
+
name: "inputs",
|
|
10747
|
+
type: "bytes[]"
|
|
10748
|
+
},
|
|
10749
|
+
{
|
|
10750
|
+
internalType: "uint256",
|
|
10751
|
+
name: "deadline",
|
|
10752
|
+
type: "uint256"
|
|
11590
10753
|
}
|
|
11591
10754
|
],
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
type: "function",
|
|
11597
|
-
name: "msgSender",
|
|
11598
|
-
inputs: [],
|
|
11599
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
11600
|
-
stateMutability: "view"
|
|
10755
|
+
name: "execute",
|
|
10756
|
+
outputs: [],
|
|
10757
|
+
stateMutability: "payable",
|
|
10758
|
+
type: "function"
|
|
11601
10759
|
},
|
|
11602
10760
|
{
|
|
11603
|
-
type: "function",
|
|
11604
|
-
name: "poolManager",
|
|
11605
10761
|
inputs: [],
|
|
11606
|
-
|
|
11607
|
-
stateMutability: "view"
|
|
11608
|
-
},
|
|
11609
|
-
{
|
|
11610
|
-
type: "function",
|
|
11611
|
-
name: "quoteExactInput",
|
|
11612
|
-
inputs: [
|
|
11613
|
-
{
|
|
11614
|
-
name: "params",
|
|
11615
|
-
type: "tuple",
|
|
11616
|
-
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
11617
|
-
components: [
|
|
11618
|
-
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
11619
|
-
{
|
|
11620
|
-
name: "path",
|
|
11621
|
-
type: "tuple[]",
|
|
11622
|
-
internalType: "struct PathKey[]",
|
|
11623
|
-
components: [
|
|
11624
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11625
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11626
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11627
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11628
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11629
|
-
]
|
|
11630
|
-
},
|
|
11631
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11632
|
-
]
|
|
11633
|
-
}
|
|
11634
|
-
],
|
|
10762
|
+
name: "msgSender",
|
|
11635
10763
|
outputs: [
|
|
11636
|
-
{
|
|
11637
|
-
|
|
10764
|
+
{
|
|
10765
|
+
internalType: "address",
|
|
10766
|
+
name: "",
|
|
10767
|
+
type: "address"
|
|
10768
|
+
}
|
|
11638
10769
|
],
|
|
11639
|
-
stateMutability: "
|
|
10770
|
+
stateMutability: "view",
|
|
10771
|
+
type: "function"
|
|
11640
10772
|
},
|
|
11641
10773
|
{
|
|
11642
|
-
|
|
11643
|
-
name: "
|
|
11644
|
-
|
|
10774
|
+
inputs: [],
|
|
10775
|
+
name: "poolManager",
|
|
10776
|
+
outputs: [
|
|
11645
10777
|
{
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
components: [
|
|
11650
|
-
{
|
|
11651
|
-
name: "poolKey",
|
|
11652
|
-
type: "tuple",
|
|
11653
|
-
internalType: "struct PoolKey",
|
|
11654
|
-
components: [
|
|
11655
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11656
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11657
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11658
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11659
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11660
|
-
]
|
|
11661
|
-
},
|
|
11662
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11663
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11664
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11665
|
-
]
|
|
10778
|
+
internalType: "contract IPoolManager",
|
|
10779
|
+
name: "",
|
|
10780
|
+
type: "address"
|
|
11666
10781
|
}
|
|
11667
10782
|
],
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
11671
|
-
],
|
|
11672
|
-
stateMutability: "nonpayable"
|
|
10783
|
+
stateMutability: "view",
|
|
10784
|
+
type: "function"
|
|
11673
10785
|
},
|
|
11674
10786
|
{
|
|
11675
|
-
type: "function",
|
|
11676
|
-
name: "quoteExactOutput",
|
|
11677
10787
|
inputs: [
|
|
11678
10788
|
{
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11693
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11694
|
-
]
|
|
11695
|
-
},
|
|
11696
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11697
|
-
]
|
|
10789
|
+
internalType: "int256",
|
|
10790
|
+
name: "amount0Delta",
|
|
10791
|
+
type: "int256"
|
|
10792
|
+
},
|
|
10793
|
+
{
|
|
10794
|
+
internalType: "int256",
|
|
10795
|
+
name: "amount1Delta",
|
|
10796
|
+
type: "int256"
|
|
10797
|
+
},
|
|
10798
|
+
{
|
|
10799
|
+
internalType: "bytes",
|
|
10800
|
+
name: "data",
|
|
10801
|
+
type: "bytes"
|
|
11698
10802
|
}
|
|
11699
10803
|
],
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
stateMutability: "nonpayable"
|
|
10804
|
+
name: "uniswapV3SwapCallback",
|
|
10805
|
+
outputs: [],
|
|
10806
|
+
stateMutability: "nonpayable",
|
|
10807
|
+
type: "function"
|
|
11705
10808
|
},
|
|
11706
10809
|
{
|
|
11707
|
-
type: "function",
|
|
11708
|
-
name: "quoteExactOutputSingle",
|
|
11709
10810
|
inputs: [
|
|
11710
10811
|
{
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
components: [
|
|
11715
|
-
{
|
|
11716
|
-
name: "poolKey",
|
|
11717
|
-
type: "tuple",
|
|
11718
|
-
internalType: "struct PoolKey",
|
|
11719
|
-
components: [
|
|
11720
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11721
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11722
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11723
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11724
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11725
|
-
]
|
|
11726
|
-
},
|
|
11727
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11728
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11729
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11730
|
-
]
|
|
10812
|
+
internalType: "bytes",
|
|
10813
|
+
name: "data",
|
|
10814
|
+
type: "bytes"
|
|
11731
10815
|
}
|
|
11732
10816
|
],
|
|
10817
|
+
name: "unlockCallback",
|
|
11733
10818
|
outputs: [
|
|
11734
|
-
{
|
|
11735
|
-
|
|
10819
|
+
{
|
|
10820
|
+
internalType: "bytes",
|
|
10821
|
+
name: "",
|
|
10822
|
+
type: "bytes"
|
|
10823
|
+
}
|
|
11736
10824
|
],
|
|
11737
|
-
stateMutability: "nonpayable"
|
|
11738
|
-
|
|
11739
|
-
{
|
|
11740
|
-
type: "function",
|
|
11741
|
-
name: "unlockCallback",
|
|
11742
|
-
inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
|
|
11743
|
-
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
11744
|
-
stateMutability: "nonpayable"
|
|
11745
|
-
},
|
|
11746
|
-
{
|
|
11747
|
-
type: "error",
|
|
11748
|
-
name: "NotEnoughLiquidity",
|
|
11749
|
-
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }]
|
|
11750
|
-
},
|
|
11751
|
-
{ type: "error", name: "NotPoolManager", inputs: [] },
|
|
11752
|
-
{ type: "error", name: "NotSelf", inputs: [] },
|
|
11753
|
-
{
|
|
11754
|
-
type: "error",
|
|
11755
|
-
name: "QuoteSwap",
|
|
11756
|
-
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }]
|
|
10825
|
+
stateMutability: "nonpayable",
|
|
10826
|
+
type: "function"
|
|
11757
10827
|
},
|
|
11758
|
-
{ type: "error", name: "UnexpectedCallSuccess", inputs: [] },
|
|
11759
10828
|
{
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
inputs: [{ name: "revertData", type: "bytes", internalType: "bytes" }]
|
|
10829
|
+
stateMutability: "payable",
|
|
10830
|
+
type: "receive"
|
|
11763
10831
|
}
|
|
11764
10832
|
];
|
|
10833
|
+
var universalRouter_default = { ABI: ABI6 };
|
|
10834
|
+
|
|
10835
|
+
// src/protocols/intents.ts
|
|
11765
10836
|
var IntentGateway = class {
|
|
11766
10837
|
/**
|
|
11767
10838
|
* Creates a new IntentGateway instance for cross-chain operations.
|
|
@@ -11952,7 +11023,7 @@ var IntentGateway = class {
|
|
|
11952
11023
|
wethAsset,
|
|
11953
11024
|
feeTokenAmount,
|
|
11954
11025
|
evmChainID,
|
|
11955
|
-
"v2"
|
|
11026
|
+
{ selectedProtocol: "v2" }
|
|
11956
11027
|
);
|
|
11957
11028
|
if (amountOut === 0n) {
|
|
11958
11029
|
throw new Error();
|
|
@@ -11979,7 +11050,15 @@ var IntentGateway = class {
|
|
|
11979
11050
|
*/
|
|
11980
11051
|
async convertGasToFeeToken(gasEstimate, gasEstimateIn, evmChainID) {
|
|
11981
11052
|
const client = this[gasEstimateIn].client;
|
|
11982
|
-
const
|
|
11053
|
+
const useEtherscan = USE_ETHERSCAN_CHAINS.has(evmChainID);
|
|
11054
|
+
const etherscanApiKey = useEtherscan ? this[gasEstimateIn].config.getEtherscanApiKey() : void 0;
|
|
11055
|
+
const gasPrice = useEtherscan && etherscanApiKey ? await retryPromise(() => getGasPriceFromEtherscan(evmChainID, etherscanApiKey), {
|
|
11056
|
+
maxRetries: 3,
|
|
11057
|
+
backoffMs: 250
|
|
11058
|
+
}).catch(async () => {
|
|
11059
|
+
console.warn({ evmChainID }, "Error getting gas price from etherscan, using client's gas price");
|
|
11060
|
+
return await client.getGasPrice();
|
|
11061
|
+
}) : await client.getGasPrice();
|
|
11983
11062
|
const gasCostInWei = gasEstimate * gasPrice;
|
|
11984
11063
|
const wethAddr = this[gasEstimateIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11985
11064
|
const feeToken = await this[gasEstimateIn].getFeeTokenWithDecimals();
|
|
@@ -11990,7 +11069,7 @@ var IntentGateway = class {
|
|
|
11990
11069
|
feeToken.address,
|
|
11991
11070
|
gasCostInWei,
|
|
11992
11071
|
evmChainID,
|
|
11993
|
-
"v2"
|
|
11072
|
+
{ selectedProtocol: "v2" }
|
|
11994
11073
|
);
|
|
11995
11074
|
if (amountOut === 0n) {
|
|
11996
11075
|
console.log("Amount out not found");
|
|
@@ -12033,102 +11112,185 @@ var IntentGateway = class {
|
|
|
12033
11112
|
return quoteNative;
|
|
12034
11113
|
}
|
|
12035
11114
|
/**
|
|
12036
|
-
*
|
|
12037
|
-
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
12038
|
-
*
|
|
12039
|
-
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
12040
|
-
* @param tokenIn - The address of the input token
|
|
12041
|
-
* @param tokenOut - The address of the output token
|
|
12042
|
-
* @param amountOut - The desired output amount
|
|
12043
|
-
* @returns Object containing the best protocol, required input amount, and fee tier (for V3/V4)
|
|
11115
|
+
* Gets V2 quote for exact output swap.
|
|
12044
11116
|
*/
|
|
12045
|
-
async
|
|
11117
|
+
async getV2QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
12046
11118
|
const client = this[getQuoteIn].client;
|
|
12047
|
-
let amountInV2 = maxUint256;
|
|
12048
|
-
let amountInV3 = maxUint256;
|
|
12049
|
-
let amountInV4 = maxUint256;
|
|
12050
|
-
let bestV3Fee = 0;
|
|
12051
|
-
let bestV4Fee = 0;
|
|
12052
|
-
const commonFees = [100, 500, 3e3, 1e4];
|
|
12053
11119
|
const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
|
|
12054
|
-
const v2Factory = this[getQuoteIn].config.getUniswapV2FactoryAddress(evmChainID);
|
|
12055
|
-
const v3Factory = this[getQuoteIn].config.getUniswapV3FactoryAddress(evmChainID);
|
|
12056
|
-
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
12057
|
-
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
12058
11120
|
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
12059
11121
|
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
12060
11122
|
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12061
11123
|
try {
|
|
12062
|
-
const
|
|
12063
|
-
address:
|
|
12064
|
-
abi:
|
|
12065
|
-
|
|
12066
|
-
|
|
11124
|
+
const v2AmountIn = await client.simulateContract({
|
|
11125
|
+
address: v2Router,
|
|
11126
|
+
abi: uniswapRouterV2_default.ABI,
|
|
11127
|
+
// @ts-ignore
|
|
11128
|
+
functionName: "getAmountsIn",
|
|
11129
|
+
// @ts-ignore
|
|
11130
|
+
args: [amountOut, [tokenInForQuote, tokenOutForQuote]]
|
|
12067
11131
|
});
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
11132
|
+
return v2AmountIn.result[0];
|
|
11133
|
+
} catch (error) {
|
|
11134
|
+
console.warn("V2 quote failed:", error);
|
|
11135
|
+
return maxUint256;
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
/**
|
|
11139
|
+
* Gets V2 quote for exact input swap.
|
|
11140
|
+
*/
|
|
11141
|
+
async getV2QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11142
|
+
const client = this[getQuoteIn].client;
|
|
11143
|
+
const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
|
|
11144
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11145
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11146
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
11147
|
+
try {
|
|
11148
|
+
const v2AmountOut = await client.simulateContract({
|
|
11149
|
+
address: v2Router,
|
|
11150
|
+
abi: uniswapRouterV2_default.ABI,
|
|
11151
|
+
// @ts-ignore
|
|
11152
|
+
functionName: "getAmountsOut",
|
|
11153
|
+
// @ts-ignore
|
|
11154
|
+
args: [amountIn, [tokenInForQuote, tokenOutForQuote]]
|
|
11155
|
+
});
|
|
11156
|
+
return v2AmountOut.result[1];
|
|
12083
11157
|
} catch (error) {
|
|
12084
11158
|
console.warn("V2 quote failed:", error);
|
|
11159
|
+
return BigInt(0);
|
|
12085
11160
|
}
|
|
12086
|
-
|
|
11161
|
+
}
|
|
11162
|
+
/**
|
|
11163
|
+
* Gets V3 quote for exact output swap.
|
|
11164
|
+
*/
|
|
11165
|
+
async getV3QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
11166
|
+
const client = this[getQuoteIn].client;
|
|
11167
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11168
|
+
let bestAmountIn = maxUint256;
|
|
11169
|
+
let bestFee = 0;
|
|
11170
|
+
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
11171
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11172
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11173
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12087
11174
|
for (const fee of commonFees) {
|
|
12088
11175
|
try {
|
|
12089
|
-
const
|
|
12090
|
-
address:
|
|
12091
|
-
abi:
|
|
12092
|
-
functionName: "
|
|
12093
|
-
args: [
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
11176
|
+
const quoteResult = (await client.simulateContract({
|
|
11177
|
+
address: v3Quoter,
|
|
11178
|
+
abi: uniswapV3Quoter_default.ABI,
|
|
11179
|
+
functionName: "quoteExactOutputSingle",
|
|
11180
|
+
args: [
|
|
11181
|
+
{
|
|
11182
|
+
tokenIn: tokenInForQuote,
|
|
11183
|
+
tokenOut: tokenOutForQuote,
|
|
11184
|
+
fee,
|
|
11185
|
+
amount: amountOut,
|
|
11186
|
+
sqrtPriceLimitX96: BigInt(0)
|
|
11187
|
+
}
|
|
11188
|
+
]
|
|
11189
|
+
})).result;
|
|
11190
|
+
const amountIn = quoteResult[0];
|
|
11191
|
+
if (amountIn < bestAmountIn) {
|
|
11192
|
+
bestAmountIn = amountIn;
|
|
11193
|
+
bestFee = fee;
|
|
11194
|
+
}
|
|
11195
|
+
} catch (error) {
|
|
11196
|
+
console.warn(`V3 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
return { amountIn: bestAmountIn, fee: bestFee };
|
|
11200
|
+
}
|
|
11201
|
+
/**
|
|
11202
|
+
* Gets V3 quote for exact input swap.
|
|
11203
|
+
*/
|
|
11204
|
+
async getV3QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11205
|
+
const client = this[getQuoteIn].client;
|
|
11206
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11207
|
+
let bestAmountOut = BigInt(0);
|
|
11208
|
+
let bestFee = 0;
|
|
11209
|
+
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
11210
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11211
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11212
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
11213
|
+
for (const fee of commonFees) {
|
|
11214
|
+
try {
|
|
11215
|
+
const quoteResult = (await client.simulateContract({
|
|
11216
|
+
address: v3Quoter,
|
|
11217
|
+
abi: uniswapV3Quoter_default.ABI,
|
|
11218
|
+
functionName: "quoteExactInputSingle",
|
|
11219
|
+
args: [
|
|
11220
|
+
{
|
|
11221
|
+
tokenIn: tokenInForQuote,
|
|
11222
|
+
tokenOut: tokenOutForQuote,
|
|
11223
|
+
fee,
|
|
11224
|
+
amountIn,
|
|
11225
|
+
sqrtPriceLimitX96: BigInt(0)
|
|
11226
|
+
}
|
|
11227
|
+
]
|
|
11228
|
+
})).result;
|
|
11229
|
+
const amountOut = quoteResult[0];
|
|
11230
|
+
if (amountOut > bestAmountOut) {
|
|
11231
|
+
bestAmountOut = amountOut;
|
|
11232
|
+
bestFee = fee;
|
|
11233
|
+
}
|
|
11234
|
+
} catch (error) {
|
|
11235
|
+
console.warn(`V3 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11238
|
+
return { amountOut: bestAmountOut, fee: bestFee };
|
|
11239
|
+
}
|
|
11240
|
+
/**
|
|
11241
|
+
* Gets V4 quote for exact output swap.
|
|
11242
|
+
*/
|
|
11243
|
+
async getV4QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
11244
|
+
const client = this[getQuoteIn].client;
|
|
11245
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11246
|
+
let bestAmountIn = maxUint256;
|
|
11247
|
+
let bestFee = 0;
|
|
11248
|
+
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
11249
|
+
for (const fee of commonFees) {
|
|
11250
|
+
try {
|
|
11251
|
+
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
11252
|
+
const currency1 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenOut : tokenIn;
|
|
11253
|
+
const zeroForOne = tokenIn.toLowerCase() === currency0.toLowerCase();
|
|
11254
|
+
const poolKey = {
|
|
11255
|
+
currency0,
|
|
11256
|
+
currency1,
|
|
11257
|
+
fee,
|
|
11258
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11259
|
+
hooks: ADDRESS_ZERO
|
|
11260
|
+
};
|
|
11261
|
+
const quoteResult = (await client.simulateContract({
|
|
11262
|
+
address: v4Quoter,
|
|
11263
|
+
abi: UNISWAP_V4_QUOTER_ABI,
|
|
11264
|
+
functionName: "quoteExactOutputSingle",
|
|
11265
|
+
args: [
|
|
11266
|
+
{
|
|
11267
|
+
poolKey,
|
|
11268
|
+
zeroForOne,
|
|
11269
|
+
exactAmount: amountOut,
|
|
11270
|
+
hookData: "0x"
|
|
12120
11271
|
}
|
|
12121
|
-
|
|
11272
|
+
]
|
|
11273
|
+
})).result;
|
|
11274
|
+
const amountIn = quoteResult[0];
|
|
11275
|
+
if (amountIn < bestAmountIn) {
|
|
11276
|
+
bestAmountIn = amountIn;
|
|
11277
|
+
bestFee = fee;
|
|
12122
11278
|
}
|
|
12123
11279
|
} catch (error) {
|
|
12124
|
-
console.warn(`
|
|
11280
|
+
console.warn(`V4 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
12125
11281
|
}
|
|
12126
11282
|
}
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
11283
|
+
return { amountIn: bestAmountIn, fee: bestFee };
|
|
11284
|
+
}
|
|
11285
|
+
/**
|
|
11286
|
+
* Gets V4 quote for exact input swap.
|
|
11287
|
+
*/
|
|
11288
|
+
async getV4QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11289
|
+
const client = this[getQuoteIn].client;
|
|
11290
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11291
|
+
let bestAmountOut = BigInt(0);
|
|
11292
|
+
let bestFee = 0;
|
|
11293
|
+
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
12132
11294
|
for (const fee of commonFees) {
|
|
12133
11295
|
try {
|
|
12134
11296
|
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
@@ -12140,35 +11302,606 @@ var IntentGateway = class {
|
|
|
12140
11302
|
fee,
|
|
12141
11303
|
tickSpacing: this.getTickSpacing(fee),
|
|
12142
11304
|
hooks: ADDRESS_ZERO
|
|
12143
|
-
// No hooks
|
|
12144
11305
|
};
|
|
12145
11306
|
const quoteResult = (await client.simulateContract({
|
|
12146
11307
|
address: v4Quoter,
|
|
12147
11308
|
abi: UNISWAP_V4_QUOTER_ABI,
|
|
12148
|
-
functionName: "
|
|
11309
|
+
functionName: "quoteExactInputSingle",
|
|
12149
11310
|
args: [
|
|
12150
11311
|
{
|
|
12151
11312
|
poolKey,
|
|
12152
11313
|
zeroForOne,
|
|
12153
|
-
exactAmount:
|
|
11314
|
+
exactAmount: amountIn,
|
|
12154
11315
|
hookData: "0x"
|
|
12155
|
-
// Empty hook data
|
|
12156
11316
|
}
|
|
12157
11317
|
]
|
|
12158
11318
|
})).result;
|
|
12159
|
-
const
|
|
12160
|
-
if (
|
|
12161
|
-
|
|
12162
|
-
|
|
11319
|
+
const amountOut = quoteResult[0];
|
|
11320
|
+
if (amountOut > bestAmountOut) {
|
|
11321
|
+
bestAmountOut = amountOut;
|
|
11322
|
+
bestFee = fee;
|
|
12163
11323
|
}
|
|
12164
11324
|
} catch (error) {
|
|
12165
11325
|
console.warn(`V4 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
12166
11326
|
}
|
|
12167
11327
|
}
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
11328
|
+
return { amountOut: bestAmountOut, fee: bestFee };
|
|
11329
|
+
}
|
|
11330
|
+
/**
|
|
11331
|
+
* Creates transaction structure for V2 exact input swap, including ERC20 transfer if needed.
|
|
11332
|
+
*/
|
|
11333
|
+
createV2SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, recipient, evmChainID, getQuoteIn) {
|
|
11334
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11335
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11336
|
+
}
|
|
11337
|
+
const isPermit2 = false;
|
|
11338
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11339
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11340
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11341
|
+
const path = [swapSourceAddress, swapTargetAddress];
|
|
11342
|
+
const commands = [];
|
|
11343
|
+
const inputs = [];
|
|
11344
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11345
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11346
|
+
inputs.push(
|
|
11347
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11348
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11349
|
+
amountIn
|
|
11350
|
+
])
|
|
11351
|
+
);
|
|
11352
|
+
}
|
|
11353
|
+
commands.push(8 /* V2_SWAP_EXACT_IN */);
|
|
11354
|
+
inputs.push(
|
|
11355
|
+
encodeAbiParameters(
|
|
11356
|
+
parseAbiParameters(
|
|
11357
|
+
"address recipient, uint256 amountIn, uint256 amountOutMinimum, address[] path, bool isPermit2"
|
|
11358
|
+
),
|
|
11359
|
+
[
|
|
11360
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11361
|
+
amountIn,
|
|
11362
|
+
amountOutMinimum,
|
|
11363
|
+
path,
|
|
11364
|
+
isPermit2
|
|
11365
|
+
]
|
|
11366
|
+
)
|
|
11367
|
+
);
|
|
11368
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11369
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11370
|
+
inputs.push(
|
|
11371
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11372
|
+
recipient,
|
|
11373
|
+
amountOutMinimum
|
|
11374
|
+
])
|
|
11375
|
+
);
|
|
11376
|
+
}
|
|
11377
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11378
|
+
const executeData = encodeFunctionData({
|
|
11379
|
+
abi: universalRouter_default.ABI,
|
|
11380
|
+
functionName: "execute",
|
|
11381
|
+
args: [commandsEncoded, inputs]
|
|
11382
|
+
});
|
|
11383
|
+
const transactions = [];
|
|
11384
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11385
|
+
const transferData = encodeFunctionData({
|
|
11386
|
+
abi: erc20Abi,
|
|
11387
|
+
functionName: "transfer",
|
|
11388
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
|
|
11389
|
+
});
|
|
11390
|
+
transactions.push({
|
|
11391
|
+
to: sourceTokenAddress,
|
|
11392
|
+
value: 0n,
|
|
11393
|
+
data: transferData
|
|
11394
|
+
});
|
|
11395
|
+
}
|
|
11396
|
+
transactions.push({
|
|
11397
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11398
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11399
|
+
data: executeData
|
|
11400
|
+
});
|
|
11401
|
+
return transactions;
|
|
11402
|
+
}
|
|
11403
|
+
/**
|
|
11404
|
+
* Creates transaction structure for V2 exact output swap, including ERC20 transfer if needed.
|
|
11405
|
+
*/
|
|
11406
|
+
createV2SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, recipient, evmChainID, getQuoteIn) {
|
|
11407
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11408
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11409
|
+
}
|
|
11410
|
+
const isPermit2 = false;
|
|
11411
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11412
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11413
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11414
|
+
const path = [swapSourceAddress, swapTargetAddress];
|
|
11415
|
+
const commands = [];
|
|
11416
|
+
const inputs = [];
|
|
11417
|
+
const transactions = [];
|
|
11418
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11419
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11420
|
+
inputs.push(
|
|
11421
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11422
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11423
|
+
amountInMax
|
|
11424
|
+
])
|
|
11425
|
+
);
|
|
11426
|
+
}
|
|
11427
|
+
commands.push(9 /* V2_SWAP_EXACT_OUT */);
|
|
11428
|
+
inputs.push(
|
|
11429
|
+
encodeAbiParameters(
|
|
11430
|
+
parseAbiParameters(
|
|
11431
|
+
"address recipient, uint256 amountOut, uint256 amountInMax, address[] path, bool isPermit2"
|
|
11432
|
+
),
|
|
11433
|
+
[
|
|
11434
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11435
|
+
amountOut,
|
|
11436
|
+
amountInMax,
|
|
11437
|
+
path,
|
|
11438
|
+
isPermit2
|
|
11439
|
+
]
|
|
11440
|
+
)
|
|
11441
|
+
);
|
|
11442
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11443
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11444
|
+
inputs.push(
|
|
11445
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [recipient, amountOut])
|
|
11446
|
+
);
|
|
11447
|
+
}
|
|
11448
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11449
|
+
const executeData = encodeFunctionData({
|
|
11450
|
+
abi: universalRouter_default.ABI,
|
|
11451
|
+
functionName: "execute",
|
|
11452
|
+
args: [commandsEncoded, inputs]
|
|
11453
|
+
});
|
|
11454
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11455
|
+
const transferData = encodeFunctionData({
|
|
11456
|
+
abi: erc20Abi,
|
|
11457
|
+
functionName: "transfer",
|
|
11458
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
|
|
11459
|
+
});
|
|
11460
|
+
transactions.push({
|
|
11461
|
+
to: sourceTokenAddress,
|
|
11462
|
+
value: 0n,
|
|
11463
|
+
data: transferData
|
|
11464
|
+
});
|
|
11465
|
+
}
|
|
11466
|
+
transactions.push({
|
|
11467
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11468
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11469
|
+
data: executeData
|
|
11470
|
+
});
|
|
11471
|
+
return transactions;
|
|
11472
|
+
}
|
|
11473
|
+
/**
|
|
11474
|
+
* Creates transaction structure for V3 exact input swap, including ERC20 transfer if needed.
|
|
11475
|
+
*/
|
|
11476
|
+
createV3SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, fee, recipient, evmChainID, getQuoteIn) {
|
|
11477
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11478
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11479
|
+
}
|
|
11480
|
+
const isPermit2 = false;
|
|
11481
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11482
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11483
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11484
|
+
const pathV3 = encodePacked(["address", "uint24", "address"], [swapSourceAddress, fee, swapTargetAddress]);
|
|
11485
|
+
const commands = [];
|
|
11486
|
+
const inputs = [];
|
|
11487
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11488
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11489
|
+
inputs.push(
|
|
11490
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11491
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11492
|
+
amountIn
|
|
11493
|
+
])
|
|
11494
|
+
);
|
|
11495
|
+
}
|
|
11496
|
+
commands.push(0 /* V3_SWAP_EXACT_IN */);
|
|
11497
|
+
inputs.push(
|
|
11498
|
+
encodeAbiParameters(
|
|
11499
|
+
parseAbiParameters(
|
|
11500
|
+
"address recipient, uint256 amountIn, uint256 amountOutMinimum, bytes path, bool isPermit2"
|
|
11501
|
+
),
|
|
11502
|
+
[
|
|
11503
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11504
|
+
amountIn,
|
|
11505
|
+
amountOutMinimum,
|
|
11506
|
+
pathV3,
|
|
11507
|
+
isPermit2
|
|
11508
|
+
]
|
|
11509
|
+
)
|
|
11510
|
+
);
|
|
11511
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11512
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11513
|
+
inputs.push(
|
|
11514
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11515
|
+
recipient,
|
|
11516
|
+
amountOutMinimum
|
|
11517
|
+
])
|
|
11518
|
+
);
|
|
11519
|
+
}
|
|
11520
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11521
|
+
const executeData = encodeFunctionData({
|
|
11522
|
+
abi: universalRouter_default.ABI,
|
|
11523
|
+
functionName: "execute",
|
|
11524
|
+
args: [commandsEncoded, inputs]
|
|
11525
|
+
});
|
|
11526
|
+
const transactions = [];
|
|
11527
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11528
|
+
const transferData = encodeFunctionData({
|
|
11529
|
+
abi: erc20Abi,
|
|
11530
|
+
functionName: "transfer",
|
|
11531
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
|
|
11532
|
+
});
|
|
11533
|
+
transactions.push({
|
|
11534
|
+
to: sourceTokenAddress,
|
|
11535
|
+
value: 0n,
|
|
11536
|
+
data: transferData
|
|
11537
|
+
});
|
|
11538
|
+
}
|
|
11539
|
+
transactions.push({
|
|
11540
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11541
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11542
|
+
data: executeData
|
|
11543
|
+
});
|
|
11544
|
+
return transactions;
|
|
11545
|
+
}
|
|
11546
|
+
/**
|
|
11547
|
+
* Creates transaction structure for V3 exact output swap, including ERC20 transfer if needed.
|
|
11548
|
+
*/
|
|
11549
|
+
createV3SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, fee, recipient, evmChainID, getQuoteIn) {
|
|
11550
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11551
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11552
|
+
}
|
|
11553
|
+
const isPermit2 = false;
|
|
11554
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11555
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11556
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11557
|
+
const pathV3 = encodePacked(["address", "uint24", "address"], [swapTargetAddress, fee, swapSourceAddress]);
|
|
11558
|
+
const commands = [];
|
|
11559
|
+
const inputs = [];
|
|
11560
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11561
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11562
|
+
inputs.push(
|
|
11563
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11564
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11565
|
+
amountInMax
|
|
11566
|
+
])
|
|
11567
|
+
);
|
|
11568
|
+
}
|
|
11569
|
+
commands.push(1 /* V3_SWAP_EXACT_OUT */);
|
|
11570
|
+
inputs.push(
|
|
11571
|
+
encodeAbiParameters(
|
|
11572
|
+
parseAbiParameters(
|
|
11573
|
+
"address recipient, uint256 amountOut, uint256 amountInMax, bytes path, bool isPermit2"
|
|
11574
|
+
),
|
|
11575
|
+
[
|
|
11576
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11577
|
+
amountOut,
|
|
11578
|
+
amountInMax,
|
|
11579
|
+
pathV3,
|
|
11580
|
+
isPermit2
|
|
11581
|
+
]
|
|
11582
|
+
)
|
|
11583
|
+
);
|
|
11584
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11585
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11586
|
+
inputs.push(
|
|
11587
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [recipient, amountOut])
|
|
11588
|
+
);
|
|
11589
|
+
}
|
|
11590
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11591
|
+
const executeData = encodeFunctionData({
|
|
11592
|
+
abi: universalRouter_default.ABI,
|
|
11593
|
+
functionName: "execute",
|
|
11594
|
+
args: [commandsEncoded, inputs]
|
|
11595
|
+
});
|
|
11596
|
+
const transactions = [];
|
|
11597
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11598
|
+
const transferData = encodeFunctionData({
|
|
11599
|
+
abi: erc20Abi,
|
|
11600
|
+
functionName: "transfer",
|
|
11601
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
|
|
11602
|
+
});
|
|
11603
|
+
transactions.push({
|
|
11604
|
+
to: sourceTokenAddress,
|
|
11605
|
+
value: 0n,
|
|
11606
|
+
data: transferData
|
|
11607
|
+
});
|
|
11608
|
+
}
|
|
11609
|
+
transactions.push({
|
|
11610
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11611
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11612
|
+
data: executeData
|
|
11613
|
+
});
|
|
11614
|
+
return transactions;
|
|
11615
|
+
}
|
|
11616
|
+
/**
|
|
11617
|
+
* Creates transaction structure for V4 exact input swap, including Permit2 approvals for ERC20 tokens.
|
|
11618
|
+
*/
|
|
11619
|
+
createV4SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, fee, evmChainID, getQuoteIn) {
|
|
11620
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11621
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11622
|
+
}
|
|
11623
|
+
const currency0 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? sourceTokenAddress : targetTokenAddress;
|
|
11624
|
+
const currency1 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? targetTokenAddress : sourceTokenAddress;
|
|
11625
|
+
const zeroForOne = sourceTokenAddress.toLowerCase() === currency0.toLowerCase();
|
|
11626
|
+
const poolKey = {
|
|
11627
|
+
currency0,
|
|
11628
|
+
currency1,
|
|
11629
|
+
fee,
|
|
11630
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11631
|
+
hooks: ADDRESS_ZERO
|
|
11632
|
+
};
|
|
11633
|
+
const actions = encodePacked(
|
|
11634
|
+
["uint8", "uint8", "uint8"],
|
|
11635
|
+
[
|
|
11636
|
+
6 /* V4_SWAP_EXACT_IN_SINGLE */,
|
|
11637
|
+
12 /* SETTLE_ALL */,
|
|
11638
|
+
15 /* TAKE_ALL */
|
|
11639
|
+
]
|
|
11640
|
+
);
|
|
11641
|
+
const swapParams = encodeAbiParameters(
|
|
11642
|
+
parseAbiParameters(
|
|
11643
|
+
"((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, bool zeroForOne, uint128 amountIn, uint128 amountOutMinimum, bytes hookData)"
|
|
11644
|
+
),
|
|
11645
|
+
[
|
|
11646
|
+
{
|
|
11647
|
+
poolKey,
|
|
11648
|
+
zeroForOne,
|
|
11649
|
+
amountIn,
|
|
11650
|
+
amountOutMinimum,
|
|
11651
|
+
hookData: "0x"
|
|
11652
|
+
}
|
|
11653
|
+
]
|
|
11654
|
+
);
|
|
11655
|
+
const settleParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11656
|
+
sourceTokenAddress,
|
|
11657
|
+
amountIn
|
|
11658
|
+
]);
|
|
11659
|
+
const takeParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11660
|
+
targetTokenAddress,
|
|
11661
|
+
amountOutMinimum
|
|
11662
|
+
]);
|
|
11663
|
+
const params = [swapParams, settleParams, takeParams];
|
|
11664
|
+
const commands = encodePacked(["uint8"], [16 /* V4_SWAP */]);
|
|
11665
|
+
const inputs = [encodeAbiParameters(parseAbiParameters("bytes actions, bytes[] params"), [actions, params])];
|
|
11666
|
+
const executeData = encodeFunctionData({
|
|
11667
|
+
abi: universalRouter_default.ABI,
|
|
11668
|
+
functionName: "execute",
|
|
11669
|
+
args: [commands, inputs]
|
|
11670
|
+
});
|
|
11671
|
+
const transactions = [];
|
|
11672
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11673
|
+
const approveToPermit2Data = encodeFunctionData({
|
|
11674
|
+
abi: erc20Abi,
|
|
11675
|
+
functionName: "approve",
|
|
11676
|
+
args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountIn]
|
|
11677
|
+
});
|
|
11678
|
+
transactions.push({
|
|
11679
|
+
to: sourceTokenAddress,
|
|
11680
|
+
value: 0n,
|
|
11681
|
+
data: approveToPermit2Data
|
|
11682
|
+
});
|
|
11683
|
+
const permit2ApprovalData = encodeFunctionData({
|
|
11684
|
+
abi: PERMIT2_ABI,
|
|
11685
|
+
functionName: "approve",
|
|
11686
|
+
args: [
|
|
11687
|
+
sourceTokenAddress,
|
|
11688
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11689
|
+
amountIn,
|
|
11690
|
+
281474976710655
|
|
11691
|
+
// Max expiration
|
|
11692
|
+
]
|
|
11693
|
+
});
|
|
11694
|
+
transactions.push({
|
|
11695
|
+
to: this[getQuoteIn].config.getPermit2Address(evmChainID),
|
|
11696
|
+
value: 0n,
|
|
11697
|
+
data: permit2ApprovalData
|
|
11698
|
+
});
|
|
11699
|
+
}
|
|
11700
|
+
transactions.push({
|
|
11701
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11702
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11703
|
+
data: executeData
|
|
11704
|
+
});
|
|
11705
|
+
return transactions;
|
|
11706
|
+
}
|
|
11707
|
+
/**
|
|
11708
|
+
* Creates transaction structure for V4 exact output swap, including Permit2 approvals for ERC20 tokens.
|
|
11709
|
+
*/
|
|
11710
|
+
createV4SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, fee, evmChainID, getQuoteIn) {
|
|
11711
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11712
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11713
|
+
}
|
|
11714
|
+
const currency0 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? sourceTokenAddress : targetTokenAddress;
|
|
11715
|
+
const currency1 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? targetTokenAddress : sourceTokenAddress;
|
|
11716
|
+
const zeroForOne = sourceTokenAddress.toLowerCase() === currency0.toLowerCase();
|
|
11717
|
+
const poolKey = {
|
|
11718
|
+
currency0,
|
|
11719
|
+
currency1,
|
|
11720
|
+
fee,
|
|
11721
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11722
|
+
hooks: ADDRESS_ZERO
|
|
11723
|
+
};
|
|
11724
|
+
const actions = encodePacked(
|
|
11725
|
+
["uint8", "uint8", "uint8"],
|
|
11726
|
+
[
|
|
11727
|
+
8 /* V4_SWAP_EXACT_OUT_SINGLE */,
|
|
11728
|
+
12 /* SETTLE_ALL */,
|
|
11729
|
+
15 /* TAKE_ALL */
|
|
11730
|
+
]
|
|
11731
|
+
);
|
|
11732
|
+
const swapParams = encodeAbiParameters(
|
|
11733
|
+
parseAbiParameters(
|
|
11734
|
+
"((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, bool zeroForOne, uint128 amountOut, uint128 amountInMaximum, bytes hookData)"
|
|
11735
|
+
),
|
|
11736
|
+
[
|
|
11737
|
+
{
|
|
11738
|
+
poolKey,
|
|
11739
|
+
zeroForOne,
|
|
11740
|
+
amountOut,
|
|
11741
|
+
amountInMaximum: amountInMax,
|
|
11742
|
+
hookData: "0x"
|
|
11743
|
+
}
|
|
11744
|
+
]
|
|
11745
|
+
);
|
|
11746
|
+
const settleParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11747
|
+
sourceTokenAddress,
|
|
11748
|
+
amountInMax
|
|
11749
|
+
]);
|
|
11750
|
+
const takeParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11751
|
+
targetTokenAddress,
|
|
11752
|
+
amountOut
|
|
11753
|
+
]);
|
|
11754
|
+
const params = [swapParams, settleParams, takeParams];
|
|
11755
|
+
const commands = encodePacked(["uint8"], [16 /* V4_SWAP */]);
|
|
11756
|
+
const inputs = [encodeAbiParameters(parseAbiParameters("bytes actions, bytes[] params"), [actions, params])];
|
|
11757
|
+
const executeData = encodeFunctionData({
|
|
11758
|
+
abi: universalRouter_default.ABI,
|
|
11759
|
+
functionName: "execute",
|
|
11760
|
+
args: [commands, inputs]
|
|
11761
|
+
});
|
|
11762
|
+
const transactions = [];
|
|
11763
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11764
|
+
const approveToPermit2Data = encodeFunctionData({
|
|
11765
|
+
abi: erc20Abi,
|
|
11766
|
+
functionName: "approve",
|
|
11767
|
+
args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountInMax]
|
|
11768
|
+
});
|
|
11769
|
+
transactions.push({
|
|
11770
|
+
to: sourceTokenAddress,
|
|
11771
|
+
value: 0n,
|
|
11772
|
+
data: approveToPermit2Data
|
|
11773
|
+
});
|
|
11774
|
+
const permit2ApprovalData = encodeFunctionData({
|
|
11775
|
+
abi: PERMIT2_ABI,
|
|
11776
|
+
functionName: "approve",
|
|
11777
|
+
args: [
|
|
11778
|
+
sourceTokenAddress,
|
|
11779
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11780
|
+
amountInMax,
|
|
11781
|
+
281474976710655
|
|
11782
|
+
// Max expiration
|
|
11783
|
+
]
|
|
11784
|
+
});
|
|
11785
|
+
transactions.push({
|
|
11786
|
+
to: this[getQuoteIn].config.getPermit2Address(evmChainID),
|
|
11787
|
+
value: 0n,
|
|
11788
|
+
data: permit2ApprovalData
|
|
11789
|
+
});
|
|
11790
|
+
}
|
|
11791
|
+
transactions.push({
|
|
11792
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11793
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11794
|
+
data: executeData
|
|
11795
|
+
});
|
|
11796
|
+
return transactions;
|
|
11797
|
+
}
|
|
11798
|
+
/**
|
|
11799
|
+
* Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given a desired output amount.
|
|
11800
|
+
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
11801
|
+
*
|
|
11802
|
+
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
11803
|
+
* @param tokenIn - The address of the input token
|
|
11804
|
+
* @param tokenOut - The address of the output token
|
|
11805
|
+
* @param amountOut - The desired output amount
|
|
11806
|
+
* @returns Object containing the best protocol, required input amount, fee tier (for V3/V4), and transaction structure
|
|
11807
|
+
*/
|
|
11808
|
+
async findBestProtocolWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID, options) {
|
|
11809
|
+
if (options?.generateCalldata && !options?.recipient) {
|
|
11810
|
+
throw new Error("Recipient address is required when generating calldata");
|
|
11811
|
+
}
|
|
11812
|
+
if (options?.selectedProtocol) {
|
|
11813
|
+
if (options.selectedProtocol === "v2") {
|
|
11814
|
+
const amountInV22 = await this.getV2QuoteWithAmountOut(
|
|
11815
|
+
getQuoteIn,
|
|
11816
|
+
tokenIn,
|
|
11817
|
+
tokenOut,
|
|
11818
|
+
amountOut,
|
|
11819
|
+
evmChainID
|
|
11820
|
+
);
|
|
11821
|
+
if (amountInV22 === maxUint256) {
|
|
11822
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11823
|
+
}
|
|
11824
|
+
let transactions2;
|
|
11825
|
+
if (options?.generateCalldata) {
|
|
11826
|
+
transactions2 = this.createV2SwapCalldataExactOut(
|
|
11827
|
+
tokenIn,
|
|
11828
|
+
tokenOut,
|
|
11829
|
+
amountOut,
|
|
11830
|
+
amountInV22,
|
|
11831
|
+
options.recipient,
|
|
11832
|
+
evmChainID,
|
|
11833
|
+
getQuoteIn
|
|
11834
|
+
);
|
|
11835
|
+
}
|
|
11836
|
+
return { protocol: "v2", amountIn: amountInV22, transactions: transactions2 };
|
|
11837
|
+
}
|
|
11838
|
+
if (options.selectedProtocol === "v3") {
|
|
11839
|
+
const { amountIn: amountInV32, fee: bestV3Fee2 } = await this.getV3QuoteWithAmountOut(
|
|
11840
|
+
getQuoteIn,
|
|
11841
|
+
tokenIn,
|
|
11842
|
+
tokenOut,
|
|
11843
|
+
amountOut,
|
|
11844
|
+
evmChainID
|
|
11845
|
+
);
|
|
11846
|
+
if (amountInV32 === maxUint256) {
|
|
11847
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11848
|
+
}
|
|
11849
|
+
let transactions2;
|
|
11850
|
+
if (options?.generateCalldata) {
|
|
11851
|
+
transactions2 = this.createV3SwapCalldataExactOut(
|
|
11852
|
+
tokenIn,
|
|
11853
|
+
tokenOut,
|
|
11854
|
+
amountOut,
|
|
11855
|
+
amountInV32,
|
|
11856
|
+
bestV3Fee2,
|
|
11857
|
+
options.recipient,
|
|
11858
|
+
evmChainID,
|
|
11859
|
+
getQuoteIn
|
|
11860
|
+
);
|
|
11861
|
+
}
|
|
11862
|
+
return { protocol: "v3", amountIn: amountInV32, fee: bestV3Fee2, transactions: transactions2 };
|
|
11863
|
+
}
|
|
11864
|
+
if (options.selectedProtocol === "v4") {
|
|
11865
|
+
const { amountIn: amountInV42, fee: bestV4Fee2 } = await this.getV4QuoteWithAmountOut(
|
|
11866
|
+
getQuoteIn,
|
|
11867
|
+
tokenIn,
|
|
11868
|
+
tokenOut,
|
|
11869
|
+
amountOut,
|
|
11870
|
+
evmChainID
|
|
11871
|
+
);
|
|
11872
|
+
if (amountInV42 === maxUint256) {
|
|
11873
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11874
|
+
}
|
|
11875
|
+
let transactions2;
|
|
11876
|
+
if (options?.generateCalldata) {
|
|
11877
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11878
|
+
tokenIn,
|
|
11879
|
+
tokenOut,
|
|
11880
|
+
amountOut,
|
|
11881
|
+
amountInV42,
|
|
11882
|
+
bestV4Fee2,
|
|
11883
|
+
evmChainID,
|
|
11884
|
+
getQuoteIn
|
|
11885
|
+
);
|
|
11886
|
+
}
|
|
11887
|
+
return { protocol: "v4", amountIn: amountInV42, fee: bestV4Fee2, transactions: transactions2 };
|
|
11888
|
+
}
|
|
12171
11889
|
}
|
|
11890
|
+
const amountInV2 = await this.getV2QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID);
|
|
11891
|
+
const { amountIn: amountInV3, fee: bestV3Fee } = await this.getV3QuoteWithAmountOut(
|
|
11892
|
+
getQuoteIn,
|
|
11893
|
+
tokenIn,
|
|
11894
|
+
tokenOut,
|
|
11895
|
+
amountOut,
|
|
11896
|
+
evmChainID
|
|
11897
|
+
);
|
|
11898
|
+
const { amountIn: amountInV4, fee: bestV4Fee } = await this.getV4QuoteWithAmountOut(
|
|
11899
|
+
getQuoteIn,
|
|
11900
|
+
tokenIn,
|
|
11901
|
+
tokenOut,
|
|
11902
|
+
amountOut,
|
|
11903
|
+
evmChainID
|
|
11904
|
+
);
|
|
12172
11905
|
if (amountInV2 === maxUint256 && amountInV3 === maxUint256 && amountInV4 === maxUint256) {
|
|
12173
11906
|
return {
|
|
12174
11907
|
protocol: null,
|
|
@@ -12178,10 +11911,34 @@ var IntentGateway = class {
|
|
|
12178
11911
|
if (amountInV4 !== maxUint256) {
|
|
12179
11912
|
const thresholdBps = 100n;
|
|
12180
11913
|
if (amountInV3 !== maxUint256 && this.isWithinThreshold(amountInV4, amountInV3, thresholdBps)) {
|
|
12181
|
-
|
|
11914
|
+
let transactions2;
|
|
11915
|
+
if (options?.generateCalldata) {
|
|
11916
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11917
|
+
tokenIn,
|
|
11918
|
+
tokenOut,
|
|
11919
|
+
amountOut,
|
|
11920
|
+
amountInV4,
|
|
11921
|
+
bestV4Fee,
|
|
11922
|
+
evmChainID,
|
|
11923
|
+
getQuoteIn
|
|
11924
|
+
);
|
|
11925
|
+
}
|
|
11926
|
+
return { protocol: "v4", amountIn: amountInV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12182
11927
|
}
|
|
12183
11928
|
if (amountInV2 !== maxUint256 && this.isWithinThreshold(amountInV4, amountInV2, thresholdBps)) {
|
|
12184
|
-
|
|
11929
|
+
let transactions2;
|
|
11930
|
+
if (options?.generateCalldata) {
|
|
11931
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11932
|
+
tokenIn,
|
|
11933
|
+
tokenOut,
|
|
11934
|
+
amountOut,
|
|
11935
|
+
amountInV4,
|
|
11936
|
+
bestV4Fee,
|
|
11937
|
+
evmChainID,
|
|
11938
|
+
getQuoteIn
|
|
11939
|
+
);
|
|
11940
|
+
}
|
|
11941
|
+
return { protocol: "v4", amountIn: amountInV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12185
11942
|
}
|
|
12186
11943
|
}
|
|
12187
11944
|
const minAmount = [
|
|
@@ -12189,22 +11946,60 @@ var IntentGateway = class {
|
|
|
12189
11946
|
{ protocol: "v3", amountIn: amountInV3, fee: bestV3Fee },
|
|
12190
11947
|
{ protocol: "v4", amountIn: amountInV4, fee: bestV4Fee }
|
|
12191
11948
|
].reduce((best, current) => current.amountIn < best.amountIn ? current : best);
|
|
11949
|
+
let transactions;
|
|
11950
|
+
if (options?.generateCalldata) {
|
|
11951
|
+
if (minAmount.protocol === "v2") {
|
|
11952
|
+
transactions = this.createV2SwapCalldataExactOut(
|
|
11953
|
+
tokenIn,
|
|
11954
|
+
tokenOut,
|
|
11955
|
+
amountOut,
|
|
11956
|
+
amountInV2,
|
|
11957
|
+
options.recipient,
|
|
11958
|
+
evmChainID,
|
|
11959
|
+
getQuoteIn
|
|
11960
|
+
);
|
|
11961
|
+
} else if (minAmount.protocol === "v3") {
|
|
11962
|
+
transactions = this.createV3SwapCalldataExactOut(
|
|
11963
|
+
tokenIn,
|
|
11964
|
+
tokenOut,
|
|
11965
|
+
amountOut,
|
|
11966
|
+
amountInV3,
|
|
11967
|
+
bestV3Fee,
|
|
11968
|
+
options.recipient,
|
|
11969
|
+
evmChainID,
|
|
11970
|
+
getQuoteIn
|
|
11971
|
+
);
|
|
11972
|
+
} else {
|
|
11973
|
+
transactions = this.createV4SwapCalldataExactOut(
|
|
11974
|
+
tokenIn,
|
|
11975
|
+
tokenOut,
|
|
11976
|
+
amountOut,
|
|
11977
|
+
amountInV4,
|
|
11978
|
+
bestV4Fee,
|
|
11979
|
+
evmChainID,
|
|
11980
|
+
getQuoteIn
|
|
11981
|
+
);
|
|
11982
|
+
}
|
|
11983
|
+
}
|
|
12192
11984
|
if (minAmount.protocol === "v2") {
|
|
12193
11985
|
return {
|
|
12194
11986
|
protocol: "v2",
|
|
12195
|
-
amountIn: amountInV2
|
|
11987
|
+
amountIn: amountInV2,
|
|
11988
|
+
transactions
|
|
12196
11989
|
};
|
|
12197
11990
|
} else if (minAmount.protocol === "v3") {
|
|
12198
11991
|
return {
|
|
12199
11992
|
protocol: "v3",
|
|
12200
11993
|
amountIn: amountInV3,
|
|
12201
|
-
fee: bestV3Fee
|
|
11994
|
+
fee: bestV3Fee,
|
|
11995
|
+
transactions
|
|
12202
11996
|
};
|
|
12203
11997
|
} else {
|
|
12204
11998
|
return {
|
|
12205
11999
|
protocol: "v4",
|
|
12206
12000
|
amountIn: amountInV4,
|
|
12207
|
-
fee: bestV4Fee
|
|
12001
|
+
fee: bestV4Fee,
|
|
12002
|
+
transactions
|
|
12208
12003
|
};
|
|
12209
12004
|
}
|
|
12210
12005
|
}
|
|
@@ -12218,126 +12013,105 @@ var IntentGateway = class {
|
|
|
12218
12013
|
* @param amountIn - The input amount to swap
|
|
12219
12014
|
* @param evmChainID - The EVM chain ID in format "EVM-{id}"
|
|
12220
12015
|
* @param selectedProtocol - Optional specific protocol to use ("v2", "v3", or "v4")
|
|
12221
|
-
* @returns Object containing the best protocol, expected output amount,
|
|
12016
|
+
* @returns Object containing the best protocol, expected output amount, fee tier (for V3/V4), and transaction structure
|
|
12222
12017
|
*/
|
|
12223
|
-
async findBestProtocolWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID,
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
let amountOutV3 = BigInt(0);
|
|
12227
|
-
let amountOutV4 = BigInt(0);
|
|
12228
|
-
let bestV3Fee = 0;
|
|
12229
|
-
let bestV4Fee = 0;
|
|
12230
|
-
const commonFees = [100, 500, 3e3, 1e4];
|
|
12231
|
-
const v2Router = this.source.config.getUniswapRouterV2Address(evmChainID);
|
|
12232
|
-
this.source.config.getUniswapV2FactoryAddress(evmChainID);
|
|
12233
|
-
const v3Factory = this.source.config.getUniswapV3FactoryAddress(evmChainID);
|
|
12234
|
-
const v3Quoter = this.source.config.getUniswapV3QuoterAddress(evmChainID);
|
|
12235
|
-
const v4Quoter = this.source.config.getUniswapV4QuoterAddress(evmChainID);
|
|
12236
|
-
const wethAsset = this.source.config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
12237
|
-
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
12238
|
-
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12239
|
-
try {
|
|
12240
|
-
const v2AmountOut = await client.simulateContract({
|
|
12241
|
-
address: v2Router,
|
|
12242
|
-
abi: uniswapRouterV2_default.ABI,
|
|
12243
|
-
// @ts-ignore
|
|
12244
|
-
functionName: "getAmountsOut",
|
|
12245
|
-
// @ts-ignore
|
|
12246
|
-
args: [amountIn, [tokenInForQuote, tokenOutForQuote]]
|
|
12247
|
-
});
|
|
12248
|
-
amountOutV2 = v2AmountOut.result[1];
|
|
12249
|
-
if (selectedProtocol === "v2") {
|
|
12250
|
-
return { protocol: "v2", amountOut: amountOutV2 };
|
|
12251
|
-
}
|
|
12252
|
-
} catch (error) {
|
|
12253
|
-
console.warn("V2 quote failed:", error);
|
|
12018
|
+
async findBestProtocolWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID, options) {
|
|
12019
|
+
if (options?.generateCalldata && !options?.recipient) {
|
|
12020
|
+
throw new Error("Recipient address is required when generating calldata");
|
|
12254
12021
|
}
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
if (
|
|
12265
|
-
|
|
12266
|
-
address: pool,
|
|
12267
|
-
abi: uniswapV3Pool_default.ABI,
|
|
12268
|
-
functionName: "liquidity"
|
|
12269
|
-
});
|
|
12270
|
-
if (liquidity > BigInt(0)) {
|
|
12271
|
-
const quoteResult = (await client.simulateContract({
|
|
12272
|
-
address: v3Quoter,
|
|
12273
|
-
abi: uniswapV3Quoter_default.ABI,
|
|
12274
|
-
functionName: "quoteExactInputSingle",
|
|
12275
|
-
args: [
|
|
12276
|
-
{
|
|
12277
|
-
tokenIn: tokenInForQuote,
|
|
12278
|
-
tokenOut: tokenOutForQuote,
|
|
12279
|
-
fee,
|
|
12280
|
-
amountIn,
|
|
12281
|
-
sqrtPriceLimitX96: BigInt(0)
|
|
12282
|
-
}
|
|
12283
|
-
]
|
|
12284
|
-
})).result;
|
|
12285
|
-
const amountOut = quoteResult[0];
|
|
12286
|
-
if (amountOut > bestV3AmountOut) {
|
|
12287
|
-
bestV3AmountOut = amountOut;
|
|
12288
|
-
bestV3Fee = fee;
|
|
12289
|
-
}
|
|
12290
|
-
}
|
|
12022
|
+
if (options?.selectedProtocol) {
|
|
12023
|
+
if (options.selectedProtocol === "v2") {
|
|
12024
|
+
const amountOutV22 = await this.getV2QuoteWithAmountIn(
|
|
12025
|
+
getQuoteIn,
|
|
12026
|
+
tokenIn,
|
|
12027
|
+
tokenOut,
|
|
12028
|
+
amountIn,
|
|
12029
|
+
evmChainID
|
|
12030
|
+
);
|
|
12031
|
+
if (amountOutV22 === BigInt(0)) {
|
|
12032
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
12291
12033
|
}
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
12304
|
-
const currency1 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenOut : tokenIn;
|
|
12305
|
-
const zeroForOne = tokenIn.toLowerCase() === currency0.toLowerCase();
|
|
12306
|
-
const poolKey = {
|
|
12307
|
-
currency0,
|
|
12308
|
-
currency1,
|
|
12309
|
-
fee,
|
|
12310
|
-
tickSpacing: this.getTickSpacing(fee),
|
|
12311
|
-
hooks: ADDRESS_ZERO
|
|
12312
|
-
// No hooks
|
|
12313
|
-
};
|
|
12314
|
-
const quoteResult = (await client.simulateContract({
|
|
12315
|
-
address: v4Quoter,
|
|
12316
|
-
abi: UNISWAP_V4_QUOTER_ABI,
|
|
12317
|
-
functionName: "quoteExactInputSingle",
|
|
12318
|
-
args: [
|
|
12319
|
-
{
|
|
12320
|
-
poolKey,
|
|
12321
|
-
zeroForOne,
|
|
12322
|
-
exactAmount: amountIn,
|
|
12323
|
-
hookData: "0x"
|
|
12324
|
-
// Empty hook data
|
|
12325
|
-
}
|
|
12326
|
-
]
|
|
12327
|
-
})).result;
|
|
12328
|
-
const amountOut = quoteResult[0];
|
|
12329
|
-
if (amountOut > bestV4AmountOut) {
|
|
12330
|
-
bestV4AmountOut = amountOut;
|
|
12331
|
-
bestV4Fee = fee;
|
|
12034
|
+
let transactions2;
|
|
12035
|
+
if (options?.generateCalldata) {
|
|
12036
|
+
transactions2 = this.createV2SwapCalldataExactIn(
|
|
12037
|
+
tokenIn,
|
|
12038
|
+
tokenOut,
|
|
12039
|
+
amountIn,
|
|
12040
|
+
amountOutV22,
|
|
12041
|
+
options.recipient,
|
|
12042
|
+
evmChainID,
|
|
12043
|
+
getQuoteIn
|
|
12044
|
+
);
|
|
12332
12045
|
}
|
|
12333
|
-
|
|
12334
|
-
|
|
12046
|
+
return { protocol: "v2", amountOut: amountOutV22, transactions: transactions2 };
|
|
12047
|
+
}
|
|
12048
|
+
if (options.selectedProtocol === "v3") {
|
|
12049
|
+
const { amountOut: amountOutV32, fee: bestV3Fee2 } = await this.getV3QuoteWithAmountIn(
|
|
12050
|
+
getQuoteIn,
|
|
12051
|
+
tokenIn,
|
|
12052
|
+
tokenOut,
|
|
12053
|
+
amountIn,
|
|
12054
|
+
evmChainID
|
|
12055
|
+
);
|
|
12056
|
+
if (amountOutV32 === BigInt(0)) {
|
|
12057
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
12058
|
+
}
|
|
12059
|
+
let transactions2;
|
|
12060
|
+
if (options?.generateCalldata) {
|
|
12061
|
+
transactions2 = this.createV3SwapCalldataExactIn(
|
|
12062
|
+
tokenIn,
|
|
12063
|
+
tokenOut,
|
|
12064
|
+
amountIn,
|
|
12065
|
+
amountOutV32,
|
|
12066
|
+
bestV3Fee2,
|
|
12067
|
+
options.recipient,
|
|
12068
|
+
evmChainID,
|
|
12069
|
+
getQuoteIn
|
|
12070
|
+
);
|
|
12071
|
+
}
|
|
12072
|
+
return { protocol: "v3", amountOut: amountOutV32, fee: bestV3Fee2, transactions: transactions2 };
|
|
12073
|
+
}
|
|
12074
|
+
if (options.selectedProtocol === "v4") {
|
|
12075
|
+
const { amountOut: amountOutV42, fee: bestV4Fee2 } = await this.getV4QuoteWithAmountIn(
|
|
12076
|
+
getQuoteIn,
|
|
12077
|
+
tokenIn,
|
|
12078
|
+
tokenOut,
|
|
12079
|
+
amountIn,
|
|
12080
|
+
evmChainID
|
|
12081
|
+
);
|
|
12082
|
+
if (amountOutV42 === BigInt(0)) {
|
|
12083
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
12084
|
+
}
|
|
12085
|
+
let transactions2;
|
|
12086
|
+
if (options?.generateCalldata) {
|
|
12087
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12088
|
+
tokenIn,
|
|
12089
|
+
tokenOut,
|
|
12090
|
+
amountIn,
|
|
12091
|
+
amountOutV42,
|
|
12092
|
+
bestV4Fee2,
|
|
12093
|
+
evmChainID,
|
|
12094
|
+
getQuoteIn
|
|
12095
|
+
);
|
|
12096
|
+
}
|
|
12097
|
+
return { protocol: "v4", amountOut: amountOutV42, fee: bestV4Fee2, transactions: transactions2 };
|
|
12335
12098
|
}
|
|
12336
12099
|
}
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12100
|
+
const amountOutV2 = await this.getV2QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID);
|
|
12101
|
+
const { amountOut: amountOutV3, fee: bestV3Fee } = await this.getV3QuoteWithAmountIn(
|
|
12102
|
+
getQuoteIn,
|
|
12103
|
+
tokenIn,
|
|
12104
|
+
tokenOut,
|
|
12105
|
+
amountIn,
|
|
12106
|
+
evmChainID
|
|
12107
|
+
);
|
|
12108
|
+
const { amountOut: amountOutV4, fee: bestV4Fee } = await this.getV4QuoteWithAmountIn(
|
|
12109
|
+
getQuoteIn,
|
|
12110
|
+
tokenIn,
|
|
12111
|
+
tokenOut,
|
|
12112
|
+
amountIn,
|
|
12113
|
+
evmChainID
|
|
12114
|
+
);
|
|
12341
12115
|
if (amountOutV2 === BigInt(0) && amountOutV3 === BigInt(0) && amountOutV4 === BigInt(0)) {
|
|
12342
12116
|
return {
|
|
12343
12117
|
protocol: null,
|
|
@@ -12347,10 +12121,34 @@ var IntentGateway = class {
|
|
|
12347
12121
|
if (amountOutV4 !== BigInt(0)) {
|
|
12348
12122
|
const thresholdBps = 100n;
|
|
12349
12123
|
if (amountOutV3 !== BigInt(0) && this.isWithinThreshold(amountOutV4, amountOutV3, thresholdBps)) {
|
|
12350
|
-
|
|
12124
|
+
let transactions2;
|
|
12125
|
+
if (options?.generateCalldata) {
|
|
12126
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12127
|
+
tokenIn,
|
|
12128
|
+
tokenOut,
|
|
12129
|
+
amountIn,
|
|
12130
|
+
amountOutV4,
|
|
12131
|
+
bestV4Fee,
|
|
12132
|
+
evmChainID,
|
|
12133
|
+
getQuoteIn
|
|
12134
|
+
);
|
|
12135
|
+
}
|
|
12136
|
+
return { protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12351
12137
|
}
|
|
12352
12138
|
if (amountOutV2 !== BigInt(0) && this.isWithinThreshold(amountOutV4, amountOutV2, thresholdBps)) {
|
|
12353
|
-
|
|
12139
|
+
let transactions2;
|
|
12140
|
+
if (options?.generateCalldata) {
|
|
12141
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12142
|
+
tokenIn,
|
|
12143
|
+
tokenOut,
|
|
12144
|
+
amountIn,
|
|
12145
|
+
amountOutV4,
|
|
12146
|
+
bestV4Fee,
|
|
12147
|
+
evmChainID,
|
|
12148
|
+
getQuoteIn
|
|
12149
|
+
);
|
|
12150
|
+
}
|
|
12151
|
+
return { protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12354
12152
|
}
|
|
12355
12153
|
}
|
|
12356
12154
|
const maxAmount = [
|
|
@@ -12358,22 +12156,60 @@ var IntentGateway = class {
|
|
|
12358
12156
|
{ protocol: "v3", amountOut: amountOutV3, fee: bestV3Fee },
|
|
12359
12157
|
{ protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee }
|
|
12360
12158
|
].reduce((best, current) => current.amountOut > best.amountOut ? current : best);
|
|
12159
|
+
let transactions;
|
|
12160
|
+
if (options?.generateCalldata) {
|
|
12161
|
+
if (maxAmount.protocol === "v2") {
|
|
12162
|
+
transactions = this.createV2SwapCalldataExactIn(
|
|
12163
|
+
tokenIn,
|
|
12164
|
+
tokenOut,
|
|
12165
|
+
amountIn,
|
|
12166
|
+
amountOutV2,
|
|
12167
|
+
options.recipient,
|
|
12168
|
+
evmChainID,
|
|
12169
|
+
getQuoteIn
|
|
12170
|
+
);
|
|
12171
|
+
} else if (maxAmount.protocol === "v3") {
|
|
12172
|
+
transactions = this.createV3SwapCalldataExactIn(
|
|
12173
|
+
tokenIn,
|
|
12174
|
+
tokenOut,
|
|
12175
|
+
amountIn,
|
|
12176
|
+
amountOutV3,
|
|
12177
|
+
bestV3Fee,
|
|
12178
|
+
options.recipient,
|
|
12179
|
+
evmChainID,
|
|
12180
|
+
getQuoteIn
|
|
12181
|
+
);
|
|
12182
|
+
} else {
|
|
12183
|
+
transactions = this.createV4SwapCalldataExactIn(
|
|
12184
|
+
tokenIn,
|
|
12185
|
+
tokenOut,
|
|
12186
|
+
amountIn,
|
|
12187
|
+
amountOutV4,
|
|
12188
|
+
bestV4Fee,
|
|
12189
|
+
evmChainID,
|
|
12190
|
+
getQuoteIn
|
|
12191
|
+
);
|
|
12192
|
+
}
|
|
12193
|
+
}
|
|
12361
12194
|
if (maxAmount.protocol === "v2") {
|
|
12362
12195
|
return {
|
|
12363
12196
|
protocol: "v2",
|
|
12364
|
-
amountOut: amountOutV2
|
|
12197
|
+
amountOut: amountOutV2,
|
|
12198
|
+
transactions
|
|
12365
12199
|
};
|
|
12366
12200
|
} else if (maxAmount.protocol === "v3") {
|
|
12367
12201
|
return {
|
|
12368
12202
|
protocol: "v3",
|
|
12369
12203
|
amountOut: amountOutV3,
|
|
12370
|
-
fee: bestV3Fee
|
|
12204
|
+
fee: bestV3Fee,
|
|
12205
|
+
transactions
|
|
12371
12206
|
};
|
|
12372
12207
|
} else {
|
|
12373
12208
|
return {
|
|
12374
12209
|
protocol: "v4",
|
|
12375
12210
|
amountOut: amountOutV4,
|
|
12376
|
-
fee: bestV4Fee
|
|
12211
|
+
fee: bestV4Fee,
|
|
12212
|
+
transactions
|
|
12377
12213
|
};
|
|
12378
12214
|
}
|
|
12379
12215
|
}
|
|
@@ -12435,13 +12271,17 @@ var IntentGateway = class {
|
|
|
12435
12271
|
let lastFailedHeight = null;
|
|
12436
12272
|
let proofHex = null;
|
|
12437
12273
|
while (!proofHex) {
|
|
12438
|
-
|
|
12439
|
-
() =>
|
|
12440
|
-
|
|
12441
|
-
|
|
12274
|
+
const height = await retryPromise(
|
|
12275
|
+
() => indexerClient.queryLatestStateMachineHeight({
|
|
12276
|
+
statemachineId: destStateMachine,
|
|
12277
|
+
chain: hyperbridgeConfig.stateMachineId
|
|
12442
12278
|
}),
|
|
12443
12279
|
{ maxRetries: 5, backoffMs: 500, logMessage: "Failed to fetch latest state machine height" }
|
|
12444
12280
|
);
|
|
12281
|
+
if (!height) {
|
|
12282
|
+
throw new Error("No state machine updates found for destination chain");
|
|
12283
|
+
}
|
|
12284
|
+
latestHeight = height;
|
|
12445
12285
|
const shouldFetchProof = lastFailedHeight === null ? latestHeight > order.deadline : latestHeight > lastFailedHeight;
|
|
12446
12286
|
if (!shouldFetchProof) {
|
|
12447
12287
|
yield {
|
|
@@ -12513,9 +12353,9 @@ var IntentGateway = class {
|
|
|
12513
12353
|
break;
|
|
12514
12354
|
}
|
|
12515
12355
|
const nextHeight = await retryPromise(
|
|
12516
|
-
() =>
|
|
12517
|
-
|
|
12518
|
-
|
|
12356
|
+
() => indexerClient.queryLatestStateMachineHeight({
|
|
12357
|
+
statemachineId: sourceStateMachine,
|
|
12358
|
+
chain: hyperbridgeConfig.stateMachineId
|
|
12519
12359
|
}),
|
|
12520
12360
|
{
|
|
12521
12361
|
maxRetries: 5,
|
|
@@ -12523,6 +12363,11 @@ var IntentGateway = class {
|
|
|
12523
12363
|
logMessage: "Failed to fetch latest state machine height (post-source-proof failure)"
|
|
12524
12364
|
}
|
|
12525
12365
|
);
|
|
12366
|
+
if (!nextHeight) {
|
|
12367
|
+
throw new Error(
|
|
12368
|
+
`No state machine updates found for ${sourceStateMachine} on chain ${hyperbridgeConfig.stateMachineId}`
|
|
12369
|
+
);
|
|
12370
|
+
}
|
|
12526
12371
|
if (nextHeight <= failedHeight) {
|
|
12527
12372
|
await sleep(1e4);
|
|
12528
12373
|
continue;
|
|
@@ -12590,6 +12435,17 @@ var IntentGateway = class {
|
|
|
12590
12435
|
const basisPoints = 10000n;
|
|
12591
12436
|
return candidate * basisPoints <= reference * (basisPoints + thresholdBps);
|
|
12592
12437
|
}
|
|
12438
|
+
/**
|
|
12439
|
+
* Encodes multiple command bytes into packed format
|
|
12440
|
+
* @private
|
|
12441
|
+
*/
|
|
12442
|
+
encodeCommands(commands) {
|
|
12443
|
+
if (commands.length === 0) {
|
|
12444
|
+
throw new Error("Commands array cannot be empty");
|
|
12445
|
+
}
|
|
12446
|
+
const types = Array(commands.length).fill("uint8");
|
|
12447
|
+
return encodePacked(types, commands);
|
|
12448
|
+
}
|
|
12593
12449
|
};
|
|
12594
12450
|
function transformOrderForContract(order) {
|
|
12595
12451
|
return {
|
|
@@ -12931,6 +12787,6 @@ async function teleportDot(param_) {
|
|
|
12931
12787
|
return stream;
|
|
12932
12788
|
}
|
|
12933
12789
|
|
|
12934
|
-
export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TeleportStatus, TimeoutStatus, WrappedNativeDecimals, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, teleport, teleportDot, viemChains };
|
|
12790
|
+
export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, USE_ETHERSCAN_CHAINS, WrappedNativeDecimals, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getGasPriceFromEtherscan, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, viemChains };
|
|
12935
12791
|
//# sourceMappingURL=index.js.map
|
|
12936
12792
|
//# sourceMappingURL=index.js.map
|