From c7c4993afa6b351f8a5dec049085931ed205dce0 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Thu, 27 Apr 2023 13:13:18 -0400 Subject: [PATCH] feat: add fund to multisig rune (#939) --- examples/multisig/basic.eg.ts | 8 ++------ examples/multisig/stash.eg.ts | 8 ++------ examples/multisig/virtual.eg.ts | 2 -- patterns/multisig/MultisigRune.ts | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/examples/multisig/basic.eg.ts b/examples/multisig/basic.eg.ts index ef874c569..3f7feae38 100644 --- a/examples/multisig/basic.eg.ts +++ b/examples/multisig/basic.eg.ts @@ -3,7 +3,6 @@ * @stability unstable * @description Create a multisig account and ratify a vote to execute a transfer from * that multisig. - * @test_skip */ import { polkadotDev } from "@capi/polkadot-dev" @@ -31,11 +30,8 @@ const davidFreeInitial = await davidFree.run() console.log("David free initial:", davidFreeInitial) /// Transfer initial funds to the multisig (existential deposit). -await polkadotDev.Balances - .transfer({ - value: 2_000_000_000_000n, - dest: multisig.address, - }) +await multisig + .fund(2_000_000_000_000n) .signed(signature({ sender: alexa })) .sent() .dbgStatus("Existential deposit:") diff --git a/examples/multisig/stash.eg.ts b/examples/multisig/stash.eg.ts index 6c9d947d0..caffc5702 100644 --- a/examples/multisig/stash.eg.ts +++ b/examples/multisig/stash.eg.ts @@ -3,7 +3,6 @@ * @stability unstable * @description Administrate a stash account (pure proxy) through a multisig with * three signatories. - * @test_skip */ import { MultiAddress, polkadotDev } from "@capi/polkadot-dev" @@ -22,11 +21,8 @@ const multisig = MultisigRune.from(polkadotDev, { }) /// Send funds to the multisig (existential deposit). -await polkadotDev.Balances - .transfer({ - value: 20_000_000_000_000n, - dest: multisig.address, - }) +await multisig + .fund(20_000_000_000_000n) .signed(signature({ sender: alexa })) .sent() .dbgStatus("Existential deposit:") diff --git a/examples/multisig/virtual.eg.ts b/examples/multisig/virtual.eg.ts index f13e41516..a43dd7886 100644 --- a/examples/multisig/virtual.eg.ts +++ b/examples/multisig/virtual.eg.ts @@ -15,8 +15,6 @@ * To edit a virtual multisig, its members can propose the creation of a new multisig, * comprised of proxy accounts corresponding to its new members. Finally, the current * members ratify a call to give ownership of the stash account to the new multisig. - * - * @test_skip */ import { MultiAddress, polkadotDev } from "@capi/polkadot-dev" diff --git a/patterns/multisig/MultisigRune.ts b/patterns/multisig/MultisigRune.ts index 0ed72a12c..e0d1f39a3 100644 --- a/patterns/multisig/MultisigRune.ts +++ b/patterns/multisig/MultisigRune.ts @@ -84,6 +84,21 @@ export class MultisigRune extends PatternRune(...[amount]: RunicArgs) { + return this.chain.extrinsic( + Rune + .object({ + type: "Balances", + value: Rune.object({ + type: "transfer", + dest: this.address, + value: amount, + }), + }) + .unsafeAs>(), + ) + } + maybeTimepoint( ...[callHash, blockHash]: RunicArgs ) {