@hyperbridge/sdk 2.8.3 → 2.8.5
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 +133 -46
- package/dist/browser/index.js +354 -235
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +359 -234
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +25 -12
- package/dist/node/index.d.ts +25 -12
- package/dist/node/index.js +354 -235
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-CxCDx-hH.d.cts → intents-helpers-Cf0-Odlu.d.cts} +111 -37
- package/dist/node/{intents-helpers-CxCDx-hH.d.ts → intents-helpers-Cf0-Odlu.d.ts} +111 -37
- package/dist/node/intents-helpers.cjs +10 -0
- 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 +9 -1
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +155 -153
|
@@ -2,7 +2,7 @@ import { ConsolaInstance } from 'consola';
|
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { GraphQLClient } from 'graphql-request';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
|
-
import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs } from 'viem';
|
|
5
|
+
import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs, Chain as Chain$1 } from 'viem';
|
|
6
6
|
import { Chain } from 'viem/chains';
|
|
7
7
|
import { ApiPromise } from '@polkadot/api';
|
|
8
8
|
import { KeyringPair } from '@polkadot/keyring/types';
|
|
@@ -886,7 +886,9 @@ declare const tronNile: {
|
|
|
886
886
|
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
887
887
|
};
|
|
888
888
|
declare const tronChainIds: Set<number>;
|
|
889
|
-
type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT";
|
|
889
|
+
type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT" | "ZARP" | "EURC" | "XSGD" | "TRYB" | "USDR";
|
|
890
|
+
/** A configured asset symbol in its canonical, lowercase, or uppercase form. */
|
|
891
|
+
type ConfiguredAssetSymbolInput = ConfiguredAssetSymbol | Lowercase<ConfiguredAssetSymbol> | Uppercase<ConfiguredAssetSymbol>;
|
|
890
892
|
interface UniswapV4PoolConfigData {
|
|
891
893
|
tokens: readonly [ConfiguredAssetSymbol, ConfiguredAssetSymbol];
|
|
892
894
|
fee: number;
|
|
@@ -1015,7 +1017,7 @@ interface ChainConfigData {
|
|
|
1015
1017
|
layerZeroEid?: number;
|
|
1016
1018
|
}
|
|
1017
1019
|
declare const chainConfigs: Record<number, ChainConfigData>;
|
|
1018
|
-
declare const getConfigByStateMachineId: (id:
|
|
1020
|
+
declare const getConfigByStateMachineId: (id: string) => ChainConfigData | undefined;
|
|
1019
1021
|
declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
1020
1022
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
1021
1023
|
declare const hyperbridgeAddress = "";
|
|
@@ -1056,6 +1058,12 @@ declare class ChainConfigService {
|
|
|
1056
1058
|
* it, so a new asset is added once in `chain.ts` and nowhere else.
|
|
1057
1059
|
*/
|
|
1058
1060
|
getAssetBySymbol(chain: string, symbol: string): HexString$1 | undefined;
|
|
1061
|
+
/** Resolves a configured token symbol case-insensitively on a specific chain. */
|
|
1062
|
+
getAssetMetadataBySymbol(chain: string, symbol: string): {
|
|
1063
|
+
symbol: ConfiguredAssetSymbol;
|
|
1064
|
+
address: HexString$1;
|
|
1065
|
+
decimals?: number;
|
|
1066
|
+
} | undefined;
|
|
1059
1067
|
getCNgnDecimals(chain: string): number | undefined;
|
|
1060
1068
|
getExtAsset(chain: string): HexString$1 | undefined;
|
|
1061
1069
|
getExtDecimals(chain: string): number | undefined;
|
|
@@ -1372,6 +1380,14 @@ declare function convertCodecToIProof(codec: {
|
|
|
1372
1380
|
}): IProof;
|
|
1373
1381
|
declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
|
|
1374
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* How long a submitted extrinsic has to reach a block before the attempt is treated as stalled.
|
|
1385
|
+
*
|
|
1386
|
+
* Sized against the bid window, not against how long inclusion can conceivably take: a bid is worth
|
|
1387
|
+
* nothing once its window closes, so an extrinsic still sitting in the pool after a few blocks is
|
|
1388
|
+
* better replaced by a higher-tipped copy than waited on.
|
|
1389
|
+
*/
|
|
1390
|
+
declare const INCLUSION_TIMEOUT_MS = 20000;
|
|
1375
1391
|
/**
|
|
1376
1392
|
* Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the
|
|
1377
1393
|
* same host and port, so the scheme is the only difference. Throws for anything that is not a
|
|
@@ -1550,8 +1566,10 @@ declare class IntentsCoprocessor {
|
|
|
1550
1566
|
/**
|
|
1551
1567
|
* Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
|
|
1552
1568
|
* concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
|
|
1553
|
-
* (or is confirmed still pooled and returned as `pending`) before the next is signed
|
|
1554
|
-
*
|
|
1569
|
+
* (or is confirmed still pooled and returned as `pending`) before the next is signed. The
|
|
1570
|
+
* auto-nonce is the account's on-chain nonce, so a still-pooled extrinsic does not advance it: a
|
|
1571
|
+
* submission signed behind a pending one bounces off it (1013/1014) and is reported as pending
|
|
1572
|
+
* too, rather than landing as a second copy.
|
|
1555
1573
|
*
|
|
1556
1574
|
* The extrinsic is built rather than passed in because the api it is built on decides where it
|
|
1557
1575
|
* is signed and sent: a websocket that is down when the queue reaches this submission diverts it
|
|
@@ -1576,14 +1594,34 @@ declare class IntentsCoprocessor {
|
|
|
1576
1594
|
* Signs and sends an extrinsic, handling status updates and errors.
|
|
1577
1595
|
* Implements retry logic with progressive tip increases for stuck transactions.
|
|
1578
1596
|
*
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1597
|
+
* Two kinds of failure are retried, and the difference is the nonce.
|
|
1598
|
+
*
|
|
1599
|
+
* An attempt that verifiably went nowhere (rejected before the pool, dropped, invalid) leaves
|
|
1600
|
+
* the account nonce free, so the next attempt simply re-signs with the auto-nonce.
|
|
1601
|
+
*
|
|
1602
|
+
* An attempt that reached the pool and was still there when the watch timed out (`stalled`) is
|
|
1603
|
+
* retried as a *replacement*: the same nonce it was signed with, and double the tip. Substrate's
|
|
1604
|
+
* pool evicts a pooled extrinsic in favour of a higher-priority one at the same (account, nonce),
|
|
1605
|
+
* so exactly one of the two can ever execute. This matters for a bid, which is worth nothing once
|
|
1606
|
+
* its window closes — waiting out a stalled extrinsic usually means not bidding at all.
|
|
1607
|
+
*
|
|
1608
|
+
* Re-signing without pinning the nonce is what must never happen here. The auto-nonce is read
|
|
1609
|
+
* from on-chain state, so it is only the stalled extrinsic's nonce for as long as that extrinsic
|
|
1610
|
+
* stays out of a block — and a stall is precisely the case where it may land at any moment. Once
|
|
1611
|
+
* it does, an unpinned retry takes the *next* nonce and both execute: a duplicate `placeBid` that
|
|
1612
|
+
* fails on-chain, and a second `retractBid` that pulls the bid just placed. When the signed nonce
|
|
1613
|
+
* cannot be read, the stalled result is returned rather than guessed at.
|
|
1614
|
+
*
|
|
1615
|
+
* A rejection that bounced off a copy already pooled (1013/1014) is likewise left alone: that
|
|
1616
|
+
* copy is in flight and its outcome is unknown here, so the `pending` result goes back to the
|
|
1617
|
+
* caller to confirm later.
|
|
1585
1618
|
*/
|
|
1586
1619
|
private sendExtrinsicWithRetries;
|
|
1620
|
+
/**
|
|
1621
|
+
* The nonce an extrinsic was signed with, or undefined if it carries no readable one — which is
|
|
1622
|
+
* the case before it has ever been signed, and for a stub api in tests.
|
|
1623
|
+
*/
|
|
1624
|
+
private signedNonce;
|
|
1587
1625
|
/**
|
|
1588
1626
|
* Classifies a submission rejection. Codes 1013 ("already imported") and 1014 ("priority is
|
|
1589
1627
|
* too low") both mean a copy of this account+nonce is already in the pool — almost always our
|
|
@@ -1597,8 +1635,13 @@ declare class IntentsCoprocessor {
|
|
|
1597
1635
|
*
|
|
1598
1636
|
* A timeout is only a failure when the extrinsic never made it into the transaction pool.
|
|
1599
1637
|
* Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is
|
|
1600
|
-
* in flight and may well execute after the watch is abandoned — the result is then `pending
|
|
1601
|
-
* telling the caller to
|
|
1638
|
+
* in flight and may well execute after the watch is abandoned — the result is then `pending`
|
|
1639
|
+
* and `stalled`, telling the caller to replace it under the same nonce or confirm it later,
|
|
1640
|
+
* never to re-sign the same call under a fresh one.
|
|
1641
|
+
*
|
|
1642
|
+
* `nonce` pins the submission to a specific account nonce, which is what makes a retry a pool
|
|
1643
|
+
* replacement rather than a second extrinsic queued behind the first. Left undefined on the
|
|
1644
|
+
* first attempt, where the api's auto-nonce is correct.
|
|
1602
1645
|
*/
|
|
1603
1646
|
private sendWithTimeout;
|
|
1604
1647
|
/**
|
|
@@ -2926,25 +2969,51 @@ interface PhantomOrderPriceSnapshotsResponse {
|
|
|
2926
2969
|
}>;
|
|
2927
2970
|
};
|
|
2928
2971
|
}
|
|
2972
|
+
/** One independently reported slice of indexed liquidity. */
|
|
2973
|
+
interface LiquiditySlice {
|
|
2974
|
+
totalLiquidity: string;
|
|
2975
|
+
providerCount: number;
|
|
2976
|
+
}
|
|
2929
2977
|
/**
|
|
2930
|
-
*
|
|
2978
|
+
* Indexed destination capacity and its source-routing slices.
|
|
2931
2979
|
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2980
|
+
* The SDK reports the indexer's facts separately and does not decide whether a
|
|
2981
|
+
* source chain is covered by the legacy unrestricted-bidder policy.
|
|
2934
2982
|
*/
|
|
2935
|
-
interface
|
|
2936
|
-
|
|
2937
|
-
|
|
2983
|
+
interface AvailableLiquidity {
|
|
2984
|
+
sourceChain: Chains;
|
|
2985
|
+
destinationChain: Chains;
|
|
2938
2986
|
tokenAddress: HexString$1;
|
|
2939
|
-
|
|
2940
|
-
|
|
2987
|
+
updatedAt: Date;
|
|
2988
|
+
destination: LiquiditySlice;
|
|
2989
|
+
unrestricted: LiquiditySlice;
|
|
2990
|
+
explicitRoute: (LiquiditySlice & {
|
|
2991
|
+
updatedAt: Date;
|
|
2992
|
+
}) | null;
|
|
2941
2993
|
}
|
|
2942
|
-
/**
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2994
|
+
/**
|
|
2995
|
+
* Chain-specific buy and sell rates expressed as quote-token units per one
|
|
2996
|
+
* base token. The quote token is the less valuable currency when the indexed
|
|
2997
|
+
* rates establish an ordering (for example, cNGN in a USDC/cNGN pair).
|
|
2998
|
+
*/
|
|
2999
|
+
interface BuyAndSellRates {
|
|
3000
|
+
baseTokenSymbol: ConfiguredAssetSymbol;
|
|
3001
|
+
quoteTokenSymbol: ConfiguredAssetSymbol;
|
|
3002
|
+
sourceChain: Chains;
|
|
3003
|
+
destinationChain: Chains;
|
|
3004
|
+
/** Quote-token units received when buying the quote token with one base token. */
|
|
3005
|
+
buyRate: string | null;
|
|
3006
|
+
/** Quote-token units sold to receive one base token. */
|
|
3007
|
+
sellRate: string | null;
|
|
3008
|
+
buyRateUpdatedAt: Date | null;
|
|
3009
|
+
sellRateUpdatedAt: Date | null;
|
|
3010
|
+
}
|
|
3011
|
+
/** Symbol-only input for querying an indexed pool's rates. */
|
|
3012
|
+
interface QueryBuyAndSellRatesParams {
|
|
3013
|
+
tokenInSymbol: ConfiguredAssetSymbolInput;
|
|
3014
|
+
tokenOutSymbol: ConfiguredAssetSymbolInput;
|
|
3015
|
+
sourceChainId: Chain$1["id"];
|
|
3016
|
+
destinationChainId: Chain$1["id"];
|
|
2948
3017
|
}
|
|
2949
3018
|
interface TokenPrice {
|
|
2950
3019
|
symbol: string;
|
|
@@ -3033,19 +3102,14 @@ interface PackedUserOperation {
|
|
|
3033
3102
|
signature: HexString$1;
|
|
3034
3103
|
}
|
|
3035
3104
|
interface SigningAccount {
|
|
3036
|
-
/** Signs a bid message hash for a given chain. Returns a 65-byte ECDSA signature. */
|
|
3037
|
-
signMessage: (messageHash: HexString$1, chainId: number) => Promise<HexString$1>;
|
|
3038
|
-
/** Signs a raw 32-byte hash, returning split signature components for EIP-7702 etc. */
|
|
3039
|
-
signRawHash: (hash: HexString$1) => Promise<{
|
|
3040
|
-
r: HexString$1;
|
|
3041
|
-
s: HexString$1;
|
|
3042
|
-
yParity: number;
|
|
3043
|
-
}>;
|
|
3044
3105
|
/**
|
|
3045
3106
|
* Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle Paymaster).
|
|
3046
3107
|
* The shape of `typedData` matches viem's `TypedDataDefinition` (domain + types + message).
|
|
3108
|
+
*
|
|
3109
|
+
* No chain id parameter: EIP-712 carries it in `domain.chainId`, which is what
|
|
3110
|
+
* the digest covers and what a backend scoping the request to a chain reads.
|
|
3047
3111
|
*/
|
|
3048
|
-
signTypedData: (typedData: unknown
|
|
3112
|
+
signTypedData: (typedData: unknown) => Promise<HexString$1>;
|
|
3049
3113
|
}
|
|
3050
3114
|
interface SubmitBidOptions {
|
|
3051
3115
|
order: Order;
|
|
@@ -3390,6 +3454,16 @@ type ERC7821Call = {
|
|
|
3390
3454
|
data: `0x${string}`;
|
|
3391
3455
|
};
|
|
3392
3456
|
|
|
3457
|
+
/**
|
|
3458
|
+
* Canonical symbol order used by the SDK and indexer pool IDs.
|
|
3459
|
+
*
|
|
3460
|
+
* Plain code-unit comparison, never locale-sensitive collation — the result is
|
|
3461
|
+
* a persisted primary key and must sort identically everywhere.
|
|
3462
|
+
*/
|
|
3463
|
+
declare function sortPoolSymbols<Symbol extends string>(symbolA: Symbol, symbolB: Symbol): [Symbol, Symbol];
|
|
3464
|
+
/** Canonical indexer pool ID for a pair of canonical token symbols. */
|
|
3465
|
+
declare function poolSlug(symbolA: string, symbolB: string): string;
|
|
3466
|
+
|
|
3393
3467
|
declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString$1;
|
|
3394
3468
|
declare function decodeERC7821ExecuteBatch(callData: HexString$1): ERC7821Call[] | null;
|
|
3395
3469
|
|
|
@@ -7839,4 +7913,4 @@ declare const _default: {
|
|
|
7839
7913
|
}];
|
|
7840
7914
|
};
|
|
7841
7915
|
|
|
7842
|
-
export { type
|
|
7916
|
+
export { type AssetTeleportedResponse as $, type AssetTeleported as A, type BuyAndSellRates as B, ChainConfigService as C, type Bid as D, type EstimateGasCallData as E, type FillerBid as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type EstimateFillOrderParams as J, type FillOrderEstimate as K, type OrderFeesQuote as L, type ERC7821Call as M, type OrderWithStatus as N, type Order as O, type PostRequestWithStatus as P, type QueryBuyAndSellRatesParams as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, OrderStatus as U, type TokenGatewayAssetTeleportedWithStatus as V, TeleportStatus as W, type DecodedOrderPlacedLog as X, type DecodedPostRequestEvent as Y, type DecodedPostResponseEvent as Z, type AllStatusKey as _, type IEvmConfig as a, type SigningAccount as a$, type BidStorageEntry as a0, type BidSubmissionResult as a1, type BlockMetadata as a2, type BytesLikeHex as a3, type CancelOptions as a4, type ChainConfig as a5, type ChainConfigData as a6, Chains as a7, type ConfiguredAssetSymbol as a8, type ConfiguredAssetSymbolInput as a9, type ITimeoutPostRequestMessage as aA, ABI as aB, type IntentGatewayParams as aC, IntentOrderStatus as aD, type IntentOrderStatusKey as aE, type IsmpRequest as aF, type LiquiditySlice as aG, type OrderResponse as aH, type OrderStatusMetadata as aI, type PaymentInfo as aJ, type PhantomBid as aK, type PhantomBidBatchResult as aL, type PhantomBidDeclaration as aM, type PhantomBidOutcome as aN, type PhantomOrderEvent as aO, type PhantomOrderLeg as aP, type PhantomOrderPriceSnapshot as aQ, type PhantomOrderPriceSnapshotsResponse as aR, type PollPhantomOrdersOptions as aS, type PostRequestStatus as aT, type RequestBody as aU, type RequestCommitment as aV, RequestKind as aW, type RequestResponse as aX, RequestStatus as aY, type RequestStatusKey as aZ, type SelectOptions as a_, type Deployment as aa, type DispatchGet as ab, type DispatchInfo as ac, type DispatchPost as ad, type Erc4626VaultConfigData as ae, type ExecuteIntentOrderOptions as af, type ExecutionResult as ag, type FillOptions as ah, type FillerConfig as ai, type GetRequestResponse as aj, type GetResponseByRequestIdResponse as ak, type GetResponseStorageValues as al, type HostParams as am, HyperClientStatus as an, type IBatchConsensusAndGetResponseMessage as ao, type IBatchConsensusAndPostRequestMessage as ap, type IConfig as aq, type IConsensusMessage as ar, type IGetRequestMessage as as, type IGetResponse as at, type IGetResponseMessage as au, type IHyperbridgeConfig as av, INCLUSION_TIMEOUT_MS as aw, type IPostResponse as ax, type IRequestMessage as ay, type ISubstrateConfig as az, type IMessage as b, recoverBidSignerViem as b$, type StateMachineId as b0, type StateMachineResponse as b1, type StorageFacade as b2, TimeoutStatus as b3, type TimeoutStatusKey as b4, type TokenGatewayAssetTeleportedResponse as b5, type TokenInfo as b6, type TokenPrice as b7, type TokenPricesResponse as b8, type UniswapV4PoolConfigData as b9, poolSlug as bA, sortPoolSymbols as bB, tronChainIds as bC, tronNile as bD, type AggregationLogger as bE, type BidNonceKeyFn as bF, type BidSignature as bG, ENTRY_POINT_V08_ADDRESS as bH, FILL_ORDER_ABI as bI, type FetchLike as bJ, type FillData as bK, type HexString as bL, _default as bM, type LpBalance as bN, type OrderCommitmentFn as bO, type PhantomAggregation as bP, type PhantomLegAggregation as bQ, type PhantomLegBidder as bR, type RecoverBidSigner as bS, type RpcBidInfo as bT, type SolverBalanceReader as bU, type YieldVaultMap as bV, aggregatePhantomBids as bW, extractFillData as bX, fetchBidsForOrder as bY, memoizedSolverBalance as bZ, orderCommitmentFromDecoded as b_, chainConfigs as ba, convertCodecToIGetRequest as bb, convertCodecToIProof as bc, convertIGetRequestToCodec as bd, convertIProofToCodec as be, convertStateIdToStateMachineId as bf, convertStateMachineEnumToString as bg, convertStateMachineIdToEnum as bh, decodeAcceptedSourceChains as bi, decodeERC7821ExecuteBatch as bj, decodePhantomBidDeclaration as bk, decodeUserOpScale as bl, deriveHttpUrl as bm, encodeAcceptedSourceChains as bn, encodeERC7821ExecuteBatch as bo, encodeISMPMessage as bp, encodePhantomBidDeclaration as bq, encodeUserOpScale as br, getChainId as bs, getConfigByStateMachineId as bt, getViemChain as bu, hyperbridgeAddress as bv, pharosAtlantic as bw, pharosMainnet as bx, polkadotAssetHubPaseo as by, polkadotHubMainnet as bz, type StateMachineHeight as c, setAggregationFetch as c0, splitBidSignature as c1, weightedMedian as c2, zipFillLegs as c3, type IIsmpMessage as d, type IPostRequest as e, type IGetRequest as f, type IPolkadotHubConfig as g, type IPharosConfig as h, type StateMachineUpdate as i, type ResponseCommitmentWithValues as j, type RequestStatusWithMetadata as k, type PostRequestTimeoutStatus as l, SubstrateChain as m, type ClientConfig as n, type IndexerQueryClient as o, type IProof as p, type IEvmChain as q, IntentsCoprocessor as r, type AvailableLiquidity as s, type IntentOrderStatusUpdate as t, type SelectBidResult as u, type ResumeIntentOrderOptions as v, type CancelOrderOptions as w, type CancelQuote as x, type SubmitBidOptions as y, type PackedUserOperation as z };
|
|
@@ -2,7 +2,7 @@ import { ConsolaInstance } from 'consola';
|
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { GraphQLClient } from 'graphql-request';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
|
-
import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs } from 'viem';
|
|
5
|
+
import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs, Chain as Chain$1 } from 'viem';
|
|
6
6
|
import { Chain } from 'viem/chains';
|
|
7
7
|
import { ApiPromise } from '@polkadot/api';
|
|
8
8
|
import { KeyringPair } from '@polkadot/keyring/types';
|
|
@@ -886,7 +886,9 @@ declare const tronNile: {
|
|
|
886
886
|
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
887
887
|
};
|
|
888
888
|
declare const tronChainIds: Set<number>;
|
|
889
|
-
type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT";
|
|
889
|
+
type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT" | "ZARP" | "EURC" | "XSGD" | "TRYB" | "USDR";
|
|
890
|
+
/** A configured asset symbol in its canonical, lowercase, or uppercase form. */
|
|
891
|
+
type ConfiguredAssetSymbolInput = ConfiguredAssetSymbol | Lowercase<ConfiguredAssetSymbol> | Uppercase<ConfiguredAssetSymbol>;
|
|
890
892
|
interface UniswapV4PoolConfigData {
|
|
891
893
|
tokens: readonly [ConfiguredAssetSymbol, ConfiguredAssetSymbol];
|
|
892
894
|
fee: number;
|
|
@@ -1015,7 +1017,7 @@ interface ChainConfigData {
|
|
|
1015
1017
|
layerZeroEid?: number;
|
|
1016
1018
|
}
|
|
1017
1019
|
declare const chainConfigs: Record<number, ChainConfigData>;
|
|
1018
|
-
declare const getConfigByStateMachineId: (id:
|
|
1020
|
+
declare const getConfigByStateMachineId: (id: string) => ChainConfigData | undefined;
|
|
1019
1021
|
declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
1020
1022
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
1021
1023
|
declare const hyperbridgeAddress = "";
|
|
@@ -1056,6 +1058,12 @@ declare class ChainConfigService {
|
|
|
1056
1058
|
* it, so a new asset is added once in `chain.ts` and nowhere else.
|
|
1057
1059
|
*/
|
|
1058
1060
|
getAssetBySymbol(chain: string, symbol: string): HexString$1 | undefined;
|
|
1061
|
+
/** Resolves a configured token symbol case-insensitively on a specific chain. */
|
|
1062
|
+
getAssetMetadataBySymbol(chain: string, symbol: string): {
|
|
1063
|
+
symbol: ConfiguredAssetSymbol;
|
|
1064
|
+
address: HexString$1;
|
|
1065
|
+
decimals?: number;
|
|
1066
|
+
} | undefined;
|
|
1059
1067
|
getCNgnDecimals(chain: string): number | undefined;
|
|
1060
1068
|
getExtAsset(chain: string): HexString$1 | undefined;
|
|
1061
1069
|
getExtDecimals(chain: string): number | undefined;
|
|
@@ -1372,6 +1380,14 @@ declare function convertCodecToIProof(codec: {
|
|
|
1372
1380
|
}): IProof;
|
|
1373
1381
|
declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
|
|
1374
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* How long a submitted extrinsic has to reach a block before the attempt is treated as stalled.
|
|
1385
|
+
*
|
|
1386
|
+
* Sized against the bid window, not against how long inclusion can conceivably take: a bid is worth
|
|
1387
|
+
* nothing once its window closes, so an extrinsic still sitting in the pool after a few blocks is
|
|
1388
|
+
* better replaced by a higher-tipped copy than waited on.
|
|
1389
|
+
*/
|
|
1390
|
+
declare const INCLUSION_TIMEOUT_MS = 20000;
|
|
1375
1391
|
/**
|
|
1376
1392
|
* Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the
|
|
1377
1393
|
* same host and port, so the scheme is the only difference. Throws for anything that is not a
|
|
@@ -1550,8 +1566,10 @@ declare class IntentsCoprocessor {
|
|
|
1550
1566
|
/**
|
|
1551
1567
|
* Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
|
|
1552
1568
|
* concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
|
|
1553
|
-
* (or is confirmed still pooled and returned as `pending`) before the next is signed
|
|
1554
|
-
*
|
|
1569
|
+
* (or is confirmed still pooled and returned as `pending`) before the next is signed. The
|
|
1570
|
+
* auto-nonce is the account's on-chain nonce, so a still-pooled extrinsic does not advance it: a
|
|
1571
|
+
* submission signed behind a pending one bounces off it (1013/1014) and is reported as pending
|
|
1572
|
+
* too, rather than landing as a second copy.
|
|
1555
1573
|
*
|
|
1556
1574
|
* The extrinsic is built rather than passed in because the api it is built on decides where it
|
|
1557
1575
|
* is signed and sent: a websocket that is down when the queue reaches this submission diverts it
|
|
@@ -1576,14 +1594,34 @@ declare class IntentsCoprocessor {
|
|
|
1576
1594
|
* Signs and sends an extrinsic, handling status updates and errors.
|
|
1577
1595
|
* Implements retry logic with progressive tip increases for stuck transactions.
|
|
1578
1596
|
*
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1597
|
+
* Two kinds of failure are retried, and the difference is the nonce.
|
|
1598
|
+
*
|
|
1599
|
+
* An attempt that verifiably went nowhere (rejected before the pool, dropped, invalid) leaves
|
|
1600
|
+
* the account nonce free, so the next attempt simply re-signs with the auto-nonce.
|
|
1601
|
+
*
|
|
1602
|
+
* An attempt that reached the pool and was still there when the watch timed out (`stalled`) is
|
|
1603
|
+
* retried as a *replacement*: the same nonce it was signed with, and double the tip. Substrate's
|
|
1604
|
+
* pool evicts a pooled extrinsic in favour of a higher-priority one at the same (account, nonce),
|
|
1605
|
+
* so exactly one of the two can ever execute. This matters for a bid, which is worth nothing once
|
|
1606
|
+
* its window closes — waiting out a stalled extrinsic usually means not bidding at all.
|
|
1607
|
+
*
|
|
1608
|
+
* Re-signing without pinning the nonce is what must never happen here. The auto-nonce is read
|
|
1609
|
+
* from on-chain state, so it is only the stalled extrinsic's nonce for as long as that extrinsic
|
|
1610
|
+
* stays out of a block — and a stall is precisely the case where it may land at any moment. Once
|
|
1611
|
+
* it does, an unpinned retry takes the *next* nonce and both execute: a duplicate `placeBid` that
|
|
1612
|
+
* fails on-chain, and a second `retractBid` that pulls the bid just placed. When the signed nonce
|
|
1613
|
+
* cannot be read, the stalled result is returned rather than guessed at.
|
|
1614
|
+
*
|
|
1615
|
+
* A rejection that bounced off a copy already pooled (1013/1014) is likewise left alone: that
|
|
1616
|
+
* copy is in flight and its outcome is unknown here, so the `pending` result goes back to the
|
|
1617
|
+
* caller to confirm later.
|
|
1585
1618
|
*/
|
|
1586
1619
|
private sendExtrinsicWithRetries;
|
|
1620
|
+
/**
|
|
1621
|
+
* The nonce an extrinsic was signed with, or undefined if it carries no readable one — which is
|
|
1622
|
+
* the case before it has ever been signed, and for a stub api in tests.
|
|
1623
|
+
*/
|
|
1624
|
+
private signedNonce;
|
|
1587
1625
|
/**
|
|
1588
1626
|
* Classifies a submission rejection. Codes 1013 ("already imported") and 1014 ("priority is
|
|
1589
1627
|
* too low") both mean a copy of this account+nonce is already in the pool — almost always our
|
|
@@ -1597,8 +1635,13 @@ declare class IntentsCoprocessor {
|
|
|
1597
1635
|
*
|
|
1598
1636
|
* A timeout is only a failure when the extrinsic never made it into the transaction pool.
|
|
1599
1637
|
* Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is
|
|
1600
|
-
* in flight and may well execute after the watch is abandoned — the result is then `pending
|
|
1601
|
-
* telling the caller to
|
|
1638
|
+
* in flight and may well execute after the watch is abandoned — the result is then `pending`
|
|
1639
|
+
* and `stalled`, telling the caller to replace it under the same nonce or confirm it later,
|
|
1640
|
+
* never to re-sign the same call under a fresh one.
|
|
1641
|
+
*
|
|
1642
|
+
* `nonce` pins the submission to a specific account nonce, which is what makes a retry a pool
|
|
1643
|
+
* replacement rather than a second extrinsic queued behind the first. Left undefined on the
|
|
1644
|
+
* first attempt, where the api's auto-nonce is correct.
|
|
1602
1645
|
*/
|
|
1603
1646
|
private sendWithTimeout;
|
|
1604
1647
|
/**
|
|
@@ -2926,25 +2969,51 @@ interface PhantomOrderPriceSnapshotsResponse {
|
|
|
2926
2969
|
}>;
|
|
2927
2970
|
};
|
|
2928
2971
|
}
|
|
2972
|
+
/** One independently reported slice of indexed liquidity. */
|
|
2973
|
+
interface LiquiditySlice {
|
|
2974
|
+
totalLiquidity: string;
|
|
2975
|
+
providerCount: number;
|
|
2976
|
+
}
|
|
2929
2977
|
/**
|
|
2930
|
-
*
|
|
2978
|
+
* Indexed destination capacity and its source-routing slices.
|
|
2931
2979
|
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2980
|
+
* The SDK reports the indexer's facts separately and does not decide whether a
|
|
2981
|
+
* source chain is covered by the legacy unrestricted-bidder policy.
|
|
2934
2982
|
*/
|
|
2935
|
-
interface
|
|
2936
|
-
|
|
2937
|
-
|
|
2983
|
+
interface AvailableLiquidity {
|
|
2984
|
+
sourceChain: Chains;
|
|
2985
|
+
destinationChain: Chains;
|
|
2938
2986
|
tokenAddress: HexString$1;
|
|
2939
|
-
|
|
2940
|
-
|
|
2987
|
+
updatedAt: Date;
|
|
2988
|
+
destination: LiquiditySlice;
|
|
2989
|
+
unrestricted: LiquiditySlice;
|
|
2990
|
+
explicitRoute: (LiquiditySlice & {
|
|
2991
|
+
updatedAt: Date;
|
|
2992
|
+
}) | null;
|
|
2941
2993
|
}
|
|
2942
|
-
/**
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2994
|
+
/**
|
|
2995
|
+
* Chain-specific buy and sell rates expressed as quote-token units per one
|
|
2996
|
+
* base token. The quote token is the less valuable currency when the indexed
|
|
2997
|
+
* rates establish an ordering (for example, cNGN in a USDC/cNGN pair).
|
|
2998
|
+
*/
|
|
2999
|
+
interface BuyAndSellRates {
|
|
3000
|
+
baseTokenSymbol: ConfiguredAssetSymbol;
|
|
3001
|
+
quoteTokenSymbol: ConfiguredAssetSymbol;
|
|
3002
|
+
sourceChain: Chains;
|
|
3003
|
+
destinationChain: Chains;
|
|
3004
|
+
/** Quote-token units received when buying the quote token with one base token. */
|
|
3005
|
+
buyRate: string | null;
|
|
3006
|
+
/** Quote-token units sold to receive one base token. */
|
|
3007
|
+
sellRate: string | null;
|
|
3008
|
+
buyRateUpdatedAt: Date | null;
|
|
3009
|
+
sellRateUpdatedAt: Date | null;
|
|
3010
|
+
}
|
|
3011
|
+
/** Symbol-only input for querying an indexed pool's rates. */
|
|
3012
|
+
interface QueryBuyAndSellRatesParams {
|
|
3013
|
+
tokenInSymbol: ConfiguredAssetSymbolInput;
|
|
3014
|
+
tokenOutSymbol: ConfiguredAssetSymbolInput;
|
|
3015
|
+
sourceChainId: Chain$1["id"];
|
|
3016
|
+
destinationChainId: Chain$1["id"];
|
|
2948
3017
|
}
|
|
2949
3018
|
interface TokenPrice {
|
|
2950
3019
|
symbol: string;
|
|
@@ -3033,19 +3102,14 @@ interface PackedUserOperation {
|
|
|
3033
3102
|
signature: HexString$1;
|
|
3034
3103
|
}
|
|
3035
3104
|
interface SigningAccount {
|
|
3036
|
-
/** Signs a bid message hash for a given chain. Returns a 65-byte ECDSA signature. */
|
|
3037
|
-
signMessage: (messageHash: HexString$1, chainId: number) => Promise<HexString$1>;
|
|
3038
|
-
/** Signs a raw 32-byte hash, returning split signature components for EIP-7702 etc. */
|
|
3039
|
-
signRawHash: (hash: HexString$1) => Promise<{
|
|
3040
|
-
r: HexString$1;
|
|
3041
|
-
s: HexString$1;
|
|
3042
|
-
yParity: number;
|
|
3043
|
-
}>;
|
|
3044
3105
|
/**
|
|
3045
3106
|
* Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle Paymaster).
|
|
3046
3107
|
* The shape of `typedData` matches viem's `TypedDataDefinition` (domain + types + message).
|
|
3108
|
+
*
|
|
3109
|
+
* No chain id parameter: EIP-712 carries it in `domain.chainId`, which is what
|
|
3110
|
+
* the digest covers and what a backend scoping the request to a chain reads.
|
|
3047
3111
|
*/
|
|
3048
|
-
signTypedData: (typedData: unknown
|
|
3112
|
+
signTypedData: (typedData: unknown) => Promise<HexString$1>;
|
|
3049
3113
|
}
|
|
3050
3114
|
interface SubmitBidOptions {
|
|
3051
3115
|
order: Order;
|
|
@@ -3390,6 +3454,16 @@ type ERC7821Call = {
|
|
|
3390
3454
|
data: `0x${string}`;
|
|
3391
3455
|
};
|
|
3392
3456
|
|
|
3457
|
+
/**
|
|
3458
|
+
* Canonical symbol order used by the SDK and indexer pool IDs.
|
|
3459
|
+
*
|
|
3460
|
+
* Plain code-unit comparison, never locale-sensitive collation — the result is
|
|
3461
|
+
* a persisted primary key and must sort identically everywhere.
|
|
3462
|
+
*/
|
|
3463
|
+
declare function sortPoolSymbols<Symbol extends string>(symbolA: Symbol, symbolB: Symbol): [Symbol, Symbol];
|
|
3464
|
+
/** Canonical indexer pool ID for a pair of canonical token symbols. */
|
|
3465
|
+
declare function poolSlug(symbolA: string, symbolB: string): string;
|
|
3466
|
+
|
|
3393
3467
|
declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString$1;
|
|
3394
3468
|
declare function decodeERC7821ExecuteBatch(callData: HexString$1): ERC7821Call[] | null;
|
|
3395
3469
|
|
|
@@ -7839,4 +7913,4 @@ declare const _default: {
|
|
|
7839
7913
|
}];
|
|
7840
7914
|
};
|
|
7841
7915
|
|
|
7842
|
-
export { type
|
|
7916
|
+
export { type AssetTeleportedResponse as $, type AssetTeleported as A, type BuyAndSellRates as B, ChainConfigService as C, type Bid as D, type EstimateGasCallData as E, type FillerBid as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type EstimateFillOrderParams as J, type FillOrderEstimate as K, type OrderFeesQuote as L, type ERC7821Call as M, type OrderWithStatus as N, type Order as O, type PostRequestWithStatus as P, type QueryBuyAndSellRatesParams as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, OrderStatus as U, type TokenGatewayAssetTeleportedWithStatus as V, TeleportStatus as W, type DecodedOrderPlacedLog as X, type DecodedPostRequestEvent as Y, type DecodedPostResponseEvent as Z, type AllStatusKey as _, type IEvmConfig as a, type SigningAccount as a$, type BidStorageEntry as a0, type BidSubmissionResult as a1, type BlockMetadata as a2, type BytesLikeHex as a3, type CancelOptions as a4, type ChainConfig as a5, type ChainConfigData as a6, Chains as a7, type ConfiguredAssetSymbol as a8, type ConfiguredAssetSymbolInput as a9, type ITimeoutPostRequestMessage as aA, ABI as aB, type IntentGatewayParams as aC, IntentOrderStatus as aD, type IntentOrderStatusKey as aE, type IsmpRequest as aF, type LiquiditySlice as aG, type OrderResponse as aH, type OrderStatusMetadata as aI, type PaymentInfo as aJ, type PhantomBid as aK, type PhantomBidBatchResult as aL, type PhantomBidDeclaration as aM, type PhantomBidOutcome as aN, type PhantomOrderEvent as aO, type PhantomOrderLeg as aP, type PhantomOrderPriceSnapshot as aQ, type PhantomOrderPriceSnapshotsResponse as aR, type PollPhantomOrdersOptions as aS, type PostRequestStatus as aT, type RequestBody as aU, type RequestCommitment as aV, RequestKind as aW, type RequestResponse as aX, RequestStatus as aY, type RequestStatusKey as aZ, type SelectOptions as a_, type Deployment as aa, type DispatchGet as ab, type DispatchInfo as ac, type DispatchPost as ad, type Erc4626VaultConfigData as ae, type ExecuteIntentOrderOptions as af, type ExecutionResult as ag, type FillOptions as ah, type FillerConfig as ai, type GetRequestResponse as aj, type GetResponseByRequestIdResponse as ak, type GetResponseStorageValues as al, type HostParams as am, HyperClientStatus as an, type IBatchConsensusAndGetResponseMessage as ao, type IBatchConsensusAndPostRequestMessage as ap, type IConfig as aq, type IConsensusMessage as ar, type IGetRequestMessage as as, type IGetResponse as at, type IGetResponseMessage as au, type IHyperbridgeConfig as av, INCLUSION_TIMEOUT_MS as aw, type IPostResponse as ax, type IRequestMessage as ay, type ISubstrateConfig as az, type IMessage as b, recoverBidSignerViem as b$, type StateMachineId as b0, type StateMachineResponse as b1, type StorageFacade as b2, TimeoutStatus as b3, type TimeoutStatusKey as b4, type TokenGatewayAssetTeleportedResponse as b5, type TokenInfo as b6, type TokenPrice as b7, type TokenPricesResponse as b8, type UniswapV4PoolConfigData as b9, poolSlug as bA, sortPoolSymbols as bB, tronChainIds as bC, tronNile as bD, type AggregationLogger as bE, type BidNonceKeyFn as bF, type BidSignature as bG, ENTRY_POINT_V08_ADDRESS as bH, FILL_ORDER_ABI as bI, type FetchLike as bJ, type FillData as bK, type HexString as bL, _default as bM, type LpBalance as bN, type OrderCommitmentFn as bO, type PhantomAggregation as bP, type PhantomLegAggregation as bQ, type PhantomLegBidder as bR, type RecoverBidSigner as bS, type RpcBidInfo as bT, type SolverBalanceReader as bU, type YieldVaultMap as bV, aggregatePhantomBids as bW, extractFillData as bX, fetchBidsForOrder as bY, memoizedSolverBalance as bZ, orderCommitmentFromDecoded as b_, chainConfigs as ba, convertCodecToIGetRequest as bb, convertCodecToIProof as bc, convertIGetRequestToCodec as bd, convertIProofToCodec as be, convertStateIdToStateMachineId as bf, convertStateMachineEnumToString as bg, convertStateMachineIdToEnum as bh, decodeAcceptedSourceChains as bi, decodeERC7821ExecuteBatch as bj, decodePhantomBidDeclaration as bk, decodeUserOpScale as bl, deriveHttpUrl as bm, encodeAcceptedSourceChains as bn, encodeERC7821ExecuteBatch as bo, encodeISMPMessage as bp, encodePhantomBidDeclaration as bq, encodeUserOpScale as br, getChainId as bs, getConfigByStateMachineId as bt, getViemChain as bu, hyperbridgeAddress as bv, pharosAtlantic as bw, pharosMainnet as bx, polkadotAssetHubPaseo as by, polkadotHubMainnet as bz, type StateMachineHeight as c, setAggregationFetch as c0, splitBidSignature as c1, weightedMedian as c2, zipFillLegs as c3, type IIsmpMessage as d, type IPostRequest as e, type IGetRequest as f, type IPolkadotHubConfig as g, type IPharosConfig as h, type StateMachineUpdate as i, type ResponseCommitmentWithValues as j, type RequestStatusWithMetadata as k, type PostRequestTimeoutStatus as l, SubstrateChain as m, type ClientConfig as n, type IndexerQueryClient as o, type IProof as p, type IEvmChain as q, IntentsCoprocessor as r, type AvailableLiquidity as s, type IntentOrderStatusUpdate as t, type SelectBidResult as u, type ResumeIntentOrderOptions as v, type CancelOrderOptions as w, type CancelQuote as x, type SubmitBidOptions as y, type PackedUserOperation as z };
|
|
@@ -1939,6 +1939,14 @@ function decodeUserOpScale(hex) {
|
|
|
1939
1939
|
signature: util.u8aToHex(new Uint8Array(decoded.signature))
|
|
1940
1940
|
};
|
|
1941
1941
|
}
|
|
1942
|
+
|
|
1943
|
+
// src/protocols/intents/liquidity-pool.ts
|
|
1944
|
+
function sortPoolSymbols(symbolA, symbolB) {
|
|
1945
|
+
return symbolA.toLowerCase() <= symbolB.toLowerCase() ? [symbolA, symbolB] : [symbolB, symbolA];
|
|
1946
|
+
}
|
|
1947
|
+
function poolSlug(symbolA, symbolB) {
|
|
1948
|
+
return sortPoolSymbols(symbolA, symbolB).join("-");
|
|
1949
|
+
}
|
|
1942
1950
|
var SELECT_SOLVER_TYPEHASH = viem.keccak256(viem.toHex("SelectSolver(bytes32 commitment,address solver)"));
|
|
1943
1951
|
var PACKED_USEROP_TYPEHASH = viem.keccak256(
|
|
1944
1952
|
viem.toHex(
|
|
@@ -3036,8 +3044,10 @@ exports.extractFillData = extractFillData;
|
|
|
3036
3044
|
exports.fetchBidsForOrder = fetchBidsForOrder;
|
|
3037
3045
|
exports.memoizedSolverBalance = memoizedSolverBalance;
|
|
3038
3046
|
exports.orderCommitmentFromDecoded = orderCommitmentFromDecoded;
|
|
3047
|
+
exports.poolSlug = poolSlug;
|
|
3039
3048
|
exports.recoverBidSignerViem = recoverBidSignerViem;
|
|
3040
3049
|
exports.setAggregationFetch = setAggregationFetch;
|
|
3050
|
+
exports.sortPoolSymbols = sortPoolSymbols;
|
|
3041
3051
|
exports.splitBidSignature = splitBidSignature;
|
|
3042
3052
|
exports.weightedMedian = weightedMedian;
|
|
3043
3053
|
exports.zipFillLegs = zipFillLegs;
|