@hyperbridge/sdk 2.4.0 → 2.4.2
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 +100 -33
- package/dist/browser/index.js +322 -108
- package/dist/browser/index.js.map +1 -1
- package/dist/node/{IntentGatewayV2-SB851bZs.d.cts → IntentGatewayV2-PzbhFn_7.d.cts} +39 -1
- package/dist/node/{IntentGatewayV2-SB851bZs.d.ts → IntentGatewayV2-PzbhFn_7.d.ts} +39 -1
- package/dist/node/index.cjs +323 -107
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +64 -35
- package/dist/node/index.d.ts +64 -35
- package/dist/node/index.js +322 -108
- package/dist/node/index.js.map +1 -1
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +1 -1
- package/dist/node/intents-helpers.d.ts +1 -1
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -2529,30 +2529,30 @@ var handlerV2_default = { ABI: ABI2 };
|
|
|
2529
2529
|
function tronAddress(base58) {
|
|
2530
2530
|
return `0x${TronWeb.address.toHex(base58).slice(2)}`;
|
|
2531
2531
|
}
|
|
2532
|
-
var Chains = /* @__PURE__ */ ((
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
return
|
|
2532
|
+
var Chains = /* @__PURE__ */ ((Chains2) => {
|
|
2533
|
+
Chains2["BSC_CHAPEL"] = "EVM-97";
|
|
2534
|
+
Chains2["GNOSIS_CHIADO"] = "EVM-10200";
|
|
2535
|
+
Chains2["HYPERBRIDGE_GARGANTUA"] = "KUSAMA-4009";
|
|
2536
|
+
Chains2["SEPOLIA"] = "EVM-11155111";
|
|
2537
|
+
Chains2["MAINNET"] = "EVM-1";
|
|
2538
|
+
Chains2["BSC_MAINNET"] = "EVM-56";
|
|
2539
|
+
Chains2["ARBITRUM_MAINNET"] = "EVM-42161";
|
|
2540
|
+
Chains2["ARBITRUM_SEPOLIA"] = "EVM-421614";
|
|
2541
|
+
Chains2["BASE_MAINNET"] = "EVM-8453";
|
|
2542
|
+
Chains2["BASE_SEPOLIA"] = "EVM-84532";
|
|
2543
|
+
Chains2["OPTIMISM_MAINNET"] = "EVM-10";
|
|
2544
|
+
Chains2["OPTIMISM_SEPOLIA"] = "EVM-11155420";
|
|
2545
|
+
Chains2["GNOSIS_MAINNET"] = "EVM-100";
|
|
2546
|
+
Chains2["SONEIUM_MAINNET"] = "EVM-1868";
|
|
2547
|
+
Chains2["POLYGON_MAINNET"] = "EVM-137";
|
|
2548
|
+
Chains2["POLKADOT_HUB_MAINNET"] = "EVM-420420419";
|
|
2549
|
+
Chains2["POLYGON_AMOY"] = "EVM-80002";
|
|
2550
|
+
Chains2["POLKADOT_ASSET_HUB_PASEO"] = "EVM-420420417";
|
|
2551
|
+
Chains2["TRON_MAINNET"] = "EVM-728126428";
|
|
2552
|
+
Chains2["TRON_NILE"] = "EVM-3448148188";
|
|
2553
|
+
Chains2["PHAROS_MAINNET"] = "EVM-688600";
|
|
2554
|
+
Chains2["PHAROS_ATLANTIC"] = "EVM-688689";
|
|
2555
|
+
return Chains2;
|
|
2556
2556
|
})(Chains || {});
|
|
2557
2557
|
var polkadotAssetHubPaseo = defineChain({
|
|
2558
2558
|
id: 420420417,
|
|
@@ -2743,7 +2743,7 @@ var chainConfigs = {
|
|
|
2743
2743
|
},
|
|
2744
2744
|
addresses: {
|
|
2745
2745
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2746
|
-
SolverAccount: "
|
|
2746
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
2747
2747
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2748
2748
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2749
2749
|
UniswapRouter02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
@@ -2798,7 +2798,7 @@ var chainConfigs = {
|
|
|
2798
2798
|
},
|
|
2799
2799
|
addresses: {
|
|
2800
2800
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2801
|
-
SolverAccount: "
|
|
2801
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
2802
2802
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2803
2803
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2804
2804
|
UniswapRouter02: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
@@ -2854,7 +2854,7 @@ var chainConfigs = {
|
|
|
2854
2854
|
},
|
|
2855
2855
|
addresses: {
|
|
2856
2856
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2857
|
-
SolverAccount: "
|
|
2857
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
2858
2858
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2859
2859
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2860
2860
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -2911,7 +2911,7 @@ var chainConfigs = {
|
|
|
2911
2911
|
},
|
|
2912
2912
|
addresses: {
|
|
2913
2913
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2914
|
-
SolverAccount: "
|
|
2914
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
2915
2915
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
2916
2916
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2917
2917
|
UniswapRouter02: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
@@ -2970,7 +2970,7 @@ var chainConfigs = {
|
|
|
2970
2970
|
},
|
|
2971
2971
|
addresses: {
|
|
2972
2972
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
2973
|
-
SolverAccount: "
|
|
2973
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
2974
2974
|
TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
|
|
2975
2975
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
2976
2976
|
UniswapRouter02: "0xd2f9496824951D5237cC71245D659E48d0d5f9E8",
|
|
@@ -3081,7 +3081,7 @@ var chainConfigs = {
|
|
|
3081
3081
|
},
|
|
3082
3082
|
addresses: {
|
|
3083
3083
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3084
|
-
SolverAccount: "
|
|
3084
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
3085
3085
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3086
3086
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3087
3087
|
UniswapRouter02: "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2",
|
|
@@ -3116,7 +3116,7 @@ var chainConfigs = {
|
|
|
3116
3116
|
},
|
|
3117
3117
|
addresses: {
|
|
3118
3118
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3119
|
-
SolverAccount: "
|
|
3119
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
3120
3120
|
TokenGateway: "0xFd413e3AFe560182C4471F4d143A96d3e259B6dE",
|
|
3121
3121
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3122
3122
|
UniswapRouter02: "0xB2e26652e4BAd1e56055A051f922E06760cA0BFE",
|
|
@@ -3271,7 +3271,7 @@ var chainConfigs = {
|
|
|
3271
3271
|
},
|
|
3272
3272
|
addresses: {
|
|
3273
3273
|
IntentGateway: "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
|
|
3274
|
-
SolverAccount: "
|
|
3274
|
+
SolverAccount: "0xfCd233b937D7622AAc63ced3C9A1A12F4a6B64E3",
|
|
3275
3275
|
Host: "0x620128E2B19193d6Bd244a3AC8D3bBa0541B19c3",
|
|
3276
3276
|
Calldispatcher: "0xE2C7e576E26E0bE7aC97c6fE925bcDAbD87c4bEd"
|
|
3277
3277
|
},
|
|
@@ -5157,6 +5157,24 @@ var ChainConfigService = class {
|
|
|
5157
5157
|
getAssetAddress(chain, symbol) {
|
|
5158
5158
|
return this.getConfig(chain)?.assets?.[symbol];
|
|
5159
5159
|
}
|
|
5160
|
+
/**
|
|
5161
|
+
* Resolves configured token metadata from an address on a specific chain.
|
|
5162
|
+
* This is used by SDK helpers that accept token addresses rather than caller-
|
|
5163
|
+
* supplied symbols or decimals.
|
|
5164
|
+
*/
|
|
5165
|
+
getAssetMetadataByAddress(chain, address) {
|
|
5166
|
+
const config = this.getConfig(chain);
|
|
5167
|
+
if (!config?.assets) return;
|
|
5168
|
+
const normalizedAddress = address.toLowerCase();
|
|
5169
|
+
for (const [symbol, configuredAddress] of Object.entries(config.assets)) {
|
|
5170
|
+
if (configuredAddress.toLowerCase() !== normalizedAddress) continue;
|
|
5171
|
+
return {
|
|
5172
|
+
symbol,
|
|
5173
|
+
address: configuredAddress,
|
|
5174
|
+
decimals: config.tokenDecimals?.[symbol]
|
|
5175
|
+
};
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5160
5178
|
getUsdtAsset(chain) {
|
|
5161
5179
|
return this.getConfig(chain)?.assets?.USDT ?? "0x";
|
|
5162
5180
|
}
|
|
@@ -7830,7 +7848,7 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
|
|
|
7830
7848
|
*/
|
|
7831
7849
|
async sendExtrinsicWithRetries(extrinsic, maxRetries, timeoutMs) {
|
|
7832
7850
|
const keyPair = this.getKeyPair();
|
|
7833
|
-
|
|
7851
|
+
const baseTip = 1000000000n;
|
|
7834
7852
|
let attempt = 0;
|
|
7835
7853
|
while (attempt < maxRetries) {
|
|
7836
7854
|
const currentTip = baseTip * BigInt(2 ** attempt);
|
|
@@ -11500,6 +11518,33 @@ query OrderStatus($commitment: String!) {
|
|
|
11500
11518
|
}
|
|
11501
11519
|
}
|
|
11502
11520
|
}`;
|
|
11521
|
+
var LATEST_PHANTOM_ORDER_PRICE_SNAPSHOT = `
|
|
11522
|
+
query LatestPhantomOrderPriceSnapshot($tokenA: String!, $tokenB: String!) {
|
|
11523
|
+
phantomOrderPriceSnapshots(
|
|
11524
|
+
filter: {
|
|
11525
|
+
and: [
|
|
11526
|
+
{ tokenA: { equalTo: $tokenA } }
|
|
11527
|
+
{ tokenB: { equalTo: $tokenB } }
|
|
11528
|
+
{ medianPrice: { isNull: false } }
|
|
11529
|
+
]
|
|
11530
|
+
}
|
|
11531
|
+
orderBy: BLOCK_NUMBER_DESC
|
|
11532
|
+
first: 1
|
|
11533
|
+
) {
|
|
11534
|
+
nodes {
|
|
11535
|
+
commitment
|
|
11536
|
+
tokenA
|
|
11537
|
+
tokenB
|
|
11538
|
+
standardAmount
|
|
11539
|
+
blockNumber
|
|
11540
|
+
medianPrice
|
|
11541
|
+
lowestPrice
|
|
11542
|
+
highestPrice
|
|
11543
|
+
bidCount
|
|
11544
|
+
snapshotTime
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
}`;
|
|
11503
11548
|
var TOKEN_GATEWAY_ASSET_TELEPORTED_STATUS = `
|
|
11504
11549
|
query TokenGatewayAssetTeleportedStatus($commitment: String!) {
|
|
11505
11550
|
tokenGatewayAssetTeleportedV2s(
|
|
@@ -11561,6 +11606,29 @@ async function queryAssetTeleported(params) {
|
|
|
11561
11606
|
function queryGetRequest(params) {
|
|
11562
11607
|
return _queryGetRequestInternal(params);
|
|
11563
11608
|
}
|
|
11609
|
+
async function _queryLatestPhantomOrderPriceSnapshot(params) {
|
|
11610
|
+
const response = await params.queryClient.request(
|
|
11611
|
+
LATEST_PHANTOM_ORDER_PRICE_SNAPSHOT,
|
|
11612
|
+
{
|
|
11613
|
+
tokenA: params.tokenA.toLowerCase(),
|
|
11614
|
+
tokenB: params.tokenB.toLowerCase()
|
|
11615
|
+
}
|
|
11616
|
+
);
|
|
11617
|
+
const snapshot = response.phantomOrderPriceSnapshots.nodes[0];
|
|
11618
|
+
if (!snapshot?.medianPrice) return;
|
|
11619
|
+
return {
|
|
11620
|
+
commitment: snapshot.commitment,
|
|
11621
|
+
tokenA: snapshot.tokenA,
|
|
11622
|
+
tokenB: snapshot.tokenB,
|
|
11623
|
+
standardAmount: BigInt(snapshot.standardAmount),
|
|
11624
|
+
blockNumber: BigInt(snapshot.blockNumber),
|
|
11625
|
+
medianPrice: BigInt(snapshot.medianPrice),
|
|
11626
|
+
lowestPrice: snapshot.lowestPrice === null ? void 0 : BigInt(snapshot.lowestPrice),
|
|
11627
|
+
highestPrice: snapshot.highestPrice === null ? void 0 : BigInt(snapshot.highestPrice),
|
|
11628
|
+
bidCount: snapshot.bidCount,
|
|
11629
|
+
snapshotTime: new Date(snapshot.snapshotTime)
|
|
11630
|
+
};
|
|
11631
|
+
}
|
|
11564
11632
|
async function _queryTokenGatewayAssetTeleportedInternal(params) {
|
|
11565
11633
|
const { commitmentHash, queryClient: client, logger = DEFAULT_LOGGER } = params;
|
|
11566
11634
|
const response = await retryPromise(
|
|
@@ -17370,15 +17438,67 @@ var UnsupportedIntentQuoteStrategyError = class extends Error {
|
|
|
17370
17438
|
var UnsupportedIntentQuotePairError = class extends Error {
|
|
17371
17439
|
constructor(params) {
|
|
17372
17440
|
super(
|
|
17373
|
-
`No Uniswap v4 pool config found for ${params.tokenIn
|
|
17441
|
+
`No ${params.quoteSource ?? "Uniswap v4 pool config"} found for ${params.tokenIn} -> ${params.tokenOut} on ${params.source} -> ${params.destination}`
|
|
17374
17442
|
);
|
|
17375
17443
|
this.name = "UnsupportedIntentQuotePairError";
|
|
17376
17444
|
}
|
|
17377
17445
|
};
|
|
17446
|
+
var PhantomSnapshotUnavailableError = class extends Error {
|
|
17447
|
+
constructor(tokenA, tokenB) {
|
|
17448
|
+
super(`No Phantom order price snapshot found for ${tokenA} -> ${tokenB}`);
|
|
17449
|
+
this.name = "PhantomSnapshotUnavailableError";
|
|
17450
|
+
}
|
|
17451
|
+
};
|
|
17452
|
+
var InvalidPhantomSnapshotError = class extends Error {
|
|
17453
|
+
constructor(commitment, reason) {
|
|
17454
|
+
super(`Invalid Phantom order price snapshot ${commitment}: ${reason}`);
|
|
17455
|
+
this.name = "InvalidPhantomSnapshotError";
|
|
17456
|
+
}
|
|
17457
|
+
};
|
|
17458
|
+
var BPS_DENOMINATOR = 10000n;
|
|
17459
|
+
function validateQuoteParams(params) {
|
|
17460
|
+
const hasAmountIn = params.amountIn !== void 0;
|
|
17461
|
+
const hasAmountOut = params.amountOut !== void 0;
|
|
17462
|
+
if (hasAmountIn === hasAmountOut) throw new Error("Provide exactly one of amountIn or amountOut");
|
|
17463
|
+
if (params.amountIn !== void 0 && params.amountIn <= 0n) throw new Error("amountIn must be greater than zero");
|
|
17464
|
+
if (params.amountOut !== void 0 && params.amountOut <= 0n) throw new Error("amountOut must be greater than zero");
|
|
17465
|
+
if (params.tokenIn.toLowerCase() === params.tokenOut.toLowerCase()) {
|
|
17466
|
+
throw new Error("tokenIn and tokenOut cannot be the same");
|
|
17467
|
+
}
|
|
17468
|
+
}
|
|
17469
|
+
async function readProtocolFeeBps(chainConfigService, source) {
|
|
17470
|
+
const gatewayAddress = chainConfigService.getIntentGatewayAddress(source.stateMachineId);
|
|
17471
|
+
if (!gatewayAddress || gatewayAddress === "0x" || gatewayAddress === zeroAddress) {
|
|
17472
|
+
throw new Error(`IntentGatewayV2 is not configured for chain ${source.stateMachineId}`);
|
|
17473
|
+
}
|
|
17474
|
+
const gatewayParams = await source.client.readContract({
|
|
17475
|
+
address: gatewayAddress,
|
|
17476
|
+
abi: IntentGatewayV2_default.ABI,
|
|
17477
|
+
functionName: "params"
|
|
17478
|
+
});
|
|
17479
|
+
const protocolFeeBps = Array.isArray(gatewayParams) ? BigInt(gatewayParams[4]) : BigInt(gatewayParams.protocolFeeBps ?? 0);
|
|
17480
|
+
if (protocolFeeBps < 0n || protocolFeeBps >= BPS_DENOMINATOR) {
|
|
17481
|
+
throw new Error(`Invalid IntentGateway protocol fee: ${protocolFeeBps} bps`);
|
|
17482
|
+
}
|
|
17483
|
+
return protocolFeeBps;
|
|
17484
|
+
}
|
|
17485
|
+
function deductProtocolFee(amount, protocolFeeBps) {
|
|
17486
|
+
if (protocolFeeBps <= 0n) return amount;
|
|
17487
|
+
const fee = amount * protocolFeeBps / BPS_DENOMINATOR;
|
|
17488
|
+
return amount - fee;
|
|
17489
|
+
}
|
|
17490
|
+
function grossUpForProtocolFee(netAmount, protocolFeeBps) {
|
|
17491
|
+
if (protocolFeeBps <= 0n) return netAmount;
|
|
17492
|
+
if (protocolFeeBps >= BPS_DENOMINATOR) throw new Error("protocolFeeBps must be less than 10,000");
|
|
17493
|
+
return divCeil(netAmount * BPS_DENOMINATOR, BPS_DENOMINATOR - protocolFeeBps);
|
|
17494
|
+
}
|
|
17495
|
+
function divCeil(numerator, denominator) {
|
|
17496
|
+
if (denominator <= 0n) throw new Error("denominator must be greater than zero");
|
|
17497
|
+
return (numerator + denominator - 1n) / denominator;
|
|
17498
|
+
}
|
|
17378
17499
|
|
|
17379
17500
|
// src/protocols/intents/quote/uniswapV4.ts
|
|
17380
17501
|
var UNISWAP_INTENT_QUOTE_CHAIN = "EVM-8453" /* BASE_MAINNET */;
|
|
17381
|
-
var BPS_DENOMINATOR = 10000n;
|
|
17382
17502
|
var UniswapV4IntentQuoteStrategy = class {
|
|
17383
17503
|
constructor(chainConfigService) {
|
|
17384
17504
|
this.chainConfigService = chainConfigService;
|
|
@@ -17386,10 +17506,10 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17386
17506
|
chainConfigService;
|
|
17387
17507
|
baseQuoteClient;
|
|
17388
17508
|
async quote(params, source, destination) {
|
|
17389
|
-
|
|
17390
|
-
const protocolFeeBps = await
|
|
17509
|
+
validateQuoteParams(params);
|
|
17510
|
+
const protocolFeeBps = await readProtocolFeeBps(this.chainConfigService, source);
|
|
17391
17511
|
const quoteClient = this.resolveQuoteClient(source, destination);
|
|
17392
|
-
const poolConfig = this.resolvePoolConfig(params, source.stateMachineId,
|
|
17512
|
+
const poolConfig = this.resolvePoolConfig(params, source.stateMachineId, destination.stateMachineId);
|
|
17393
17513
|
return params.amountIn !== void 0 ? this.quoteExactInput({ params, client: quoteClient, protocolFeeBps, poolConfig }) : this.quoteExactOutput({ params, client: quoteClient, protocolFeeBps, poolConfig });
|
|
17394
17514
|
}
|
|
17395
17515
|
resolveQuoteClient(source, destination) {
|
|
@@ -17405,34 +17525,11 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17405
17525
|
this.baseQuoteClient = baseQuoteClient;
|
|
17406
17526
|
return baseQuoteClient;
|
|
17407
17527
|
}
|
|
17408
|
-
validateQuoteParams(params) {
|
|
17409
|
-
const hasAmountIn = params.amountIn !== void 0;
|
|
17410
|
-
const hasAmountOut = params.amountOut !== void 0;
|
|
17411
|
-
if (hasAmountIn === hasAmountOut) throw new Error("Provide exactly one of amountIn or amountOut");
|
|
17412
|
-
if (hasAmountIn && params.amountIn <= 0n) throw new Error("amountIn must be greater than zero");
|
|
17413
|
-
if (hasAmountOut && params.amountOut <= 0n) throw new Error("amountOut must be greater than zero");
|
|
17414
|
-
if (params.tokenIn.address.toLowerCase() === params.tokenOut.address.toLowerCase()) {
|
|
17415
|
-
throw new Error("tokenIn and tokenOut cannot be the same");
|
|
17416
|
-
}
|
|
17417
|
-
}
|
|
17418
|
-
async readProtocolFeeBps(client, chain) {
|
|
17419
|
-
const gatewayAddress = this.chainConfigService.getIntentGatewayAddress(chain);
|
|
17420
|
-
if (!gatewayAddress || gatewayAddress === "0x" || gatewayAddress === zeroAddress) {
|
|
17421
|
-
throw new Error(`IntentGatewayV2 is not configured for chain ${chain}`);
|
|
17422
|
-
}
|
|
17423
|
-
const gatewayParams = await client.readContract({
|
|
17424
|
-
address: gatewayAddress,
|
|
17425
|
-
abi: IntentGatewayV2_default.ABI,
|
|
17426
|
-
functionName: "params"
|
|
17427
|
-
});
|
|
17428
|
-
if (isGatewayParamsTuple(gatewayParams)) return BigInt(gatewayParams[4]);
|
|
17429
|
-
return BigInt(gatewayParams.protocolFeeBps ?? 0);
|
|
17430
|
-
}
|
|
17431
17528
|
resolvePoolConfig(params, source, destination) {
|
|
17432
17529
|
const override = params.uniswapV4?.poolKey;
|
|
17433
17530
|
if (override) {
|
|
17434
17531
|
const poolKey = normalizePoolKey(override);
|
|
17435
|
-
const tokenInForQuote = getAddress(override.currencyIn ?? params.tokenIn
|
|
17532
|
+
const tokenInForQuote = getAddress(override.currencyIn ?? params.tokenIn);
|
|
17436
17533
|
if (tokenInForQuote !== poolKey.currency0 && tokenInForQuote !== poolKey.currency1) {
|
|
17437
17534
|
throw new Error(
|
|
17438
17535
|
`Input currency ${tokenInForQuote} is not part of the override pool (${poolKey.currency0}, ${poolKey.currency1}). For cross-chain quotes pass uniswapV4.poolKey.currencyIn with the Base-side input currency address.`
|
|
@@ -17440,11 +17537,11 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17440
17537
|
}
|
|
17441
17538
|
return {
|
|
17442
17539
|
poolKey,
|
|
17443
|
-
quoterAddress: this.resolveQuoterAddress(
|
|
17540
|
+
quoterAddress: this.resolveQuoterAddress(UNISWAP_INTENT_QUOTE_CHAIN, override.quoterAddress),
|
|
17444
17541
|
tokenInForQuote
|
|
17445
17542
|
};
|
|
17446
17543
|
}
|
|
17447
|
-
const poolConfig = this.resolveConfiguredPool(params, destination);
|
|
17544
|
+
const poolConfig = this.resolveConfiguredPool(params, source, destination, UNISWAP_INTENT_QUOTE_CHAIN);
|
|
17448
17545
|
if (poolConfig) return poolConfig;
|
|
17449
17546
|
throw new UnsupportedIntentQuotePairError({
|
|
17450
17547
|
source,
|
|
@@ -17453,12 +17550,12 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17453
17550
|
tokenOut: params.tokenOut
|
|
17454
17551
|
});
|
|
17455
17552
|
}
|
|
17456
|
-
resolveConfiguredPool(params,
|
|
17457
|
-
for (const pool of this.chainConfigService.getUniswapV4PoolConfigs(
|
|
17458
|
-
const resolvedPool = this.resolveConfiguredPoolTokens(
|
|
17553
|
+
resolveConfiguredPool(params, sourceChain, destinationChain, quoteChain) {
|
|
17554
|
+
for (const pool of this.chainConfigService.getUniswapV4PoolConfigs(quoteChain)) {
|
|
17555
|
+
const resolvedPool = this.resolveConfiguredPoolTokens(quoteChain, pool);
|
|
17459
17556
|
if (!resolvedPool) continue;
|
|
17460
|
-
const tokenInForQuote = matchPoolToken(params.tokenIn, resolvedPool);
|
|
17461
|
-
const tokenOutForQuote = matchPoolToken(params.tokenOut, resolvedPool);
|
|
17557
|
+
const tokenInForQuote = this.matchPoolToken(params.tokenIn, sourceChain, resolvedPool);
|
|
17558
|
+
const tokenOutForQuote = this.matchPoolToken(params.tokenOut, destinationChain, resolvedPool);
|
|
17462
17559
|
if (!tokenInForQuote || !tokenOutForQuote || tokenInForQuote.symbol === tokenOutForQuote.symbol) continue;
|
|
17463
17560
|
const { currency0, currency1 } = sortCurrencies(resolvedPool[0].address, resolvedPool[1].address);
|
|
17464
17561
|
return {
|
|
@@ -17469,7 +17566,7 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17469
17566
|
tickSpacing: pool.tickSpacing,
|
|
17470
17567
|
hooks: getAddress(pool.hooks ?? zeroAddress)
|
|
17471
17568
|
},
|
|
17472
|
-
quoterAddress: this.resolveQuoterAddress(
|
|
17569
|
+
quoterAddress: this.resolveQuoterAddress(quoteChain),
|
|
17473
17570
|
tokenInForQuote: tokenInForQuote.address
|
|
17474
17571
|
};
|
|
17475
17572
|
}
|
|
@@ -17492,8 +17589,18 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17492
17589
|
if (!address || address === "0x") return null;
|
|
17493
17590
|
return { symbol, address: getAddress(address) };
|
|
17494
17591
|
}
|
|
17592
|
+
matchPoolToken(tokenAddress, orderChain, poolTokens) {
|
|
17593
|
+
const addressMatch = poolTokens.find(
|
|
17594
|
+
(poolToken) => poolToken.address.toLowerCase() === tokenAddress.toLowerCase()
|
|
17595
|
+
);
|
|
17596
|
+
if (addressMatch) return addressMatch;
|
|
17597
|
+
const metadata = this.chainConfigService.getAssetMetadataByAddress(orderChain, tokenAddress);
|
|
17598
|
+
if (!metadata) return null;
|
|
17599
|
+
return poolTokens.find((poolToken) => poolToken.symbol === metadata.symbol) ?? null;
|
|
17600
|
+
}
|
|
17495
17601
|
async quoteExactInput(args) {
|
|
17496
17602
|
const amountIn = args.params.amountIn;
|
|
17603
|
+
if (amountIn === void 0) throw new Error("amountIn is required for an exact-input quote");
|
|
17497
17604
|
const swapAmountIn = deductProtocolFee(amountIn, args.protocolFeeBps);
|
|
17498
17605
|
const amountOut = await this.readV4QuoteExactInput(args.client, args.poolConfig, swapAmountIn);
|
|
17499
17606
|
return {
|
|
@@ -17511,6 +17618,7 @@ var UniswapV4IntentQuoteStrategy = class {
|
|
|
17511
17618
|
}
|
|
17512
17619
|
async quoteExactOutput(args) {
|
|
17513
17620
|
const amountOut = args.params.amountOut;
|
|
17621
|
+
if (amountOut === void 0) throw new Error("amountOut is required for an exact-output quote");
|
|
17514
17622
|
const swapAmountIn = await this.readV4QuoteExactOutput(args.client, args.poolConfig, amountOut);
|
|
17515
17623
|
const amountIn = grossUpForProtocolFee(swapAmountIn, args.protocolFeeBps);
|
|
17516
17624
|
return {
|
|
@@ -17589,34 +17697,125 @@ function sortCurrencies(tokenIn, tokenOut) {
|
|
|
17589
17697
|
const output = getAddress(tokenOut);
|
|
17590
17698
|
return BigInt(input) < BigInt(output) ? { currency0: input, currency1: output } : { currency0: output, currency1: input };
|
|
17591
17699
|
}
|
|
17592
|
-
function matchPoolToken(token, poolTokens) {
|
|
17593
|
-
const tokenAddress = token.address.toLowerCase();
|
|
17594
|
-
const addressMatch = poolTokens.find((poolToken) => poolToken.address.toLowerCase() === tokenAddress);
|
|
17595
|
-
if (addressMatch) return addressMatch;
|
|
17596
|
-
const tokenSymbol = token.symbol?.toUpperCase();
|
|
17597
|
-
if (!tokenSymbol) return null;
|
|
17598
|
-
return poolTokens.find((poolToken) => poolToken.symbol.toUpperCase() === tokenSymbol) ?? null;
|
|
17599
|
-
}
|
|
17600
17700
|
function getZeroForOne(tokenIn, poolKey) {
|
|
17601
17701
|
return getAddress(tokenIn).toLowerCase() === getAddress(poolKey.currency0).toLowerCase();
|
|
17602
17702
|
}
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
}
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17703
|
+
|
|
17704
|
+
// src/protocols/intents/quote/phantomSnapshot.ts
|
|
17705
|
+
var PHANTOM_INTENT_QUOTE_CHAIN = "EVM-8453" /* BASE_MAINNET */;
|
|
17706
|
+
var BASE_SNAPSHOT_ASSET_BY_ORDER_ASSET = {
|
|
17707
|
+
USDC: "USDC",
|
|
17708
|
+
USDT: "USDC",
|
|
17709
|
+
cNGN: "cNGN"
|
|
17710
|
+
};
|
|
17711
|
+
var SUPPORTED_BASE_SNAPSHOT_PAIRS = /* @__PURE__ */ new Set(["USDC:cNGN", "cNGN:USDC"]);
|
|
17712
|
+
var PhantomSnapshotIntentQuoteStrategy = class {
|
|
17713
|
+
constructor(chainConfigService, getQueryClient) {
|
|
17714
|
+
this.chainConfigService = chainConfigService;
|
|
17715
|
+
this.getQueryClient = getQueryClient;
|
|
17716
|
+
}
|
|
17717
|
+
chainConfigService;
|
|
17718
|
+
getQueryClient;
|
|
17719
|
+
async quote(params, source, destination) {
|
|
17720
|
+
validateQuoteParams(params);
|
|
17721
|
+
const pair = this.resolveBaseSnapshotPair(params, source.stateMachineId, destination.stateMachineId);
|
|
17722
|
+
if (!pair) {
|
|
17723
|
+
throw new UnsupportedIntentQuotePairError({
|
|
17724
|
+
source: source.stateMachineId,
|
|
17725
|
+
destination: destination.stateMachineId,
|
|
17726
|
+
tokenIn: params.tokenIn,
|
|
17727
|
+
tokenOut: params.tokenOut,
|
|
17728
|
+
quoteSource: "Phantom snapshot pair"
|
|
17729
|
+
});
|
|
17730
|
+
}
|
|
17731
|
+
const queryClient = this.getQueryClient();
|
|
17732
|
+
const [protocolFeeBps, snapshot] = await Promise.all([
|
|
17733
|
+
readProtocolFeeBps(this.chainConfigService, source),
|
|
17734
|
+
_queryLatestPhantomOrderPriceSnapshot({
|
|
17735
|
+
tokenA: pair.tokenA,
|
|
17736
|
+
tokenB: pair.tokenB,
|
|
17737
|
+
queryClient
|
|
17738
|
+
})
|
|
17739
|
+
]);
|
|
17740
|
+
if (!snapshot) throw new PhantomSnapshotUnavailableError(pair.tokenA, pair.tokenB);
|
|
17741
|
+
this.validateSnapshot(snapshot);
|
|
17742
|
+
return this.quoteSnapshot(params, protocolFeeBps, snapshot);
|
|
17743
|
+
}
|
|
17744
|
+
quoteSnapshot(params, protocolFeeBps, snapshot) {
|
|
17745
|
+
if (params.amountIn !== void 0) {
|
|
17746
|
+
const netAmountIn2 = deductProtocolFee(params.amountIn, protocolFeeBps);
|
|
17747
|
+
const amountOut = netAmountIn2 * snapshot.medianPrice / snapshot.standardAmount;
|
|
17748
|
+
if (amountOut <= 0n) {
|
|
17749
|
+
throw new InvalidPhantomSnapshotError(snapshot.commitment, "quote rounds down to zero output");
|
|
17750
|
+
}
|
|
17751
|
+
return this.buildResult("EXACT_INPUT", params.amountIn, amountOut, protocolFeeBps, snapshot);
|
|
17752
|
+
}
|
|
17753
|
+
if (params.amountOut === void 0) throw new Error("Quote amount is missing after validation");
|
|
17754
|
+
const netAmountIn = divCeil(params.amountOut * snapshot.standardAmount, snapshot.medianPrice);
|
|
17755
|
+
const amountIn = grossUpForProtocolFee(netAmountIn, protocolFeeBps);
|
|
17756
|
+
return this.buildResult("EXACT_OUTPUT", amountIn, params.amountOut, protocolFeeBps, snapshot);
|
|
17757
|
+
}
|
|
17758
|
+
buildResult(tradeType, amountIn, amountOut, protocolFeeBps, snapshot) {
|
|
17759
|
+
return {
|
|
17760
|
+
strategy: "phantom_snapshot",
|
|
17761
|
+
tradeType,
|
|
17762
|
+
amountIn,
|
|
17763
|
+
amountOut,
|
|
17764
|
+
quoteMetadata: {
|
|
17765
|
+
quoteChain: PHANTOM_INTENT_QUOTE_CHAIN,
|
|
17766
|
+
commitment: snapshot.commitment,
|
|
17767
|
+
tokenA: snapshot.tokenA,
|
|
17768
|
+
tokenB: snapshot.tokenB,
|
|
17769
|
+
standardAmount: snapshot.standardAmount,
|
|
17770
|
+
medianPrice: snapshot.medianPrice,
|
|
17771
|
+
lowestPrice: snapshot.lowestPrice,
|
|
17772
|
+
highestPrice: snapshot.highestPrice,
|
|
17773
|
+
blockNumber: snapshot.blockNumber,
|
|
17774
|
+
snapshotTime: snapshot.snapshotTime,
|
|
17775
|
+
bidCount: snapshot.bidCount,
|
|
17776
|
+
protocolFeeBps
|
|
17777
|
+
}
|
|
17778
|
+
};
|
|
17779
|
+
}
|
|
17780
|
+
validateSnapshot(snapshot) {
|
|
17781
|
+
if (snapshot.standardAmount <= 0n) {
|
|
17782
|
+
throw new InvalidPhantomSnapshotError(snapshot.commitment, "standardAmount must be greater than zero");
|
|
17783
|
+
}
|
|
17784
|
+
if (snapshot.medianPrice <= 0n) {
|
|
17785
|
+
throw new InvalidPhantomSnapshotError(snapshot.commitment, "medianPrice must be greater than zero");
|
|
17786
|
+
}
|
|
17787
|
+
if (snapshot.bidCount <= 0) {
|
|
17788
|
+
throw new InvalidPhantomSnapshotError(snapshot.commitment, "bidCount must be greater than zero");
|
|
17789
|
+
}
|
|
17790
|
+
if (Number.isNaN(snapshot.snapshotTime.getTime())) {
|
|
17791
|
+
throw new InvalidPhantomSnapshotError(snapshot.commitment, "snapshotTime is invalid");
|
|
17792
|
+
}
|
|
17793
|
+
}
|
|
17794
|
+
resolveBaseSnapshotPair(params, sourceStateMachineId, destinationStateMachineId) {
|
|
17795
|
+
const tokenIn = this.resolveBaseSnapshotToken(sourceStateMachineId, params.tokenIn);
|
|
17796
|
+
const tokenOut = this.resolveBaseSnapshotToken(destinationStateMachineId, params.tokenOut);
|
|
17797
|
+
if (!tokenIn || !tokenOut || !isSupportedSnapshotPair(tokenIn.symbol, tokenOut.symbol)) return;
|
|
17798
|
+
return { tokenA: tokenIn.address, tokenB: tokenOut.address };
|
|
17799
|
+
}
|
|
17800
|
+
resolveBaseSnapshotToken(chain, tokenAddress) {
|
|
17801
|
+
const orderAsset = this.chainConfigService.getAssetMetadataByAddress(chain, tokenAddress)?.symbol;
|
|
17802
|
+
if (!orderAsset) return;
|
|
17803
|
+
const snapshotAsset = BASE_SNAPSHOT_ASSET_BY_ORDER_ASSET[orderAsset];
|
|
17804
|
+
if (!snapshotAsset) return;
|
|
17805
|
+
const address = this.chainConfigService.getAssetAddress(PHANTOM_INTENT_QUOTE_CHAIN, snapshotAsset);
|
|
17806
|
+
if (!isConfiguredAddress(address)) return;
|
|
17807
|
+
return { symbol: snapshotAsset, address };
|
|
17808
|
+
}
|
|
17809
|
+
};
|
|
17810
|
+
function isSupportedSnapshotPair(tokenA, tokenB) {
|
|
17811
|
+
return SUPPORTED_BASE_SNAPSHOT_PAIRS.has(`${tokenA}:${tokenB}`);
|
|
17614
17812
|
}
|
|
17615
|
-
function
|
|
17616
|
-
return (
|
|
17813
|
+
function isConfiguredAddress(address) {
|
|
17814
|
+
return Boolean(address && address !== "0x" && !/^0x0{40}$/i.test(address));
|
|
17617
17815
|
}
|
|
17618
17816
|
|
|
17619
17817
|
// src/protocols/intents/IntentGateway.ts
|
|
17818
|
+
var CROSS_CHAIN_ORDER_FEE_GAS_BUMP = 600000n;
|
|
17620
17819
|
var IntentGateway = class _IntentGateway {
|
|
17621
17820
|
/** EVM chain on which orders are placed and escrowed. */
|
|
17622
17821
|
source;
|
|
@@ -17688,6 +17887,10 @@ var IntentGateway = class _IntentGateway {
|
|
|
17688
17887
|
this.gasEstimator = gasEstimator;
|
|
17689
17888
|
this._crypto = crypto;
|
|
17690
17889
|
this.quoteStrategies = {
|
|
17890
|
+
phantom_snapshot: new PhantomSnapshotIntentQuoteStrategy(
|
|
17891
|
+
dest.configService,
|
|
17892
|
+
() => this.requireIndexer().queryClient
|
|
17893
|
+
),
|
|
17691
17894
|
uniswap_v4: new UniswapV4IntentQuoteStrategy(dest.configService)
|
|
17692
17895
|
};
|
|
17693
17896
|
}
|
|
@@ -17737,37 +17940,39 @@ var IntentGateway = class _IntentGateway {
|
|
|
17737
17940
|
/**
|
|
17738
17941
|
* Quotes an intent between this gateway's source and destination chains.
|
|
17739
17942
|
*
|
|
17740
|
-
*
|
|
17741
|
-
*
|
|
17943
|
+
* Uses the latest directional Phantom order price snapshot from the attached
|
|
17944
|
+
* indexer by default. Pass `strategy: "uniswap_v4"` only when explicitly
|
|
17945
|
+
* requesting a Uniswap quote. Provide exactly one of `amountIn` or `amountOut`.
|
|
17742
17946
|
*
|
|
17743
|
-
*
|
|
17744
|
-
*
|
|
17947
|
+
* Both built-in strategies resolve their canonical market on Base,
|
|
17948
|
+
* regardless of this gateway's destination chain. Returned
|
|
17745
17949
|
* `amountIn`/`amountOut` already account for the gateway's protocol fee
|
|
17746
17950
|
* (`quoteMetadata.protocolFeeBps`), which the gateway deducts from order
|
|
17747
|
-
* inputs;
|
|
17951
|
+
* inputs; use the returned amounts directly when placing the order.
|
|
17748
17952
|
*
|
|
17749
17953
|
* @param params - Token pair, amount, and optional strategy/pool overrides.
|
|
17750
17954
|
* @returns The quoted amounts plus strategy-specific metadata.
|
|
17751
17955
|
* @throws {UnsupportedIntentQuoteStrategyError} For unknown strategies.
|
|
17752
|
-
* @throws {UnsupportedIntentQuotePairError} When
|
|
17956
|
+
* @throws {UnsupportedIntentQuotePairError} When the selected strategy does not support the pair.
|
|
17957
|
+
* @throws {PhantomSnapshotUnavailableError} When an eligible cNGN pair has no snapshot.
|
|
17753
17958
|
*/
|
|
17754
17959
|
async quoteIntent(params) {
|
|
17755
|
-
const
|
|
17960
|
+
const source = { stateMachineId: this.source.config.stateMachineId, client: this.source.client };
|
|
17961
|
+
const destination = { stateMachineId: this.dest.config.stateMachineId, client: this.dest.client };
|
|
17962
|
+
const strategy = params.strategy ?? "phantom_snapshot";
|
|
17756
17963
|
const handler = this.quoteStrategies[strategy];
|
|
17757
17964
|
if (!handler) throw new UnsupportedIntentQuoteStrategyError(strategy);
|
|
17758
|
-
return handler.quote(
|
|
17759
|
-
{ ...params, strategy },
|
|
17760
|
-
{ stateMachineId: this.source.config.stateMachineId, client: this.source.client },
|
|
17761
|
-
{ stateMachineId: this.dest.config.stateMachineId, client: this.dest.client }
|
|
17762
|
-
);
|
|
17965
|
+
return handler.quote({ ...params, strategy }, source, destination);
|
|
17763
17966
|
}
|
|
17764
17967
|
/**
|
|
17765
17968
|
* Bidirectional async generator that orchestrates the full order lifecycle:
|
|
17766
17969
|
* placement, fee estimation, bid collection, and execution.
|
|
17767
17970
|
*
|
|
17768
17971
|
* **Yield/receive protocol:**
|
|
17769
|
-
* 1. If `order.fees` is unset or zero, estimates gas and sets
|
|
17770
|
-
*
|
|
17972
|
+
* 1. If `order.fees` is unset or zero, estimates gas and sets same-chain
|
|
17973
|
+
* `order.fees` to twice the estimate. Cross-chain orders retain a 1% buffer
|
|
17974
|
+
* and include an additional 600k-gas fee uplift, while the wei cost used for
|
|
17975
|
+
* the `value` field receives a 2% buffer.
|
|
17771
17976
|
* 2. Yields `AWAITING_PLACE_ORDER` with `{ to, data, value, sessionPrivateKey }`.
|
|
17772
17977
|
* The caller must sign the transaction and pass it back via `gen.next(signedTx)`.
|
|
17773
17978
|
* 3. Yields `ORDER_PLACED` with the finalised order and transaction hash once
|
|
@@ -17799,8 +18004,15 @@ var IntentGateway = class _IntentGateway {
|
|
|
17799
18004
|
if (estimate.totalGasCostWei === 0n || estimate.totalGasInFeeToken === 0n) {
|
|
17800
18005
|
throw new Error("Gas estimation failed");
|
|
17801
18006
|
}
|
|
18007
|
+
const isSameChain = this.source.config.stateMachineId === this.dest.config.stateMachineId;
|
|
17802
18008
|
value = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
|
|
17803
|
-
|
|
18009
|
+
const crossChainFeeBump = isSameChain ? 0n : await convertGasToFeeToken(
|
|
18010
|
+
this.ctx,
|
|
18011
|
+
CROSS_CHAIN_ORDER_FEE_GAS_BUMP,
|
|
18012
|
+
"source",
|
|
18013
|
+
this.source.config.stateMachineId
|
|
18014
|
+
);
|
|
18015
|
+
order.fees = isSameChain ? estimate.totalGasInFeeToken * 2n : estimate.totalGasInFeeToken + (crossChainFeeBump + estimate.totalGasInFeeToken * 1n / 100n);
|
|
17804
18016
|
}
|
|
17805
18017
|
const placeOrderGen = this.orderPlacer.placeOrder(order, graffiti);
|
|
17806
18018
|
const placeOrderFirst = await placeOrderGen.next();
|
|
@@ -18181,7 +18393,9 @@ var IntentGateway = class _IntentGateway {
|
|
|
18181
18393
|
}
|
|
18182
18394
|
requireIndexer() {
|
|
18183
18395
|
if (!this.indexer) {
|
|
18184
|
-
throw new Error(
|
|
18396
|
+
throw new Error(
|
|
18397
|
+
"IntentGateway: call withQueryClient(queryClient) before using indexer-backed methods or Phantom quotes"
|
|
18398
|
+
);
|
|
18185
18399
|
}
|
|
18186
18400
|
return this.indexer;
|
|
18187
18401
|
}
|
|
@@ -22695,6 +22909,6 @@ async function teleportDot(param_) {
|
|
|
22695
22909
|
return stream;
|
|
22696
22910
|
}
|
|
22697
22911
|
|
|
22698
|
-
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
22912
|
+
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, InvalidPhantomSnapshotError, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PhantomSnapshotUnavailableError, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
22699
22913
|
//# sourceMappingURL=index.js.map
|
|
22700
22914
|
//# sourceMappingURL=index.js.map
|