From 3beb07b7e80d7809851d805da2719d9e69e9dd6d Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Wed, 15 Feb 2023 14:46:40 -0500 Subject: [PATCH 1/3] log util changes --- fluent/ExtrinsicStatusRune.ts | 15 +++++++++------ rune/ValueRune.ts | 13 ++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/fluent/ExtrinsicStatusRune.ts b/fluent/ExtrinsicStatusRune.ts index 288b60c1c..7b540cbc5 100644 --- a/fluent/ExtrinsicStatusRune.ts +++ b/fluent/ExtrinsicStatusRune.ts @@ -15,12 +15,15 @@ export class ExtrinsicStatusRune } 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) + return Rune + .tuple([this.into(ValueRune), ...prefix]) + .map(([rune, ...prefix]) => + rune.into(ValueRune).map((value) => { + console.log(...prefix, value) + return value + }) + ) + .into(ExtrinsicStatusRune, this.extrinsic) } terminalTransactionStatuses() { diff --git a/rune/ValueRune.ts b/rune/ValueRune.ts index 22505777c..01b007885 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,8 +115,15 @@ export class ValueRune extends Rune { return ValueRune.new(RunSingular, this) } - dbg(...prefix: unknown[]) { - return this.map((value) => { + dbg(...prefix: RunicArgs) { + return Rune.tuple([this, ...prefix]).map(([value, ...prefix]) => { + console.log(...prefix, value) + return value + }) + } + + log(...prefix: RunicArgs) { + return Rune.tuple([this, ...prefix]).map(([value, ...prefix]) => { console.log(...prefix, value) return value }) From b2730b2b8649716cb386fe7541b16770962cc138 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Wed, 15 Feb 2023 15:08:07 -0500 Subject: [PATCH 2/3] t6 feedback --- fluent/ExtrinsicStatusRune.ts | 8 ++++---- rune/ValueRune.ts | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/fluent/ExtrinsicStatusRune.ts b/fluent/ExtrinsicStatusRune.ts index 7b540cbc5..44d1d3ea1 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,10 +14,10 @@ export class ExtrinsicStatusRune super(_prime) } - logStatus(...prefix: unknown[]): ExtrinsicStatusRune { + logStatus(...prefix: RunicArgs): ExtrinsicStatusRune { return Rune - .tuple([this.into(ValueRune), ...prefix]) - .map(([rune, ...prefix]) => + .tuple([this.into(ValueRune), Rune.tuple(prefix).lazy()]) + .map(([rune, prefix]) => rune.into(ValueRune).map((value) => { console.log(...prefix, value) return value diff --git a/rune/ValueRune.ts b/rune/ValueRune.ts index 01b007885..4ab6e5834 100644 --- a/rune/ValueRune.ts +++ b/rune/ValueRune.ts @@ -116,17 +116,21 @@ export class ValueRune extends Rune { } dbg(...prefix: RunicArgs) { - return Rune.tuple([this, ...prefix]).map(([value, ...prefix]) => { - console.log(...prefix, value) - return value - }) + return Rune + .tuple([this, Rune.tuple(prefix).lazy()]) + .map(([value, prefix]) => { + console.log(...prefix, value) + return value + }) } log(...prefix: RunicArgs) { - return Rune.tuple([this, ...prefix]).map(([value, ...prefix]) => { - console.log(...prefix, value) - return value - }) + return Rune + .tuple([this, Rune.tuple(prefix).lazy()]) + .map(([value, prefix]) => { + console.log(...prefix, value) + return value + }) } chain(fn: (result: ValueRune) => Rune): ValueRune { From acdb9d44f01ad9f131daacece7236e1e28b3e806 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Wed, 15 Feb 2023 15:23:09 -0500 Subject: [PATCH 3/3] t6 feedback --- fluent/ExtrinsicStatusRune.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fluent/ExtrinsicStatusRune.ts b/fluent/ExtrinsicStatusRune.ts index 44d1d3ea1..8dc45178d 100644 --- a/fluent/ExtrinsicStatusRune.ts +++ b/fluent/ExtrinsicStatusRune.ts @@ -15,14 +15,9 @@ export class ExtrinsicStatusRune } logStatus(...prefix: RunicArgs): ExtrinsicStatusRune { - return Rune - .tuple([this.into(ValueRune), Rune.tuple(prefix).lazy()]) - .map(([rune, prefix]) => - rune.into(ValueRune).map((value) => { - console.log(...prefix, value) - return value - }) - ) + return this + .into(ValueRune) + .map((rune) => rune.into(ValueRune).log(...prefix)) .into(ExtrinsicStatusRune, this.extrinsic) }