///
import BigNumber from "bignumber.js";
export declare enum PackPrimitive {
Bool = "bool",
U8 = "u8",
U16 = "u16",
U32 = "u32",
U64 = "u64",
U128 = "u128",
U256 = "u256",
Str = "string",
Bytes = "bytes",
Bytes32 = "bytes32",
Bytes65 = "bytes65"
}
export interface PackStructType {
struct: Array<{
[name: string]: PackTypeDefinition;
}>;
}
export declare const isPackStructType: (type: any) => type is PackStructType;
export interface PackListType {
list: PackTypeDefinition;
}
export declare const isPackListType: (type: any) => type is PackListType;
export declare type PackNilType = "nil";
export declare type PackType = PackPrimitive | PackNilType | "list" | "struct";
export declare type MarshalledPackArray = Array;
export declare type MarshalledPackStruct = T;
export declare type Marshalled = Type extends PackPrimitive.Bool ? boolean : Type extends PackPrimitive.U8 ? string : Type extends PackPrimitive.U16 ? string : Type extends PackPrimitive.U32 ? string : Type extends PackPrimitive.U64 ? string : Type extends PackPrimitive.U128 ? string : Type extends PackPrimitive.U256 ? string : Type extends PackPrimitive.Str ? string : Type extends PackPrimitive.Bytes ? string : Type extends PackPrimitive.Bytes32 ? string : Type extends PackPrimitive.Bytes65 ? string : Type extends PackNilType ? string : Type extends "list" ? Array : Type extends "struct" ? any : never;
export declare type Unmarshalled = Type extends PackPrimitive.Bool ? boolean : Type extends PackPrimitive.U8 ? BigNumber : Type extends PackPrimitive.U16 ? BigNumber : Type extends PackPrimitive.U32 ? BigNumber : Type extends PackPrimitive.U64 ? BigNumber : Type extends PackPrimitive.U128 ? BigNumber : Type extends PackPrimitive.U256 ? BigNumber : Type extends PackPrimitive.Str ? string : Type extends PackPrimitive.Bytes ? Buffer : Type extends PackPrimitive.Bytes32 ? Buffer : Type extends PackPrimitive.Bytes65 ? Buffer : Type extends PackNilType ? undefined : Type extends "list" ? Array : Type extends "struct" ? any : never;
export declare type PackTypeDefinition = PackPrimitive | PackStructType | PackListType | PackNilType;
export interface TypedPackValue {
t: PackTypeDefinition;
v: V;
}
export declare const unmarshalPackPrimitive: (type: PackPrimitive, value: any) => any;
export declare const unmarshalPackStruct: (type: PackStructType, value: object) => {};
/**
* Unmarshals a pack list.
*/
export declare const unmarshalPackList: (type: PackListType, value: T[]) => T[];
export declare const unmarshalPackValue: (type: PackTypeDefinition, value: unknown) => any;
export declare const unmarshalTypedPackValue: ({ t, v }: TypedPackValue) => any;