-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
31 lines (26 loc) · 841 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Decode, Walker } from '@scale-codec/core'
/**
* This symbol could be used by tracker to inspect value
*/
export const TrackValueInspect = Symbol('TrackValueInspect')
/**
* Implement this for the object if you want to handle its inspection in the console
*/
export interface TrackValueInspectable {
[TrackValueInspect]: () => any
}
export type TrackDecodeFn = <T>(loc: string, walker: Walker, decode: Decode<T>) => T
export type RefineDecodeLocFn = <T>(loc: string, headlessDecode: () => T) => T
/**
* Instance that defines method to track decoding flow
*/
export interface CodecTracker {
/**
* Used to track decode step: location, input, and result
*/
decode?: TrackDecodeFn
/**
* Used to clarify decode location without tracking of the input and the output
*/
refineDecodeLoc?: RefineDecodeLocFn
}