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

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay committed Mar 2, 2023
1 parent 4f5d966 commit d3962c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fluent/ExtrinsicsEventsRune.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isSystemExtrinsicFailedEvent, SystemExtrinsicFailedEvent } from "../primitives/mod.ts"
import { Rune, ValueRune } from "../rune/mod.ts"
import { Chain } from "./ChainRune.ts"
import { CodecRune } from "./CodecRune.ts"
import { EventsRune } from "./EventsRune.ts"

export class ExtrinsicEventsRune<
Expand Down Expand Up @@ -29,12 +30,12 @@ export class ExtrinsicEventsRune<
dispatchError.access("index"),
])
.map(([pallets, i]) => pallets.find((pallet) => pallet.i === i)!)
const $error = Rune
return Rune
.tuple([metadata.deriveCodec, pallet])
.map(([deriveCodec, pallet]) => deriveCodec(pallet.error!))
return Rune
.tuple([$error, dispatchError.access("error")])
.map(([$error, data]) => new ExtrinsicError($error.decode(data)))
.into(CodecRune)
.decoded(dispatchError.access("error"))
.map((data) => new ExtrinsicError((typeof data === "string" ? { type: data } : data) as any))
.unhandle(ExtrinsicError)
.rehandle(undefined, () => this /* TODO: type-level exclusions? */)
}
Expand Down

0 comments on commit d3962c2

Please sign in to comment.