@hyperbridge/sdk 2.8.12 → 2.8.13
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 +61 -2
- package/dist/browser/index.js +133 -22
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +134 -20
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +133 -22
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-C9PJp8rx.d.cts → intents-helpers-fntBuoYM.d.cts} +61 -2
- package/dist/node/{intents-helpers-C9PJp8rx.d.ts → intents-helpers-fntBuoYM.d.ts} +61 -2
- package/dist/node/intents-helpers.cjs +135 -21
- 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 +134 -23
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IChain, H as HexString, a as IEvmConfig, C as ChainConfigService, b as IMessage, S as StateMachineIdParams, c as StateMachineHeight, d as IIsmpMessage, e as IPostRequest, f as IGetRequest, O as Order, E as EstimateGasCallData, R as RetryConfig, g as IPolkadotHubConfig, h as IPharosConfig, i as StateMachineUpdate, P as PostRequestWithStatus, G as GetRequestWithStatus, j as ResponseCommitmentWithValues, k as RequestStatusWithMetadata, l as PostRequestTimeoutStatus, m as SubstrateChain, n as ClientConfig, o as IndexerQueryClient, A as AssetTeleported, T as Transaction, p as IProof, q as IEvmChain, r as IntentsCoprocessor, s as Chains, t as ConfiguredAssetSymbol, u as AvailableLiquidity, Q as QueryBuyAndSellRatesParams, B as BuyAndSellRates, v as IntentOrderStatusUpdate, w as SelectBidResult, x as ResumeIntentOrderOptions, y as CancelOrderOptions, z as CancelQuote, D as SubmitBidOptions, F as PackedUserOperation, J as FillerBid, K as Bid, L as EstimateFillOrderParams, M as FillOrderEstimate, N as OrderFeesQuote, U as ERC7821Call, V as OrderWithStatus, W as OrderStatus, X as TokenGatewayAssetTeleportedWithStatus, Y as TeleportStatus, Z as DecodedOrderPlacedLog, _ as DecodedPostRequestEvent, $ as DecodedPostResponseEvent } from './intents-helpers-
|
|
2
|
-
export { a0 as AllStatusKey, a1 as AssetTeleportedResponse, a2 as BidStorageEntry, a3 as BidSubmissionResult, a4 as BlockMetadata, a5 as BytesLikeHex, a6 as CHAINS_WITHOUT_VALID_UNTIL, a7 as CancelOptions, a8 as ChainConfig, a9 as ChainConfigData, aa as ConfiguredAssetSymbolInput, ab as Deployment, ac as DispatchGet, ad as DispatchInfo, ae as DispatchPost, af as Erc4626VaultConfigData, ag as ExecuteIntentOrderOptions, ah as ExecutionResult, ai as FILL_ORDER_V1_ABI, aj as FillOptions, ak as FillOptionsVersion, al as FillerConfig, am as GetRequestResponse, an as GetResponseByRequestIdResponse, ao as GetResponseStorageValues, ap as HostParams, aq as HyperClientStatus, ar as IBatchConsensusAndGetResponseMessage, as as IBatchConsensusAndPostRequestMessage, at as IConfig, au as IConsensusMessage, av as IGetRequestMessage, aw as IGetResponse, ax as IGetResponseMessage, ay as IHyperbridgeConfig, az as INCLUSION_TIMEOUT_MS, aA as IPostResponse, aB as IRequestMessage, aC as ISubstrateConfig, aD as ITimeoutPostRequestMessage, aE as IntentGatewayABI, aF as IntentGatewayParams, aG as IntentOrderStatus, aH as IntentOrderStatusKey, aI as IsmpRequest, aJ as LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, aK as LiquiditySlice, aL as OrderResponse, aM as OrderStatusMetadata, aN as
|
|
1
|
+
import { I as IChain, H as HexString, a as IEvmConfig, C as ChainConfigService, b as IMessage, S as StateMachineIdParams, c as StateMachineHeight, d as IIsmpMessage, e as IPostRequest, f as IGetRequest, O as Order, E as EstimateGasCallData, R as RetryConfig, g as IPolkadotHubConfig, h as IPharosConfig, i as StateMachineUpdate, P as PostRequestWithStatus, G as GetRequestWithStatus, j as ResponseCommitmentWithValues, k as RequestStatusWithMetadata, l as PostRequestTimeoutStatus, m as SubstrateChain, n as ClientConfig, o as IndexerQueryClient, A as AssetTeleported, T as Transaction, p as IProof, q as IEvmChain, r as IntentsCoprocessor, s as Chains, t as ConfiguredAssetSymbol, u as AvailableLiquidity, Q as QueryBuyAndSellRatesParams, B as BuyAndSellRates, v as IntentOrderStatusUpdate, w as SelectBidResult, x as ResumeIntentOrderOptions, y as CancelOrderOptions, z as CancelQuote, D as SubmitBidOptions, F as PackedUserOperation, J as FillerBid, K as Bid, L as EstimateFillOrderParams, M as FillOrderEstimate, N as OrderFeesQuote, U as ERC7821Call, V as OrderWithStatus, W as OrderStatus, X as TokenGatewayAssetTeleportedWithStatus, Y as TeleportStatus, Z as DecodedOrderPlacedLog, _ as DecodedPostRequestEvent, $ as DecodedPostResponseEvent } from './intents-helpers-fntBuoYM.cjs';
|
|
2
|
+
export { a0 as AllStatusKey, a1 as AssetTeleportedResponse, a2 as BidStorageEntry, a3 as BidSubmissionResult, a4 as BlockMetadata, a5 as BytesLikeHex, a6 as CHAINS_WITHOUT_VALID_UNTIL, a7 as CancelOptions, a8 as ChainConfig, a9 as ChainConfigData, aa as ConfiguredAssetSymbolInput, ab as Deployment, ac as DispatchGet, ad as DispatchInfo, ae as DispatchPost, af as Erc4626VaultConfigData, ag as ExecuteIntentOrderOptions, ah as ExecutionResult, ai as FILL_ORDER_V1_ABI, aj as FillOptions, ak as FillOptionsVersion, al as FillerConfig, am as GetRequestResponse, an as GetResponseByRequestIdResponse, ao as GetResponseStorageValues, ap as HostParams, aq as HyperClientStatus, ar as IBatchConsensusAndGetResponseMessage, as as IBatchConsensusAndPostRequestMessage, at as IConfig, au as IConsensusMessage, av as IGetRequestMessage, aw as IGetResponse, ax as IGetResponseMessage, ay as IHyperbridgeConfig, az as INCLUSION_TIMEOUT_MS, aA as IPostResponse, aB as IRequestMessage, aC as ISubstrateConfig, aD as ITimeoutPostRequestMessage, aE as IntentGatewayABI, aF as IntentGatewayParams, aG as IntentOrderStatus, aH as IntentOrderStatusKey, aI as IsmpRequest, aJ as LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, aK as LiquiditySlice, aL as OrderResponse, aM as OrderStatusMetadata, aN as PERMIT2_SPONSORSHIP_BYTES, aO as PaymentInfo, aP as PhantomBid, aQ as PhantomBidBatchResult, aR as PhantomBidDeclaration, aS as PhantomBidOutcome, aT as PhantomBidPaymasterAndData, aU as PhantomBidSponsorship, aV as PhantomOrderEvent, aW as PhantomOrderLeg, aX as PhantomOrderPriceSnapshot, aY as PhantomOrderPriceSnapshotsResponse, aZ as PhantomTimings, a_ as PollPhantomOrdersOptions, a$ as PostRequestStatus, b0 as RequestBody, b1 as RequestCommitment, b2 as RequestKind, b3 as RequestResponse, b4 as RequestStatus, b5 as RequestStatusKey, b6 as SelectOptions, b7 as SigningAccount, b8 as StateMachineId, b9 as StateMachineResponse, ba as StorageFacade, bb as TimeoutStatus, bc as TimeoutStatusKey, bd as TokenGatewayAssetTeleportedResponse, be as TokenInfo, bf as TokenPrice, bg as TokenPricesResponse, bh as UNISWAP_QUOTE_HAIRCUT_BPS, bi as UniswapV4PoolConfigData, bj as applyProtocolFeeHaircut, bk as applyUniswapQuoteHaircut, bl as chainConfigs, bm as convertCodecToIGetRequest, bn as convertCodecToIProof, bo as convertIGetRequestToCodec, bp as convertIProofToCodec, bq as convertStateIdToStateMachineId, br as convertStateMachineEnumToString, bs as convertStateMachineIdToEnum, bt as decodeAcceptedSourceChains, bu as decodeERC7821ExecuteBatch, bv as decodeFillOrder, bw as decodePhantomBidDeclaration, bx as decodePhantomBidPaymasterAndData, by as decodeUserOpScale, bz as deriveHttpUrl, bA as encodeAcceptedSourceChains, bB as encodeERC7821ExecuteBatch, bC as encodeFillOrder, bD as encodeISMPMessage, bE as encodePhantomBidDeclaration, bF as encodePhantomBidPaymasterAndData, bG as encodeUserOpScale, bH as getChainId, bI as getConfigByStateMachineId, bJ as getFillOptionsVersion, bK as getViemChain, bL as hyperbridgeAddress, bM as pharosAtlantic, bN as pharosMainnet, bO as polkadotAssetHubPaseo, bP as polkadotHubMainnet, bQ as poolSlug, bR as readProtocolFeeHaircutBps, bS as resetFillOptionsVersionCache, bT as sortPoolSymbols, bU as tronChainIds, bV as tronNile } from './intents-helpers-fntBuoYM.cjs';
|
|
3
3
|
import { ConsolaInstance } from 'consola';
|
|
4
4
|
import { GraphQLClient } from 'graphql-request';
|
|
5
5
|
import { PublicClient, TransactionReceipt, Hex, Address } from 'viem';
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IChain, H as HexString, a as IEvmConfig, C as ChainConfigService, b as IMessage, S as StateMachineIdParams, c as StateMachineHeight, d as IIsmpMessage, e as IPostRequest, f as IGetRequest, O as Order, E as EstimateGasCallData, R as RetryConfig, g as IPolkadotHubConfig, h as IPharosConfig, i as StateMachineUpdate, P as PostRequestWithStatus, G as GetRequestWithStatus, j as ResponseCommitmentWithValues, k as RequestStatusWithMetadata, l as PostRequestTimeoutStatus, m as SubstrateChain, n as ClientConfig, o as IndexerQueryClient, A as AssetTeleported, T as Transaction, p as IProof, q as IEvmChain, r as IntentsCoprocessor, s as Chains, t as ConfiguredAssetSymbol, u as AvailableLiquidity, Q as QueryBuyAndSellRatesParams, B as BuyAndSellRates, v as IntentOrderStatusUpdate, w as SelectBidResult, x as ResumeIntentOrderOptions, y as CancelOrderOptions, z as CancelQuote, D as SubmitBidOptions, F as PackedUserOperation, J as FillerBid, K as Bid, L as EstimateFillOrderParams, M as FillOrderEstimate, N as OrderFeesQuote, U as ERC7821Call, V as OrderWithStatus, W as OrderStatus, X as TokenGatewayAssetTeleportedWithStatus, Y as TeleportStatus, Z as DecodedOrderPlacedLog, _ as DecodedPostRequestEvent, $ as DecodedPostResponseEvent } from './intents-helpers-
|
|
2
|
-
export { a0 as AllStatusKey, a1 as AssetTeleportedResponse, a2 as BidStorageEntry, a3 as BidSubmissionResult, a4 as BlockMetadata, a5 as BytesLikeHex, a6 as CHAINS_WITHOUT_VALID_UNTIL, a7 as CancelOptions, a8 as ChainConfig, a9 as ChainConfigData, aa as ConfiguredAssetSymbolInput, ab as Deployment, ac as DispatchGet, ad as DispatchInfo, ae as DispatchPost, af as Erc4626VaultConfigData, ag as ExecuteIntentOrderOptions, ah as ExecutionResult, ai as FILL_ORDER_V1_ABI, aj as FillOptions, ak as FillOptionsVersion, al as FillerConfig, am as GetRequestResponse, an as GetResponseByRequestIdResponse, ao as GetResponseStorageValues, ap as HostParams, aq as HyperClientStatus, ar as IBatchConsensusAndGetResponseMessage, as as IBatchConsensusAndPostRequestMessage, at as IConfig, au as IConsensusMessage, av as IGetRequestMessage, aw as IGetResponse, ax as IGetResponseMessage, ay as IHyperbridgeConfig, az as INCLUSION_TIMEOUT_MS, aA as IPostResponse, aB as IRequestMessage, aC as ISubstrateConfig, aD as ITimeoutPostRequestMessage, aE as IntentGatewayABI, aF as IntentGatewayParams, aG as IntentOrderStatus, aH as IntentOrderStatusKey, aI as IsmpRequest, aJ as LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, aK as LiquiditySlice, aL as OrderResponse, aM as OrderStatusMetadata, aN as
|
|
1
|
+
import { I as IChain, H as HexString, a as IEvmConfig, C as ChainConfigService, b as IMessage, S as StateMachineIdParams, c as StateMachineHeight, d as IIsmpMessage, e as IPostRequest, f as IGetRequest, O as Order, E as EstimateGasCallData, R as RetryConfig, g as IPolkadotHubConfig, h as IPharosConfig, i as StateMachineUpdate, P as PostRequestWithStatus, G as GetRequestWithStatus, j as ResponseCommitmentWithValues, k as RequestStatusWithMetadata, l as PostRequestTimeoutStatus, m as SubstrateChain, n as ClientConfig, o as IndexerQueryClient, A as AssetTeleported, T as Transaction, p as IProof, q as IEvmChain, r as IntentsCoprocessor, s as Chains, t as ConfiguredAssetSymbol, u as AvailableLiquidity, Q as QueryBuyAndSellRatesParams, B as BuyAndSellRates, v as IntentOrderStatusUpdate, w as SelectBidResult, x as ResumeIntentOrderOptions, y as CancelOrderOptions, z as CancelQuote, D as SubmitBidOptions, F as PackedUserOperation, J as FillerBid, K as Bid, L as EstimateFillOrderParams, M as FillOrderEstimate, N as OrderFeesQuote, U as ERC7821Call, V as OrderWithStatus, W as OrderStatus, X as TokenGatewayAssetTeleportedWithStatus, Y as TeleportStatus, Z as DecodedOrderPlacedLog, _ as DecodedPostRequestEvent, $ as DecodedPostResponseEvent } from './intents-helpers-fntBuoYM.js';
|
|
2
|
+
export { a0 as AllStatusKey, a1 as AssetTeleportedResponse, a2 as BidStorageEntry, a3 as BidSubmissionResult, a4 as BlockMetadata, a5 as BytesLikeHex, a6 as CHAINS_WITHOUT_VALID_UNTIL, a7 as CancelOptions, a8 as ChainConfig, a9 as ChainConfigData, aa as ConfiguredAssetSymbolInput, ab as Deployment, ac as DispatchGet, ad as DispatchInfo, ae as DispatchPost, af as Erc4626VaultConfigData, ag as ExecuteIntentOrderOptions, ah as ExecutionResult, ai as FILL_ORDER_V1_ABI, aj as FillOptions, ak as FillOptionsVersion, al as FillerConfig, am as GetRequestResponse, an as GetResponseByRequestIdResponse, ao as GetResponseStorageValues, ap as HostParams, aq as HyperClientStatus, ar as IBatchConsensusAndGetResponseMessage, as as IBatchConsensusAndPostRequestMessage, at as IConfig, au as IConsensusMessage, av as IGetRequestMessage, aw as IGetResponse, ax as IGetResponseMessage, ay as IHyperbridgeConfig, az as INCLUSION_TIMEOUT_MS, aA as IPostResponse, aB as IRequestMessage, aC as ISubstrateConfig, aD as ITimeoutPostRequestMessage, aE as IntentGatewayABI, aF as IntentGatewayParams, aG as IntentOrderStatus, aH as IntentOrderStatusKey, aI as IsmpRequest, aJ as LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, aK as LiquiditySlice, aL as OrderResponse, aM as OrderStatusMetadata, aN as PERMIT2_SPONSORSHIP_BYTES, aO as PaymentInfo, aP as PhantomBid, aQ as PhantomBidBatchResult, aR as PhantomBidDeclaration, aS as PhantomBidOutcome, aT as PhantomBidPaymasterAndData, aU as PhantomBidSponsorship, aV as PhantomOrderEvent, aW as PhantomOrderLeg, aX as PhantomOrderPriceSnapshot, aY as PhantomOrderPriceSnapshotsResponse, aZ as PhantomTimings, a_ as PollPhantomOrdersOptions, a$ as PostRequestStatus, b0 as RequestBody, b1 as RequestCommitment, b2 as RequestKind, b3 as RequestResponse, b4 as RequestStatus, b5 as RequestStatusKey, b6 as SelectOptions, b7 as SigningAccount, b8 as StateMachineId, b9 as StateMachineResponse, ba as StorageFacade, bb as TimeoutStatus, bc as TimeoutStatusKey, bd as TokenGatewayAssetTeleportedResponse, be as TokenInfo, bf as TokenPrice, bg as TokenPricesResponse, bh as UNISWAP_QUOTE_HAIRCUT_BPS, bi as UniswapV4PoolConfigData, bj as applyProtocolFeeHaircut, bk as applyUniswapQuoteHaircut, bl as chainConfigs, bm as convertCodecToIGetRequest, bn as convertCodecToIProof, bo as convertIGetRequestToCodec, bp as convertIProofToCodec, bq as convertStateIdToStateMachineId, br as convertStateMachineEnumToString, bs as convertStateMachineIdToEnum, bt as decodeAcceptedSourceChains, bu as decodeERC7821ExecuteBatch, bv as decodeFillOrder, bw as decodePhantomBidDeclaration, bx as decodePhantomBidPaymasterAndData, by as decodeUserOpScale, bz as deriveHttpUrl, bA as encodeAcceptedSourceChains, bB as encodeERC7821ExecuteBatch, bC as encodeFillOrder, bD as encodeISMPMessage, bE as encodePhantomBidDeclaration, bF as encodePhantomBidPaymasterAndData, bG as encodeUserOpScale, bH as getChainId, bI as getConfigByStateMachineId, bJ as getFillOptionsVersion, bK as getViemChain, bL as hyperbridgeAddress, bM as pharosAtlantic, bN as pharosMainnet, bO as polkadotAssetHubPaseo, bP as polkadotHubMainnet, bQ as poolSlug, bR as readProtocolFeeHaircutBps, bS as resetFillOptionsVersionCache, bT as sortPoolSymbols, bU as tronChainIds, bV as tronNile } from './intents-helpers-fntBuoYM.js';
|
|
3
3
|
import { ConsolaInstance } from 'consola';
|
|
4
4
|
import { GraphQLClient } from 'graphql-request';
|
|
5
5
|
import { PublicClient, TransactionReceipt, Hex, Address } from 'viem';
|
package/dist/node/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { match } from 'ts-pattern';
|
|
|
10
10
|
import { WsProvider, ApiPromise, Keyring, HttpProvider } from '@polkadot/api';
|
|
11
11
|
import { Struct, Vector, u8, Bytes, Enum, Tuple, _void, u64, u32, Option, bool, u128 } from 'scale-ts';
|
|
12
12
|
import { xxhashAsU8a, keccakAsU8a, decodeAddress, keccakAsHex, blake2AsU8a } from '@polkadot/util-crypto';
|
|
13
|
-
import { u8aToHex, u8aConcat, hexToU8a,
|
|
13
|
+
import { u8aToHex, u8aConcat, hexToU8a, isHex as isHex$1 } from '@polkadot/util';
|
|
14
14
|
import PQueue from 'p-queue';
|
|
15
15
|
import { hasWindow, isNode, env } from 'std-env';
|
|
16
16
|
import mergeRace from '@async-generator/merge-race';
|
|
@@ -20595,8 +20595,67 @@ async function rpcCall(url, payload) {
|
|
|
20595
20595
|
var FILL_ORDER_ABI = IntentGatewayV2_default.ABI;
|
|
20596
20596
|
var DECLARATION_V1 = 1;
|
|
20597
20597
|
var DECLARATION_V2 = 2;
|
|
20598
|
+
var PAYMASTER_ADDRESS_BYTES = 20;
|
|
20599
|
+
var PAYMASTER_GAS_LIMIT_BYTES = 16;
|
|
20600
|
+
var PAYMASTER_DATA_OFFSET = PAYMASTER_ADDRESS_BYTES + 2 * PAYMASTER_GAS_LIMIT_BYTES;
|
|
20601
|
+
var SIMPLEX_MODE_PERMIT2 = 2;
|
|
20602
|
+
var PERMIT2_DATA_BYTES = 1 + 20 + 32 + 32 + 32 + 1 + 32 + 32;
|
|
20603
|
+
var PERMIT2_SPONSORSHIP_BYTES = PAYMASTER_DATA_OFFSET + PERMIT2_DATA_BYTES;
|
|
20598
20604
|
var MAX_DECLARED_ENTRIES = 255;
|
|
20599
20605
|
var MAX_TOKEN_ID_BYTES = 32;
|
|
20606
|
+
function utf8Encode(text) {
|
|
20607
|
+
const bytes = [];
|
|
20608
|
+
for (const char of text) {
|
|
20609
|
+
const codePoint = char.codePointAt(0);
|
|
20610
|
+
if (codePoint < 128) bytes.push(codePoint);
|
|
20611
|
+
else if (codePoint < 2048) bytes.push(192 | codePoint >> 6, 128 | codePoint & 63);
|
|
20612
|
+
else if (codePoint < 65536) {
|
|
20613
|
+
bytes.push(224 | codePoint >> 12, 128 | codePoint >> 6 & 63, 128 | codePoint & 63);
|
|
20614
|
+
} else {
|
|
20615
|
+
bytes.push(
|
|
20616
|
+
240 | codePoint >> 18,
|
|
20617
|
+
128 | codePoint >> 12 & 63,
|
|
20618
|
+
128 | codePoint >> 6 & 63,
|
|
20619
|
+
128 | codePoint & 63
|
|
20620
|
+
);
|
|
20621
|
+
}
|
|
20622
|
+
}
|
|
20623
|
+
return bytes;
|
|
20624
|
+
}
|
|
20625
|
+
function utf8Decode(bytes) {
|
|
20626
|
+
let text = "";
|
|
20627
|
+
for (let offset = 0; offset < bytes.length; ) {
|
|
20628
|
+
const lead = bytes[offset];
|
|
20629
|
+
let codePoint;
|
|
20630
|
+
let continuations;
|
|
20631
|
+
if (lead < 128) {
|
|
20632
|
+
codePoint = lead;
|
|
20633
|
+
continuations = 0;
|
|
20634
|
+
} else if ((lead & 224) === 192) {
|
|
20635
|
+
codePoint = lead & 31;
|
|
20636
|
+
continuations = 1;
|
|
20637
|
+
} else if ((lead & 240) === 224) {
|
|
20638
|
+
codePoint = lead & 15;
|
|
20639
|
+
continuations = 2;
|
|
20640
|
+
} else if ((lead & 248) === 240) {
|
|
20641
|
+
codePoint = lead & 7;
|
|
20642
|
+
continuations = 3;
|
|
20643
|
+
} else {
|
|
20644
|
+
return null;
|
|
20645
|
+
}
|
|
20646
|
+
if (offset + continuations >= bytes.length) return null;
|
|
20647
|
+
for (let index = 1; index <= continuations; index++) {
|
|
20648
|
+
const byte = bytes[offset + index];
|
|
20649
|
+
if ((byte & 192) !== 128) return null;
|
|
20650
|
+
codePoint = codePoint << 6 | byte & 63;
|
|
20651
|
+
}
|
|
20652
|
+
const overlong = continuations === 1 && codePoint < 128 || continuations === 2 && codePoint < 2048 || continuations === 3 && codePoint < 65536;
|
|
20653
|
+
if (overlong || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) return null;
|
|
20654
|
+
text += String.fromCodePoint(codePoint);
|
|
20655
|
+
offset += continuations + 1;
|
|
20656
|
+
}
|
|
20657
|
+
return text;
|
|
20658
|
+
}
|
|
20600
20659
|
function tokenIdToBytes(tokenId) {
|
|
20601
20660
|
if (tokenId < 0n) throw new Error(`Uniswap V4 tokenId cannot be negative: ${tokenId}`);
|
|
20602
20661
|
const bytes = [];
|
|
@@ -20619,7 +20678,7 @@ function encodePhantomBidDeclaration(declaration) {
|
|
|
20619
20678
|
const version = positions.length > 0 ? DECLARATION_V2 : DECLARATION_V1;
|
|
20620
20679
|
const bytes = [version, chains2.length];
|
|
20621
20680
|
for (const chain of chains2) {
|
|
20622
|
-
const encoded =
|
|
20681
|
+
const encoded = utf8Encode(chain);
|
|
20623
20682
|
if (encoded.length === 0 || encoded.length > 255) {
|
|
20624
20683
|
throw new Error(`Invalid state machine id in source chain declaration: ${chain}`);
|
|
20625
20684
|
}
|
|
@@ -20637,42 +20696,94 @@ function encodePhantomBidDeclaration(declaration) {
|
|
|
20637
20696
|
}
|
|
20638
20697
|
return u8aToHex(new Uint8Array(bytes));
|
|
20639
20698
|
}
|
|
20640
|
-
function
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
if (bytes.length < 2) return absent;
|
|
20645
|
-
const version = bytes[0];
|
|
20646
|
-
if (version !== DECLARATION_V1 && version !== DECLARATION_V2) return absent;
|
|
20699
|
+
function parseDeclaration(bytes, start) {
|
|
20700
|
+
if (bytes.length - start < 2) return null;
|
|
20701
|
+
const version = bytes[start];
|
|
20702
|
+
if (version !== DECLARATION_V1 && version !== DECLARATION_V2) return null;
|
|
20647
20703
|
const chains2 = [];
|
|
20648
|
-
let offset = 2;
|
|
20649
|
-
for (let entry = 0; entry < bytes[1]; entry++) {
|
|
20650
|
-
if (offset >= bytes.length) return
|
|
20704
|
+
let offset = start + 2;
|
|
20705
|
+
for (let entry = 0; entry < bytes[start + 1]; entry++) {
|
|
20706
|
+
if (offset >= bytes.length) return null;
|
|
20651
20707
|
const length = bytes[offset];
|
|
20652
20708
|
offset += 1;
|
|
20653
|
-
if (length === 0 || offset + length > bytes.length) return
|
|
20654
|
-
|
|
20709
|
+
if (length === 0 || offset + length > bytes.length) return null;
|
|
20710
|
+
const chain = utf8Decode(bytes.subarray(offset, offset + length));
|
|
20711
|
+
if (chain === null) return null;
|
|
20712
|
+
chains2.push(chain);
|
|
20655
20713
|
offset += length;
|
|
20656
20714
|
}
|
|
20657
20715
|
const positions = [];
|
|
20658
20716
|
if (version === DECLARATION_V2) {
|
|
20659
|
-
if (offset >= bytes.length) return
|
|
20717
|
+
if (offset >= bytes.length) return null;
|
|
20660
20718
|
const count = bytes[offset];
|
|
20661
20719
|
offset += 1;
|
|
20662
20720
|
for (let entry = 0; entry < count; entry++) {
|
|
20663
|
-
if (offset >= bytes.length) return
|
|
20721
|
+
if (offset >= bytes.length) return null;
|
|
20664
20722
|
const length = bytes[offset];
|
|
20665
20723
|
offset += 1;
|
|
20666
|
-
if (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return
|
|
20667
|
-
|
|
20668
|
-
for (const byte of bytes.subarray(offset, offset + length)) tokenId = tokenId << 8n | BigInt(byte);
|
|
20669
|
-
positions.push(tokenId);
|
|
20724
|
+
if (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return null;
|
|
20725
|
+
positions.push(bytesToBigInt3(bytes.subarray(offset, offset + length)));
|
|
20670
20726
|
offset += length;
|
|
20671
20727
|
}
|
|
20672
20728
|
}
|
|
20673
|
-
if (offset !== bytes.length) return
|
|
20729
|
+
if (offset !== bytes.length) return null;
|
|
20674
20730
|
return { acceptedSources: chains2, uniswapV4Positions: positions };
|
|
20675
20731
|
}
|
|
20732
|
+
function bytesToBigInt3(bytes) {
|
|
20733
|
+
let value = 0n;
|
|
20734
|
+
for (const byte of bytes) value = value << 8n | BigInt(byte);
|
|
20735
|
+
return value;
|
|
20736
|
+
}
|
|
20737
|
+
function bytesToAddress(bytes) {
|
|
20738
|
+
return u8aToHex(bytes);
|
|
20739
|
+
}
|
|
20740
|
+
function hasPermit2Sponsorship(bytes) {
|
|
20741
|
+
return bytes.length >= PERMIT2_SPONSORSHIP_BYTES && bytes[PAYMASTER_DATA_OFFSET] === SIMPLEX_MODE_PERMIT2;
|
|
20742
|
+
}
|
|
20743
|
+
function parseSponsorship(bytes) {
|
|
20744
|
+
let offset = 0;
|
|
20745
|
+
const take = (length) => {
|
|
20746
|
+
const slice = bytes.subarray(offset, offset + length);
|
|
20747
|
+
offset += length;
|
|
20748
|
+
return slice;
|
|
20749
|
+
};
|
|
20750
|
+
const paymaster = bytesToAddress(take(PAYMASTER_ADDRESS_BYTES));
|
|
20751
|
+
take(2 * PAYMASTER_GAS_LIMIT_BYTES);
|
|
20752
|
+
take(1);
|
|
20753
|
+
const token = bytesToAddress(take(20));
|
|
20754
|
+
const permitAmount = bytesToBigInt3(take(32));
|
|
20755
|
+
const nonce = bytesToBigInt3(take(32));
|
|
20756
|
+
const deadline = bytesToBigInt3(take(32));
|
|
20757
|
+
return { paymaster, token, permitAmount, nonce, deadline };
|
|
20758
|
+
}
|
|
20759
|
+
var absentDeclaration = () => ({ acceptedSources: null, uniswapV4Positions: [] });
|
|
20760
|
+
function decodePhantomBidPaymasterAndData(paymasterAndData) {
|
|
20761
|
+
const none = { mode: "none", declaration: absentDeclaration(), sponsorship: null };
|
|
20762
|
+
if (!paymasterAndData || !isHex$1(paymasterAndData)) return none;
|
|
20763
|
+
const bytes = hexToU8a(paymasterAndData);
|
|
20764
|
+
const bare = parseDeclaration(bytes, 0);
|
|
20765
|
+
if (bare) return { mode: "declaration", declaration: bare, sponsorship: null };
|
|
20766
|
+
if (!hasPermit2Sponsorship(bytes)) return none;
|
|
20767
|
+
const sponsorship = parseSponsorship(bytes);
|
|
20768
|
+
const tail = bytes.length > PERMIT2_SPONSORSHIP_BYTES ? parseDeclaration(bytes, PERMIT2_SPONSORSHIP_BYTES) : null;
|
|
20769
|
+
return { mode: "permit2", declaration: tail ?? absentDeclaration(), sponsorship };
|
|
20770
|
+
}
|
|
20771
|
+
function decodePhantomBidDeclaration(paymasterAndData) {
|
|
20772
|
+
return decodePhantomBidPaymasterAndData(paymasterAndData).declaration;
|
|
20773
|
+
}
|
|
20774
|
+
function encodePhantomBidPaymasterAndData(bid) {
|
|
20775
|
+
const declaration = encodePhantomBidDeclaration(bid);
|
|
20776
|
+
const sponsorship = bid.sponsorship;
|
|
20777
|
+
if (!sponsorship || sponsorship === "0x") return declaration;
|
|
20778
|
+
if (!isHex$1(sponsorship)) throw new Error("Phantom bid sponsorship is not hex");
|
|
20779
|
+
const bytes = hexToU8a(sponsorship);
|
|
20780
|
+
if (bytes.length !== PERMIT2_SPONSORSHIP_BYTES || !hasPermit2Sponsorship(bytes)) {
|
|
20781
|
+
throw new Error(
|
|
20782
|
+
`Phantom bid sponsorship must be a ${PERMIT2_SPONSORSHIP_BYTES}-byte Permit2-mode paymasterAndData, got ${bytes.length} bytes`
|
|
20783
|
+
);
|
|
20784
|
+
}
|
|
20785
|
+
return `${sponsorship}${declaration.slice(2)}`;
|
|
20786
|
+
}
|
|
20676
20787
|
function encodeAcceptedSourceChains(chains2) {
|
|
20677
20788
|
return encodePhantomBidDeclaration({ acceptedSourceChains: chains2 });
|
|
20678
20789
|
}
|
|
@@ -25183,6 +25294,6 @@ async function teleportDot(param_) {
|
|
|
25183
25294
|
return stream;
|
|
25184
25295
|
}
|
|
25185
25296
|
|
|
25186
|
-
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, CHAINS_WITHOUT_VALID_UNTIL, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, FILL_ORDER_V1_ABI, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, INCLUSION_TIMEOUT_MS, IndexedRateUnavailableError, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, InvalidIndexedRateError, InvalidLiquidityIndexerResponseError, InvalidPhantomSnapshotError, IsmpClient, LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, 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, UNISWAP_QUOTE_HAIRCUT_BPS, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, UnsupportedLiquidityAssetError, UnsupportedLiquidityChainError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, applyProtocolFeeHaircut, applyUniswapQuoteHaircut, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodeFillOrder, decodePhantomBidDeclaration, decodeUserOpScale, deriveHttpUrl, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodeFillOrder, encodeISMPMessage, encodePhantomBidDeclaration, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getFillOptionsVersion, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, poolSlug, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, readProtocolFeeHaircutBps, requestCommitmentKey, resetFillOptionsVersionCache, responseCommitmentKey, retryPromise, sortPoolSymbols, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
25297
|
+
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, CHAINS_WITHOUT_VALID_UNTIL, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, FILL_ORDER_V1_ABI, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, INCLUSION_TIMEOUT_MS, IndexedRateUnavailableError, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, InvalidIndexedRateError, InvalidLiquidityIndexerResponseError, InvalidPhantomSnapshotError, IsmpClient, LEGACY_FILL_OPTIONS_IMPLEMENTATIONS, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PERMIT2_SPONSORSHIP_BYTES, 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, UNISWAP_QUOTE_HAIRCUT_BPS, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, UnsupportedLiquidityAssetError, UnsupportedLiquidityChainError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, applyProtocolFeeHaircut, applyUniswapQuoteHaircut, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodeFillOrder, decodePhantomBidDeclaration, decodePhantomBidPaymasterAndData, decodeUserOpScale, deriveHttpUrl, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodeFillOrder, encodeISMPMessage, encodePhantomBidDeclaration, encodePhantomBidPaymasterAndData, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getFillOptionsVersion, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, poolSlug, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, readProtocolFeeHaircutBps, requestCommitmentKey, resetFillOptionsVersionCache, responseCommitmentKey, retryPromise, sortPoolSymbols, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
25187
25298
|
//# sourceMappingURL=index.js.map
|
|
25188
25299
|
//# sourceMappingURL=index.js.map
|