Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
feat: add fund to multisig rune (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleecode authored Apr 27, 2023
1 parent d18a2bd commit c7c4993
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
8 changes: 2 additions & 6 deletions examples/multisig/basic.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:")
Expand Down
8 changes: 2 additions & 6 deletions examples/multisig/stash.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:")
Expand Down
2 changes: 0 additions & 2 deletions examples/multisig/virtual.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions patterns/multisig/MultisigRune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ export class MultisigRune<out C extends Chain, out U> extends PatternRune<Multis
)
}

fund<X>(...[amount]: RunicArgs<X, [amount: bigint]>) {
return this.chain.extrinsic(
Rune
.object({
type: "Balances",
value: Rune.object({
type: "transfer",
dest: this.address,
value: amount,
}),
})
.unsafeAs<Chain.Call<C>>(),
)
}

maybeTimepoint<X>(
...[callHash, blockHash]: RunicArgs<X, [callHash: Uint8Array, blockHash?: string]>
) {
Expand Down

0 comments on commit c7c4993

Please sign in to comment.