UNPKG

@xlink-network/xlink-sdk

Version:
1,771 lines (1,760 loc) 160 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/xlinkSdkUtils/bridgeFromEVM.ts var bridgeFromEVM_exports = {}; __export(bridgeFromEVM_exports, { bridgeFromEVM: () => bridgeFromEVM, bridgeFromEVM_toLaunchpad: () => bridgeFromEVM_toLaunchpad, supportedRoutes: () => supportedRoutes }); module.exports = __toCommonJS(bridgeFromEVM_exports); var import_viem4 = require("viem"); var import_actions3 = require("viem/actions"); // src/evmUtils/addressHelpers.ts var import_viem = require("viem"); var nativeCurrencyAddress = import_viem.zeroAddress; // src/evmUtils/contractAbi/bridgeEndpoint.ts var BridgeEndpointAbi = [ { inputs: [ { internalType: "address", name: "_owner", type: "address" }, { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "version", type: "string" }, { internalType: "address", name: "_registry", type: "address" }, { internalType: "address", name: "_pegInAddress", type: "address" }, { internalType: "address", name: "_timeLock", type: "address" } ], stateMutability: "nonpayable", type: "constructor" }, { inputs: [], name: "InvalidShortString", type: "error" }, { inputs: [ { internalType: "string", name: "str", type: "string" } ], name: "StringTooLong", type: "error" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address[]", name: "_allowed", type: "address[]" } ], name: "AddAllowlistEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "bool", name: "allowlist", type: "bool" } ], name: "AllowlistEvent", type: "event" }, { anonymous: false, inputs: [], name: "EIP712DomainChanged", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "bytes32", name: "orderHash", type: "bytes32" } ], name: "FinalizeUnwrapEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, { indexed: true, internalType: "address", name: "newOwner", type: "address" } ], name: "OwnershipTransferred", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address" } ], name: "Paused", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address[]", name: "_removed", type: "address[]" } ], name: "RemoveAllowlistEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: false, internalType: "bytes", name: "payload", type: "bytes" }, { indexed: false, internalType: "uint256", name: "value", type: "uint256" } ], name: "SendMessageEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: true, internalType: "address", name: "token", type: "address" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, { indexed: false, internalType: "bytes", name: "payload", type: "bytes" } ], name: "SendMessageWithTokenEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "timeLock", type: "address" } ], name: "SetTimeLockEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "token", type: "address" }, { indexed: false, internalType: "uint256", name: "timeLockThreshold", type: "uint256" } ], name: "SetTimeLockThresholdByTokenEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "uint256", name: "timeLockThreshold", type: "uint256" } ], name: "SetTimeLockThresholdEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "bytes32", name: "orderHash", type: "bytes32" }, { indexed: false, internalType: "bytes32", name: "salt", type: "bytes32" }, { indexed: true, internalType: "address", name: "recipient", type: "address" }, { indexed: true, internalType: "address", name: "token", type: "address" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" } ], name: "TransferToUnwrapEvent", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address" } ], name: "Unpaused", type: "event" }, { inputs: [ { internalType: "address[]", name: "_allowed", type: "address[]" } ], name: "addAllowlist", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "allowlist", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "", type: "address" } ], name: "allowlisted", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "domainSeparatorV4", outputs: [ { internalType: "bytes32", name: "", type: "bytes32" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "eip712Domain", outputs: [ { internalType: "bytes1", name: "fields", type: "bytes1" }, { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "version", type: "string" }, { internalType: "uint256", name: "chainId", type: "uint256" }, { internalType: "address", name: "verifyingContract", type: "address" }, { internalType: "bytes32", name: "salt", type: "bytes32" }, { internalType: "uint256[]", name: "extensions", type: "uint256[]" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "bytes32[]", name: "orderHash", type: "bytes32[]" } ], name: "finalizeUnwrap", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "bytes32", name: "structHash", type: "bytes32" } ], name: "hashTypedDataV4", outputs: [ { internalType: "bytes32", name: "", type: "bytes32" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "offAllowlist", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "onAllowlist", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "owner", outputs: [ { internalType: "address", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "paused", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "pegInAddress", outputs: [ { internalType: "address", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "registry", outputs: [ { internalType: "contract BridgeRegistry", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address[]", name: "_removed", type: "address[]" } ], name: "removeAllowlist", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "bytes", name: "payload", type: "bytes" } ], name: "sendMessage", outputs: [], stateMutability: "payable", type: "function" }, { inputs: [ { internalType: "address", name: "token", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" }, { internalType: "bytes", name: "payload", type: "bytes" } ], name: "sendMessageWithToken", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "_timeLock", type: "address" } ], name: "setTimeLock", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "uint256", name: "_timeLockThreshold", type: "uint256" } ], name: "setTimeLockThreshold", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "token", type: "address" }, { internalType: "uint256", name: "_timeLockThreshold", type: "uint256" } ], name: "setTimeLockThresholdByToken", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "timeLock", outputs: [ { internalType: "contract ITimeLock", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "timeLockThreshold", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "", type: "address" } ], name: "timeLockThresholdByToken", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "newOwner", type: "address" } ], name: "transferOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "token", type: "address" }, { internalType: "address", name: "recipient", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" }, { internalType: "bytes32", name: "salt", type: "bytes32" }, { components: [ { internalType: "bytes32", name: "orderHash", type: "bytes32" }, { internalType: "address", name: "signer", type: "address" }, { internalType: "bytes", name: "signature", type: "bytes" } ], internalType: "struct BridgeEndpoint.SignaturePackage[]", name: "proofs", type: "tuple[]" } ], name: "transferToUnwrap", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "bytes32", name: "", type: "bytes32" } ], name: "unwrapSent", outputs: [ { internalType: "address", name: "recipient", type: "address" }, { internalType: "address", name: "token", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" }, { internalType: "bool", name: "sent", type: "bool" } ], stateMutability: "view", type: "function" } ]; // src/evmUtils/contractAbi/nativeBridgeEndpoint.ts var NativeBridgeEndpointAbi = [ { inputs: [ { internalType: "address", name: "_owner", type: "address" }, { internalType: "address", name: "_registry", type: "address" }, { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "version", type: "string" } ], stateMutability: "nonpayable", type: "constructor" }, { inputs: [], name: "InvalidShortString", type: "error" }, { inputs: [ { internalType: "string", name: "str", type: "string" } ], name: "StringTooLong", type: "error" }, { anonymous: false, inputs: [], name: "EIP712DomainChanged", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, { indexed: true, internalType: "address", name: "newOwner", type: "address" } ], name: "OwnershipTransferred", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address" } ], name: "Paused", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "sender", type: "address" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" } ], name: "ReceivedNativeToken", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "recipient", type: "address" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, { indexed: false, internalType: "bytes32", name: "salt", type: "bytes32" }, { indexed: false, internalType: "bytes32", name: "orderHash", type: "bytes32" } ], name: "TransferNativeToken", type: "event" }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address" } ], name: "Unpaused", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: false, internalType: "string", name: "settle", type: "string" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" } ], name: "WithdrawEvent", type: "event" }, { stateMutability: "payable", type: "fallback" }, { inputs: [ { internalType: "address payable", name: "recipient", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" }, { internalType: "bytes32", name: "salt", type: "bytes32" }, { components: [ { internalType: "bytes32", name: "orderHash", type: "bytes32" }, { internalType: "address", name: "signer", type: "address" }, { internalType: "bytes", name: "signature", type: "bytes" } ], internalType: "struct NativeBridgeEndpoint.SignaturePackage[]", name: "proofs", type: "tuple[]" } ], name: "deposit", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "domainSeparatorV4", outputs: [ { internalType: "bytes32", name: "", type: "bytes32" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "eip712Domain", outputs: [ { internalType: "bytes1", name: "fields", type: "bytes1" }, { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "version", type: "string" }, { internalType: "uint256", name: "chainId", type: "uint256" }, { internalType: "address", name: "verifyingContract", type: "address" }, { internalType: "bytes32", name: "salt", type: "bytes32" }, { internalType: "uint256[]", name: "extensions", type: "uint256[]" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "bytes32", name: "structHash", type: "bytes32" } ], name: "hashTypedDataV4", outputs: [ { internalType: "bytes32", name: "", type: "bytes32" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "owner", outputs: [ { internalType: "address", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "paused", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "registry", outputs: [ { internalType: "contract NativeBridgeRegistry", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "newOwner", type: "address" } ], name: "transferOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "string", name: "settleData", type: "string" } ], name: "withdraw", outputs: [], stateMutability: "payable", type: "function" }, { stateMutability: "payable", type: "receive" } ]; // src/evmUtils/contractMessageHelpers.ts var import_viem2 = require("viem"); var sendMessageAbi = (0, import_viem2.parseAbi)([ "function transferToLaunchpad(uint256 launchId, bytes calldata destAddress) pure returns (uint256)", "function transferToEVM(uint256 destChainId, address destToken, address destAddress) pure returns (uint256)", "function transferToStacks(string calldata to) pure returns (uint256)", "function transferToBTC(bytes calldata btcAddress) pure returns (uint256)", "function transferToBRC20(bytes calldata btcAddress) pure returns (uint256)", "function transferToRunes(bytes calldata btcAddress) pure returns (uint256)" ]); // src/evmUtils/peggingHelpers.ts var import_transactions = require("@stacks/transactions"); var import_clarity_codegen2 = require("clarity-codegen"); var import_actions2 = require("viem/actions"); // src/stacksUtils/xlinkContractHelpers.ts var import_btc_signer2 = require("@scure/btc-signer"); var import_c32check = require("c32check"); var import_clarity_codegen = require("clarity-codegen"); // generated/smartContractHelpers/codegenImport.ts var codegenImport_exports = {}; __reExport(codegenImport_exports, require("clarity-codegen")); // generated/smartContract/contract_xlink_btc-peg-in-endpoint-v2-05.ts var btcPegInEndpointV205 = (0, codegenImport_exports.defineContract)({ "btc-peg-in-endpoint-v2-05": { callback: { input: [ { name: "sender", type: codegenImport_exports.principalT }, { name: "payload", type: codegenImport_exports.bufferT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "finalize-peg-in-cross": { input: [ { name: "tx", type: codegenImport_exports.bufferT }, { name: "block", type: (0, codegenImport_exports.tupleT)({ header: codegenImport_exports.bufferT, height: codegenImport_exports.uintT }) }, { name: "proof", type: (0, codegenImport_exports.tupleT)({ hashes: (0, codegenImport_exports.listT)(codegenImport_exports.bufferT), "tree-depth": codegenImport_exports.uintT, "tx-index": codegenImport_exports.uintT }) }, { name: "output-idx", type: codegenImport_exports.uintT }, { name: "reveal-tx", type: (0, codegenImport_exports.tupleT)({ "order-idx": codegenImport_exports.uintT, tx: codegenImport_exports.bufferT }) }, { name: "reveal-block", type: (0, codegenImport_exports.tupleT)({ header: codegenImport_exports.bufferT, height: codegenImport_exports.uintT }) }, { name: "reveal-proof", type: (0, codegenImport_exports.tupleT)({ hashes: (0, codegenImport_exports.listT)(codegenImport_exports.bufferT), "tree-depth": codegenImport_exports.uintT, "tx-index": codegenImport_exports.uintT }) }, { name: "token-out-trait", type: codegenImport_exports.traitT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "pause-peg-in": { input: [{ name: "paused", type: codegenImport_exports.booleanT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-fee-to-address": { input: [{ name: "new-fee-to-address", type: codegenImport_exports.principalT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-peg-in-fee": { input: [{ name: "fee", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-peg-in-min-fee": { input: [{ name: "fee", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "construct-principal": { input: [{ name: "hash-bytes", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.principalT), mode: "readonly" }, "create-order-cross-or-fail": { input: [ { name: "order", type: (0, codegenImport_exports.tupleT)({ "chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, to: codegenImport_exports.bufferT, token: codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.bufferT), mode: "readonly" }, "decode-from-reveal-tx-or-fail": { input: [ { name: "tx", type: codegenImport_exports.bufferT }, { name: "order-idx", type: codegenImport_exports.uintT } ], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "commit-txid": codegenImport_exports.bufferT, "order-script": codegenImport_exports.bufferT })), mode: "readonly" }, "decode-order-cross-from-reveal-tx-or-fail": { input: [ { name: "tx", type: codegenImport_exports.bufferT }, { name: "order-idx", type: codegenImport_exports.uintT } ], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "commit-txid": codegenImport_exports.bufferT, "order-details": (0, codegenImport_exports.tupleT)({ "chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, to: codegenImport_exports.bufferT, token: codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) })), mode: "readonly" }, "decode-order-cross-or-fail": { input: [{ name: "order-script", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, to: codegenImport_exports.bufferT, token: codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT })), mode: "readonly" }, "destruct-principal": { input: [{ name: "address", type: codegenImport_exports.principalT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "hash-bytes": codegenImport_exports.bufferT, name: (0, codegenImport_exports.optionalT)(codegenImport_exports.stringAsciiT), version: codegenImport_exports.bufferT })), mode: "readonly" }, "extract-tx-ins-outs": { input: [{ name: "tx", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ ins: (0, codegenImport_exports.listT)((0, codegenImport_exports.tupleT)({ outpoint: (0, codegenImport_exports.tupleT)({ hash: codegenImport_exports.bufferT, index: codegenImport_exports.uintT }), scriptSig: codegenImport_exports.bufferT, sequence: codegenImport_exports.uintT })), outs: (0, codegenImport_exports.listT)((0, codegenImport_exports.tupleT)({ scriptPubKey: codegenImport_exports.bufferT, value: codegenImport_exports.uintT })) })), mode: "readonly" }, "get-fee-to-address": { input: [], output: codegenImport_exports.principalT, mode: "readonly" }, "get-peg-in-fee": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-peg-in-min-fee": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-peg-in-sent-or-default": { input: [{ name: "tx", type: codegenImport_exports.bufferT }, { name: "output", type: codegenImport_exports.uintT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "get-txid": { input: [{ name: "tx", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.bufferT), mode: "readonly" }, "is-dao-or-extension": { input: [], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "readonly" }, "is-peg-in-address-approved": { input: [{ name: "address", type: codegenImport_exports.bufferT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "is-peg-in-paused": { input: [], output: codegenImport_exports.booleanT, mode: "readonly" }, "validate-tx-cross": { input: [ { name: "commit-tx", type: (0, codegenImport_exports.tupleT)({ "output-idx": codegenImport_exports.uintT, tx: codegenImport_exports.bufferT }) }, { name: "reveal-tx", type: (0, codegenImport_exports.tupleT)({ "order-idx": codegenImport_exports.uintT, tx: codegenImport_exports.bufferT }) }, { name: "token-out-trait", type: codegenImport_exports.traitT } ], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "amount-net": codegenImport_exports.uintT, fee: codegenImport_exports.uintT, "order-details": (0, codegenImport_exports.tupleT)({ "chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, to: codegenImport_exports.bufferT, token: codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) })), mode: "readonly" }, "verify-mined": { input: [ { name: "tx", type: codegenImport_exports.bufferT }, { name: "block", type: (0, codegenImport_exports.tupleT)({ header: codegenImport_exports.bufferT, height: codegenImport_exports.uintT }) }, { name: "proof", type: (0, codegenImport_exports.tupleT)({ hashes: (0, codegenImport_exports.listT)(codegenImport_exports.bufferT), "tree-depth": codegenImport_exports.uintT, "tx-index": codegenImport_exports.uintT }) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "readonly" }, "fee-to-address": { input: codegenImport_exports.noneT, output: codegenImport_exports.principalT, mode: "variable" }, "peg-in-fee": { input: codegenImport_exports.noneT, output: codegenImport_exports.uintT, mode: "variable" }, "peg-in-min-fee": { input: codegenImport_exports.noneT, output: codegenImport_exports.uintT, mode: "variable" }, "peg-in-paused": { input: codegenImport_exports.noneT, output: codegenImport_exports.booleanT, mode: "variable" } } }); // generated/smartContract/contract_xlink_btc-peg-out-endpoint-v2-01.ts var btcPegOutEndpointV201 = (0, codegenImport_exports.defineContract)({ "btc-peg-out-endpoint-v2-01": { callback: { input: [ { name: "sender", type: codegenImport_exports.principalT }, { name: "payload", type: codegenImport_exports.bufferT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "claim-peg-out": { input: [ { name: "request-id", type: codegenImport_exports.uintT }, { name: "fulfilled-by", type: codegenImport_exports.bufferT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "finalize-peg-out": { input: [ { name: "request-id", type: codegenImport_exports.uintT }, { name: "tx", type: codegenImport_exports.bufferT }, { name: "block", type: (0, codegenImport_exports.tupleT)({ header: codegenImport_exports.bufferT, height: codegenImport_exports.uintT }) }, { name: "proof", type: (0, codegenImport_exports.tupleT)({ hashes: (0, codegenImport_exports.listT)(codegenImport_exports.bufferT), "tree-depth": codegenImport_exports.uintT, "tx-index": codegenImport_exports.uintT }) }, { name: "output-idx", type: codegenImport_exports.uintT }, { name: "fulfilled-by-idx", type: codegenImport_exports.uintT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "pause-peg-out": { input: [{ name: "paused", type: codegenImport_exports.booleanT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "request-peg-out-0": { input: [ { name: "peg-out-address", type: codegenImport_exports.bufferT }, { name: "amount", type: codegenImport_exports.uintT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.uintT), mode: "public" }, "revoke-peg-out": { input: [{ name: "request-id", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-fee-to-address": { input: [{ name: "new-fee-to-address", type: codegenImport_exports.principalT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-peg-out-fee": { input: [{ name: "fee", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-peg-out-min-fee": { input: [{ name: "fee", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "extract-tx-ins-outs": { input: [{ name: "tx", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ ins: (0, codegenImport_exports.listT)((0, codegenImport_exports.tupleT)({ outpoint: (0, codegenImport_exports.tupleT)({ hash: codegenImport_exports.bufferT, index: codegenImport_exports.uintT }), scriptSig: codegenImport_exports.bufferT, sequence: codegenImport_exports.uintT })), outs: (0, codegenImport_exports.listT)((0, codegenImport_exports.tupleT)({ scriptPubKey: codegenImport_exports.bufferT, value: codegenImport_exports.uintT })) })), mode: "readonly" }, "get-fee-to-address": { input: [], output: codegenImport_exports.principalT, mode: "readonly" }, "get-peg-in-sent-or-default": { input: [{ name: "tx", type: codegenImport_exports.bufferT }, { name: "output", type: codegenImport_exports.uintT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "get-peg-out-fee": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-peg-out-min-fee": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-request-claim-grace-period": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-request-or-fail": { input: [{ name: "request-id", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "amount-net": codegenImport_exports.uintT, claimed: codegenImport_exports.uintT, "claimed-by": codegenImport_exports.principalT, fee: codegenImport_exports.uintT, finalized: codegenImport_exports.booleanT, "fulfilled-by": codegenImport_exports.bufferT, "gas-fee": codegenImport_exports.uintT, "peg-out-address": codegenImport_exports.bufferT, "requested-at": codegenImport_exports.uintT, "requested-at-burn-height": codegenImport_exports.uintT, "requested-by": codegenImport_exports.principalT, revoked: codegenImport_exports.booleanT })), mode: "readonly" }, "get-request-revoke-grace-period": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-txid": { input: [{ name: "tx", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.bufferT), mode: "readonly" }, "is-dao-or-extension": { input: [], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "readonly" }, "is-peg-in-address-approved": { input: [{ name: "address", type: codegenImport_exports.bufferT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "is-peg-out-paused": { input: [], output: codegenImport_exports.booleanT, mode: "readonly" }, "validate-peg-out-0": { input: [{ name: "amount", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ amount: codegenImport_exports.uintT, fee: codegenImport_exports.uintT, "gas-fee": codegenImport_exports.uintT })), mode: "readonly" }, "verify-mined": { input: [ { name: "tx", type: codegenImport_exports.bufferT }, { name: "block", type: (0, codegenImport_exports.tupleT)({ header: codegenImport_exports.bufferT, height: codegenImport_exports.uintT }) }, { name: "proof", type: (0, codegenImport_exports.tupleT)({ hashes: (0, codegenImport_exports.listT)(codegenImport_exports.bufferT), "tree-depth": codegenImport_exports.uintT, "tx-index": codegenImport_exports.uintT }) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "readonly" }, "fee-to-address": { input: codegenImport_exports.noneT, output: codegenImport_exports.principalT, mode: "variable" }, "peg-out-fee": { input: codegenImport_exports.noneT, output: codegenImport_exports.uintT, mode: "variable" }, "peg-out-min-fee": { input: codegenImport_exports.noneT, output: codegenImport_exports.uintT, mode: "variable" }, "peg-out-paused": { input: codegenImport_exports.noneT, output: codegenImport_exports.booleanT, mode: "variable" } } }); // generated/smartContract/contract_xlink_cross-peg-in-endpoint-v2-04.ts var crossPegInEndpointV204 = (0, codegenImport_exports.defineContract)({ "cross-peg-in-endpoint-v2-04": { "apply-whitelist": { input: [{ name: "new-use-whitelist", type: codegenImport_exports.booleanT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, callback: { input: [ { name: "sender", type: codegenImport_exports.principalT }, { name: "payload", type: codegenImport_exports.bufferT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, execute: { input: [{ name: "sender", type: codegenImport_exports.principalT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "set-paused": { input: [{ name: "paused", type: codegenImport_exports.booleanT }], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "transfer-to-cross": { input: [ { name: "order", type: (0, codegenImport_exports.tupleT)({ "amount-in-fixed": codegenImport_exports.uintT, "dest-chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, salt: codegenImport_exports.bufferT, "src-chain-id": codegenImport_exports.uintT, to: codegenImport_exports.bufferT, "token-in": codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) }, { name: "token-in-trait", type: codegenImport_exports.traitT }, { name: "token-out-trait", type: codegenImport_exports.traitT }, { name: "signature-packs", type: (0, codegenImport_exports.listT)((0, codegenImport_exports.tupleT)({ "order-hash": codegenImport_exports.bufferT, signature: codegenImport_exports.bufferT, signer: codegenImport_exports.principalT })) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, whitelist: { input: [ { name: "user", type: codegenImport_exports.principalT }, { name: "whitelisted", type: codegenImport_exports.booleanT } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "public" }, "whitelist-many": { input: [ { name: "users", type: (0, codegenImport_exports.listT)(codegenImport_exports.principalT) }, { name: "whitelisted", type: (0, codegenImport_exports.listT)(codegenImport_exports.booleanT) } ], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.listT)((0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT))), mode: "public" }, "create-cross-order": { input: [ { name: "order", type: (0, codegenImport_exports.tupleT)({ "amount-in-fixed": codegenImport_exports.uintT, "dest-chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, salt: codegenImport_exports.bufferT, "src-chain-id": codegenImport_exports.uintT, to: codegenImport_exports.bufferT, "token-in": codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.bufferT), mode: "readonly" }, "decode-cross-order": { input: [{ name: "order-buff", type: codegenImport_exports.bufferT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "amount-in-fixed": codegenImport_exports.uintT, "dest-chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, salt: codegenImport_exports.bufferT, "src-chain-id": codegenImport_exports.uintT, to: codegenImport_exports.bufferT, "token-in": codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT })), mode: "readonly" }, "get-approved-chain-or-fail": { input: [{ name: "src-chain-id", type: codegenImport_exports.uintT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "buff-length": codegenImport_exports.uintT, name: codegenImport_exports.stringT })), mode: "readonly" }, "get-approved-pair-or-fail": { input: [ { name: "pair", type: (0, codegenImport_exports.tupleT)({ "chain-id": codegenImport_exports.uintT, token: codegenImport_exports.principalT }) } ], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ approved: codegenImport_exports.booleanT, burnable: codegenImport_exports.booleanT, fee: codegenImport_exports.uintT, "max-amount": codegenImport_exports.uintT, "min-amount": codegenImport_exports.uintT, "min-fee": codegenImport_exports.uintT, reserve: codegenImport_exports.uintT })), mode: "readonly" }, "get-min-fee-or-default": { input: [ { name: "pair", type: (0, codegenImport_exports.tupleT)({ "chain-id": codegenImport_exports.uintT, token: codegenImport_exports.principalT }) } ], output: codegenImport_exports.uintT, mode: "readonly" }, "get-paused": { input: [], output: codegenImport_exports.booleanT, mode: "readonly" }, "get-required-validators": { input: [], output: codegenImport_exports.uintT, mode: "readonly" }, "get-token-reserve-or-default": { input: [ { name: "pair", type: (0, codegenImport_exports.tupleT)({ "chain-id": codegenImport_exports.uintT, token: codegenImport_exports.principalT }) } ], output: codegenImport_exports.uintT, mode: "readonly" }, "get-use-whitelist": { input: [], output: codegenImport_exports.booleanT, mode: "readonly" }, "get-validator-or-fail": { input: [{ name: "validator", type: codegenImport_exports.principalT }], output: (0, codegenImport_exports.responseSimpleT)((0, codegenImport_exports.tupleT)({ "chain-id": codegenImport_exports.uintT, pubkey: codegenImport_exports.bufferT })), mode: "readonly" }, "hash-cross-order": { input: [ { name: "order", type: (0, codegenImport_exports.tupleT)({ "amount-in-fixed": codegenImport_exports.uintT, "dest-chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_exports.bufferT, salt: codegenImport_exports.bufferT, "src-chain-id": codegenImport_exports.uintT, to: codegenImport_exports.bufferT, "token-in": codegenImport_exports.principalT, "token-out": codegenImport_exports.principalT }) } ], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.bufferT), mode: "readonly" }, "is-approved-relayer-or-default": { input: [{ name: "relayer", type: codegenImport_exports.principalT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "is-dao-or-extension": { input: [], output: (0, codegenImport_exports.responseSimpleT)(codegenImport_exports.booleanT), mode: "readonly" }, "is-order-sent-or-default": { input: [{ name: "order-hash", type: codegenImport_exports.bufferT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "is-order-validated-by-or-default": { input: [ { name: "order-hash", type: codegenImport_exports.bufferT }, { name: "validator", type: codegenImport_exports.principalT } ], output: codegenImport_exports.booleanT, mode: "readonly" }, "is-whitelisted": { input: [{ name: "user", type: codegenImport_exports.principalT }], output: codegenImport_exports.booleanT, mode: "readonly" }, "message-domain": { input: [], output: codegenImport_exports.bufferT, mode: "readonly" }, "validate-cross-order": { input: [ { name: "order", type: (0, codegenImport_exports.tupleT)({ "amount-in-fixed": codegenImport_exports.uintT, "dest-chain-id": (0, codegenImport_exports.optionalT)(codegenImport_exports.uintT), from: codegenImport_export