@hyperbridge/sdk 1.8.2 → 1.8.4
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 +11 -6
- package/dist/browser/index.js +66 -36
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +11 -6
- package/dist/node/index.js +66 -36
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -1837,6 +1837,10 @@ declare enum TeleportStatus {
|
|
|
1837
1837
|
RECEIVED = "RECEIVED",
|
|
1838
1838
|
REFUNDED = "REFUNDED"
|
|
1839
1839
|
}
|
|
1840
|
+
interface CancelQuote {
|
|
1841
|
+
nativeValue: bigint;
|
|
1842
|
+
relayerFee: bigint;
|
|
1843
|
+
}
|
|
1840
1844
|
interface TokenGatewayAssetTeleportedResponse {
|
|
1841
1845
|
tokenGatewayAssetTeleportedV2s: {
|
|
1842
1846
|
nodes: Array<{
|
|
@@ -3909,16 +3913,17 @@ declare class IntentGateway {
|
|
|
3909
3913
|
};
|
|
3910
3914
|
}): AsyncGenerator<IntentOrderStatusUpdate, void, HexString>;
|
|
3911
3915
|
/**
|
|
3912
|
-
*
|
|
3916
|
+
* Returns both the native token cost and the relayer fee for cancelling an
|
|
3917
|
+
* order. Use `relayerFee` to approve the ERC-20 spend before submitting.
|
|
3913
3918
|
*
|
|
3914
|
-
* Delegates to {@link OrderCanceller.
|
|
3919
|
+
* Delegates to {@link OrderCanceller.quoteCancelOrder}.
|
|
3915
3920
|
*
|
|
3916
3921
|
* @param order - The order to quote cancellation for.
|
|
3917
3922
|
* @param fromDest - If `true`, quotes the destination-initiated cancellation fee.
|
|
3918
|
-
*
|
|
3919
|
-
*
|
|
3923
|
+
* @returns `{ nativeValue }` — native token amount (wei) to send as `value`;
|
|
3924
|
+
* `{ relayerFee }` — relayer incentive denominated in the chain's fee token.
|
|
3920
3925
|
*/
|
|
3921
|
-
|
|
3926
|
+
quoteCancelOrder(order: Order, fromDest?: boolean): Promise<CancelQuote>;
|
|
3922
3927
|
/**
|
|
3923
3928
|
* Async generator that cancels an order and streams status events until
|
|
3924
3929
|
* cancellation is complete.
|
|
@@ -8029,4 +8034,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
|
8029
8034
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
8030
8035
|
declare const hyperbridgeAddress = "";
|
|
8031
8036
|
|
|
8032
|
-
export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, parseStateMachineId, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
8037
|
+
export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, parseStateMachineId, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
package/dist/node/index.js
CHANGED
|
@@ -14826,6 +14826,34 @@ async function convertGasToFeeToken(ctx, gasEstimate, gasEstimateIn, evmChainID,
|
|
|
14826
14826
|
return parseUnits(gasCostInFeeToken.toFixed(feeToken.decimals), feeToken.decimals);
|
|
14827
14827
|
}
|
|
14828
14828
|
}
|
|
14829
|
+
async function convertFeeTokenToWei(ctx, feeTokenAmount, feeTokenIn, evmChainID) {
|
|
14830
|
+
const chain = ctx[feeTokenIn];
|
|
14831
|
+
const client = chain.client;
|
|
14832
|
+
const wethAddr = chain.configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
14833
|
+
const feeToken = await getFeeToken(ctx, evmChainID, chain);
|
|
14834
|
+
try {
|
|
14835
|
+
const { amountOut } = await ctx.swap.findBestProtocolWithAmountIn(
|
|
14836
|
+
client,
|
|
14837
|
+
feeToken.address,
|
|
14838
|
+
wethAddr,
|
|
14839
|
+
feeTokenAmount,
|
|
14840
|
+
evmChainID,
|
|
14841
|
+
{ selectedProtocol: "v2" }
|
|
14842
|
+
);
|
|
14843
|
+
if (amountOut === 0n) {
|
|
14844
|
+
throw new Error();
|
|
14845
|
+
}
|
|
14846
|
+
return amountOut;
|
|
14847
|
+
} catch {
|
|
14848
|
+
const nativeCurrency = client.chain?.nativeCurrency;
|
|
14849
|
+
const chainId = Number.parseInt(evmChainID.split("-")[1]);
|
|
14850
|
+
const feeTokenAmountInToken = new Decimal2(formatUnits(feeTokenAmount, feeToken.decimals));
|
|
14851
|
+
const nativeTokenPriceUsd = await fetchPrice(nativeCurrency?.symbol, chainId);
|
|
14852
|
+
const feeTokenAmountUsd = feeTokenAmountInToken.times(new Decimal2(1));
|
|
14853
|
+
const nativeAmount = feeTokenAmountUsd.dividedBy(nativeTokenPriceUsd);
|
|
14854
|
+
return parseUnits(nativeAmount.toFixed(nativeCurrency?.decimals ?? 18), nativeCurrency?.decimals ?? 18);
|
|
14855
|
+
}
|
|
14856
|
+
}
|
|
14829
14857
|
|
|
14830
14858
|
// src/protocols/intents/OrderPlacer.ts
|
|
14831
14859
|
var OrderPlacer = class {
|
|
@@ -15157,21 +15185,20 @@ var OrderCanceller = class {
|
|
|
15157
15185
|
this.ctx = ctx;
|
|
15158
15186
|
}
|
|
15159
15187
|
/**
|
|
15160
|
-
*
|
|
15161
|
-
*
|
|
15162
|
-
*
|
|
15163
|
-
* quote covers the ISMP GET/POST dispatch fee.
|
|
15188
|
+
* Returns both the native token cost and the relayer fee for cancelling an
|
|
15189
|
+
* order. Frontends can use `relayerFee` to approve the ERC-20 spend before
|
|
15190
|
+
* submitting the cancel transaction.
|
|
15164
15191
|
*
|
|
15165
|
-
* @param order - The order to quote
|
|
15166
|
-
* @param fromDest - If `true`, quotes the destination-initiated
|
|
15167
|
-
*
|
|
15168
|
-
*
|
|
15192
|
+
* @param order - The order to quote.
|
|
15193
|
+
* @param fromDest - If `true`, quotes the destination-initiated path.
|
|
15194
|
+
* @returns `{ nativeValue }` — native token amount (wei) to send as `value`;
|
|
15195
|
+
* `{ relayerFee }` — relayer incentive denominated in the chain's fee token.
|
|
15169
15196
|
*/
|
|
15170
|
-
async
|
|
15197
|
+
async quoteCancelOrder(order, fromDest = false) {
|
|
15171
15198
|
if (fromDest) {
|
|
15172
|
-
return this.
|
|
15199
|
+
return this.quoteCancelFromDest(order);
|
|
15173
15200
|
}
|
|
15174
|
-
return this.
|
|
15201
|
+
return this.quoteCancelFromSource(order);
|
|
15175
15202
|
}
|
|
15176
15203
|
/**
|
|
15177
15204
|
* Quotes the native token cost of a source-initiated cross-chain cancellation.
|
|
@@ -15183,8 +15210,9 @@ var OrderCanceller = class {
|
|
|
15183
15210
|
* @param order - The order to quote.
|
|
15184
15211
|
* @returns The native token dispatch fee in wei.
|
|
15185
15212
|
*/
|
|
15186
|
-
async
|
|
15187
|
-
if (order.source === order.destination) return 0n;
|
|
15213
|
+
async quoteCancelFromSource(order) {
|
|
15214
|
+
if (order.source === order.destination) return { nativeValue: 0n, relayerFee: 0n };
|
|
15215
|
+
const sourceStateMachine = order.source.startsWith("0x") ? hexToString(order.source) : order.source;
|
|
15188
15216
|
const height = order.deadline + 1n;
|
|
15189
15217
|
const destIntentGateway = this.ctx.dest.configService.getIntentGatewayV2Address(
|
|
15190
15218
|
hexToString(order.destination)
|
|
@@ -15198,7 +15226,7 @@ var OrderCanceller = class {
|
|
|
15198
15226
|
const key = concatHex([destIntentGateway, slotHash]);
|
|
15199
15227
|
const context = encodeWithdrawalRequest(order, order.user);
|
|
15200
15228
|
const getRequest = {
|
|
15201
|
-
source:
|
|
15229
|
+
source: sourceStateMachine,
|
|
15202
15230
|
dest: order.destination.startsWith("0x") ? hexToString(order.destination) : order.destination,
|
|
15203
15231
|
from: this.ctx.source.configService.getIntentGatewayV2Address(hexToString(order.destination)),
|
|
15204
15232
|
nonce: await this.ctx.source.getHostNonce(),
|
|
@@ -15207,7 +15235,10 @@ var OrderCanceller = class {
|
|
|
15207
15235
|
timeoutTimestamp: 0n,
|
|
15208
15236
|
context
|
|
15209
15237
|
};
|
|
15210
|
-
|
|
15238
|
+
const feeInSourceFeeToken = await convertGasToFeeToken(this.ctx, 400000n, "source", sourceStateMachine);
|
|
15239
|
+
const relayerFee = feeInSourceFeeToken * 1005n / 1000n;
|
|
15240
|
+
const nativeValue = await this.ctx.source.quoteNative(getRequest, relayerFee);
|
|
15241
|
+
return { nativeValue, relayerFee };
|
|
15211
15242
|
}
|
|
15212
15243
|
/**
|
|
15213
15244
|
* Async generator that cancels an order and streams status events until
|
|
@@ -15302,17 +15333,17 @@ var OrderCanceller = class {
|
|
|
15302
15333
|
STORAGE_KEYS.getRequest(orderId)
|
|
15303
15334
|
);
|
|
15304
15335
|
if (!getRequest) {
|
|
15305
|
-
const
|
|
15336
|
+
const quote = await this.quoteCancelFromSource(order);
|
|
15306
15337
|
const data = encodeFunctionData({
|
|
15307
15338
|
abi: ABI7,
|
|
15308
15339
|
functionName: "cancelOrder",
|
|
15309
|
-
args: [transformOrderForContract(order), { relayerFee:
|
|
15340
|
+
args: [transformOrderForContract(order), { relayerFee: quote.relayerFee, height: destIProof.height }]
|
|
15310
15341
|
});
|
|
15311
15342
|
const signedTransaction = yield {
|
|
15312
15343
|
status: "AWAITING_CANCEL_TRANSACTION",
|
|
15313
15344
|
data,
|
|
15314
15345
|
to: intentGatewayAddress,
|
|
15315
|
-
value
|
|
15346
|
+
value: quote.nativeValue
|
|
15316
15347
|
};
|
|
15317
15348
|
const receipt = signedTransaction.length === 66 ? await this.ctx.source.getTransactionReceipt(signedTransaction) : await this.ctx.source.broadcastTransaction(signedTransaction);
|
|
15318
15349
|
const events = parseEventLogs({ abi: evmHost_default.ABI, logs: receipt.logs });
|
|
@@ -15397,8 +15428,8 @@ var OrderCanceller = class {
|
|
|
15397
15428
|
* @param order - The order to quote.
|
|
15398
15429
|
* @returns The native token dispatch fee in wei.
|
|
15399
15430
|
*/
|
|
15400
|
-
async
|
|
15401
|
-
if (order.source === order.destination) return 0n;
|
|
15431
|
+
async quoteCancelFromDest(order) {
|
|
15432
|
+
if (order.source === order.destination) return { nativeValue: 0n, relayerFee: 0n };
|
|
15402
15433
|
const destStateMachine = order.destination.startsWith("0x") ? hexToString(order.destination) : order.destination;
|
|
15403
15434
|
const sourceStateMachine = order.source.startsWith("0x") ? hexToString(order.source) : order.source;
|
|
15404
15435
|
const destIntentGateway = this.ctx.dest.configService.getIntentGatewayV2Address(destStateMachine);
|
|
@@ -15414,7 +15445,8 @@ var OrderCanceller = class {
|
|
|
15414
15445
|
body,
|
|
15415
15446
|
timeoutTimestamp: 0n
|
|
15416
15447
|
};
|
|
15417
|
-
|
|
15448
|
+
const nativeValue = await this.ctx.dest.quoteNative(postRequest, relayerFee);
|
|
15449
|
+
return { nativeValue, relayerFee };
|
|
15418
15450
|
}
|
|
15419
15451
|
/**
|
|
15420
15452
|
* Async generator that cancels an order by initiating from the destination
|
|
@@ -15447,17 +15479,17 @@ var OrderCanceller = class {
|
|
|
15447
15479
|
STORAGE_KEYS.postCommitment(orderId)
|
|
15448
15480
|
);
|
|
15449
15481
|
if (!commitment) {
|
|
15450
|
-
const
|
|
15482
|
+
const quote = await this.quoteCancelFromDest(order);
|
|
15451
15483
|
const data = encodeFunctionData({
|
|
15452
15484
|
abi: ABI7,
|
|
15453
15485
|
functionName: "cancelOrder",
|
|
15454
|
-
args: [transformOrderForContract(order), { relayerFee:
|
|
15486
|
+
args: [transformOrderForContract(order), { relayerFee: quote.relayerFee, height: 0n }]
|
|
15455
15487
|
});
|
|
15456
15488
|
const signedTransaction = yield {
|
|
15457
15489
|
status: "AWAITING_CANCEL_TRANSACTION",
|
|
15458
15490
|
data,
|
|
15459
15491
|
to: intentGatewayAddress,
|
|
15460
|
-
value
|
|
15492
|
+
value: quote.nativeValue
|
|
15461
15493
|
};
|
|
15462
15494
|
const receipt = signedTransaction.length === 66 ? await this.ctx.dest.getTransactionReceipt(signedTransaction) : await this.ctx.dest.broadcastTransaction(signedTransaction);
|
|
15463
15495
|
yield {
|
|
@@ -17887,7 +17919,7 @@ var GasEstimator = class {
|
|
|
17887
17919
|
}
|
|
17888
17920
|
}
|
|
17889
17921
|
const totalGas = callGasLimit + verificationGasLimit + preVerificationGas;
|
|
17890
|
-
const
|
|
17922
|
+
const rawTotalGasCostWei = totalGas * maxFeePerGas;
|
|
17891
17923
|
const totalGasInDestFeeToken = await convertGasToFeeToken(
|
|
17892
17924
|
this.ctx,
|
|
17893
17925
|
totalGas,
|
|
@@ -17895,11 +17927,8 @@ var GasEstimator = class {
|
|
|
17895
17927
|
destStateMachineId,
|
|
17896
17928
|
gasPrice
|
|
17897
17929
|
);
|
|
17898
|
-
const totalGasInSourceFeeToken = adjustDecimals(
|
|
17899
|
-
|
|
17900
|
-
destFeeToken.decimals,
|
|
17901
|
-
sourceFeeToken.decimals
|
|
17902
|
-
);
|
|
17930
|
+
const totalGasInSourceFeeToken = isSameChain ? totalGasInDestFeeToken : adjustDecimals(totalGasInDestFeeToken, destFeeToken.decimals, sourceFeeToken.decimals);
|
|
17931
|
+
const totalGasCostWei = isSameChain ? rawTotalGasCostWei : await convertFeeTokenToWei(this.ctx, totalGasInSourceFeeToken, "source", souceStateMachineId);
|
|
17903
17932
|
return {
|
|
17904
17933
|
callGasLimit,
|
|
17905
17934
|
verificationGasLimit,
|
|
@@ -18340,17 +18369,18 @@ var IntentGateway = class _IntentGateway {
|
|
|
18340
18369
|
return;
|
|
18341
18370
|
}
|
|
18342
18371
|
/**
|
|
18343
|
-
*
|
|
18372
|
+
* Returns both the native token cost and the relayer fee for cancelling an
|
|
18373
|
+
* order. Use `relayerFee` to approve the ERC-20 spend before submitting.
|
|
18344
18374
|
*
|
|
18345
|
-
* Delegates to {@link OrderCanceller.
|
|
18375
|
+
* Delegates to {@link OrderCanceller.quoteCancelOrder}.
|
|
18346
18376
|
*
|
|
18347
18377
|
* @param order - The order to quote cancellation for.
|
|
18348
18378
|
* @param fromDest - If `true`, quotes the destination-initiated cancellation fee.
|
|
18349
|
-
*
|
|
18350
|
-
*
|
|
18379
|
+
* @returns `{ nativeValue }` — native token amount (wei) to send as `value`;
|
|
18380
|
+
* `{ relayerFee }` — relayer incentive denominated in the chain's fee token.
|
|
18351
18381
|
*/
|
|
18352
|
-
async
|
|
18353
|
-
return this.orderCanceller.
|
|
18382
|
+
async quoteCancelOrder(order, fromDest = false) {
|
|
18383
|
+
return this.orderCanceller.quoteCancelOrder(order, fromDest);
|
|
18354
18384
|
}
|
|
18355
18385
|
/**
|
|
18356
18386
|
* Async generator that cancels an order and streams status events until
|