@hyperbridge/sdk
Version:
The hyperclient SDK provides utilities for querying proofs and statuses for cross-chain requests from HyperBridge.
2,168 lines (2,164 loc) • 395 kB
JavaScript
import { readFileSync } from 'fs';
import { join } from 'path';
import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'util';
import { createConsola, LogLevels } from 'consola';
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, hexToString as hexToString$1, parseEventLogs, parseAbiParameters, parseAbiItem } from 'viem';
import mergeRace from '@async-generator/merge-race';
import { unichain, polygon, gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
import { hasWindow, isNode, env } from 'std-env';
import { Vector, u8, Struct, Tuple, Enum, _void, u64, u32, Option, bool, u128, Bytes } from 'scale-ts';
import { match } from 'ts-pattern';
import { WsProvider, ApiPromise } from '@polkadot/api';
import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a } from '@polkadot/util-crypto';
import { GraphQLClient } from 'graphql-request';
import { Decimal } from 'decimal.js';
import { createStorage } from 'unstorage';
import inMemoryDriver from 'unstorage/drivers/memory';
import fsDriver from 'unstorage/drivers/fs';
import { hexToU8a, u8aToHex } from '@polkadot/util';
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// src/utils/ckb-mmr-wasm/dist/node/node.js
var node_exports = {};
__export(node_exports, {
KeccakMerge: () => KeccakMerge,
__wasm: () => __wasm,
__wbindgen_error_new: () => __wbindgen_error_new,
__wbindgen_init_externref_table: () => __wbindgen_init_externref_table,
__wbindgen_string_get: () => __wbindgen_string_get,
__wbindgen_throw: () => __wbindgen_throw,
default: () => init,
generate_root_with_proof: () => generate_root_with_proof,
verify_proof: () => verify_proof
});
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === void 0) {
const buf = cachedTextEncoder.encode(arg);
const ptr2 = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr2;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 127) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
function isLikeNone(x) {
return x === void 0 || x === null;
}
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function takeFromExternrefTable0(idx) {
const value = wasm.__wbindgen_export_0.get(idx);
wasm.__externref_table_dealloc(idx);
return value;
}
function generate_root_with_proof(calldata_bytes, tree_size) {
let deferred3_0;
let deferred3_1;
try {
const ptr0 = passArray8ToWasm0(calldata_bytes, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.generate_root_with_proof(ptr0, len0, tree_size);
var ptr2 = ret[0];
var len2 = ret[1];
if (ret[3]) {
ptr2 = 0;
len2 = 0;
throw takeFromExternrefTable0(ret[2]);
}
deferred3_0 = ptr2;
deferred3_1 = len2;
return getStringFromWasm0(ptr2, len2);
} finally {
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
}
}
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_export_0.set(idx, obj);
return idx;
}
function passArrayJsValueToWasm0(array, malloc) {
const ptr = malloc(array.length * 4, 4) >>> 0;
for (let i = 0; i < array.length; i++) {
const add = addToExternrefTable0(array[i]);
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
}
WASM_VECTOR_LEN = array.length;
return ptr;
}
function verify_proof(root_hex, proof_hex, mmr_size, leaf_position, calldata_bytes) {
const ptr0 = passStringToWasm0(root_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArrayJsValueToWasm0(proof_hex, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(calldata_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ret = wasm.verify_proof(ptr0, len0, ptr1, len1, mmr_size, leaf_position, ptr2, len2);
if (ret[2]) {
throw takeFromExternrefTable0(ret[1]);
}
return ret[0] !== 0;
}
function __wbindgen_error_new(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
return ret;
}
function __wbindgen_init_externref_table() {
const table = wasm.__wbindgen_export_0;
const offset = table.grow(4);
table.set(0, void 0);
table.set(offset + 0, void 0);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
}
function __wbindgen_string_get(arg0, arg1) {
const obj = arg1;
const ret = typeof obj === "string" ? obj : void 0;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}
function __wbindgen_throw(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
}
function init() {
console.log("CKB MMR WASM initialized");
}
var wasm, full_path, __dirname$1, cachedTextDecoder, cachedUint8ArrayMemory0, WASM_VECTOR_LEN, cachedTextEncoder, encodeString, cachedDataViewMemory0, KeccakMergeFinalization, KeccakMerge, wasmPath, wasmBytes, bindings, wasmModule, wasmInstance, __wasm;
var init_node = __esm({
"src/utils/ckb-mmr-wasm/dist/node/node.js"() {
full_path = import.meta.url.split("/").slice(1);
__dirname$1 = `${full_path.slice(0, full_path.length - 1).join("/")}/`;
cachedTextDecoder = new TextDecoder$1("utf-8", { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
cachedUint8ArrayMemory0 = null;
WASM_VECTOR_LEN = 0;
cachedTextEncoder = new TextEncoder$1("utf-8");
encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
} : function(arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
};
cachedDataViewMemory0 = null;
KeccakMergeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_keccakmerge_free(ptr >>> 0, 1));
KeccakMerge = class {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
KeccakMergeFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_keccakmerge_free(ptr, 0);
}
};
wasmPath = join(__dirname$1, "./node_bg.wasm");
wasmBytes = readFileSync(wasmPath);
bindings = {
generate_root_with_proof,
verify_proof,
KeccakMerge,
__wbindgen_error_new,
__wbindgen_init_externref_table,
__wbindgen_string_get,
__wbindgen_throw
};
wasmModule = new WebAssembly.Module(wasmBytes);
wasmInstance = new WebAssembly.Instance(wasmModule, {
__wbindgen_placeholder__: bindings
});
wasm = wasmInstance.exports;
__wasm = wasm;
wasm.__wbindgen_start();
}
});
// src/types/index.ts
var RequestStatus = Object.freeze({
SOURCE: "SOURCE",
SOURCE_FINALIZED: "SOURCE_FINALIZED",
HYPERBRIDGE_DELIVERED: "HYPERBRIDGE_DELIVERED",
HYPERBRIDGE_FINALIZED: "HYPERBRIDGE_FINALIZED",
DESTINATION: "DESTINATION",
TIMED_OUT: "TIMED_OUT",
HYPERBRIDGE_TIMED_OUT: "HYPERBRIDGE_TIMED_OUT"
});
var TimeoutStatus = Object.freeze({
PENDING_TIMEOUT: "PENDING_TIMEOUT",
DESTINATION_FINALIZED_TIMEOUT: "DESTINATION_FINALIZED_TIMEOUT",
HYPERBRIDGE_TIMED_OUT: "HYPERBRIDGE_TIMED_OUT",
HYPERBRIDGE_FINALIZED_TIMEOUT: "HYPERBRIDGE_FINALIZED_TIMEOUT",
TIMED_OUT: "TIMED_OUT"
});
var HyperClientStatus = /* @__PURE__ */ ((HyperClientStatus2) => {
HyperClientStatus2["PENDING"] = "PENDING";
HyperClientStatus2["SOURCE_FINALIZED"] = "SOURCE_FINALIZED";
HyperClientStatus2["HYPERBRIDGE_FINALIZED"] = "HYPERBRIDGE_FINALIZED";
HyperClientStatus2["HYPERBRIDGE_VERIFIED"] = "HYPERBRIDGE_VERIFIED";
HyperClientStatus2["DESTINATION"] = "DESTINATION";
HyperClientStatus2["TIMED_OUT"] = "TIMED_OUT";
HyperClientStatus2["HYPERBRIDGE_TIMED_OUT"] = "HYPERBRIDGE_TIMED_OUT";
HyperClientStatus2["ERROR"] = "ERROR";
return HyperClientStatus2;
})(HyperClientStatus || {});
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
OrderStatus2["PLACED"] = "PLACED";
OrderStatus2["FILLED"] = "FILLED";
OrderStatus2["REDEEMED"] = "REDEEMED";
OrderStatus2["REFUNDED"] = "REFUNDED";
return OrderStatus2;
})(OrderStatus || {});
var TeleportStatus = /* @__PURE__ */ ((TeleportStatus2) => {
TeleportStatus2["TELEPORTED"] = "TELEPORTED";
TeleportStatus2["RECEIVED"] = "RECEIVED";
TeleportStatus2["REFUNDED"] = "REFUNDED";
return TeleportStatus2;
})(TeleportStatus || {});
var RequestKind = /* @__PURE__ */ ((RequestKind2) => {
RequestKind2[RequestKind2["RedeemEscrow"] = 0] = "RedeemEscrow";
RequestKind2[RequestKind2["NewDeployment"] = 1] = "NewDeployment";
RequestKind2[RequestKind2["UpdateParams"] = 2] = "UpdateParams";
return RequestKind2;
})(RequestKind || {});
// src/abis/evmHost.ts
var ABI = [
{
inputs: [],
name: "CannotChangeFeeToken",
type: "error"
},
{
inputs: [],
name: "DuplicateResponse",
type: "error"
},
{
inputs: [],
name: "FrozenHost",
type: "error"
},
{
inputs: [],
name: "InvalidAddressLength",
type: "error"
},
{
inputs: [],
name: "InvalidConsensusClient",
type: "error"
},
{
inputs: [],
name: "InvalidHandler",
type: "error"
},
{
inputs: [],
name: "InvalidHostManager",
type: "error"
},
{
inputs: [],
name: "InvalidHyperbridgeId",
type: "error"
},
{
inputs: [],
name: "InvalidStateMachinesLength",
type: "error"
},
{
inputs: [],
name: "InvalidUnstakingPeriod",
type: "error"
},
{
inputs: [],
name: "UnauthorizedAccount",
type: "error"
},
{
inputs: [],
name: "UnauthorizedAction",
type: "error"
},
{
inputs: [],
name: "UnauthorizedResponse",
type: "error"
},
{
inputs: [],
name: "UnknownRequest",
type: "error"
},
{
inputs: [],
name: "UnknownResponse",
type: "error"
},
{
inputs: [],
name: "WithdrawalFailed",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "source",
type: "string"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
},
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: false,
internalType: "bytes[]",
name: "keys",
type: "bytes[]"
},
{
indexed: false,
internalType: "uint256",
name: "height",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "nonce",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "timeoutTimestamp",
type: "uint256"
},
{
indexed: false,
internalType: "bytes",
name: "context",
type: "bytes"
},
{
indexed: false,
internalType: "uint256",
name: "fee",
type: "uint256"
}
],
name: "GetRequestEvent",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "GetRequestHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
}
],
name: "GetRequestTimeoutHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "enum FrozenStatus",
name: "status",
type: "uint8"
}
],
name: "HostFrozen",
type: "event"
},
{
anonymous: false,
inputs: [
{
components: [
{
internalType: "uint256",
name: "defaultTimeout",
type: "uint256"
},
{
internalType: "uint256",
name: "defaultPerByteFee",
type: "uint256"
},
{
internalType: "uint256",
name: "stateCommitmentFee",
type: "uint256"
},
{
internalType: "address",
name: "feeToken",
type: "address"
},
{
internalType: "address",
name: "admin",
type: "address"
},
{
internalType: "address",
name: "handler",
type: "address"
},
{
internalType: "address",
name: "hostManager",
type: "address"
},
{
internalType: "address",
name: "uniswapV2",
type: "address"
},
{
internalType: "uint256",
name: "unStakingPeriod",
type: "uint256"
},
{
internalType: "uint256",
name: "challengePeriod",
type: "uint256"
},
{
internalType: "address",
name: "consensusClient",
type: "address"
},
{
internalType: "uint256[]",
name: "stateMachines",
type: "uint256[]"
},
{
components: [
{
internalType: "bytes32",
name: "stateIdHash",
type: "bytes32"
},
{
internalType: "uint256",
name: "perByteFee",
type: "uint256"
}
],
internalType: "struct PerByteFee[]",
name: "perByteFees",
type: "tuple[]"
},
{
internalType: "bytes",
name: "hyperbridge",
type: "bytes"
}
],
indexed: false,
internalType: "struct HostParams",
name: "oldParams",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "defaultTimeout",
type: "uint256"
},
{
internalType: "uint256",
name: "defaultPerByteFee",
type: "uint256"
},
{
internalType: "uint256",
name: "stateCommitmentFee",
type: "uint256"
},
{
internalType: "address",
name: "feeToken",
type: "address"
},
{
internalType: "address",
name: "admin",
type: "address"
},
{
internalType: "address",
name: "handler",
type: "address"
},
{
internalType: "address",
name: "hostManager",
type: "address"
},
{
internalType: "address",
name: "uniswapV2",
type: "address"
},
{
internalType: "uint256",
name: "unStakingPeriod",
type: "uint256"
},
{
internalType: "uint256",
name: "challengePeriod",
type: "uint256"
},
{
internalType: "address",
name: "consensusClient",
type: "address"
},
{
internalType: "uint256[]",
name: "stateMachines",
type: "uint256[]"
},
{
components: [
{
internalType: "bytes32",
name: "stateIdHash",
type: "bytes32"
},
{
internalType: "uint256",
name: "perByteFee",
type: "uint256"
}
],
internalType: "struct PerByteFee[]",
name: "perByteFees",
type: "tuple[]"
},
{
internalType: "bytes",
name: "hyperbridge",
type: "bytes"
}
],
indexed: false,
internalType: "struct HostParams",
name: "newParams",
type: "tuple"
}
],
name: "HostParamsUpdated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "beneficiary",
type: "address"
},
{
indexed: false,
internalType: "bool",
name: "native",
type: "bool"
}
],
name: "HostWithdrawal",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "source",
type: "string"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
},
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: false,
internalType: "bytes",
name: "to",
type: "bytes"
},
{
indexed: false,
internalType: "uint256",
name: "nonce",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "timeoutTimestamp",
type: "uint256"
},
{
indexed: false,
internalType: "bytes",
name: "body",
type: "bytes"
},
{
indexed: false,
internalType: "uint256",
name: "fee",
type: "uint256"
}
],
name: "PostRequestEvent",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "PostRequestHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
}
],
name: "PostRequestTimeoutHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "source",
type: "string"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
},
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: false,
internalType: "bytes",
name: "to",
type: "bytes"
},
{
indexed: false,
internalType: "uint256",
name: "nonce",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "timeoutTimestamp",
type: "uint256"
},
{
indexed: false,
internalType: "bytes",
name: "body",
type: "bytes"
},
{
indexed: false,
internalType: "bytes",
name: "response",
type: "bytes"
},
{
indexed: false,
internalType: "uint256",
name: "responseTimeoutTimestamp",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "fee",
type: "uint256"
}
],
name: "PostResponseEvent",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "uint256",
name: "newFee",
type: "uint256"
}
],
name: "PostResponseFunded",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "PostResponseHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "string",
name: "dest",
type: "string"
}
],
name: "PostResponseTimeoutHandled",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
indexed: false,
internalType: "uint256",
name: "newFee",
type: "uint256"
}
],
name: "RequestFunded",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "caller",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "fee",
type: "uint256"
}
],
name: "StateCommitmentRead",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "stateMachineId",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "height",
type: "uint256"
},
{
components: [
{
internalType: "uint256",
name: "timestamp",
type: "uint256"
},
{
internalType: "bytes32",
name: "overlayRoot",
type: "bytes32"
},
{
internalType: "bytes32",
name: "stateRoot",
type: "bytes32"
}
],
indexed: false,
internalType: "struct StateCommitment",
name: "stateCommitment",
type: "tuple"
},
{
indexed: true,
internalType: "address",
name: "fisherman",
type: "address"
}
],
name: "StateCommitmentVetoed",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "stateMachineId",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "height",
type: "uint256"
}
],
name: "StateMachineUpdated",
type: "event"
},
{
inputs: [],
name: "admin",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "chainId",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "challengePeriod",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "consensusClient",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "consensusState",
outputs: [
{
internalType: "bytes",
name: "",
type: "bytes"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "consensusUpdateTime",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "uint256",
name: "stateMachineId",
type: "uint256"
},
{
internalType: "uint256",
name: "height",
type: "uint256"
}
],
internalType: "struct StateMachineHeight",
name: "height",
type: "tuple"
},
{
internalType: "address",
name: "fisherman",
type: "address"
}
],
name: "deleteStateMachineCommitment",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "bytes",
name: "from",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
}
],
internalType: "struct PostRequest",
name: "request",
type: "tuple"
},
{
internalType: "bytes",
name: "response",
type: "bytes"
},
{
internalType: "uint64",
name: "timeout",
type: "uint64"
},
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "payer",
type: "address"
}
],
internalType: "struct DispatchPostResponse",
name: "post",
type: "tuple"
}
],
name: "dispatch",
outputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
},
{
internalType: "uint64",
name: "timeout",
type: "uint64"
},
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "payer",
type: "address"
}
],
internalType: "struct DispatchPost",
name: "post",
type: "tuple"
}
],
name: "dispatch",
outputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "height",
type: "uint64"
},
{
internalType: "bytes[]",
name: "keys",
type: "bytes[]"
},
{
internalType: "uint64",
name: "timeout",
type: "uint64"
},
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "bytes",
name: "context",
type: "bytes"
}
],
internalType: "struct DispatchGet",
name: "get",
type: "tuple"
}
],
name: "dispatch",
outputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "bytes",
name: "from",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
}
],
internalType: "struct PostRequest",
name: "request",
type: "tuple"
},
{
internalType: "bytes",
name: "response",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
}
],
internalType: "struct PostResponse",
name: "response",
type: "tuple"
},
{
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "dispatchIncoming",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "bytes",
name: "from",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
}
],
internalType: "struct PostRequest",
name: "request",
type: "tuple"
},
{
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "dispatchIncoming",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "address",
name: "from",
type: "address"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes[]",
name: "keys",
type: "bytes[]"
},
{
internalType: "uint64",
name: "height",
type: "uint64"
},
{
internalType: "bytes",
name: "context",
type: "bytes"
}
],
internalType: "struct GetRequest",
name: "request",
type: "tuple"
},
{
components: [
{
internalType: "bytes",
name: "key",
type: "bytes"
},
{
internalType: "bytes",
name: "value",
type: "bytes"
}
],
internalType: "struct StorageValue[]",
name: "values",
type: "tuple[]"
}
],
internalType: "struct GetResponse",
name: "response",
type: "tuple"
},
{
internalType: "address",
name: "relayer",
type: "address"
}
],
name: "dispatchIncoming",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "bytes",
name: "from",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
}
],
internalType: "struct PostRequest",
name: "request",
type: "tuple"
},
{
internalType: "bytes",
name: "response",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
}
],
internalType: "struct PostResponse",
name: "response",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "sender",
type: "address"
}
],
internalType: "struct FeeMetadata",
name: "meta",
type: "tuple"
},
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "dispatchTimeOut",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "bytes",
name: "from",
type: "bytes"
},
{
internalType: "bytes",
name: "to",
type: "bytes"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes",
name: "body",
type: "bytes"
}
],
internalType: "struct PostRequest",
name: "request",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "sender",
type: "address"
}
],
internalType: "struct FeeMetadata",
name: "meta",
type: "tuple"
},
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "dispatchTimeOut",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "bytes",
name: "source",
type: "bytes"
},
{
internalType: "bytes",
name: "dest",
type: "bytes"
},
{
internalType: "uint64",
name: "nonce",
type: "uint64"
},
{
internalType: "address",
name: "from",
type: "address"
},
{
internalType: "uint64",
name: "timeoutTimestamp",
type: "uint64"
},
{
internalType: "bytes[]",
name: "keys",
type: "bytes[]"
},
{
internalType: "uint64",
name: "height",
type: "uint64"
},
{
internalType: "bytes",
name: "context",
type: "bytes"
}
],
internalType: "struct GetRequest",
name: "request",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "sender",
type: "address"
}
],
internalType: "struct FeeMetadata",
name: "meta",
type: "tuple"
},
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "dispatchTimeOut",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "feeToken",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "frozen",
outputs: [
{
internalType: "enum FrozenStatus",
name: "",
type: "uint8"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "fundRequest",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "fundResponse",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [],
name: "host",
outputs: [
{
internalType: "bytes",
name: "",
type: "bytes"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "hostParams",
outputs: [
{
components: [
{
internalType: "uint256",
name: "defaultTimeout",
type: "uint256"
},
{
internalType: "uint256",
name: "defaultPerByteFee",
type: "uint256"
},
{
internalType: "uint256",
name: "stateCommitmentFee",
type: "uint256"
},
{
internalType: "address",
name: "feeToken",
type: "address"
},
{
internalType: "address",
name: "admin",
type: "address"
},
{
internalType: "address",
name: "handler",
type: "address"
},
{
internalType: "address",
name: "hostManager",
type: "address"
},
{
internalType: "address",
name: "uniswapV2",
type: "address"
},
{
internalType: "uint256",
name: "unStakingPeriod",
type: "uint256"
},
{
internalType: "uint256",
name: "challengePeriod",
type: "uint256"
},
{
internalType: "address",
name: "consensusClient",
type: "address"
},
{
internalType: "uint256[]",
name: "stateMachines",
type: "uint256[]"
},
{
components: [
{
internalType: "bytes32",
name: "stateIdHash",
type: "bytes32"
},
{
internalType: "uint256",
name: "perByteFee",
type: "uint256"
}
],
internalType: "struct PerByteFee[]",
name: "perByteFees",
type: "tuple[]"
},
{
internalType: "bytes",
name: "hyperbridge",
type: "bytes"
}
],
internalType: "struct HostParams",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "hyperbridge",
outputs: [
{
internalType: "bytes",
name: "",
type: "bytes"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "id",
type: "uint256"
}
],
name: "latestStateMachineHeight",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "nonce",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "stateId",
type: "bytes"
}
],
name: "perByteFee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "requestCommitments",
outputs: [
{
components: [
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "sender",
type: "address"
}
],
internalType: "struct FeeMetadata",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "requestReceipts",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "responded",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "responseCommitments",
outputs: [
{
components: [
{
internalType: "uint256",
name: "fee",
type: "uint256"
},
{
internalType: "address",
name: "sender",
type: "address"
}
],
internalType: "struct FeeMetadata",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "commitment",
type: "bytes32"
}
],
name: "responseReceipts",
outputs: [
{
components: [
{
internalType: "bytes32",
name: "responseCommitment",
type: "bytes32"
},
{
internalType: "address",
name: "relayer",
type: "address"
}
],
internalType: "struct ResponseReceipt",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "state",
type: "bytes"
},
{
components: [
{
internalType: "uint256",
name: "stateMachineId",
type: "uint256"
},
{
internalType: "uint256",
name: "height",
type: "uint256"
}
],
internalType: "struct StateMachineHeight",
name: "height",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "timestamp",
type: "uint256"
},
{
internalType: "bytes32",
name: "overlayRoot",
type: "bytes32"
},
{
internalType: "bytes32",
name: "stateRoot",
type: "bytes32"
}
],
internalType: "struct StateCommitment",
name: "commitment",
type: "tuple"
}
],
name: "setC