@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/browser/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/browser/index.js
CHANGED
|
@@ -8661,6 +8661,7 @@ var IndexerClient = class {
|
|
|
8661
8661
|
async aggregateTransactionWithCommitment(commitment) {
|
|
8662
8662
|
const logger = this.logger.withTag("aggregateTransactionWithCommitment");
|
|
8663
8663
|
const { stateMachineId, consensusStateId } = this.config.source.config;
|
|
8664
|
+
const consensusStateIdToHex = toHex(consensusStateId);
|
|
8664
8665
|
const sourceChain = this.config.source;
|
|
8665
8666
|
const hyperbridge = this.config.hyperbridge;
|
|
8666
8667
|
logger.trace("Querying post request with commitment hash");
|
|
@@ -8669,7 +8670,7 @@ var IndexerClient = class {
|
|
|
8669
8670
|
logger.trace("Fetch latest stateMachineHeight");
|
|
8670
8671
|
const latestStateMachineHeight = await hyperbridge.latestStateMachineHeight({
|
|
8671
8672
|
stateId: parseStateMachineId(stateMachineId).stateId,
|
|
8672
|
-
consensusStateId
|
|
8673
|
+
consensusStateId: consensusStateIdToHex
|
|
8673
8674
|
});
|
|
8674
8675
|
logger.trace("Query Request Proof from sourceChain");
|
|
8675
8676
|
const proof = await sourceChain.queryProof(
|
|
@@ -13366,7 +13367,7 @@ async function getPostResponseEventFromTx(client, txHash) {
|
|
|
13366
13367
|
var TeleportParams = Struct({
|
|
13367
13368
|
/// StateMachine
|
|
13368
13369
|
destination: StateMachine,
|
|
13369
|
-
///
|
|
13370
|
+
/// Receipient
|
|
13370
13371
|
recepient: H256,
|
|
13371
13372
|
/// Amount
|
|
13372
13373
|
amount: u128,
|
|
@@ -13397,7 +13398,7 @@ async function fetchLocalAssetId(params) {
|
|
|
13397
13398
|
return null;
|
|
13398
13399
|
}
|
|
13399
13400
|
async function teleport(teleport_param) {
|
|
13400
|
-
const {
|
|
13401
|
+
const { who, options, params, apiPromise } = teleport_param;
|
|
13401
13402
|
const substrateComplianceAddr = (address, stateMachine) => {
|
|
13402
13403
|
if (stateMachine.startsWith("EVM-")) return pad(address, { size: 32, dir: "left" });
|
|
13403
13404
|
return address;
|
|
@@ -13421,15 +13422,14 @@ async function teleport(teleport_param) {
|
|
|
13421
13422
|
};
|
|
13422
13423
|
const encoded = TeleportParams.enc(teleportParams);
|
|
13423
13424
|
const fullCallData = new Uint8Array([...scaleEncodedAssetId, ...encoded]);
|
|
13424
|
-
const
|
|
13425
|
-
const tx = extrinsics.length === 0 ? token_gateway_extrinsics : apiPromise.tx.utility.batchAll([...extrinsics, token_gateway_extrinsics]);
|
|
13425
|
+
const tx = apiPromise.tx.tokenGateway.teleport(fullCallData);
|
|
13426
13426
|
let unsub = () => {
|
|
13427
13427
|
};
|
|
13428
13428
|
let closed = false;
|
|
13429
13429
|
const stream = new ReadableStream(
|
|
13430
13430
|
{
|
|
13431
13431
|
async start(controller) {
|
|
13432
|
-
unsub = await tx.signAndSend(
|
|
13432
|
+
unsub = await tx.signAndSend(who, options, async (result) => {
|
|
13433
13433
|
try {
|
|
13434
13434
|
const { isInBlock, isError, dispatchError, txHash, isFinalized, status } = result;
|
|
13435
13435
|
const events = result.events;
|