Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot-api/substrate-bindings

Package Overview
Dependencies
Maintainers
2
Versions
603
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot-api/substrate-bindings - npm Package Compare versions

Comparing version 0.0.1-b93545aad989f8c380fb1d4764731b59fd1d692d.1.0 to 0.0.1-b95115e314039199595018979c6d5c177dd28c00.1.0

422

dist/index.d.ts
import * as scale_ts from 'scale-ts';
import { Codec, Encoder, Decoder, CodecType } from 'scale-ts';
export * from 'scale-ts';
import { Codec, Encoder, Decoder, StringRecord, CodecType, EncoderType, DecoderType } from 'scale-ts';
export { Bytes, Codec, CodecType, Decoder, DecoderType, Encoder, EncoderType, Option, Result, ResultPayload, StringRecord, Struct, Tuple, Vector, _void, bool, compact, createCodec, createDecoder, enhanceCodec, enhanceDecoder, enhanceEncoder, i128, i16, i256, i32, i64, i8, str, u128, u16, u256, u32, u64, u8 } from 'scale-ts';

@@ -8,7 +8,52 @@ type SS58String = string & {

};
type SS58AddressInfo = {
isValid: false;
} | {
isValid: true;
ss58Format: number;
publicKey: Uint8Array;
};
declare const getSs58AddressInfo: (address: SS58String) => SS58AddressInfo;
declare const fromBufferToBase58: (ss58Format: number) => (publicKey: Uint8Array) => SS58String;
declare const AccountId: (ss58Format?: number, nBytes?: 32 | 33) => scale_ts.Codec<SS58String>;
type HexString = string & {
__hexString?: unknown;
};
declare const Hex: {
(nBytes?: number): Codec<HexString>;
enc: (nBytes?: number) => Encoder<HexString>;
dec: (nBytes?: number) => Decoder<HexString>;
};
declare class Binary {
#private;
constructor(data: Uint8Array);
asText: () => string;
asHex: () => string;
asBytes: () => Uint8Array;
static fromText(input: string): Binary;
static fromHex(input: HexString): Binary;
static fromBytes(input: Uint8Array): Binary;
}
declare const Bin: {
(nBytes?: number): Codec<Binary>;
enc: (nBytes?: number) => Encoder<Binary>;
dec: (nBytes?: number) => Decoder<Binary>;
};
interface BitSequence {
bitsLen: number;
bytes: Uint8Array;
}
declare const bitSequence: scale_ts.Codec<BitSequence>;
declare const char: scale_ts.Codec<string>;
declare const compactNumber: Codec<number>;
declare const compactBn: Codec<bigint>;
declare const fixedStr: (nBytes: number) => scale_ts.Codec<string>;
declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<T>;

@@ -18,12 +63,84 @@ declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<T>;

