diff --git a/fluent/ExtrinsicStatusRune.ts b/fluent/ExtrinsicStatusRune.ts index 288b60c1c..8dc45178d 100644 --- a/fluent/ExtrinsicStatusRune.ts +++ b/fluent/ExtrinsicStatusRune.ts @@ -1,5 +1,5 @@ import { known } from "../rpc/mod.ts" -import { MetaRune, Rune, ValueRune } from "../rune/mod.ts" +import { MetaRune, Rune, RunicArgs, ValueRune } from "../rune/mod.ts" import { BlockRune } from "./BlockRune.ts" import { Chain } from "./ClientRune.ts" import { SignedExtrinsicRune } from "./SignedExtrinsicRune.ts" @@ -14,13 +14,11 @@ export class ExtrinsicStatusRune super(_prime) } - logStatus(...prefix: unknown[]): ExtrinsicStatusRune { - return this.into(ValueRune).map((rune) => - rune.into(ValueRune).map((value) => { - console.log(...prefix, value) - return value - }) - ).into(ExtrinsicStatusRune, this.extrinsic) + logStatus(...prefix: RunicArgs): ExtrinsicStatusRune { + return this + .into(ValueRune) + .map((rune) => rune.into(ValueRune).log(...prefix)) + .into(ExtrinsicStatusRune, this.extrinsic) } terminalTransactionStatuses() { diff --git a/rune/ValueRune.ts b/rune/ValueRune.ts index 22505777c..4ab6e5834 100644 --- a/rune/ValueRune.ts +++ b/rune/ValueRune.ts @@ -1,5 +1,5 @@ import { PromiseOr } from "../util/types.ts" -import { Batch, Run, Rune, Unhandled } from "./Rune.ts" +import { Batch, Run, Rune, RunicArgs, Unhandled } from "./Rune.ts" import { Receipt } from "./Timeline.ts" type NonIndexSignatureKeys = T extends T ? keyof { @@ -115,11 +115,22 @@ export class ValueRune extends Rune { return ValueRune.new(RunSingular, this) } - dbg(...prefix: unknown[]) { - return this.map((value) => { - console.log(...prefix, value) - return value - }) + dbg(...prefix: RunicArgs) { + return Rune + .tuple([this, Rune.tuple(prefix).lazy()]) + .map(([value, prefix]) => { + console.log(...prefix, value) + return value + }) + } + + log(...prefix: RunicArgs) { + return Rune + .tuple([this, Rune.tuple(prefix).lazy()]) + .map(([value, prefix]) => { + console.log(...prefix, value) + return value + }) } chain(fn: (result: ValueRune) => Rune): ValueRune {