From a5a22cde8f34aab79ba36203b49fab3923b739d5 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:42:02 -0400 Subject: [PATCH] add batch and remark --- packages/auto-consensus/src/batch.ts | 3 +++ packages/auto-consensus/src/index.ts | 2 ++ packages/auto-consensus/src/remark.ts | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 packages/auto-consensus/src/batch.ts create mode 100644 packages/auto-consensus/src/remark.ts diff --git a/packages/auto-consensus/src/batch.ts b/packages/auto-consensus/src/batch.ts new file mode 100644 index 00000000..cf2e6a38 --- /dev/null +++ b/packages/auto-consensus/src/batch.ts @@ -0,0 +1,3 @@ +import type { ApiPromise } from '@polkadot/api' + +export const batch = async (api: ApiPromise, txs: any[]) => await api.tx.utility.batch(txs) diff --git a/packages/auto-consensus/src/index.ts b/packages/auto-consensus/src/index.ts index 93380ff7..b2845280 100644 --- a/packages/auto-consensus/src/index.ts +++ b/packages/auto-consensus/src/index.ts @@ -2,7 +2,9 @@ export * from './address' export * from './balances' +export * from './batch' export * from './info' +export * from './remark' export * from './staking' export * from './transfer' diff --git a/packages/auto-consensus/src/remark.ts b/packages/auto-consensus/src/remark.ts new file mode 100644 index 00000000..cc8a2274 --- /dev/null +++ b/packages/auto-consensus/src/remark.ts @@ -0,0 +1,4 @@ +import type { ApiPromise } from '@polkadot/api' + +export const remark = async (api: ApiPromise, remark: string, withEvent?: boolean) => + !withEvent ? await api.tx.system.remark(remark) : await api.tx.system.remarkWithEvent(remark)