@hyperbridge/sdk 1.8.5 → 1.8.6
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 +14 -2
- package/dist/browser/index.js +15 -18
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +14 -2
- package/dist/node/index.js +15 -18
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -4
package/dist/browser/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
|
|
|
9
9
|
import { ISubmittableResult } from '@polkadot/types/types';
|
|
10
10
|
import { Chain } from 'viem/chains';
|
|
11
11
|
import { TronWeb } from 'tronweb';
|
|
12
|
+
export { Account as ViemAccount } from 'viem/accounts';
|
|
12
13
|
|
|
13
14
|
declare const _default: {
|
|
14
15
|
ABI: readonly [{
|
|
@@ -2774,11 +2775,22 @@ interface PackedUserOperation {
|
|
|
2774
2775
|
paymasterAndData: HexString;
|
|
2775
2776
|
signature: HexString;
|
|
2776
2777
|
}
|
|
2778
|
+
interface SigningAccount {
|
|
2779
|
+
/** Signs a bid message hash for a given chain. Returns a 65-byte ECDSA signature. */
|
|
2780
|
+
signMessage: (messageHash: HexString, chainId: number) => Promise<HexString>;
|
|
2781
|
+
/** Signs a raw 32-byte hash, returning split signature components for EIP-7702 etc. */
|
|
2782
|
+
signRawHash: (hash: HexString) => Promise<{
|
|
2783
|
+
r: HexString;
|
|
2784
|
+
s: HexString;
|
|
2785
|
+
yParity: number;
|
|
2786
|
+
}>;
|
|
2787
|
+
}
|
|
2777
2788
|
interface SubmitBidOptions {
|
|
2778
2789
|
order: Order;
|
|
2779
2790
|
fillOptions: FillOptions;
|
|
2780
2791
|
solverAccount: HexString;
|
|
2781
|
-
|
|
2792
|
+
/** Canonical signer used for bid message signing and raw-hash operations. */
|
|
2793
|
+
solverSigner: SigningAccount;
|
|
2782
2794
|
nonce: bigint;
|
|
2783
2795
|
entryPointAddress: HexString;
|
|
2784
2796
|
callGasLimit: bigint;
|
|
@@ -8099,4 +8111,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
|
8099
8111
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
8100
8112
|
declare const hyperbridgeAddress = "";
|
|
8101
8113
|
|
|
8102
|
-
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 IPolkadotHubConfig, 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, PolkadotHubChain, type PolkadotHubChainParams, 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, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
8114
|
+
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 IPolkadotHubConfig, 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, PolkadotHubChain, type PolkadotHubChainParams, 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 SigningAccount, 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, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
package/dist/browser/index.js
CHANGED
|
@@ -7133,7 +7133,8 @@ function decodeReviveContractTrieId(accountData) {
|
|
|
7133
7133
|
var H256 = Vector(u8, 32);
|
|
7134
7134
|
var EvmStateProof = Struct({
|
|
7135
7135
|
/**
|
|
7136
|
-
* Proof of the contract state
|
|
7136
|
+
* Proof of the contract state (EVM account trie) or, for Revive / Substrate EVM, the main state trie proof
|
|
7137
|
+
* (`AccountInfo` + child root) — same SCALE shape as `SubstrateEvmProof::main_proof` on the Rust side.
|
|
7137
7138
|
*/
|
|
7138
7139
|
contractProof: Vector(Vector(u8)),
|
|
7139
7140
|
/**
|
|
@@ -7141,16 +7142,6 @@ var EvmStateProof = Struct({
|
|
|
7141
7142
|
*/
|
|
7142
7143
|
storageProof: Vector(Tuple(Vector(u8), Vector(Vector(u8))))
|
|
7143
7144
|
});
|
|
7144
|
-
var SubstrateEvmProof = Struct({
|
|
7145
|
-
main_proof: Vector(Vector(u8)),
|
|
7146
|
-
storage_proof: Vector(Tuple(Vector(u8), Vector(Vector(u8))))
|
|
7147
|
-
});
|
|
7148
|
-
function encodeSubstrateEvmProofBytes(params) {
|
|
7149
|
-
return SubstrateEvmProof.enc({
|
|
7150
|
-
main_proof: params.mainProof,
|
|
7151
|
-
storage_proof: Array.from(params.storageProof.entries())
|
|
7152
|
-
});
|
|
7153
|
-
}
|
|
7154
7145
|
var SubstrateHashing = Enum({
|
|
7155
7146
|
/* For chains that use keccak as their hashing algo */
|
|
7156
7147
|
Keccak: _void,
|
|
@@ -7663,14 +7654,21 @@ var PolkadotHubChain = class _PolkadotHubChain {
|
|
|
7663
7654
|
childKeysHex,
|
|
7664
7655
|
blockHash
|
|
7665
7656
|
]);
|
|
7657
|
+
const childNodes = childRead.proof.map((p) => hexToBytes(p));
|
|
7666
7658
|
storageProofEncoded.set(
|
|
7667
7659
|
addr20,
|
|
7668
|
-
|
|
7660
|
+
childNodes
|
|
7669
7661
|
);
|
|
7670
7662
|
}
|
|
7671
|
-
const
|
|
7672
|
-
|
|
7673
|
-
|
|
7663
|
+
const storageEntries = Array.from(storageProofEncoded.entries());
|
|
7664
|
+
const contractProofForEnc = mainProofBytes.map((b) => Array.from(b));
|
|
7665
|
+
const storageProofForEnc = storageEntries.map(([k, nodes]) => [
|
|
7666
|
+
Array.from(k),
|
|
7667
|
+
nodes.map((n) => Array.from(n))
|
|
7668
|
+
]);
|
|
7669
|
+
const encoded = EvmStateProof.enc({
|
|
7670
|
+
contractProof: contractProofForEnc,
|
|
7671
|
+
storageProof: storageProofForEnc
|
|
7674
7672
|
});
|
|
7675
7673
|
return bytesToHex(encoded);
|
|
7676
7674
|
}
|
|
@@ -15995,7 +15993,7 @@ var BidManager = class {
|
|
|
15995
15993
|
const {
|
|
15996
15994
|
order,
|
|
15997
15995
|
solverAccount,
|
|
15998
|
-
|
|
15996
|
+
solverSigner,
|
|
15999
15997
|
nonce,
|
|
16000
15998
|
entryPointAddress,
|
|
16001
15999
|
callGasLimit,
|
|
@@ -16024,8 +16022,7 @@ var BidManager = class {
|
|
|
16024
16022
|
const userOpHash = this.crypto.computeUserOpHash(userOp, entryPointAddress, chainId);
|
|
16025
16023
|
const sessionKey = order.session;
|
|
16026
16024
|
const messageHash = keccak256(concat([userOpHash, order.id, sessionKey]));
|
|
16027
|
-
const
|
|
16028
|
-
const solverSignature = await solverAccount_.signMessage({ message: { raw: messageHash } });
|
|
16025
|
+
const solverSignature = await solverSigner.signMessage(messageHash, Number(chainId));
|
|
16029
16026
|
const signature = concat([order.id, solverSignature]);
|
|
16030
16027
|
return { ...userOp, signature };
|
|
16031
16028
|
}
|