type OpaqueValue<T> = {
length: number;
inner: () => T;
type Tuple<T, N extends number> = readonly [T, ...T[]] & {
length: N;
};
declare const OpaqueCodec: {
<T>(inner: Codec<T>, len?: Codec<number>): Codec<OpaqueValue<T>>;
enc: <T_1>(inner: Encoder<T_1>, len?: Encoder<number>) => Encoder<OpaqueValue<T_1>>;
dec: <T_2>(inner: Decoder<T_2>, len?: Decoder<number>) => Decoder<OpaqueValue<T_2>>;
type Push<T extends any[], V> = [...T, V];
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
type TuplifyUnion<T, L = LastOf<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<TuplifyUnion<Exclude<T, L>>, L>;
type RestrictedLenTuple<T, O extends StringRecord<any>> = Tuple<T, TuplifyUnion<keyof O> extends Tuple<any, infer V> ? V : 0>;
type ExtractEnumValue<T extends {
type: string;
value?: any;
}, K extends string> = T extends {
type: K;
value: infer R;
} ? R : never;
interface Discriminant<T extends {
type: string;
value?: any;
}> {
is<K extends T["type"]>(this: Enum<T>, type: K): this is Enum<{
type: K;
value: ExtractEnumValue<T, K>;
}>;
as<K extends T["type"]>(type: K): ExtractEnumValue<T, K>;
}
declare const _Enum: {};
type Enum<T extends {
type: string;
value?: any;
}> = T & Discriminant<T>;
declare const Enum: <T extends {
type: string;
value?: any;
}, Key extends T["type"]>(type: Key, ...args: ExtractEnumValue<T, Key> extends undefined ? [] : [value: ExtractEnumValue<T, Key>]) => Enum<ExtractEnumValue<T, Key> extends undefined ? T : ExtractEnumValue<T, Key> extends never ? T : {
type: Key;
value: ExtractEnumValue<T, Key>;
}>;
declare const Variant: {
<O extends StringRecord<Codec<any>>>(inner: O, indexes?: RestrictedLenTuple<number, O> | undefined): Codec<Enum<{ [K in keyof O]: K extends string ? {
type: K;
value: CodecType<O[K]>;
} : never; }[keyof O]>>;
enc: <O_1 extends StringRecord<Encoder<any>>>(inner: O_1, x?: RestrictedLenTuple<number, O_1> | undefined) => Encoder<Enum<{ [K_1 in keyof O_1]: K_1 extends string ? {
type: K_1;
value: EncoderType<O_1[K_1]>;
} : never; }[keyof O_1]>>;
dec: <O_2 extends StringRecord<Decoder<any>>>(inner: O_2, x?: RestrictedLenTuple<number, O_2> | undefined) => Decoder<Enum<{ [K_2 in keyof O_2]: K_2 extends string ? {
type: K_2;
value: DecoderType<O_2[K_2]>;
} : never; }[keyof O_2]>>;
};
declare const blockHeader: Codec<{
parentHash: HexString;
number: number;
stateRoot: HexString;
extrinsicRoot: HexString;
digests: Enum<{
type: "consensus";
value: {
engine: string;
payload: HexString;
};
} | {
type: "seal";
value: {
engine: string;
payload: HexString;
};
} | {
type: "preRuntime";
value: {
engine: string;
payload: HexString;
};
} | {
type: "runtimeUpdated";
value: undefined;
}>[];
}>;
type BlockHeader = CodecType<typeof blockHeader>;
declare const lookup: scale_ts.Codec<{

@@ -34,3 +151,3 @@ id: number;

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -40,5 +157,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -51,5 +168,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -129,5 +246,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -138,70 +252,8 @@ docs: string[];

type HexString = string & {
__hexString?: unknown;
};
declare const Hex: {
(nBytes?: number): Codec<HexString>;
enc: (nBytes?: number) => Encoder<HexString>;
dec: (nBytes?: number) => Decoder<HexString>;
};
declare const pallets: scale_ts.Codec<{
name: string;
storage: void | {
prefix: string;
items: {
name: string;
modifier: number;
type: {
tag: "map";
value: {
hashers: ({
tag: "Blake2128";
value: undefined;
} | {
tag: "Blake2256";
value: undefined;
} | {
tag: "Blake2128Concat";
value: undefined;
} | {
tag: "Twox128";
value: undefined;
} | {
tag: "Twox256";
value: undefined;
} | {
tag: "Twox64Concat";
value: undefined;
} | {
tag: "Identity";
value: undefined;
})[];
key: number;
value: number;
};
} | {
tag: "plain";
value: number;
};
fallback: HexString;
docs: string[];
}[];
} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
constants: {
name: string;
type: number;
value: HexString;
docs: string[];
}[];
errors: number | void | undefined;
index: number;
}[]>;
type V14Pallets = CodecType<typeof pallets>;
declare const extrinsic: scale_ts.Codec<{
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -213,4 +265,4 @@ identifier: string;

}>;
type V14Extrinsic = CodecType<typeof extrinsic>;
declare const v14: scale_ts.Codec<{
type V15Extrinsic = CodecType<typeof extrinsic>;
declare const v15: scale_ts.Codec<{
lookup: {

@@ -221,3 +273,3 @@ id: number;

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -227,5 +279,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -238,5 +290,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -316,5 +368,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -325,3 +374,3 @@ docs: string[];

name: string;
storage: void | {
storage: {
prefix: string;

@@ -367,4 +416,4 @@ items: {

} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
calls: number | undefined;
events: number | undefined;
constants: {

@@ -376,8 +425,12 @@ name: string;

}[];
errors: number | void | undefined;
errors: number | undefined;
index: number;
docs: string[];
}[];
extrinsic: {
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -390,4 +443,26 @@ identifier: string;

type: number;
apis: {
name: string;
methods: {
name: string;
inputs: {
name: string;
type: number;
}[];
output: number;
docs: string[];
}[];
docs: string[];
}[];
outerEnums: {
call: number;
event: number;
error: number;
};
custom: [string, {
type: number;
value: HexString;
}][];
}>;
type V14 = CodecType<typeof v14>;
type V15 = CodecType<typeof v15>;

@@ -440,2 +515,5 @@ declare const metadata: Codec<{

tag: "v14";
value: unknown;
} | {
tag: "v15";
value: {

@@ -447,3 +525,3 @@ lookup: {

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -453,5 +531,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -464,5 +542,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -542,5 +620,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -551,3 +626,3 @@ docs: string[];

name: string;
storage: void | {
storage: {
prefix: string;

@@ -593,4 +668,4 @@ items: {

} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
calls: number | undefined;
events: number | undefined;
constants: {

@@ -602,8 +677,12 @@ name: string;

}[];
errors: number | void | undefined;
errors: number | undefined;
index: number;
docs: string[];
}[];
extrinsic: {
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -616,2 +695,24 @@ identifier: string;

type: number;
apis: {
name: string;
methods: {
name: string;
inputs: {
name: string;
type: number;
}[];
output: number;
docs: string[];
}[];
docs: string[];
}[];
outerEnums: {
call: number;
event: number;
error: number;
};
custom: [string, {
type: number;
value: HexString;
}][];
};

@@ -621,42 +722,2 @@ };

interface BitSequence {
bitsLen: number;
bytes: Uint8Array;
}
declare const bitSequence: scale_ts.Codec<BitSequence>;
declare const char: scale_ts.Codec<string>;
declare const fixedStr: (nBytes: number) => scale_ts.Codec<string>;
declare const blockHeader: scale_ts.Codec<{
parentHash: HexString;
number: number;
stateRoot: HexString;
extrinsicRoot: HexString;
digests: ({
tag: "consensus";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "seal";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "preRuntime";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "runtimeUpdated";
value: undefined;
})[];
}>;
type BlockHeader = CodecType<typeof blockHeader>;
declare const Blake2256: (encoded: Uint8Array) => Uint8Array;

@@ -689,23 +750,27 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array;

};
type TxDescriptor<Args extends Array<any>> = string & {
_args: Args;
type TxDescriptor<Args extends {} | undefined> = string & {
___: Args;
};
type Descriptors = Record<string, [
Record<string, StorageDescriptor<any, any, any>>,
Record<string, TxDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>
]>;
type PickDescriptors<Idx extends 0 | 1 | 2 | 3 | 4, T extends Descriptors> = {
type RuntimeDescriptor<Args extends Array<any>, T> = string & {
__: [Args, T];
};
type Descriptors = {
pallets: Record<string, [
Record<string, StorageDescriptor<any, any, any>>,
Record<string, TxDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>
]>;
apis: Record<string, Record<string, RuntimeDescriptor<any, any>>>;
asset: PlainDescriptor<any>;
};
type PickDescriptors<Idx extends 0 | 1 | 2 | 3 | 4, T extends Descriptors["pallets"]> = {
[K in keyof T]: T[K][Idx];
};
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : {
[K in keyof T]: Anonymize<T[K]>;
};
type ExtractStorage<T extends Record<string, Record<string, StorageDescriptor<any, any, any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends StorageDescriptor<infer Key, infer Value, infer Optional> ? {
KeyArgs: Anonymize<Key>;
Value: Anonymize<Value>;
KeyArgs: Key;
Value: Value;
IsOptional: Optional;

@@ -717,3 +782,3 @@ } : unknown;

[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Anonymize<Args> : unknown;
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Args : unknown;
};

@@ -723,11 +788,18 @@ };

[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Anonymize<Value> : unknown;
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Value : unknown;
};
};
type QueryFromDescriptors<T extends Descriptors> = ExtractStorage<PickDescriptors<0, T>>;
type TxFromDescriptors<T extends Descriptors> = ExtractTx<PickDescriptors<1, T>>;
type EventsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<2, T>>;
type ErrorsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<3, T>>;
type ConstFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<4, T>>;
type QueryFromDescriptors<T extends Descriptors> = ExtractStorage<PickDescriptors<0, T["pallets"]>>;
type TxFromDescriptors<T extends Descriptors> = ExtractTx<PickDescriptors<1, T["pallets"]>>;
type EventsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<2, T["pallets"]>>;
type ErrorsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<3, T["pallets"]>>;
type ConstFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<4, T["pallets"]>>;
export { AccountId, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type EncoderWithHash, type ErrorsFromDescriptors, type EventsFromDescriptors, Hex, type HexString, Identity, OpaqueCodec, type OpaqueValue, type PlainDescriptor, type QueryFromDescriptors, type SS58String, Self, Storage, type StorageDescriptor, Twox128, Twox256, Twox64Concat, type TxDescriptor, type TxFromDescriptors, type V14, type V14Extrinsic, type V14Lookup, type V14Pallets, bitSequence, blockHeader, char, compactBn, compactNumber, fixedStr, h64, metadata, selfDecoder, selfEncoder, v14 };
type GetEnum<T extends Enum<{
type: string;
value: any;
}>> = {
[K in T["type"]]: (...args: ExtractEnumValue<T, K> extends undefined ? [] : [value: ExtractEnumValue<T, K>]) => T;
};
export { AccountId, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, type GetEnum, Hex, type HexString, Identity, type PlainDescriptor, type QueryFromDescriptors, type RuntimeDescriptor, type SS58AddressInfo, type SS58String, Self, Storage, type StorageDescriptor, Twox128, Twox256, Twox64Concat, type TxDescriptor, type TxFromDescriptors, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v15 };

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -19,4 +20,25 @@ for (var name in all)

};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};

@@ -27,54 +49,99 @@ // src/index.ts

AccountId: () => AccountId,
Bin: () => Bin,
Binary: () => Binary,
Blake2128: () => Blake2128,
Blake2128Concat: () => Blake2128Concat,
Blake2256: () => Blake2256,
Bytes: () => import_scale_ts8.Bytes,
Enum: () => Enum,
Hex: () => Hex,
Identity: () => Identity,
OpaqueCodec: () => OpaqueCodec,
Option: () => import_scale_ts8.Option,
Result: () => import_scale_ts8.Result,
Self: () => Self,
Storage: () => Storage,
Struct: () => import_scale_ts8.Struct,
Tuple: () => import_scale_ts8.Tuple,
Twox128: () => Twox128,
Twox256: () => Twox256,
Twox64Concat: () => Twox64Concat,
bitSequence: () => bitSequence2,
Variant: () => Variant,
Vector: () => import_scale_ts8.Vector,
_Enum: () => _Enum,
_void: () => import_scale_ts8._void,
bitSequence: () => bitSequence,
blockHeader: () => blockHeader,
bool: () => import_scale_ts8.bool,
char: () => char,
compact: () => import_scale_ts8.compact,
compactBn: () => compactBn,
compactNumber: () => compactNumber,
createCodec: () => import_scale_ts8.createCodec,
createDecoder: () => import_scale_ts8.createDecoder,
enhanceCodec: () => import_scale_ts8.enhanceCodec,
enhanceDecoder: () => import_scale_ts8.enhanceDecoder,
enhanceEncoder: () => import_scale_ts8.enhanceEncoder,
fixedStr: () => fixedStr,
fromBufferToBase58: () => fromBufferToBase58,
getSs58AddressInfo: () => getSs58AddressInfo,
h64: () => h64,
i128: () => import_scale_ts8.i128,
i16: () => import_scale_ts8.i16,
i256: () => import_scale_ts8.i256,
i32: () => import_scale_ts8.i32,
i64: () => import_scale_ts8.i64,
i8: () => import_scale_ts8.i8,
metadata: () => metadata,
selfDecoder: () => selfDecoder,
selfEncoder: () => selfEncoder,
v14: () => v14
str: () => import_scale_ts8.str,
u128: () => import_scale_ts8.u128,
u16: () => import_scale_ts8.u16,
u256: () => import_scale_ts8.u256,
u32: () => import_scale_ts8.u32,
u64: () => import_scale_ts8.u64,
u8: () => import_scale_ts8.u8,
v15: () => v15
});
module.exports = __toCommonJS(src_exports);
__reExport(src_exports, require("scale-ts"), module.exports);
// src/codecs/index.ts
var codecs_exports = {};
__export(codecs_exports, {
AccountId: () => AccountId,
Hex: () => Hex,
OpaqueCodec: () => OpaqueCodec,
Self: () => Self,
bitSequence: () => bitSequence2,
blockHeader: () => blockHeader,
char: () => char,
compactBn: () => compactBn,
compactNumber: () => compactNumber,
fixedStr: () => fixedStr,
metadata: () => metadata,
selfDecoder: () => selfDecoder,
selfEncoder: () => selfEncoder,
v14: () => v14
});
__reExport(codecs_exports, require("scale-ts"));
// src/codecs/scale/AccountId.ts
var import_scale_ts = require("scale-ts");
// src/codecs/AccountId.ts
var import_scale_ts = require("scale-ts");
// src/utils/ss58-util.ts
var import_base = require("@scure/base");
var import_blake2b = require("@noble/hashes/blake2b");
var import_base = require("@scure/base");
var SS58_PREFIX = new TextEncoder().encode("SS58PRE");
var CHECKSUM_LENGTH = 2;
var getSs58AddressInfo = (address) => {
try {
const decoded = import_base.base58.decode(address);
const prefixBytes = decoded.subarray(0, decoded[0] & 64 ? 2 : 1);
const publicKey = decoded.subarray(
prefixBytes.length,
decoded.length - CHECKSUM_LENGTH
);
const checksum = decoded.subarray(prefixBytes.length + publicKey.length);
const expectedChecksum = (0, import_blake2b.blake2b)(
Uint8Array.of(...SS58_PREFIX, ...prefixBytes, ...publicKey),
{
dkLen: 64
}
).subarray(0, CHECKSUM_LENGTH);
const isChecksumValid = checksum[0] === expectedChecksum[0] && checksum[1] === expectedChecksum[1];
if (!isChecksumValid)
return { isValid: false };
return {
isValid: true,
ss58Format: prefixBytesToNumber(prefixBytes),
publicKey: publicKey.slice()
};
} catch (_) {
return { isValid: false };
}
};
var prefixBytesToNumber = (bytes) => {
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
return dv.byteLength === 1 ? dv.getUint8(0) : dv.getUint16(0);
};
var fromBufferToBase58 = (ss58Format) => {

@@ -97,24 +164,13 @@ const prefixBytes = ss58Format < 64 ? Uint8Array.of(ss58Format) : Uint8Array.of(

};
function fromBase58ToBuffer(nBytes, ss58Format) {
// src/codecs/scale/AccountId.ts
function fromBase58ToBuffer(nBytes, _ss58Format) {
return (address) => {
const decoded = import_base.base58.decode(address);
const prefixBytes = decoded.subarray(0, decoded[0] & 64 ? 2 : 1);
const publicKey = decoded.subarray(
prefixBytes.length,
decoded.length - CHECKSUM_LENGTH
);
const info = getSs58AddressInfo(address);
if (!info.isValid)
throw new Error("Invalid checksum");
const { publicKey } = info;
if (publicKey.length !== nBytes)
throw new Error("Invalid public key length");
const checksum = decoded.subarray(prefixBytes.length + publicKey.length);
const expectedChecksum = (0, import_blake2b.blake2b)(
Uint8Array.of(...SS58_PREFIX, ...prefixBytes, ...publicKey),
{
dkLen: 64
}
).subarray(0, CHECKSUM_LENGTH);
if (checksum[0] !== expectedChecksum[0] || checksum[1] !== expectedChecksum[1])
throw new Error("Invalid checksum");
if (prefixBytesToNumber(prefixBytes) != ss58Format)
throw new Error("Invalid SS58 prefix");
return publicKey.slice();
return publicKey;
};

@@ -127,14 +183,111 @@ }

);
var prefixBytesToNumber = (bytes) => {
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
return dv.byteLength === 1 ? dv.getUint8(0) : dv.getUint16(0);
};
// src/codecs/compact.ts
// src/codecs/scale/Binary.ts
var import_scale_ts2 = require("scale-ts");
var compactNumber = import_scale_ts2.compact;
var compactBn = import_scale_ts2.compact;
var import_utils = require("@polkadot-api/utils");
var textEncoder = new TextEncoder();
var textDecoder = new TextDecoder();
var _bytes, _hex, _str;
var _Binary = class _Binary {
constructor(data) {
__privateAdd(this, _bytes, void 0);
__privateAdd(this, _hex, null);
__privateAdd(this, _str, null);
__publicField(this, "asText", () => __privateGet(this, _str) === null ? __privateSet(this, _str, textDecoder.decode(__privateGet(this, _bytes))) : __privateGet(this, _str));
__publicField(this, "asHex", () => __privateGet(this, _hex) === null ? __privateSet(this, _hex, (0, import_utils.toHex)(__privateGet(this, _bytes))) : __privateGet(this, _hex));
__publicField(this, "asBytes", () => __privateGet(this, _bytes));
__privateSet(this, _bytes, data);
}
static fromText(input) {
return new _Binary(textEncoder.encode(input));
}
static fromHex(input) {
return new _Binary((0, import_utils.fromHex)(input));
}
static fromBytes(input) {
return new _Binary(input);
}
};
_bytes = new WeakMap();
_hex = new WeakMap();
_str = new WeakMap();
var Binary = _Binary;
var enc = (nBytes) => {
const _enc = import_scale_ts2.Bytes.enc(nBytes);
return (value) => _enc(value.asBytes());
};
var dec = (nBytes) => {
const _dec = import_scale_ts2.Bytes.dec(nBytes);
return (value) => Binary.fromBytes(_dec(value));
};
var Bin = (nBytes) => (0, import_scale_ts2.createCodec)(enc(nBytes), dec(nBytes));
Bin.enc = enc;
Bin.dec = dec;
// src/codecs/Self.ts
// src/codecs/scale/bitSequence.ts
var import_scale_ts4 = require("scale-ts");
// src/codecs/scale/compact.ts
var import_scale_ts3 = require("scale-ts");
var compactNumber = import_scale_ts3.compact;
var compactBn = import_scale_ts3.compact;
// src/codecs/scale/bitSequence.ts
var bitSequenceDecoder = (0, import_scale_ts4.createDecoder)((data) => {
const bitsLen = compactNumber.dec(data);
const bytesLen = Math.ceil(bitsLen / 8);
const bytes = (0, import_scale_ts4.Bytes)(bytesLen).dec(data);
return { bytes, bitsLen };
});
var bitSequenceEncoder = (input) => {
if (input.bitsLen > input.bytes.length * 8)
throw new Error(
`Not enough bytes. (bitsLen:${input.bitsLen}, bytesLen:${input.bytes.length})`
);
const lenEncoded = compactNumber.enc(input.bitsLen);
const result = new Uint8Array(input.bytes.length + lenEncoded.length);
result.set(lenEncoded, 0);
result.set(input.bytes, lenEncoded.length);
return result;
};
var bitSequence = (0, import_scale_ts4.createCodec)(bitSequenceEncoder, bitSequenceDecoder);
// src/codecs/scale/char.ts
var import_scale_ts5 = require("scale-ts");
var char = (0, import_scale_ts5.enhanceCodec)(
import_scale_ts5.u8,
(str5) => str5.charCodeAt(0),
String.fromCharCode
);
// src/codecs/scale/Hex.ts
var import_utils2 = require("@polkadot-api/utils");
var import_scale_ts6 = require("scale-ts");
var enc2 = (nBytes) => {
const _enc = import_scale_ts6.Bytes.enc(nBytes);
return (value) => _enc((0, import_utils2.fromHex)(value));
};
var dec2 = (nBytes) => {
const _dec = import_scale_ts6.Bytes.dec(nBytes);
return (value) => (0, import_utils2.toHex)(_dec(value));
};
var Hex = (nBytes) => (0, import_scale_ts6.createCodec)(enc2(nBytes), dec2(nBytes));
Hex.enc = enc2;
Hex.dec = dec2;
// src/codecs/scale/fixed-str.ts
var import_scale_ts7 = require("scale-ts");
var textEncoder2 = new TextEncoder();
var textDecoder2 = new TextDecoder();
var fixedStr = (nBytes) => (0, import_scale_ts7.enhanceCodec)(
(0, import_scale_ts7.Bytes)(nBytes),
(str5) => textEncoder2.encode(str5),
(bytes) => textDecoder2.decode(bytes)
);
// src/codecs/scale/re-exported.ts
var import_scale_ts8 = require("scale-ts");
// src/codecs/scale/Self.ts
var import_scale_ts9 = require("scale-ts");
var selfEncoder = (value) => {

@@ -157,3 +310,3 @@ let cache = (x) => {

};
var Self = (value) => (0, import_scale_ts3.createCodec)(
var Self = (value) => (0, import_scale_ts9.createCodec)(
selfEncoder(() => value().enc),

@@ -163,53 +316,103 @@ selfDecoder(() => value().dec)

// src/codecs/Opaque.ts
var import_scale_ts4 = require("scale-ts");
var OpaqueDecoder = (inner, len = compactNumber.dec) => (0, import_scale_ts4.createDecoder)((bytes) => {
const length = len(bytes);
const innerBytes = (0, import_scale_ts4.Bytes)(length).dec(bytes);
let _cachedValue;
return {
length,
inner: () => _cachedValue = _cachedValue || inner(innerBytes)
};
// src/codecs/scale/Variant.ts
var import_scale_ts10 = require("scale-ts");
var import_utils3 = require("@polkadot-api/utils");
var _Enum = new Proxy(
{},
{
get(_, prop) {
return (value) => Enum(prop, value);
}
}
);
var Enum = (_type, _value) => ({
as: (type) => {
if (type !== _type)
throw new Error(`Enum.as(${type}) used with actual type ${_type}`);
return _value;
},
is: (type) => type === _type,
type: _type,
value: _value
});
var OpaqueEncoder = (inner, len = compactNumber.enc) => (input) => {
const lenBytes = len(input.length);
const result = new Uint8Array(lenBytes.length + input.length);
result.set(lenBytes, 0);
result.set(inner(input.inner()), lenBytes.length);
return result;
var VariantEnc = (...args) => {
const enc3 = import_scale_ts10.Enum.enc(...args);
return (v) => enc3({ tag: v.type, value: v.value });
};
var OpaqueCodec = (inner, len = compactNumber) => (0, import_scale_ts4.createCodec)(
OpaqueEncoder(inner.enc, len.enc),
OpaqueDecoder(inner.dec, len.dec)
var VariantDec = (...args) => {
const dec3 = import_scale_ts10.Enum.dec(...args);
return (v) => {
const { tag, value } = dec3(v);
return Enum(tag, value);
};
};
var Variant = (inner, ...args) => (0, import_scale_ts10.createCodec)(
VariantEnc(
(0, import_utils3.mapObject)(inner, ([encoder]) => encoder),
...args
),
VariantDec(
(0, import_utils3.mapObject)(inner, ([, decoder]) => decoder),
...args
)
);
OpaqueCodec.enc = OpaqueEncoder;
OpaqueCodec.dec = OpaqueDecoder;
Variant.enc = VariantEnc;
Variant.dec = VariantDec;
// src/codecs/metadata/v14/v14.ts
var import_scale_ts8 = require("scale-ts");
// src/codecs/blockHeader.ts
var textEncoder3 = new TextEncoder();
var textDecoder3 = new TextDecoder();
var fourChars = (0, import_scale_ts8.enhanceCodec)(
(0, import_scale_ts8.Bytes)(4),
textEncoder3.encode.bind(textEncoder3),
textDecoder3.decode.bind(textDecoder3)
);
var diggestVal = (0, import_scale_ts8.Struct)({
engine: fourChars,
payload: Hex()
});
var diggest = Variant(
{
consensus: diggestVal,
seal: diggestVal,
preRuntime: diggestVal,
runtimeUpdated: import_scale_ts8._void
},
[4, 5, 6, 8]
);
var hex32 = Hex(32);
var blockHeader = (0, import_scale_ts8.Struct)({
parentHash: hex32,
number: compactNumber,
stateRoot: hex32,
extrinsicRoot: hex32,
digests: (0, import_scale_ts8.Vector)(diggest)
});
// src/codecs/metadata/v14/lookup.ts
var import_scale_ts5 = require("scale-ts");
var oStr = (0, import_scale_ts5.Option)(import_scale_ts5.str);
var strs = (0, import_scale_ts5.Vector)(import_scale_ts5.str);
var primitive = (0, import_scale_ts5.Enum)({
bool: import_scale_ts5._void,
char: import_scale_ts5._void,
str: import_scale_ts5._void,
u8: import_scale_ts5._void,
u16: import_scale_ts5._void,
u32: import_scale_ts5._void,
u64: import_scale_ts5._void,
u128: import_scale_ts5._void,
u256: import_scale_ts5._void,
i8: import_scale_ts5._void,
i16: import_scale_ts5._void,
i32: import_scale_ts5._void,
i64: import_scale_ts5._void,
i128: import_scale_ts5._void,
i256: import_scale_ts5._void
// src/codecs/metadata/v15/v15.ts
var import_scale_ts13 = require("scale-ts");
// src/codecs/metadata/v15/lookup.ts
var import_scale_ts11 = require("scale-ts");
var oStr = (0, import_scale_ts11.Option)(import_scale_ts11.str);
var strs = (0, import_scale_ts11.Vector)(import_scale_ts11.str);
var primitive = (0, import_scale_ts11.Enum)({
bool: import_scale_ts11._void,
char: import_scale_ts11._void,
str: import_scale_ts11._void,
u8: import_scale_ts11._void,
u16: import_scale_ts11._void,
u32: import_scale_ts11._void,
u64: import_scale_ts11._void,
u128: import_scale_ts11._void,
u256: import_scale_ts11._void,
i8: import_scale_ts11._void,
i16: import_scale_ts11._void,
i32: import_scale_ts11._void,
i64: import_scale_ts11._void,
i128: import_scale_ts11._void,
i256: import_scale_ts11._void
});
var fields = (0, import_scale_ts5.Vector)(
(0, import_scale_ts5.Struct)({
var fields = (0, import_scale_ts11.Vector)(
(0, import_scale_ts11.Struct)({
name: oStr,

@@ -221,19 +424,19 @@ type: compactNumber,

);
var arr = (0, import_scale_ts5.Struct)({
len: import_scale_ts5.u32,
var arr = (0, import_scale_ts11.Struct)({
len: import_scale_ts11.u32,
type: compactNumber
});
var bitSequence = (0, import_scale_ts5.Struct)({
var bitSequence2 = (0, import_scale_ts11.Struct)({
bitStoreType: compactNumber,
bitOrderType: compactNumber
});
var variant = (0, import_scale_ts5.Vector)(
(0, import_scale_ts5.Struct)({
name: import_scale_ts5.str,
var variant = (0, import_scale_ts11.Vector)(
(0, import_scale_ts11.Struct)({
name: import_scale_ts11.str,
fields,
index: import_scale_ts5.u8,
index: import_scale_ts11.u8,
docs: strs
})
);
var def = (0, import_scale_ts5.Enum)({
var def = (0, import_scale_ts11.Enum)({
composite: fields,

@@ -243,14 +446,13 @@ variant,

array: arr,
tuple: (0, import_scale_ts5.Vector)(compactNumber),
tuple: (0, import_scale_ts11.Vector)(compactNumber),
primitive,
compact: compactNumber,
bitSequence,
historicMetaCompat: import_scale_ts5.str
bitSequence: bitSequence2
});
var param = (0, import_scale_ts5.Struct)({
name: import_scale_ts5.str,
type: (0, import_scale_ts5.Option)(compactNumber)
var param = (0, import_scale_ts11.Struct)({
name: import_scale_ts11.str,
type: (0, import_scale_ts11.Option)(compactNumber)
});
var params = (0, import_scale_ts5.Vector)(param);
var entry = (0, import_scale_ts5.Struct)({
var params = (0, import_scale_ts11.Vector)(param);
var entry = (0, import_scale_ts11.Struct)({
id: compactNumber,

@@ -262,32 +464,17 @@ path: strs,

});
var lookup = (0, import_scale_ts5.Vector)(entry);
var lookup = (0, import_scale_ts11.Vector)(entry);
// src/codecs/Hex.ts
var import_utils = require("@polkadot-api/utils");
var import_scale_ts6 = require("scale-ts");
var enc = (nBytes) => {
const _enc = import_scale_ts6.Bytes.enc(nBytes);
return (value) => _enc((0, import_utils.fromHex)(value));
};
var dec = (nBytes) => {
const _dec = import_scale_ts6.Bytes.dec(nBytes);
return (value) => (0, import_utils.toHex)(_dec(value));
};
var Hex = (nBytes) => (0, import_scale_ts6.createCodec)(enc(nBytes), dec(nBytes));
Hex.enc = enc;
Hex.dec = dec;
// src/codecs/metadata/v14/pallets.ts
var import_scale_ts7 = require("scale-ts");
var hashType = (0, import_scale_ts7.Enum)({
Blake2128: import_scale_ts7._void,
Blake2256: import_scale_ts7._void,
Blake2128Concat: import_scale_ts7._void,
Twox128: import_scale_ts7._void,
Twox256: import_scale_ts7._void,
Twox64Concat: import_scale_ts7._void,
Identity: import_scale_ts7._void
// src/codecs/metadata/v15/pallets.ts
var import_scale_ts12 = require("scale-ts");
var hashType = (0, import_scale_ts12.Enum)({
Blake2128: import_scale_ts12._void,
Blake2256: import_scale_ts12._void,
Blake2128Concat: import_scale_ts12._void,
Twox128: import_scale_ts12._void,
Twox256: import_scale_ts12._void,
Twox64Concat: import_scale_ts12._void,
Identity: import_scale_ts12._void
});
var hashers = (0, import_scale_ts7.Vector)(hashType);
var storageMap = (0, import_scale_ts7.Struct)({
var hashers = (0, import_scale_ts12.Vector)(hashType);
var storageMap = (0, import_scale_ts12.Struct)({
hashers,

@@ -297,6 +484,6 @@ key: compactNumber,

});
var storageItem = (0, import_scale_ts7.Struct)({
name: import_scale_ts7.str,
modifier: import_scale_ts7.u8,
type: (0, import_scale_ts7.Enum)({
var storageItem = (0, import_scale_ts12.Struct)({
name: import_scale_ts12.str,
modifier: import_scale_ts12.u8,
type: (0, import_scale_ts12.Enum)({
plain: compactNumber,

@@ -306,36 +493,58 @@ map: storageMap

fallback: Hex(),
docs: (0, import_scale_ts7.Vector)(import_scale_ts7.str)
docs: (0, import_scale_ts12.Vector)(import_scale_ts12.str)
});
var storage = (0, import_scale_ts7.Option)(
(0, import_scale_ts7.Struct)({
prefix: import_scale_ts7.str,
items: (0, import_scale_ts7.Vector)(storageItem)
var storage = (0, import_scale_ts12.Option)(
(0, import_scale_ts12.Struct)({
prefix: import_scale_ts12.str,
items: (0, import_scale_ts12.Vector)(storageItem)
})
);
var pallets = (0, import_scale_ts7.Vector)(
(0, import_scale_ts7.Struct)({
name: import_scale_ts7.str,
var pallets = (0, import_scale_ts12.Vector)(
(0, import_scale_ts12.Struct)({
name: import_scale_ts12.str,
storage,
calls: (0, import_scale_ts7.Option)(compactNumber),
events: (0, import_scale_ts7.Option)(compactNumber),
constants: (0, import_scale_ts7.Vector)(
(0, import_scale_ts7.Struct)({
name: import_scale_ts7.str,
calls: (0, import_scale_ts12.Option)(compactNumber),
events: (0, import_scale_ts12.Option)(compactNumber),
constants: (0, import_scale_ts12.Vector)(
(0, import_scale_ts12.Struct)({
name: import_scale_ts12.str,
type: compactNumber,
value: Hex(),
docs: (0, import_scale_ts7.Vector)(import_scale_ts7.str)
docs: (0, import_scale_ts12.Vector)(import_scale_ts12.str)
})
),
errors: (0, import_scale_ts7.Option)(compactNumber),
index: import_scale_ts7.u8
errors: (0, import_scale_ts12.Option)(compactNumber),
index: import_scale_ts12.u8,
docs: (0, import_scale_ts12.Vector)(import_scale_ts12.str)
})
);
// src/codecs/metadata/v14/v14.ts
var extrinsic = (0, import_scale_ts8.Struct)({
type: compactNumber,
version: import_scale_ts8.u8,
signedExtensions: (0, import_scale_ts8.Vector)(
(0, import_scale_ts8.Struct)({
identifier: import_scale_ts8.str,
// src/codecs/metadata/v15/v15.ts
var docs = (0, import_scale_ts13.Vector)(import_scale_ts13.str);
var runtimeApi = (0, import_scale_ts13.Struct)({
name: import_scale_ts13.str,
methods: (0, import_scale_ts13.Vector)(
(0, import_scale_ts13.Struct)({
name: import_scale_ts13.str,
inputs: (0, import_scale_ts13.Vector)(
(0, import_scale_ts13.Struct)({
name: import_scale_ts13.str,
type: compactNumber
})
),
output: compactNumber,
docs
})
),
docs
});
var extrinsic = (0, import_scale_ts13.Struct)({
version: import_scale_ts13.u8,
address: compactNumber,
call: compactNumber,
signature: compactNumber,
extra: compactNumber,
signedExtensions: (0, import_scale_ts13.Vector)(
(0, import_scale_ts13.Struct)({
identifier: import_scale_ts13.str,
type: compactNumber,

@@ -346,21 +555,28 @@ additionalSigned: compactNumber

});
var v14 = (0, import_scale_ts8.Struct)({
var v15 = (0, import_scale_ts13.Struct)({
lookup,
pallets,
extrinsic,
type: compactNumber
type: compactNumber,
apis: (0, import_scale_ts13.Vector)(runtimeApi),
outerEnums: (0, import_scale_ts13.Struct)({
call: compactNumber,
event: compactNumber,
error: compactNumber
}),
custom: (0, import_scale_ts13.Vector)((0, import_scale_ts13.Tuple)(import_scale_ts13.str, (0, import_scale_ts13.Struct)({ type: compactNumber, value: Hex() })))
});
// src/codecs/metadata/metadata.ts
var import_scale_ts9 = require("scale-ts");
var import_scale_ts14 = require("scale-ts");
var unsupportedFn = () => {
throw new Error("Unsupported metadata version!");
};
var unsupported = (0, import_scale_ts9.createCodec)(
var unsupported = (0, import_scale_ts14.createCodec)(
unsupportedFn,
unsupportedFn
);
var metadata = (0, import_scale_ts9.Struct)({
magicNumber: import_scale_ts9.u32,
metadata: (0, import_scale_ts9.Enum)({
var metadata = (0, import_scale_ts14.Struct)({
magicNumber: import_scale_ts14.u32,
metadata: (0, import_scale_ts14.Enum)({
v0: unsupported,

@@ -380,81 +596,9 @@ v1: unsupported,

v13: unsupported,
v14
v14: unsupported,
v15
})
});
// src/codecs/bitSequence.ts
var import_scale_ts10 = require("scale-ts");
var bitSequenceDecoder = (0, import_scale_ts10.createDecoder)((data) => {
const bitsLen = compactNumber.dec(data);
const bytesLen = Math.ceil(bitsLen / 8);
const bytes = (0, import_scale_ts10.Bytes)(bytesLen).dec(data);
return { bytes, bitsLen };
});
var bitSequenceEncoder = (input) => {
if (input.bitsLen > input.bytes.length * 8)
throw new Error(
`Not enough bytes. (bitsLen:${input.bitsLen}, bytesLen:${input.bytes.length})`
);
const lenEncoded = compactNumber.enc(input.bitsLen);
const result = new Uint8Array(input.bytes.length + lenEncoded.length);
result.set(lenEncoded, 0);
result.set(input.bytes, lenEncoded.length);
return result;
};
var bitSequence2 = (0, import_scale_ts10.createCodec)(bitSequenceEncoder, bitSequenceDecoder);
// src/codecs/char.ts
var import_scale_ts11 = require("scale-ts");
var char = (0, import_scale_ts11.enhanceCodec)(
import_scale_ts11.u8,
(str4) => str4.charCodeAt(0),
String.fromCharCode
);
// src/codecs/fixed-str.ts
var import_scale_ts12 = require("scale-ts");
var textEncoder = new TextEncoder();
var textDecoder = new TextDecoder();
var fixedStr = (nBytes) => (0, import_scale_ts12.enhanceCodec)(
(0, import_scale_ts12.Bytes)(nBytes),
(str4) => textEncoder.encode(str4),
(bytes) => textDecoder.decode(bytes)
);
// src/codecs/blockHeader.ts
var import_scale_ts13 = require("scale-ts");
var textEncoder2 = new TextEncoder();
var textDecoder2 = new TextDecoder();
var fourChars = (0, import_scale_ts13.enhanceCodec)(
(0, import_scale_ts13.Bytes)(4),
textEncoder2.encode.bind(textEncoder2),
textDecoder2.decode.bind(textDecoder2)
);
var diggestVal = (0, import_scale_ts13.Struct)({
engine: fourChars,
payload: Hex()
});
var diggest = (0, import_scale_ts13.Enum)(
{
consensus: diggestVal,
seal: diggestVal,
preRuntime: diggestVal,
runtimeUpdated: import_scale_ts13._void
},
[4, 5, 6, 8]
);
var hex32 = Hex(32);
var blockHeader = (0, import_scale_ts13.Struct)({
parentHash: hex32,
number: compactNumber,
stateRoot: hex32,
extrinsicRoot: hex32,
digests: (0, import_scale_ts13.Vector)(diggest)
});
// src/index.ts
__reExport(src_exports, codecs_exports, module.exports);
// src/hashes/blake2.ts
var import_utils2 = require("@polkadot-api/utils");
var import_utils4 = require("@polkadot-api/utils");
var import_blake2b2 = require("@noble/hashes/blake2b");

@@ -465,3 +609,3 @@ var len32 = { dkLen: 32 };

var Blake2128 = (encoded) => (0, import_blake2b2.blake2b)(encoded, len16);
var Blake2128Concat = (encoded) => (0, import_utils2.mergeUint8)(Blake2128(encoded), encoded);
var Blake2128Concat = (encoded) => (0, import_utils4.mergeUint8)(Blake2128(encoded), encoded);

@@ -472,4 +616,4 @@ // src/hashes/identity.ts

// src/hashes/twoX.ts
var import_utils3 = require("@polkadot-api/utils");
var import_scale_ts14 = require("scale-ts");
var import_utils5 = require("@polkadot-api/utils");
var import_scale_ts15 = require("scale-ts");

@@ -627,15 +771,15 @@ // src/hashes/h64.ts

};
var Twox64Concat = (encoded) => (0, import_utils3.mergeUint8)(import_scale_ts14.u64.enc(h64(encoded)), encoded);
var Twox64Concat = (encoded) => (0, import_utils5.mergeUint8)(import_scale_ts15.u64.enc(h64(encoded)), encoded);
// src/storage.ts
var import_utils4 = require("@polkadot-api/utils");
var textEncoder3 = new TextEncoder();
var import_utils6 = require("@polkadot-api/utils");
var textEncoder4 = new TextEncoder();
var Storage = (pallet) => {
const palledEncoded = Twox128(textEncoder3.encode(pallet));
return (name, dec2, ...encoders) => {
const palletItemEncoded = (0, import_utils4.mergeUint8)(
const palledEncoded = Twox128(textEncoder4.encode(pallet));
return (name, dec3, ...encoders) => {
const palletItemEncoded = (0, import_utils6.mergeUint8)(
palledEncoded,
Twox128(textEncoder3.encode(name))
Twox128(textEncoder4.encode(name))
);
const palletItemEncodedHex = (0, import_utils4.toHex)(palletItemEncoded);
const palletItemEncodedHex = (0, import_utils6.toHex)(palletItemEncoded);
const bytesToSkip = encoders.map((e) => e[1]).map((x) => {

@@ -668,10 +812,10 @@ if (x === Identity)

const fns = encoders.map(
([{ enc: enc3 }, hash]) => (val) => hash(enc3(val))
([{ enc: enc4 }, hash]) => (val) => hash(enc4(val))
);
const enc2 = (...args) => (0, import_utils4.toHex)(
(0, import_utils4.mergeUint8)(palletItemEncoded, ...args.map((val, idx) => fns[idx](val)))
const enc3 = (...args) => (0, import_utils6.toHex)(
(0, import_utils6.mergeUint8)(palletItemEncoded, ...args.map((val, idx) => fns[idx](val)))
);
return {
enc: enc2,
dec: dec2,
enc: enc3,
dec: dec3,
keyDecoder

@@ -678,0 +822,0 @@ };

import * as scale_ts from 'scale-ts';
import { Codec, Encoder, Decoder, CodecType } from 'scale-ts';
export * from 'scale-ts';
import { Codec, Encoder, Decoder, StringRecord, CodecType, EncoderType, DecoderType } from 'scale-ts';
export { Bytes, Codec, CodecType, Decoder, DecoderType, Encoder, EncoderType, Option, Result, ResultPayload, StringRecord, Struct, Tuple, Vector, _void, bool, compact, createCodec, createDecoder, enhanceCodec, enhanceDecoder, enhanceEncoder, i128, i16, i256, i32, i64, i8, str, u128, u16, u256, u32, u64, u8 } from 'scale-ts';

@@ -8,7 +8,52 @@ type SS58String = string & {

};
type SS58AddressInfo = {
isValid: false;
} | {
isValid: true;
ss58Format: number;
publicKey: Uint8Array;
};
declare const getSs58AddressInfo: (address: SS58String) => SS58AddressInfo;
declare const fromBufferToBase58: (ss58Format: number) => (publicKey: Uint8Array) => SS58String;
declare const AccountId: (ss58Format?: number, nBytes?: 32 | 33) => scale_ts.Codec<SS58String>;
type HexString = string & {
__hexString?: unknown;
};
declare const Hex: {
(nBytes?: number): Codec<HexString>;
enc: (nBytes?: number) => Encoder<HexString>;
dec: (nBytes?: number) => Decoder<HexString>;
};
declare class Binary {
#private;
constructor(data: Uint8Array);
asText: () => string;
asHex: () => string;
asBytes: () => Uint8Array;
static fromText(input: string): Binary;
static fromHex(input: HexString): Binary;
static fromBytes(input: Uint8Array): Binary;
}
declare const Bin: {
(nBytes?: number): Codec<Binary>;
enc: (nBytes?: number) => Encoder<Binary>;
dec: (nBytes?: number) => Decoder<Binary>;
};
interface BitSequence {
bitsLen: number;
bytes: Uint8Array;
}
declare const bitSequence: scale_ts.Codec<BitSequence>;
declare const char: scale_ts.Codec<string>;
declare const compactNumber: Codec<number>;
declare const compactBn: Codec<bigint>;
declare const fixedStr: (nBytes: number) => scale_ts.Codec<string>;
declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<T>;

@@ -18,12 +63,84 @@ declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<T>;

type OpaqueValue<T> = {
length: number;
inner: () => T;
type Tuple<T, N extends number> = readonly [T, ...T[]] & {
length: N;
};
declare const OpaqueCodec: {
<T>(inner: Codec<T>, len?: Codec<number>): Codec<OpaqueValue<T>>;
enc: <T_1>(inner: Encoder<T_1>, len?: Encoder<number>) => Encoder<OpaqueValue<T_1>>;
dec: <T_2>(inner: Decoder<T_2>, len?: Decoder<number>) => Decoder<OpaqueValue<T_2>>;
type Push<T extends any[], V> = [...T, V];
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
type TuplifyUnion<T, L = LastOf<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<TuplifyUnion<Exclude<T, L>>, L>;
type RestrictedLenTuple<T, O extends StringRecord<any>> = Tuple<T, TuplifyUnion<keyof O> extends Tuple<any, infer V> ? V : 0>;
type ExtractEnumValue<T extends {
type: string;
value?: any;
}, K extends string> = T extends {
type: K;
value: infer R;
} ? R : never;
interface Discriminant<T extends {
type: string;
value?: any;
}> {
is<K extends T["type"]>(this: Enum<T>, type: K): this is Enum<{
type: K;
value: ExtractEnumValue<T, K>;
}>;
as<K extends T["type"]>(type: K): ExtractEnumValue<T, K>;
}
declare const _Enum: {};
type Enum<T extends {
type: string;
value?: any;
}> = T & Discriminant<T>;
declare const Enum: <T extends {
type: string;
value?: any;
}, Key extends T["type"]>(type: Key, ...args: ExtractEnumValue<T, Key> extends undefined ? [] : [value: ExtractEnumValue<T, Key>]) => Enum<ExtractEnumValue<T, Key> extends undefined ? T : ExtractEnumValue<T, Key> extends never ? T : {
type: Key;
value: ExtractEnumValue<T, Key>;
}>;
declare const Variant: {
<O extends StringRecord<Codec<any>>>(inner: O, indexes?: RestrictedLenTuple<number, O> | undefined): Codec<Enum<{ [K in keyof O]: K extends string ? {
type: K;
value: CodecType<O[K]>;
} : never; }[keyof O]>>;
enc: <O_1 extends StringRecord<Encoder<any>>>(inner: O_1, x?: RestrictedLenTuple<number, O_1> | undefined) => Encoder<Enum<{ [K_1 in keyof O_1]: K_1 extends string ? {
type: K_1;
value: EncoderType<O_1[K_1]>;
} : never; }[keyof O_1]>>;
dec: <O_2 extends StringRecord<Decoder<any>>>(inner: O_2, x?: RestrictedLenTuple<number, O_2> | undefined) => Decoder<Enum<{ [K_2 in keyof O_2]: K_2 extends string ? {
type: K_2;
value: DecoderType<O_2[K_2]>;
} : never; }[keyof O_2]>>;
};
declare const blockHeader: Codec<{
parentHash: HexString;
number: number;
stateRoot: HexString;
extrinsicRoot: HexString;
digests: Enum<{
type: "consensus";
value: {
engine: string;
payload: HexString;
};
} | {
type: "seal";
value: {
engine: string;
payload: HexString;
};
} | {
type: "preRuntime";
value: {
engine: string;
payload: HexString;
};
} | {
type: "runtimeUpdated";
value: undefined;
}>[];
}>;
type BlockHeader = CodecType<typeof blockHeader>;
declare const lookup: scale_ts.Codec<{

@@ -34,3 +151,3 @@ id: number;

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -40,5 +157,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -51,5 +168,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -129,5 +246,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -138,70 +252,8 @@ docs: string[];

type HexString = string & {
__hexString?: unknown;
};
declare const Hex: {
(nBytes?: number): Codec<HexString>;
enc: (nBytes?: number) => Encoder<HexString>;
dec: (nBytes?: number) => Decoder<HexString>;
};
declare const pallets: scale_ts.Codec<{
name: string;
storage: void | {
prefix: string;
items: {
name: string;
modifier: number;
type: {
tag: "map";
value: {
hashers: ({
tag: "Blake2128";
value: undefined;
} | {
tag: "Blake2256";
value: undefined;
} | {
tag: "Blake2128Concat";
value: undefined;
} | {
tag: "Twox128";
value: undefined;
} | {
tag: "Twox256";
value: undefined;
} | {
tag: "Twox64Concat";
value: undefined;
} | {
tag: "Identity";
value: undefined;
})[];
key: number;
value: number;
};
} | {
tag: "plain";
value: number;
};
fallback: HexString;
docs: string[];
}[];
} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
constants: {
name: string;
type: number;
value: HexString;
docs: string[];
}[];
errors: number | void | undefined;
index: number;
}[]>;
type V14Pallets = CodecType<typeof pallets>;
declare const extrinsic: scale_ts.Codec<{
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -213,4 +265,4 @@ identifier: string;

}>;
type V14Extrinsic = CodecType<typeof extrinsic>;
declare const v14: scale_ts.Codec<{
type V15Extrinsic = CodecType<typeof extrinsic>;
declare const v15: scale_ts.Codec<{
lookup: {

@@ -221,3 +273,3 @@ id: number;

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -227,5 +279,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -238,5 +290,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -316,5 +368,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -325,3 +374,3 @@ docs: string[];

name: string;
storage: void | {
storage: {
prefix: string;

@@ -367,4 +416,4 @@ items: {

} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
calls: number | undefined;
events: number | undefined;
constants: {

@@ -376,8 +425,12 @@ name: string;

}[];
errors: number | void | undefined;
errors: number | undefined;
index: number;
docs: string[];
}[];
extrinsic: {
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -390,4 +443,26 @@ identifier: string;

type: number;
apis: {
name: string;
methods: {
name: string;
inputs: {
name: string;
type: number;
}[];
output: number;
docs: string[];
}[];
docs: string[];
}[];
outerEnums: {
call: number;
event: number;
error: number;
};
custom: [string, {
type: number;
value: HexString;
}][];
}>;
type V14 = CodecType<typeof v14>;
type V15 = CodecType<typeof v15>;

@@ -440,2 +515,5 @@ declare const metadata: Codec<{

tag: "v14";
value: unknown;
} | {
tag: "v15";
value: {

@@ -447,3 +525,3 @@ lookup: {

name: string;
type: number | void | undefined;
type: number | undefined;
}[];

@@ -453,5 +531,5 @@ def: {

value: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -464,5 +542,5 @@ }[];

fields: {
name: string | void | undefined;
name: string | undefined;
type: number;
typeName: string | void | undefined;
typeName: string | undefined;
docs: string[];

@@ -542,5 +620,2 @@ }[];

};
} | {
tag: "historicMetaCompat";
value: string;
};

@@ -551,3 +626,3 @@ docs: string[];

name: string;
storage: void | {
storage: {
prefix: string;

@@ -593,4 +668,4 @@ items: {

} | undefined;
calls: number | void | undefined;
events: number | void | undefined;
calls: number | undefined;
events: number | undefined;
constants: {

@@ -602,8 +677,12 @@ name: string;

}[];
errors: number | void | undefined;
errors: number | undefined;
index: number;
docs: string[];
}[];
extrinsic: {
type: number;
version: number;
address: number;
call: number;
signature: number;
extra: number;
signedExtensions: {

@@ -616,2 +695,24 @@ identifier: string;

type: number;
apis: {
name: string;
methods: {
name: string;
inputs: {
name: string;
type: number;
}[];
output: number;
docs: string[];
}[];
docs: string[];
}[];
outerEnums: {
call: number;
event: number;
error: number;
};
custom: [string, {
type: number;
value: HexString;
}][];
};

@@ -621,42 +722,2 @@ };

interface BitSequence {
bitsLen: number;
bytes: Uint8Array;
}
declare const bitSequence: scale_ts.Codec<BitSequence>;
declare const char: scale_ts.Codec<string>;
declare const fixedStr: (nBytes: number) => scale_ts.Codec<string>;
declare const blockHeader: scale_ts.Codec<{
parentHash: HexString;
number: number;
stateRoot: HexString;
extrinsicRoot: HexString;
digests: ({
tag: "consensus";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "seal";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "preRuntime";
value: {
engine: string;
payload: HexString;
};
} | {
tag: "runtimeUpdated";
value: undefined;
})[];
}>;
type BlockHeader = CodecType<typeof blockHeader>;
declare const Blake2256: (encoded: Uint8Array) => Uint8Array;

@@ -689,23 +750,27 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array;

};
type TxDescriptor<Args extends Array<any>> = string & {
_args: Args;
type TxDescriptor<Args extends {} | undefined> = string & {
___: Args;
};
type Descriptors = Record<string, [
Record<string, StorageDescriptor<any, any, any>>,
Record<string, TxDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>
]>;
type PickDescriptors<Idx extends 0 | 1 | 2 | 3 | 4, T extends Descriptors> = {
type RuntimeDescriptor<Args extends Array<any>, T> = string & {
__: [Args, T];
};
type Descriptors = {
pallets: Record<string, [
Record<string, StorageDescriptor<any, any, any>>,
Record<string, TxDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>,
Record<string, PlainDescriptor<any>>
]>;
apis: Record<string, Record<string, RuntimeDescriptor<any, any>>>;
asset: PlainDescriptor<any>;
};
type PickDescriptors<Idx extends 0 | 1 | 2 | 3 | 4, T extends Descriptors["pallets"]> = {
[K in keyof T]: T[K][Idx];
};
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : {
[K in keyof T]: Anonymize<T[K]>;
};
type ExtractStorage<T extends Record<string, Record<string, StorageDescriptor<any, any, any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends StorageDescriptor<infer Key, infer Value, infer Optional> ? {
KeyArgs: Anonymize<Key>;
Value: Anonymize<Value>;
KeyArgs: Key;
Value: Value;
IsOptional: Optional;

@@ -717,3 +782,3 @@ } : unknown;

[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Anonymize<Args> : unknown;
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Args : unknown;
};

@@ -723,11 +788,18 @@ };

[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Anonymize<Value> : unknown;
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Value : unknown;
};
};
type QueryFromDescriptors<T extends Descriptors> = ExtractStorage<PickDescriptors<0, T>>;
type TxFromDescriptors<T extends Descriptors> = ExtractTx<PickDescriptors<1, T>>;
type EventsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<2, T>>;
type ErrorsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<3, T>>;
type ConstFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<4, T>>;
type QueryFromDescriptors<T extends Descriptors> = ExtractStorage<PickDescriptors<0, T["pallets"]>>;
type TxFromDescriptors<T extends Descriptors> = ExtractTx<PickDescriptors<1, T["pallets"]>>;
type EventsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<2, T["pallets"]>>;
type ErrorsFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<3, T["pallets"]>>;
type ConstFromDescriptors<T extends Descriptors> = ExtractPlain<PickDescriptors<4, T["pallets"]>>;
export { AccountId, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type EncoderWithHash, type ErrorsFromDescriptors, type EventsFromDescriptors, Hex, type HexString, Identity, OpaqueCodec, type OpaqueValue, type PlainDescriptor, type QueryFromDescriptors, type SS58String, Self, Storage, type StorageDescriptor, Twox128, Twox256, Twox64Concat, type TxDescriptor, type TxFromDescriptors, type V14, type V14Extrinsic, type V14Lookup, type V14Pallets, bitSequence, blockHeader, char, compactBn, compactNumber, fixedStr, h64, metadata, selfDecoder, selfEncoder, v14 };
type GetEnum<T extends Enum<{
type: string;
value: any;
}>> = {
[K in T["type"]]: (...args: ExtractEnumValue<T, K> extends undefined ? [] : [value: ExtractEnumValue<T, K>]) => T;
};
export { AccountId, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, type GetEnum, Hex, type HexString, Identity, type PlainDescriptor, type QueryFromDescriptors, type RuntimeDescriptor, type SS58AddressInfo, type SS58String, Self, Storage, type StorageDescriptor, Twox128, Twox256, Twox64Concat, type TxDescriptor, type TxFromDescriptors, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v15 };

@@ -1,2 +0,2 @@

"use strict";var J=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var de=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Oe(t))!Me.call(e,d)&&d!==r&&J(e,d,{get:()=>t[d],enumerable:!(i=Ke(t,d))||i.enumerable});return e},p=(e,t,r)=>(j(e,t,"default"),r&&j(r,t,"default"));var Re=e=>j(J({},"__esModule",{value:!0}),e);var h={};de(h,{AccountId:()=>pe,Blake2128:()=>_e,Blake2128Concat:()=>ce,Blake2256:()=>lt,Hex:()=>v,Identity:()=>se,OpaqueCodec:()=>R,Self:()=>ye,Storage:()=>ut,Twox128:()=>X,Twox256:()=>yt,Twox64Concat:()=>ae,bitSequence:()=>ke,blockHeader:()=>De,char:()=>Ae,compactBn:()=>le,compactNumber:()=>a,fixedStr:()=>Ue,h64:()=>D,metadata:()=>Se,selfDecoder:()=>te,selfEncoder:()=>ee,v14:()=>$});module.exports=Re(h);p(h,require("scale-ts"),module.exports);var l={};de(l,{AccountId:()=>pe,Hex:()=>v,OpaqueCodec:()=>R,Self:()=>ye,bitSequence:()=>ke,blockHeader:()=>De,char:()=>Ae,compactBn:()=>le,compactNumber:()=>a,fixedStr:()=>Ue,metadata:()=>Se,selfDecoder:()=>te,selfEncoder:()=>ee,v14:()=>$});p(l,require("scale-ts"));var M=require("scale-ts"),Y=require("@noble/hashes/blake2b"),Z=require("@scure/base"),me=new TextEncoder().encode("SS58PRE"),Q=2,Pe=e=>{let t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return r=>{let i=(0,Y.blake2b)(Uint8Array.of(...me,...t,...r),{dkLen:64}).subarray(0,Q);return Z.base58.encode(Uint8Array.of(...t,...r,...i))}};function We(e,t){return r=>{let i=Z.base58.decode(r),d=i.subarray(0,i[0]&64?2:1),b=i.subarray(d.length,i.length-Q);if(b.length!==e)throw new Error("Invalid public key length");let C=i.subarray(d.length+b.length),T=(0,Y.blake2b)(Uint8Array.of(...me,...d,...b),{dkLen:64}).subarray(0,Q);if(C[0]!==T[0]||C[1]!==T[1])throw new Error("Invalid checksum");if($e(d)!=t)throw new Error("Invalid SS58 prefix");return b.slice()}}var pe=(e=42,t=32)=>(0,M.enhanceCodec)((0,M.Bytes)(t),We(t,e),Pe(e)),$e=e=>{let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)};var F=require("scale-ts"),a=F.compact,le=F.compact;var fe=require("scale-ts"),ee=e=>{let t=r=>{let i=e();return t=i,i(r)};return r=>t(r)},te=e=>{let t=r=>{let i=e(),d=i;return t=i,d(r)};return r=>t(r)},ye=e=>(0,fe.createCodec)(ee(()=>e().enc),te(()=>e().dec));var I=require("scale-ts");var ue=(e,t=a.dec)=>(0,I.createDecoder)(r=>{let i=t(r),d=(0,I.Bytes)(i).dec(r),b;return{length:i,inner:()=>b=b||e(d)}}),xe=(e,t=a.enc)=>r=>{let i=t(r.length),d=new Uint8Array(i.length+r.length);return d.set(i,0),d.set(e(r.inner()),i.length),d},R=(e,t=a)=>(0,I.createCodec)(xe(e.enc,t.enc),ue(e.dec,t.dec));R.enc=xe;R.dec=ue;var B=require("scale-ts");var n=require("scale-ts"),be=(0,n.Option)(n.str),P=(0,n.Vector)(n.str),ze=(0,n.Enum)({bool:n._void,char:n._void,str:n._void,u8:n._void,u16:n._void,u32:n._void,u64:n._void,u128:n._void,u256:n._void,i8:n._void,i16:n._void,i32:n._void,i64:n._void,i128:n._void,i256:n._void}),ge=(0,n.Vector)((0,n.Struct)({name:be,type:a,typeName:be,docs:P})),Ge=(0,n.Struct)({len:n.u32,type:a}),Xe=(0,n.Struct)({bitStoreType:a,bitOrderType:a}),je=(0,n.Vector)((0,n.Struct)({name:n.str,fields:ge,index:n.u8,docs:P})),Je=(0,n.Enum)({composite:ge,variant:je,sequence:a,array:Ge,tuple:(0,n.Vector)(a),primitive:ze,compact:a,bitSequence:Xe,historicMetaCompat:n.str}),Qe=(0,n.Struct)({name:n.str,type:(0,n.Option)(a)}),Ye=(0,n.Vector)(Qe),Ze=(0,n.Struct)({id:a,path:P,params:Ye,def:Je,docs:P}),he=(0,n.Vector)(Ze);var W=require("@polkadot-api/utils"),K=require("scale-ts"),Te=e=>{let t=K.Bytes.enc(e);return r=>t((0,W.fromHex)(r))},Ee=e=>{let t=K.Bytes.dec(e);return r=>(0,W.toHex)(t(r))},v=e=>(0,K.createCodec)(Te(e),Ee(e));v.enc=Te;v.dec=Ee;var s=require("scale-ts"),Fe=(0,s.Enum)({Blake2128:s._void,Blake2256:s._void,Blake2128Concat:s._void,Twox128:s._void,Twox256:s._void,Twox64Concat:s._void,Identity:s._void}),et=(0,s.Vector)(Fe),tt=(0,s.Struct)({hashers:et,key:a,value:a}),rt=(0,s.Struct)({name:s.str,modifier:s.u8,type:(0,s.Enum)({plain:a,map:tt}),fallback:v(),docs:(0,s.Vector)(s.str)}),ot=(0,s.Option)((0,s.Struct)({prefix:s.str,items:(0,s.Vector)(rt)})),we=(0,s.Vector)((0,s.Struct)({name:s.str,storage:ot,calls:(0,s.Option)(a),events:(0,s.Option)(a),constants:(0,s.Vector)((0,s.Struct)({name:s.str,type:a,value:v(),docs:(0,s.Vector)(s.str)})),errors:(0,s.Option)(a),index:s.u8}));var nt=(0,B.Struct)({type:a,version:B.u8,signedExtensions:(0,B.Vector)((0,B.Struct)({identifier:B.str,type:a,additionalSigned:a}))}),$=(0,B.Struct)({lookup:he,pallets:we,extrinsic:nt,type:a});var V=require("scale-ts");var Ce=()=>{throw new Error("Unsupported metadata version!")},w=(0,V.createCodec)(Ce,Ce),Se=(0,V.Struct)({magicNumber:V.u32,metadata:(0,V.Enum)({v0:w,v1:w,v2:w,v3:w,v4:w,v5:w,v6:w,v7:w,v8:w,v9:w,v10:w,v11:w,v12:w,v13:w,v14:$})});var L=require("scale-ts");var ct=(0,L.createDecoder)(e=>{let t=a.dec(e),r=Math.ceil(t/8);return{bytes:(0,L.Bytes)(r).dec(e),bitsLen:t}}),st=e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let t=a.enc(e.bitsLen),r=new Uint8Array(e.bytes.length+t.length);return r.set(t,0),r.set(e.bytes,t.length),r},ke=(0,L.createCodec)(st,ct);var z=require("scale-ts"),Ae=(0,z.enhanceCodec)(z.u8,e=>e.charCodeAt(0),String.fromCharCode);var G=require("scale-ts"),it=new TextEncoder,at=new TextDecoder,Ue=e=>(0,G.enhanceCodec)((0,G.Bytes)(e),t=>it.encode(t),t=>at.decode(t));var S=require("scale-ts");var ve=new TextEncoder,Be=new TextDecoder,dt=(0,S.enhanceCodec)((0,S.Bytes)(4),ve.encode.bind(ve),Be.decode.bind(Be)),re=(0,S.Struct)({engine:dt,payload:v()}),mt=(0,S.Enum)({consensus:re,seal:re,preRuntime:re,runtimeUpdated:S._void},[4,5,6,8]),oe=v(32),De=(0,S.Struct)({parentHash:oe,number:a,stateRoot:oe,extrinsicRoot:oe,digests:(0,S.Vector)(mt)});p(h,l,module.exports);var Ve=require("@polkadot-api/utils"),ne=require("@noble/hashes/blake2b"),pt={dkLen:32},lt=e=>(0,ne.blake2b)(e,pt),ft={dkLen:16},_e=e=>(0,ne.blake2b)(e,ft),ce=e=>(0,Ve.mergeUint8)(_e(e),e);var se=e=>e;var Le=require("@polkadot-api/utils"),qe=require("scale-ts");var _=(e,t,r,i)=>new DataView(new Uint16Array([e,t,r,i]).buffer).getBigUint64(0,!0),ie=2n**64n-1n,g=(e,t)=>e<<t&ie|e>>64n-t,m=(e,t)=>e*t&ie,u=(e,t)=>e+t&ie,x=11400714785074694791n,k=14029467366897019727n,He=1609587929392839161n,O=9650029242287828579n,Ie=2870177450012600261n;function D(e,t=0n){let r=u(u(t,x),k),i=u(t,k),d=t,b=t-x,C=e.length,T=0,H=null;(function(){let o=0,A=o+C;if(C){if(H=new Uint8Array(32),C<32){H.set(e.subarray(0,C),T),T+=C;return}if(o<=A-32){let N=A-32;do{let U;U=_(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),r=m(g(u(r,m(U,k)),31n),x),o+=8,U=_(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),i=m(g(u(i,m(U,k)),31n),x),o+=8,U=_(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),d=m(g(u(d,m(U,k)),31n),x),o+=8,U=_(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),b=m(g(u(b,m(U,k)),31n),x),o+=8}while(o<=N)}o<A&&(H.set(e.subarray(o,A),T),T=A-o)}})(),e=H||e;let c,f=0;for(C>=32?(c=g(r,1n),c=u(c,g(i,7n)),c=u(c,g(d,12n)),c=u(c,g(b,18n)),r=m(g(m(r,k),31n),x),c=c^r,c=u(m(c,x),O),i=m(g(m(i,k),31n),x),c=c^i,c=u(m(c,x),O),d=m(g(m(d,k),31n),x),c=c^d,c=u(m(c,x),O),b=m(g(m(b,k),31n),x),c=c^b,c=u(m(c,x),O)):c=u(t,Ie),c=u(c,BigInt(C));f<=T-8;){let E=_(e[f+1]<<8|e[f],e[f+3]<<8|e[f+2],e[f+5]<<8|e[f+4],e[f+7]<<8|e[f+6]);E=m(g(m(E,k),31n),x),c=u(m(g(c^E,27n),x),O),f+=8}if(f+4<=T){let E=m(_(e[f+1]<<8|e[f],e[f+3]<<8|e[f+2],0,0),x);c=u(m(g(c^E,23n),k),He),f+=4}for(;f<T;){let E=m(_(e[f++],0,0,0),Ie);c=m(g(c^E,11n),x)}let y=c>>33n;return c=m(c^y,k),y=c>>29n,c=m(c^y,He),y=c>>32n,c^=y,c}var X=e=>{let t=new Uint8Array(16),r=new DataView(t.buffer);return r.setBigUint64(0,D(e),!0),r.setBigUint64(8,D(e,1n),!0),t},yt=e=>{let t=new Uint8Array(32),r=new DataView(t.buffer);return r.setBigUint64(0,D(e),!0),r.setBigUint64(8,D(e,1n),!0),r.setBigUint64(16,D(e,2n),!0),r.setBigUint64(24,D(e,3n),!0),t},ae=e=>(0,Le.mergeUint8)(qe.u64.enc(D(e)),e);var q=require("@polkadot-api/utils");var Ne=new TextEncoder,ut=e=>{let t=X(Ne.encode(e));return(r,i,...d)=>{let b=(0,q.mergeUint8)(t,X(Ne.encode(r))),C=(0,q.toHex)(b),T=d.map(y=>y[1]).map(y=>y===se?0:y===ae?8:y===ce?16:null).filter(Boolean),H=y=>{if(!y.startsWith(C))throw new Error(`key does not match this storage (${e}.${r})`);if(T.length!==d.length)throw new Error("Impossible to decode this key");if(d.length===0)return[];let E=y.slice(C.length),o=new Array(d.length);for(let A=0,N=0;A<T.length;A++){let U=d[A][0];N+=T[A],o[A]=U.dec(E.slice(N*2)),N+=U.enc(o[A]).length}return o},c=d.map(([{enc:y},E])=>o=>E(y(o)));return{enc:(...y)=>(0,q.toHex)((0,q.mergeUint8)(b,...y.map((E,o)=>c[o](E)))),dec:i,keyDecoder:H}}};
"use strict";var $=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Ge=(e,t,n)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xe=(e,t)=>{for(var n in t)$(e,n,{get:t[n],enumerable:!0})},Je=(e,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let y of ze(t))!Fe.call(e,y)&&y!==n&&$(e,y,{get:()=>t[y],enumerable:!(d=je(t,y))||d.enumerable});return e};var Qe=e=>Je($({},"__esModule",{value:!0}),e);var j=(e,t,n)=>(Ge(e,typeof t!="symbol"?t+"":t,n),n),be=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var A=(e,t,n)=>(be(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},F=(e,t,n,d)=>(be(e,t,"write to private field"),d?d.call(e,n):t.set(e,n),n);var _t={};Xe(_t,{AccountId:()=>et,Bin:()=>ie,Binary:()=>X,Blake2128:()=>Ne,Blake2128Concat:()=>fe,Blake2256:()=>Ot,Bytes:()=>r.Bytes,Enum:()=>ye,Hex:()=>C,Identity:()=>xe,Option:()=>r.Option,Result:()=>r.Result,Self:()=>mt,Storage:()=>Lt,Struct:()=>r.Struct,Tuple:()=>r.Tuple,Twox128:()=>te,Twox256:()=>Rt,Twox64Concat:()=>Te,Variant:()=>q,Vector:()=>r.Vector,_Enum:()=>ut,_void:()=>r._void,bitSequence:()=>st,blockHeader:()=>ft,bool:()=>r.bool,char:()=>it,compact:()=>r.compact,compactBn:()=>rt,compactNumber:()=>a,createCodec:()=>r.createCodec,createDecoder:()=>r.createDecoder,enhanceCodec:()=>r.enhanceCodec,enhanceDecoder:()=>r.enhanceDecoder,enhanceEncoder:()=>r.enhanceEncoder,fixedStr:()=>yt,fromBufferToBase58:()=>se,getSs58AddressInfo:()=>ce,h64:()=>U,i128:()=>r.i128,i16:()=>r.i16,i256:()=>r.i256,i32:()=>r.i32,i64:()=>r.i64,i8:()=>r.i8,metadata:()=>Bt,selfDecoder:()=>Ue,selfEncoder:()=>Ce,str:()=>r.str,u128:()=>r.u128,u16:()=>r.u16,u256:()=>r.u256,u32:()=>r.u32,u64:()=>r.u64,u8:()=>r.u8,v15:()=>le});module.exports=Qe(_t);var G=require("scale-ts");var re=require("@scure/base"),oe=require("@noble/hashes/blake2b"),he=new TextEncoder().encode("SS58PRE"),ne=2,ce=e=>{try{let t=re.base58.decode(e),n=t.subarray(0,t[0]&64?2:1),d=t.subarray(n.length,t.length-ne),y=t.subarray(n.length+d.length),E=(0,oe.blake2b)(Uint8Array.of(...he,...n,...d),{dkLen:64}).subarray(0,ne);return y[0]===E[0]&&y[1]===E[1]?{isValid:!0,ss58Format:Ye(n),publicKey:d.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Ye=e=>{let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},se=e=>{let t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{let d=(0,oe.blake2b)(Uint8Array.of(...he,...t,...n),{dkLen:64}).subarray(0,ne);return re.base58.encode(Uint8Array.of(...t,...n,...d))}};function Ze(e,t){return n=>{let d=ce(n);if(!d.isValid)throw new Error("Invalid checksum");let{publicKey:y}=d;if(y.length!==e)throw new Error("Invalid public key length");return y}}var et=(e=42,t=32)=>(0,G.enhanceCodec)((0,G.Bytes)(t),Ze(t,e),se(e));var N=require("scale-ts"),J=require("@polkadot-api/utils");var tt=new TextEncoder,nt=new TextDecoder,V,O,H,I=class I{constructor(t){z(this,V,void 0);z(this,O,null);z(this,H,null);j(this,"asText",()=>A(this,H)===null?F(this,H,nt.decode(A(this,V))):A(this,H));j(this,"asHex",()=>A(this,O)===null?F(this,O,(0,J.toHex)(A(this,V))):A(this,O));j(this,"asBytes",()=>A(this,V));F(this,V,t)}static fromText(t){return new I(tt.encode(t))}static fromHex(t){return new I((0,J.fromHex)(t))}static fromBytes(t){return new I(t)}};V=new WeakMap,O=new WeakMap,H=new WeakMap;var X=I,Ee=e=>{let t=N.Bytes.enc(e);return n=>t(n.asBytes())},ve=e=>{let t=N.Bytes.dec(e);return n=>X.fromBytes(t(n))},ie=e=>(0,N.createCodec)(Ee(e),ve(e));ie.enc=Ee;ie.dec=ve;var R=require("scale-ts");var ae=require("scale-ts"),a=ae.compact,rt=ae.compact;var ot=(0,R.createDecoder)(e=>{let t=a.dec(e),n=Math.ceil(t/8);return{bytes:(0,R.Bytes)(n).dec(e),bitsLen:t}}),ct=e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let t=a.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},st=(0,R.createCodec)(ct,ot);var Q=require("scale-ts"),it=(0,Q.enhanceCodec)(Q.u8,e=>e.charCodeAt(0),String.fromCharCode);var Y=require("@polkadot-api/utils"),P=require("scale-ts"),Se=e=>{let t=P.Bytes.enc(e);return n=>t((0,Y.fromHex)(n))},ke=e=>{let t=P.Bytes.dec(e);return n=>(0,Y.toHex)(t(n))},C=e=>(0,P.createCodec)(Se(e),ke(e));C.enc=Se;C.dec=ke;var Z=require("scale-ts"),at=new TextEncoder,dt=new TextDecoder,yt=e=>(0,Z.enhanceCodec)((0,Z.Bytes)(e),t=>at.encode(t),t=>dt.decode(t));var r=require("scale-ts");var we=require("scale-ts"),Ce=e=>{let t=n=>{let d=e();return t=d,d(n)};return n=>t(n)},Ue=e=>{let t=n=>{let d=e(),y=d;return t=d,y(n)};return n=>t(n)},mt=e=>(0,we.createCodec)(Ce(()=>e().enc),Ue(()=>e().dec));var M=require("scale-ts"),de=require("@polkadot-api/utils"),ut=new Proxy({},{get(e,t){return n=>ye(t,n)}}),ye=(e,t)=>({as:n=>{if(n!==e)throw new Error(`Enum.as(${n}) used with actual type ${e}`);return t},is:n=>n===e,type:e,value:t}),Ae=(...e)=>{let t=M.Enum.enc(...e);return n=>t({tag:n.type,value:n.value})},Ke=(...e)=>{let t=M.Enum.dec(...e);return n=>{let{tag:d,value:y}=t(n);return ye(d,y)}},q=(e,...t)=>(0,M.createCodec)(Ae((0,de.mapObject)(e,([n])=>n),...t),Ke((0,de.mapObject)(e,([,n])=>n),...t));q.enc=Ae;q.dec=Ke;var Ve=new TextEncoder,Be=new TextDecoder,lt=(0,r.enhanceCodec)((0,r.Bytes)(4),Ve.encode.bind(Ve),Be.decode.bind(Be)),me=(0,r.Struct)({engine:lt,payload:C()}),pt=q({consensus:me,seal:me,preRuntime:me,runtimeUpdated:r._void},[4,5,6,8]),ue=C(32),ft=(0,r.Struct)({parentHash:ue,number:a,stateRoot:ue,extrinsicRoot:ue,digests:(0,r.Vector)(pt)});var u=require("scale-ts");var c=require("scale-ts"),De=(0,c.Option)(c.str),ee=(0,c.Vector)(c.str),xt=(0,c.Enum)({bool:c._void,char:c._void,str:c._void,u8:c._void,u16:c._void,u32:c._void,u64:c._void,u128:c._void,u256:c._void,i8:c._void,i16:c._void,i32:c._void,i64:c._void,i128:c._void,i256:c._void}),Oe=(0,c.Vector)((0,c.Struct)({name:De,type:a,typeName:De,docs:ee})),gt=(0,c.Struct)({len:c.u32,type:a}),Tt=(0,c.Struct)({bitStoreType:a,bitOrderType:a}),bt=(0,c.Vector)((0,c.Struct)({name:c.str,fields:Oe,index:c.u8,docs:ee})),ht=(0,c.Enum)({composite:Oe,variant:bt,sequence:a,array:gt,tuple:(0,c.Vector)(a),primitive:xt,compact:a,bitSequence:Tt}),Et=(0,c.Struct)({name:c.str,type:(0,c.Option)(a)}),vt=(0,c.Vector)(Et),St=(0,c.Struct)({id:a,path:ee,params:vt,def:ht,docs:ee}),He=(0,c.Vector)(St);var i=require("scale-ts"),kt=(0,i.Enum)({Blake2128:i._void,Blake2256:i._void,Blake2128Concat:i._void,Twox128:i._void,Twox256:i._void,Twox64Concat:i._void,Identity:i._void}),wt=(0,i.Vector)(kt),Ct=(0,i.Struct)({hashers:wt,key:a,value:a}),Ut=(0,i.Struct)({name:i.str,modifier:i.u8,type:(0,i.Enum)({plain:a,map:Ct}),fallback:C(),docs:(0,i.Vector)(i.str)}),At=(0,i.Option)((0,i.Struct)({prefix:i.str,items:(0,i.Vector)(Ut)})),Re=(0,i.Vector)((0,i.Struct)({name:i.str,storage:At,calls:(0,i.Option)(a),events:(0,i.Option)(a),constants:(0,i.Vector)((0,i.Struct)({name:i.str,type:a,value:C(),docs:(0,i.Vector)(i.str)})),errors:(0,i.Option)(a),index:i.u8,docs:(0,i.Vector)(i.str)}));var Le=(0,u.Vector)(u.str),Kt=(0,u.Struct)({name:u.str,methods:(0,u.Vector)((0,u.Struct)({name:u.str,inputs:(0,u.Vector)((0,u.Struct)({name:u.str,type:a})),output:a,docs:Le})),docs:Le}),Vt=(0,u.Struct)({version:u.u8,address:a,call:a,signature:a,extra:a,signedExtensions:(0,u.Vector)((0,u.Struct)({identifier:u.str,type:a,additionalSigned:a}))}),le=(0,u.Struct)({lookup:He,pallets:Re,extrinsic:Vt,type:a,apis:(0,u.Vector)(Kt),outerEnums:(0,u.Struct)({call:a,event:a,error:a}),custom:(0,u.Vector)((0,u.Tuple)(u.str,(0,u.Struct)({type:a,value:C()})))});var K=require("scale-ts");var _e=()=>{throw new Error("Unsupported metadata version!")},T=(0,K.createCodec)(_e,_e),Bt=(0,K.Struct)({magicNumber:K.u32,metadata:(0,K.Enum)({v0:T,v1:T,v2:T,v3:T,v4:T,v5:T,v6:T,v7:T,v8:T,v9:T,v10:T,v11:T,v12:T,v13:T,v14:T,v15:le})});var Ie=require("@polkadot-api/utils"),pe=require("@noble/hashes/blake2b"),Dt={dkLen:32},Ot=e=>(0,pe.blake2b)(e,Dt),Ht={dkLen:16},Ne=e=>(0,pe.blake2b)(e,Ht),fe=e=>(0,Ie.mergeUint8)(Ne(e),e);var xe=e=>e;var qe=require("@polkadot-api/utils"),We=require("scale-ts");var B=(e,t,n,d)=>new DataView(new Uint16Array([e,t,n,d]).buffer).getBigUint64(0,!0),ge=2n**64n-1n,g=(e,t)=>e<<t&ge|e>>64n-t,m=(e,t)=>e*t&ge,f=(e,t)=>e+t&ge,x=11400714785074694791n,h=14029467366897019727n,Pe=1609587929392839161n,W=9650029242287828579n,Me=2870177450012600261n;function U(e,t=0n){let n=f(f(t,x),h),d=f(t,h),y=t,E=t-x,S=e.length,k=0,D=null;(function(){let o=0,v=o+S;if(S){if(D=new Uint8Array(32),S<32){D.set(e.subarray(0,S),k),k+=S;return}if(o<=v-32){let _=v-32;do{let w;w=B(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),n=m(g(f(n,m(w,h)),31n),x),o+=8,w=B(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),d=m(g(f(d,m(w,h)),31n),x),o+=8,w=B(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),y=m(g(f(y,m(w,h)),31n),x),o+=8,w=B(e[o+1]<<8|e[o],e[o+3]<<8|e[o+2],e[o+5]<<8|e[o+4],e[o+7]<<8|e[o+6]),E=m(g(f(E,m(w,h)),31n),x),o+=8}while(o<=_)}o<v&&(D.set(e.subarray(o,v),k),k=v-o)}})(),e=D||e;let s,l=0;for(S>=32?(s=g(n,1n),s=f(s,g(d,7n)),s=f(s,g(y,12n)),s=f(s,g(E,18n)),n=m(g(m(n,h),31n),x),s=s^n,s=f(m(s,x),W),d=m(g(m(d,h),31n),x),s=s^d,s=f(m(s,x),W),y=m(g(m(y,h),31n),x),s=s^y,s=f(m(s,x),W),E=m(g(m(E,h),31n),x),s=s^E,s=f(m(s,x),W)):s=f(t,Me),s=f(s,BigInt(S));l<=k-8;){let b=B(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]);b=m(g(m(b,h),31n),x),s=f(m(g(s^b,27n),x),W),l+=8}if(l+4<=k){let b=m(B(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],0,0),x);s=f(m(g(s^b,23n),h),Pe),l+=4}for(;l<k;){let b=m(B(e[l++],0,0,0),Me);s=m(g(s^b,11n),x)}let p=s>>33n;return s=m(s^p,h),p=s>>29n,s=m(s^p,Pe),p=s>>32n,s^=p,s}var te=e=>{let t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,U(e),!0),n.setBigUint64(8,U(e,1n),!0),t},Rt=e=>{let t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,U(e),!0),n.setBigUint64(8,U(e,1n),!0),n.setBigUint64(16,U(e,2n),!0),n.setBigUint64(24,U(e,3n),!0),t},Te=e=>(0,qe.mergeUint8)(We.u64.enc(U(e)),e);var L=require("@polkadot-api/utils");var $e=new TextEncoder,Lt=e=>{let t=te($e.encode(e));return(n,d,...y)=>{let E=(0,L.mergeUint8)(t,te($e.encode(n))),S=(0,L.toHex)(E),k=y.map(p=>p[1]).map(p=>p===xe?0:p===Te?8:p===fe?16:null).filter(Boolean),D=p=>{if(!p.startsWith(S))throw new Error(`key does not match this storage (${e}.${n})`);if(k.length!==y.length)throw new Error("Impossible to decode this key");if(y.length===0)return[];let b=p.slice(S.length),o=new Array(y.length);for(let v=0,_=0;v<k.length;v++){let w=y[v][0];_+=k[v],o[v]=w.dec(b.slice(_*2)),_+=w.enc(o[v]).length}return o},s=y.map(([{enc:p},b])=>o=>b(p(o)));return{enc:(...p)=>(0,L.toHex)((0,L.mergeUint8)(E,...p.map((b,o)=>s[o](b)))),dec:d,keyDecoder:D}}};
//# sourceMappingURL=index.js.map
{
"name": "@polkadot-api/substrate-bindings",
"version": "0.0.1-b93545aad989f8c380fb1d4764731b59fd1d692d.1.0",
"version": "0.0.1-b95115e314039199595018979c6d5c177dd28c00.1.0",
"author": "Josep M Sobrepere (https://github.com/josepot)",

@@ -45,4 +45,4 @@ "repository": {

"@scure/base": "^1.1.1",
"scale-ts": "^1.4.3",
"@polkadot-api/utils": "0.0.1-b93545aad989f8c380fb1d4764731b59fd1d692d.1.0"
"scale-ts": "^1.6.0",
"@polkadot-api/utils": "0.0.1-b95115e314039199595018979c6d5c177dd28c00.1.0"
},

@@ -49,0 +49,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc