@hyperbridge/sdk 1.5.0-rc0000000002 → 1.5.1
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/node/index.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { ConsolaInstance } from 'consola';
|
|
|
2
2
|
import { GraphQLClient } from 'graphql-request';
|
|
3
3
|
import { PublicClient, Hex, ContractFunctionArgs, Log } from 'viem';
|
|
4
4
|
import { ApiPromise } from '@polkadot/api';
|
|
5
|
-
import { SignerOptions
|
|
6
|
-
import { ISubmittableResult } from '@polkadot/types/types';
|
|
5
|
+
import { SignerOptions } from '@polkadot/api/types';
|
|
7
6
|
import { Chain } from 'viem/chains';
|
|
8
7
|
|
|
9
8
|
declare const _default: {
|
|
@@ -3479,12 +3478,11 @@ type Params = {
|
|
|
3479
3478
|
* @param params.recipient - Recipient address
|
|
3480
3479
|
* @param params.amount - Amount to teleport
|
|
3481
3480
|
* @param params.timeout - Operation timeout
|
|
3482
|
-
* @param params.extrinsics - An array of SubmittableExtrinsic to prepend to the teleport transaction
|
|
3483
3481
|
* @param params.tokenGatewayAddress - Gateway contract address
|
|
3484
|
-
* @param options - Signer options
|
|
3485
3482
|
* @param params.relayerFee - Fee for the relayer
|
|
3486
3483
|
* @param params.redeem - Whether to redeem on arrival
|
|
3487
3484
|
* @param params.callData - Optional additional call data
|
|
3485
|
+
* @param options - Signer options
|
|
3488
3486
|
* @yields {HyperbridgeTxEvents} Stream of events indicating transaction status
|
|
3489
3487
|
* @throws Error when asset ID is unknown or transaction fails
|
|
3490
3488
|
*/
|
|
@@ -3493,7 +3491,6 @@ declare function teleport(teleport_param: {
|
|
|
3493
3491
|
params: Params;
|
|
3494
3492
|
apiPromise: ApiPromise;
|
|
3495
3493
|
options: Partial<SignerOptions>;
|
|
3496
|
-
extrinsics: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
3497
3494
|
}): Promise<ReadableStream<HyperbridgeTxEvents>>;
|
|
3498
3495
|
|
|
3499
3496
|
declare enum Chains {
|
package/dist/node/index.js
CHANGED
|
@@ -8611,6 +8611,7 @@ var IndexerClient = class {
|
|
|
8611
8611
|
async aggregateTransactionWithCommitment(commitment) {
|
|
8612
8612
|
const logger = this.logger.withTag("aggregateTransactionWithCommitment");
|
|
8613
8613
|
const { stateMachineId, consensusStateId } = this.config.source.config;
|
|
8614
|
+
const consensusStateIdToHex = toHex(consensusStateId);
|
|
8614
8615
|
const sourceChain = this.config.source;
|
|
8615
8616
|
const hyperbridge = this.config.hyperbridge;
|
|
8616
8617
|
logger.trace("Querying post request with commitment hash");
|
|
@@ -8619,7 +8620,7 @@ var IndexerClient = class {
|
|
|
8619
8620
|
logger.trace("Fetch latest stateMachineHeight");
|
|
8620
8621
|
const latestStateMachineHeight = await hyperbridge.latestStateMachineHeight({
|
|
8621
8622
|
stateId: parseStateMachineId(stateMachineId).stateId,
|
|
8622
|
-
consensusStateId
|
|
8623
|
+
consensusStateId: consensusStateIdToHex
|
|
8623
8624
|
});
|
|
8624
8625
|
logger.trace("Query Request Proof from sourceChain");
|
|
8625
8626
|
const proof = await sourceChain.queryProof(
|
|
@@ -13306,7 +13307,7 @@ async function getPostResponseEventFromTx(client, txHash) {
|
|
|
13306
13307
|
var TeleportParams = Struct({
|
|
13307
13308
|
/// StateMachine
|
|
13308
13309
|
destination: StateMachine,
|
|
13309
|
-
///
|
|
13310
|
+
/// Receipient
|
|
13310
13311
|
recepient: H256,
|
|
13311
13312
|
/// Amount
|
|
13312
13313
|
amount: u128,
|
|
@@ -13337,7 +13338,7 @@ async function fetchLocalAssetId(params) {
|
|
|
13337
13338
|
return null;
|
|
13338
13339
|
}
|
|
13339
13340
|
async function teleport(teleport_param) {
|
|
13340
|
-
const {
|
|
13341
|
+
const { who, options, params, apiPromise } = teleport_param;
|
|
13341
13342
|
const substrateComplianceAddr = (address, stateMachine) => {
|
|
13342
13343
|
if (stateMachine.startsWith("EVM-")) return pad(address, { size: 32, dir: "left" });
|
|
13343
13344
|
return address;
|
|
@@ -13361,15 +13362,14 @@ async function teleport(teleport_param) {
|
|
|
13361
13362
|
};
|
|
13362
13363
|
const encoded = TeleportParams.enc(teleportParams);
|
|
13363
13364
|
const fullCallData = new Uint8Array([...scaleEncodedAssetId, ...encoded]);
|
|
13364
|
-
const
|
|
13365
|
-
const tx = extrinsics.length === 0 ? token_gateway_extrinsics : apiPromise.tx.utility.batchAll([...extrinsics, token_gateway_extrinsics]);
|
|
13365
|
+
const tx = apiPromise.tx.tokenGateway.teleport(fullCallData);
|
|
13366
13366
|
let unsub = () => {
|
|
13367
13367
|
};
|
|
13368
13368
|
let closed = false;
|
|
13369
13369
|
const stream = new ReadableStream(
|
|
13370
13370
|
{
|
|
13371
13371
|
async start(controller) {
|
|
13372
|
-
unsub = await tx.signAndSend(
|
|
13372
|
+
unsub = await tx.signAndSend(who, options, async (result) => {
|
|
13373
13373
|
try {
|
|
13374
13374
|
const { isInBlock, isError, dispatchError, txHash, isFinalized, status } = result;
|
|
13375
13375
|
const events = result.events;
|