@hyperbridge/sdk 2.7.2 → 2.8.0
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 +463 -405
- package/dist/browser/index.js +67 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +67 -6
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +67 -8
- package/dist/node/index.js.map +1 -1
- package/dist/node/{IntentGatewayV2-MxUcNZNs.d.cts → intents-helpers-gyGREuyu.d.cts} +1868 -235
- package/dist/node/{IntentGatewayV2-MxUcNZNs.d.ts → intents-helpers-gyGREuyu.d.ts} +1868 -235
- package/dist/node/intents-helpers.cjs +113 -19
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +3 -1506
- package/dist/node/intents-helpers.d.ts +3 -1506
- package/dist/node/intents-helpers.js +111 -21
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { match } from 'ts-pattern';
|
|
|
7
7
|
import { WsProvider, ApiPromise, Keyring } from '@polkadot/api';
|
|
8
8
|
import { Struct, Vector, u8, Bytes, Enum, Tuple, _void, u64, u32, Option, bool, u128 } from 'scale-ts';
|
|
9
9
|
import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a, blake2AsU8a } from '@polkadot/util-crypto';
|
|
10
|
-
import { hexToU8a, u8aToHex, u8aConcat } from '@polkadot/util';
|
|
10
|
+
import { hexToU8a, u8aToHex, u8aConcat, stringToU8a, isHex as isHex$1, u8aToString } from '@polkadot/util';
|
|
11
11
|
import PQueue from 'p-queue';
|
|
12
12
|
import { hasWindow, isNode, env } from 'std-env';
|
|
13
13
|
import mergeRace from '@async-generator/merge-race';
|
|
@@ -4891,6 +4891,24 @@ var ABI3 = [
|
|
|
4891
4891
|
internalType: "uint256"
|
|
4892
4892
|
}
|
|
4893
4893
|
]
|
|
4894
|
+
},
|
|
4895
|
+
{
|
|
4896
|
+
name: "predispatchCall",
|
|
4897
|
+
type: "bytes",
|
|
4898
|
+
indexed: false,
|
|
4899
|
+
internalType: "bytes"
|
|
4900
|
+
},
|
|
4901
|
+
{
|
|
4902
|
+
name: "outputCall",
|
|
4903
|
+
type: "bytes",
|
|
4904
|
+
indexed: false,
|
|
4905
|
+
internalType: "bytes"
|
|
4906
|
+
},
|
|
4907
|
+
{
|
|
4908
|
+
name: "graffiti",
|
|
4909
|
+
type: "bytes32",
|
|
4910
|
+
indexed: false,
|
|
4911
|
+
internalType: "bytes32"
|
|
4894
4912
|
}
|
|
4895
4913
|
],
|
|
4896
4914
|
anonymous: false
|
|
@@ -8272,14 +8290,17 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
|
|
|
8272
8290
|
const orders = [];
|
|
8273
8291
|
for (const { event } of records) {
|
|
8274
8292
|
if (event.section !== "intentsCoprocessor" || event.method !== "PhantomOrderRegistered") continue;
|
|
8275
|
-
const [commitment, chain, createdAt,
|
|
8293
|
+
const [commitment, chain, createdAt, legs] = event.data;
|
|
8276
8294
|
orders.push({
|
|
8277
8295
|
commitment: commitment.toHex(),
|
|
8278
8296
|
chain: new TextDecoder().decode(hexToU8a(chain.toHex())),
|
|
8279
8297
|
createdAt: createdAt.toNumber(),
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8299
|
+
legs: legs.map((leg) => ({
|
|
8300
|
+
tokenA: leg.tokenA.toHex(),
|
|
8301
|
+
tokenB: leg.tokenB.toHex(),
|
|
8302
|
+
standardAmount: BigInt(leg.standardAmount.toString())
|
|
8303
|
+
}))
|
|
8283
8304
|
});
|
|
8284
8305
|
}
|
|
8285
8306
|
return orders;
|
|
@@ -15585,13 +15606,13 @@ function deriveCanonicalPlacedOrder(order, args) {
|
|
|
15585
15606
|
session: args.session,
|
|
15586
15607
|
predispatch: {
|
|
15587
15608
|
assets: args.predispatch.map((asset) => ({ ...asset })),
|
|
15588
|
-
call: order.predispatch.call
|
|
15609
|
+
call: args.predispatchCall ?? order.predispatch.call
|
|
15589
15610
|
},
|
|
15590
15611
|
inputs: args.inputs.map((asset) => ({ ...asset })),
|
|
15591
15612
|
output: {
|
|
15592
15613
|
beneficiary: args.beneficiary,
|
|
15593
15614
|
assets: args.outputs.map((asset) => ({ ...asset })),
|
|
15594
|
-
call: order.output.call
|
|
15615
|
+
call: args.outputCall ?? order.output.call
|
|
15595
15616
|
}
|
|
15596
15617
|
};
|
|
15597
15618
|
return { ...canonicalOrder, id: orderCommitment(canonicalOrder) };
|
|
@@ -19169,6 +19190,44 @@ var IntentGateway = class _IntentGateway {
|
|
|
19169
19190
|
}
|
|
19170
19191
|
}
|
|
19171
19192
|
};
|
|
19193
|
+
var FILL_ORDER_ABI = IntentGatewayV2_default.ABI;
|
|
19194
|
+
var DECLARATION_VERSION = 1;
|
|
19195
|
+
var MAX_DECLARED_CHAINS = 255;
|
|
19196
|
+
function encodeAcceptedSourceChains(chains2) {
|
|
19197
|
+
if (chains2.length > MAX_DECLARED_CHAINS) {
|
|
19198
|
+
throw new Error(`Cannot declare more than ${MAX_DECLARED_CHAINS} source chains`);
|
|
19199
|
+
}
|
|
19200
|
+
const bytes = [DECLARATION_VERSION, chains2.length];
|
|
19201
|
+
for (const chain of chains2) {
|
|
19202
|
+
const encoded = stringToU8a(chain);
|
|
19203
|
+
if (encoded.length === 0 || encoded.length > 255) {
|
|
19204
|
+
throw new Error(`Invalid state machine id in source chain declaration: ${chain}`);
|
|
19205
|
+
}
|
|
19206
|
+
bytes.push(encoded.length, ...encoded);
|
|
19207
|
+
}
|
|
19208
|
+
return u8aToHex(new Uint8Array(bytes));
|
|
19209
|
+
}
|
|
19210
|
+
function decodeAcceptedSourceChains(paymasterAndData) {
|
|
19211
|
+
if (!paymasterAndData || !isHex$1(paymasterAndData)) return null;
|
|
19212
|
+
const bytes = hexToU8a(paymasterAndData);
|
|
19213
|
+
if (bytes.length < 2 || bytes[0] !== DECLARATION_VERSION) return null;
|
|
19214
|
+
const count = bytes[1];
|
|
19215
|
+
const chains2 = [];
|
|
19216
|
+
let offset = 2;
|
|
19217
|
+
for (let entry = 0; entry < count; entry++) {
|
|
19218
|
+
if (offset >= bytes.length) return null;
|
|
19219
|
+
const length = bytes[offset];
|
|
19220
|
+
offset += 1;
|
|
19221
|
+
if (length === 0 || offset + length > bytes.length) return null;
|
|
19222
|
+
chains2.push(u8aToString(bytes.subarray(offset, offset + length)));
|
|
19223
|
+
offset += length;
|
|
19224
|
+
}
|
|
19225
|
+
if (offset !== bytes.length) return null;
|
|
19226
|
+
return chains2;
|
|
19227
|
+
}
|
|
19228
|
+
FILL_ORDER_ABI.find(
|
|
19229
|
+
(item) => item?.type === "function" && item?.name === "fillOrder"
|
|
19230
|
+
)?.inputs?.[0];
|
|
19172
19231
|
var TokenGateway = class {
|
|
19173
19232
|
source;
|
|
19174
19233
|
dest;
|
|
@@ -23639,6 +23698,6 @@ async function teleportDot(param_) {
|
|
|
23639
23698
|
return stream;
|
|
23640
23699
|
}
|
|
23641
23700
|
|
|
23642
|
-
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, InvalidPhantomSnapshotError, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PhantomSnapshotUnavailableError, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
23701
|
+
export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, InvalidPhantomSnapshotError, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PhantomSnapshotUnavailableError, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|
|
23643
23702
|
//# sourceMappingURL=index.js.map
|
|
23644
23703
|
//# sourceMappingURL=index.js.map
|