/** * This is the doc comment for pallet `BridgePangolinMessages`'s calls. * * `BridgePangolinMessages`'s storages: {@link: module:pangoro/bridgePangolinMessages/storages} * * @module pangoro/bridgePangolinMessages/calls */ import { buildRuntimeCall, Dispatch, decodeCall } from "../../../index"; import { ethers, BytesLike } from "ethers"; import { Metadata } from "@polkadot/types"; export const getBridgePangolinMessages = (dispatch: Dispatch, metadata: Metadata) => { return { /** * Change `PalletOwner`. * * May only be called either by root, or by `PalletOwner`. * * @param {unknown} _new_owner Enum<{0/None: , 1/Some: [U8; 20]}> * @instance */ setOwner: async (signer: ethers.Signer, _new_owner: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'setOwner', false, { new_owner: _new_owner, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/setOwner}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ setOwnerH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'setOwner', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildSetOwnerCall: (_new_owner: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'setOwner', { new_owner: _new_owner, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildSetOwnerCall, but with scale encoded args. * * @returns {CallAsParam} */ buildSetOwnerCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'setOwner', argsBytes) }, /** * Halt or resume all/some pallet operations. * * May only be called either by root, or by `PalletOwner`. * * @param {unknown} _operating_mode Enum<{0/Basic: Enum<{0/Normal: , 1/Halted: }>, 1/RejectingOutboundMessages: }> * @instance */ setOperatingMode: async (signer: ethers.Signer, _operating_mode: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'setOperatingMode', false, { operating_mode: _operating_mode, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/setOperatingMode}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ setOperatingModeH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'setOperatingMode', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildSetOperatingModeCall: (_operating_mode: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'setOperatingMode', { operating_mode: _operating_mode, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildSetOperatingModeCall, but with scale encoded args. * * @returns {CallAsParam} */ buildSetOperatingModeCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'setOperatingMode', argsBytes) }, /** * Update pallet parameter. * * May only be called either by root, or by `PalletOwner`. * * The weight is: single read for permissions check + 2 writes for parameter value and * event. * * @param {unknown} _parameter () * @instance */ updatePalletParameter: async (signer: ethers.Signer, _parameter: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'updatePalletParameter', false, { parameter: _parameter, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/updatePalletParameter}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ updatePalletParameterH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'updatePalletParameter', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildUpdatePalletParameterCall: (_parameter: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'updatePalletParameter', { parameter: _parameter, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildUpdatePalletParameterCall, but with scale encoded args. * * @returns {CallAsParam} */ buildUpdatePalletParameterCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'updatePalletParameter', argsBytes) }, /** * Send message over lane. * * @param {unknown} _lane_id [U8; 4] * @param {unknown} _payload {spec_version: U32, weight: {ref_time: Compact, proof_size: Compact}, origin: Enum<{0/SourceRoot: , 1/TargetAccount: ([U8; 20], [U8; 20], [U8; 65]), 2/SourceAccount: [U8; 20]}>, dispatch_fee_payment: Enum<{0/AtSourceChain: , 1/AtTargetChain: }>, call: Vec} * @param {unknown} _delivery_and_dispatch_fee U128 * @instance */ sendMessage: async (signer: ethers.Signer, _lane_id: unknown, _payload: unknown, _delivery_and_dispatch_fee: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'sendMessage', false, { lane_id: _lane_id, payload: _payload, delivery_and_dispatch_fee: _delivery_and_dispatch_fee, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/sendMessage}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ sendMessageH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'sendMessage', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildSendMessageCall: (_lane_id: unknown, _payload: unknown, _delivery_and_dispatch_fee: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'sendMessage', { lane_id: _lane_id, payload: _payload, delivery_and_dispatch_fee: _delivery_and_dispatch_fee, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildSendMessageCall, but with scale encoded args. * * @returns {CallAsParam} */ buildSendMessageCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'sendMessage', argsBytes) }, /** * Receive messages proof from bridged chain. * * The weight of the call assumes that the transaction always brings outbound lane * state update. Because of that, the submitter (relayer) has no benefit of not including * this data in the transaction, so reward confirmations lags should be minimal. * * Note: To maintain compatibility, the call index is 5 instead of 4 because the * call(increase_message_fee) with index 4 has been removed. https://github.com/darwinia-network/darwinia-messages-substrate/pull/207 * * @param {unknown} _relayer_id_at_bridged_chain [U8; 20] * @param {unknown} _proof {bridged_header_hash: [U8; 32], storage_proof: Vec>, lane: [U8; 4], nonces_start: U64, nonces_end: U64} * @param {unknown} _messages_count U32 * @param {unknown} _dispatch_weight {ref_time: Compact, proof_size: Compact} * @instance */ receiveMessagesProof: async (signer: ethers.Signer, _relayer_id_at_bridged_chain: unknown, _proof: unknown, _messages_count: unknown, _dispatch_weight: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'receiveMessagesProof', false, { relayer_id_at_bridged_chain: _relayer_id_at_bridged_chain, proof: _proof, messages_count: _messages_count, dispatch_weight: _dispatch_weight, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/receiveMessagesProof}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ receiveMessagesProofH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'receiveMessagesProof', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildReceiveMessagesProofCall: (_relayer_id_at_bridged_chain: unknown, _proof: unknown, _messages_count: unknown, _dispatch_weight: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'receiveMessagesProof', { relayer_id_at_bridged_chain: _relayer_id_at_bridged_chain, proof: _proof, messages_count: _messages_count, dispatch_weight: _dispatch_weight, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildReceiveMessagesProofCall, but with scale encoded args. * * @returns {CallAsParam} */ buildReceiveMessagesProofCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'receiveMessagesProof', argsBytes) }, /** * Receive messages delivery proof from bridged chain. * * @param {unknown} _proof {bridged_header_hash: [U8; 32], storage_proof: Vec>, lane: [U8; 4]} * @param {unknown} _relayers_state {unrewarded_relayer_entries: U64, messages_in_oldest_entry: U64, total_messages: U64, last_delivered_nonce: U64} * @instance */ receiveMessagesDeliveryProof: async (signer: ethers.Signer, _proof: unknown, _relayers_state: unknown): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'receiveMessagesDeliveryProof', false, { proof: _proof, relayers_state: _relayers_state, }); }, /** * Similar to {@link: pangoro/bridgePangolinMessages/calls/receiveMessagesDeliveryProof}, but with scale encoded args. * * @param {BytesLike} argsBytes the args bytes * @instance */ receiveMessagesDeliveryProofH: async (signer: ethers.Signer, argsBytes: BytesLike): Promise => { return await dispatch(signer, 'BridgePangolinMessages', 'receiveMessagesDeliveryProof', true, argsBytes); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * * @returns {CallAsParam} */ buildReceiveMessagesDeliveryProofCall: (_proof: unknown, _relayers_state: unknown) => { return buildRuntimeCall(metadata, 'BridgePangolinMessages', 'receiveMessagesDeliveryProof', { proof: _proof, relayers_state: _relayers_state, }); }, /** * Build a call object to be used as a call param in other functions, such as `utilities.batchAll`. * Similar to buildReceiveMessagesDeliveryProofCall, but with scale encoded args. * * @returns {CallAsParam} */ buildReceiveMessagesDeliveryProofCallH: (argsBytes: BytesLike) => { return decodeCall(metadata, 'BridgePangolinMessages', 'receiveMessagesDeliveryProof', argsBytes) }, } }