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
3
Versions
604
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-a7c3ff9522dcd125241219385318703d14a465b9.1.0 to 0.0.1-a8c4f3c213c8f8c3b2e1c24500e4ea5c7f2142c7.1.0

171

dist/index.d.ts

@@ -6,3 +6,3 @@ import * as scale_ts from 'scale-ts';

type SS58String = string & {
__SS58String: unknown;
__SS58String?: unknown;
};

@@ -14,11 +14,5 @@ declare const AccountId: (ss58Format?: number, nBytes?: 32 | 33) => scale_ts.Codec<SS58String>;

declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<{
self: T;
}>;
declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<{
self: T;
}>;
declare const Self: <T>(value: () => Codec<T>) => Codec<{
self: T;
}>;
declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<T>;
declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<T>;
declare const Self: <T>(value: () => Codec<T>) => Codec<T>;

@@ -141,3 +135,3 @@ type OpaqueValue<T> = {

type HexString = string & {
__hexString: unknown;
__hexString?: unknown;
};

@@ -189,3 +183,3 @@ declare const Hex: {

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -360,3 +354,3 @@ }[];

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -578,3 +572,3 @@ }[];

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -618,2 +612,32 @@ }[];

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;

@@ -638,74 +662,51 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array;

type Tuple<T> = readonly [T, ...T[]];
interface DescriptorCommon<Pallet extends string, Name extends string> {
checksum: bigint;
pallet: Pallet;
name: Name;
}
interface ArgsWithPayloadCodec<Args extends Array<any>, O> {
len: Args["length"];
}
interface ArgsWithoutPayloadCodec<Args extends Array<any>> {
len: Args["length"];
}
interface StorageDescriptor<Common extends DescriptorCommon<string, string>, Codecs extends ArgsWithPayloadCodec<any, any>> {
type: "storage";
props: Common;
codecs: Codecs;
}
interface ConstantDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "const";
props: Common;
codecs: Codecs;
}
interface EventDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "event";
props: Common;
codecs: Codecs;
}
interface ErrorDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "error";
props: Common;
codecs: Codecs;
}
interface TxDescriptor<Common extends DescriptorCommon<string, string>, Codecs extends ArgsWithoutPayloadCodec<any>, Events extends Array<EventDescriptor<any, any>>, Errors extends Array<ErrorDescriptor<any, any>>> {
type: "tx";
props: Common;
codecs: Codecs;
events: Events;
errors: Errors;
}
type Descriptor = ConstantDescriptor<any, any> | EventDescriptor<any, any> | StorageDescriptor<any, any> | ErrorDescriptor<any, any> | TxDescriptor<any, any, any, any>;
declare const createCommonDescriptor: <Pallet extends string, Name extends string>(checksum: bigint, pallet: Pallet, name: Name) => DescriptorCommon<Pallet, Name>;
declare const getDescriptorCreator: <Type extends "const" | "event" | "error", Pallet extends string, Name extends string, Codecs>(type: Type, checksum: bigint, pallet: Pallet, name: Name, codecs: Codecs) => Type extends "const" ? ConstantDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : Type extends "event" ? EventDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : ErrorDescriptor<DescriptorCommon<Pallet, Name>, Codecs>;
declare const getPalletCreator: <Pallet extends string>(pallet: Pallet) => {
getPayloadDescriptor: <Type extends "const" | "event" | "error", Name extends string, Codecs>(type: Type, checksum: bigint, name: Name, codecs: Codecs) => Type extends "const" ? ConstantDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : Type extends "event" ? EventDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : ErrorDescriptor<DescriptorCommon<Pallet, Name>, Codecs>;
getStorageDescriptor: <Name_1 extends string, Codecs_1 extends ArgsWithPayloadCodec<any[], any>>(checksum: bigint, name: Name_1, codecs: Codecs_1) => StorageDescriptor<DescriptorCommon<Pallet, Name_1>, Codecs_1>;
getTxDescriptor: <Name_2 extends string, Codecs_2 extends ArgsWithoutPayloadCodec<any>, Events extends EventDescriptor<any, any>[], Errors extends ErrorDescriptor<any, any>[]>(checksum: bigint, name: Name_2, events: Events, errors: Errors, codecs: Codecs_2) => TxDescriptor<DescriptorCommon<Pallet, Name_2>, Codecs_2, Events, Errors>;
type PlainDescriptor<T> = string & {
_type?: T;
};
type EventToObject<E extends EventDescriptor<DescriptorCommon<any, string>, any>> = E extends EventDescriptor<DescriptorCommon<any, infer K>, infer V> ? {
type: K;
value: V;
} : unknown;
type UnionizeTupleEvents<E extends Array<EventDescriptor<any, any>>> = E extends Array<infer Ev> ? Ev extends EventDescriptor<any, any> ? EventToObject<Ev> : unknown : unknown;
type TxDescriptorArgs<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, ArgsWithoutPayloadCodec<infer A>, any, any> ? A : [];
type TxDescriptorEvents<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, any, infer E, any> ? E : [];
type TxDescriptorErrors<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, any, any, infer Errors> ? Errors extends Tuple<ErrorDescriptor<any, any>> ? {
[K in keyof Errors]: Errors[K] extends ErrorDescriptor<DescriptorCommon<any, infer Type>, infer Value> ? {
type: Type;
value: Value;
} : unknown;
}[keyof Errors extends number ? keyof Errors : never] : [] : [];
type TxFunction<D extends TxDescriptor<any, any, any, any>> = (...args: TxDescriptorArgs<D>) => Promise<{
ok: true;
events: Array<UnionizeTupleEvents<TxDescriptorEvents<D>>>;
} | {
ok: false;
error: TxDescriptorErrors<D>;
}>;
type StorageType<T extends StorageDescriptor<any, ArgsWithPayloadCodec<any, any>>> = T extends StorageDescriptor<any, ArgsWithPayloadCodec<infer Args, infer Payload>> ? {
keyArgs: Args;
value: Payload;
} : unknown;
type StorageDescriptor<Args extends Array<any>, T, Optional extends true | false> = string & {
_type: T;
_args: Args;
_optional: Optional;
};
type TxDescriptor<Args extends Array<any>> = string & {
_args: 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> = {
[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>;
IsOptional: Optional;
} : unknown;
};
};
type ExtractTx<T extends Record<string, Record<string, TxDescriptor<any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Anonymize<Args> : unknown;
};
};
type ExtractPlain<T extends Record<string, Record<string, PlainDescriptor<any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Anonymize<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>>;
export { AccountId, ArgsWithPayloadCodec, ArgsWithoutPayloadCodec, BitSequence, Blake2128, Blake2128Concat, Blake2256, ConstantDescriptor, Descriptor, DescriptorCommon, EncoderWithHash, ErrorDescriptor, EventDescriptor, EventToObject, Hex, HexString, Identity, OpaqueCodec, OpaqueValue, SS58String, Self, Storage, StorageDescriptor, StorageType, Twox128, Twox256, Twox64Concat, TxDescriptor, TxDescriptorArgs, TxDescriptorErrors, TxDescriptorEvents, TxFunction, UnionizeTupleEvents, V14, V14Extrinsic, V14Lookup, V14Pallets, bitSequence, char, compactBn, compactNumber, createCommonDescriptor, fixedStr, getDescriptorCreator, getPalletCreator, h64, metadata, selfDecoder, selfEncoder, v14 };
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 };

@@ -37,9 +37,7 @@ "use strict";

bitSequence: () => bitSequence2,
blockHeader: () => blockHeader,
char: () => char,
compactBn: () => compactBn,
compactNumber: () => compactNumber,
createCommonDescriptor: () => createCommonDescriptor,
fixedStr: () => fixedStr,
getDescriptorCreator: () => getDescriptorCreator,
getPalletCreator: () => getPalletCreator,
h64: () => h64,

@@ -62,2 +60,3 @@ metadata: () => metadata,

bitSequence: () => bitSequence2,
blockHeader: () => blockHeader,
char: () => char,

@@ -140,3 +139,3 @@ compactBn: () => compactBn,

let cache = (x) => {
const encoder = import_scale_ts3.Struct.enc({ self: value() });
const encoder = value();
cache = encoder;

@@ -149,3 +148,3 @@ return encoder(x);

let cache = (x) => {
const decoder = import_scale_ts3.Struct.dec({ self: value() });
const decoder = value();
const result = decoder;

@@ -299,3 +298,3 @@ cache = decoder;

}),
fallback: (0, import_scale_ts7.Vector)(import_scale_ts7.u8),
fallback: Hex(),
docs: (0, import_scale_ts7.Vector)(import_scale_ts7.str)

@@ -416,2 +415,33 @@ });

// 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

@@ -434,3 +464,3 @@ __reExport(src_exports, codecs_exports, module.exports);

var import_utils3 = require("@polkadot-api/utils");
var import_scale_ts13 = require("scale-ts");
var import_scale_ts14 = require("scale-ts");

@@ -588,13 +618,13 @@ // src/hashes/h64.ts

};
var Twox64Concat = (encoded) => (0, import_utils3.mergeUint8)(import_scale_ts13.u64.enc(h64(encoded)), encoded);
var Twox64Concat = (encoded) => (0, import_utils3.mergeUint8)(import_scale_ts14.u64.enc(h64(encoded)), encoded);
// src/storage.ts
var import_utils4 = require("@polkadot-api/utils");
var textEncoder2 = new TextEncoder();
var textEncoder3 = new TextEncoder();
var Storage = (pallet) => {
const palledEncoded = Twox128(textEncoder2.encode(pallet));
const palledEncoded = Twox128(textEncoder3.encode(pallet));
return (name, dec2, ...encoders) => {
const palletItemEncoded = (0, import_utils4.mergeUint8)(
palledEncoded,
Twox128(textEncoder2.encode(name))
Twox128(textEncoder3.encode(name))
);

@@ -641,38 +671,2 @@ const palletItemEncodedHex = (0, import_utils4.toHex)(palletItemEncoded);

};
// src/descriptors.ts
var createCommonDescriptor = (checksum, pallet, name) => ({
checksum,
pallet,
name
});
var getDescriptorCreator = (type, checksum, pallet, name, codecs) => ({
type,
props: { checksum, pallet, name },
codecs
});
var getPalletCreator = (pallet) => {
const getPayloadDescriptor = (type, checksum, name, codecs) => ({
type,
props: { checksum, pallet, name },
codecs
});
const getStorageDescriptor = (checksum, name, codecs) => ({
type: "storage",
props: { checksum, pallet, name },
codecs
});
const getTxDescriptor = (checksum, name, events, errors, codecs) => ({
type: "tx",
props: { checksum, pallet, name },
codecs,
events,
errors
});
return {
getPayloadDescriptor,
getStorageDescriptor,
getTxDescriptor
};
};
//# sourceMappingURL=index.js.map

@@ -6,3 +6,3 @@ import * as scale_ts from 'scale-ts';

type SS58String = string & {
__SS58String: unknown;
__SS58String?: unknown;
};

@@ -14,11 +14,5 @@ declare const AccountId: (ss58Format?: number, nBytes?: 32 | 33) => scale_ts.Codec<SS58String>;

declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<{
self: T;
}>;
declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<{
self: T;
}>;
declare const Self: <T>(value: () => Codec<T>) => Codec<{
self: T;
}>;
declare const selfEncoder: <T>(value: () => Encoder<T>) => Encoder<T>;
declare const selfDecoder: <T>(value: () => Decoder<T>) => Decoder<T>;
declare const Self: <T>(value: () => Codec<T>) => Codec<T>;

@@ -141,3 +135,3 @@ type OpaqueValue<T> = {

type HexString = string & {
__hexString: unknown;
__hexString?: unknown;
};

@@ -189,3 +183,3 @@ declare const Hex: {

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -360,3 +354,3 @@ }[];

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -578,3 +572,3 @@ }[];

};
fallback: number[];
fallback: HexString;
docs: string[];

@@ -618,2 +612,32 @@ }[];

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;

@@ -638,74 +662,51 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array;

type Tuple<T> = readonly [T, ...T[]];
interface DescriptorCommon<Pallet extends string, Name extends string> {
checksum: bigint;
pallet: Pallet;
name: Name;
}
interface ArgsWithPayloadCodec<Args extends Array<any>, O> {
len: Args["length"];
}
interface ArgsWithoutPayloadCodec<Args extends Array<any>> {
len: Args["length"];
}
interface StorageDescriptor<Common extends DescriptorCommon<string, string>, Codecs extends ArgsWithPayloadCodec<any, any>> {
type: "storage";
props: Common;
codecs: Codecs;
}
interface ConstantDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "const";
props: Common;
codecs: Codecs;
}
interface EventDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "event";
props: Common;
codecs: Codecs;
}
interface ErrorDescriptor<Common extends DescriptorCommon<string, string>, Codecs> {
type: "error";
props: Common;
codecs: Codecs;
}
interface TxDescriptor<Common extends DescriptorCommon<string, string>, Codecs extends ArgsWithoutPayloadCodec<any>, Events extends Array<EventDescriptor<any, any>>, Errors extends Array<ErrorDescriptor<any, any>>> {
type: "tx";
props: Common;
codecs: Codecs;
events: Events;
errors: Errors;
}
type Descriptor = ConstantDescriptor<any, any> | EventDescriptor<any, any> | StorageDescriptor<any, any> | ErrorDescriptor<any, any> | TxDescriptor<any, any, any, any>;
declare const createCommonDescriptor: <Pallet extends string, Name extends string>(checksum: bigint, pallet: Pallet, name: Name) => DescriptorCommon<Pallet, Name>;
declare const getDescriptorCreator: <Type extends "const" | "event" | "error", Pallet extends string, Name extends string, Codecs>(type: Type, checksum: bigint, pallet: Pallet, name: Name, codecs: Codecs) => Type extends "const" ? ConstantDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : Type extends "event" ? EventDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : ErrorDescriptor<DescriptorCommon<Pallet, Name>, Codecs>;
declare const getPalletCreator: <Pallet extends string>(pallet: Pallet) => {
getPayloadDescriptor: <Type extends "const" | "event" | "error", Name extends string, Codecs>(type: Type, checksum: bigint, name: Name, codecs: Codecs) => Type extends "const" ? ConstantDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : Type extends "event" ? EventDescriptor<DescriptorCommon<Pallet, Name>, Codecs> : ErrorDescriptor<DescriptorCommon<Pallet, Name>, Codecs>;
getStorageDescriptor: <Name_1 extends string, Codecs_1 extends ArgsWithPayloadCodec<any[], any>>(checksum: bigint, name: Name_1, codecs: Codecs_1) => StorageDescriptor<DescriptorCommon<Pallet, Name_1>, Codecs_1>;
getTxDescriptor: <Name_2 extends string, Codecs_2 extends ArgsWithoutPayloadCodec<any>, Events extends EventDescriptor<any, any>[], Errors extends ErrorDescriptor<any, any>[]>(checksum: bigint, name: Name_2, events: Events, errors: Errors, codecs: Codecs_2) => TxDescriptor<DescriptorCommon<Pallet, Name_2>, Codecs_2, Events, Errors>;
type PlainDescriptor<T> = string & {
_type?: T;
};
type EventToObject<E extends EventDescriptor<DescriptorCommon<any, string>, any>> = E extends EventDescriptor<DescriptorCommon<any, infer K>, infer V> ? {
type: K;
value: V;
} : unknown;
type UnionizeTupleEvents<E extends Array<EventDescriptor<any, any>>> = E extends Array<infer Ev> ? Ev extends EventDescriptor<any, any> ? EventToObject<Ev> : unknown : unknown;
type TxDescriptorArgs<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, ArgsWithoutPayloadCodec<infer A>, any, any> ? A : [];
type TxDescriptorEvents<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, any, infer E, any> ? E : [];
type TxDescriptorErrors<D extends TxDescriptor<any, any, any, any>> = D extends TxDescriptor<any, any, any, infer Errors> ? Errors extends Tuple<ErrorDescriptor<any, any>> ? {
[K in keyof Errors]: Errors[K] extends ErrorDescriptor<DescriptorCommon<any, infer Type>, infer Value> ? {
type: Type;
value: Value;
} : unknown;
}[keyof Errors extends number ? keyof Errors : never] : [] : [];
type TxFunction<D extends TxDescriptor<any, any, any, any>> = (...args: TxDescriptorArgs<D>) => Promise<{
ok: true;
events: Array<UnionizeTupleEvents<TxDescriptorEvents<D>>>;
} | {
ok: false;
error: TxDescriptorErrors<D>;
}>;
type StorageType<T extends StorageDescriptor<any, ArgsWithPayloadCodec<any, any>>> = T extends StorageDescriptor<any, ArgsWithPayloadCodec<infer Args, infer Payload>> ? {
keyArgs: Args;
value: Payload;
} : unknown;
type StorageDescriptor<Args extends Array<any>, T, Optional extends true | false> = string & {
_type: T;
_args: Args;
_optional: Optional;
};
type TxDescriptor<Args extends Array<any>> = string & {
_args: 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> = {
[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>;
IsOptional: Optional;
} : unknown;
};
};
type ExtractTx<T extends Record<string, Record<string, TxDescriptor<any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends TxDescriptor<infer Args> ? Anonymize<Args> : unknown;
};
};
type ExtractPlain<T extends Record<string, Record<string, PlainDescriptor<any>>>> = {
[K in keyof T]: {
[KK in keyof T[K]]: T[K][KK] extends PlainDescriptor<infer Value> ? Anonymize<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>>;
export { AccountId, ArgsWithPayloadCodec, ArgsWithoutPayloadCodec, BitSequence, Blake2128, Blake2128Concat, Blake2256, ConstantDescriptor, Descriptor, DescriptorCommon, EncoderWithHash, ErrorDescriptor, EventDescriptor, EventToObject, Hex, HexString, Identity, OpaqueCodec, OpaqueValue, SS58String, Self, Storage, StorageDescriptor, StorageType, Twox128, Twox256, Twox64Concat, TxDescriptor, TxDescriptorArgs, TxDescriptorErrors, TxDescriptorEvents, TxFunction, UnionizeTupleEvents, V14, V14Extrinsic, V14Lookup, V14Pallets, bitSequence, char, compactBn, compactNumber, createCommonDescriptor, fixedStr, getDescriptorCreator, getPalletCreator, h64, metadata, selfDecoder, selfEncoder, v14 };
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 };

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

"use strict";var J=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var ae=(e,r)=>{for(var t in r)J(e,t,{get:r[t],enumerable:!0})},X=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ve(r))!_e.call(e,a)&&a!==t&&J(e,a,{get:()=>r[a],enumerable:!(i=Be(r,a))||i.enumerable});return e},m=(e,r,t)=>(X(e,r,"default"),t&&X(t,r,"default"));var He=e=>X(J({},"__esModule",{value:!0}),e);var T={};ae(T,{AccountId:()=>de,Blake2128:()=>we,Blake2128Concat:()=>oe,Blake2256:()=>nr,Hex:()=>V,Identity:()=>ne,OpaqueCodec:()=>O,Self:()=>me,Storage:()=>ar,Twox128:()=>G,Twox256:()=>cr,Twox64Concat:()=>ce,bitSequence:()=>be,char:()=>he,compactBn:()=>pe,compactNumber:()=>d,createCommonDescriptor:()=>ir,fixedStr:()=>Ae,getDescriptorCreator:()=>dr,getPalletCreator:()=>pr,h64:()=>k,metadata:()=>Te,selfDecoder:()=>re,selfEncoder:()=>ee,v14:()=>$});module.exports=He(T);m(T,require("scale-ts"),module.exports);var l={};ae(l,{AccountId:()=>de,Hex:()=>V,OpaqueCodec:()=>O,Self:()=>me,bitSequence:()=>be,char:()=>he,compactBn:()=>pe,compactNumber:()=>d,fixedStr:()=>Ae,metadata:()=>Te,selfDecoder:()=>re,selfEncoder:()=>ee,v14:()=>$});m(l,require("scale-ts"));var K=require("scale-ts"),Y=require("@noble/hashes/blake2b"),Z=require("@scure/base"),ie=new TextEncoder().encode("SS58PRE"),Q=2,Ie=e=>{let r=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return t=>{let i=(0,Y.blake2b)(Uint8Array.of(...ie,...r,...t),{dkLen:64}).subarray(0,Q);return Z.base58.encode(Uint8Array.of(...r,...t,...i))}};function Le(e,r){return t=>{let i=Z.base58.decode(t),a=i.subarray(0,i[0]&64?2:1),y=i.subarray(a.length,i.length-Q);if(y.length!==e)throw new Error("Invalid public key length");let x=i.subarray(a.length+y.length),f=(0,Y.blake2b)(Uint8Array.of(...ie,...a,...y),{dkLen:64}).subarray(0,Q);if(x[0]!==f[0]||x[1]!==f[1])throw new Error("Invalid checksum");if(We(a)!=r)throw new Error("Invalid SS58 prefix");return y.slice()}}var de=(e=42,r=32)=>(0,K.enhanceCodec)((0,K.Bytes)(r),Le(r,e),Ie(e)),We=e=>{let r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.byteLength===1?r.getUint8(0):r.getUint16(0)};var F=require("scale-ts"),d=F.compact,pe=F.compact;var L=require("scale-ts"),ee=e=>{let r=t=>{let i=L.Struct.enc({self:e()});return r=i,i(t)};return t=>r(t)},re=e=>{let r=t=>{let i=L.Struct.dec({self:e()}),a=i;return r=i,a(t)};return t=>r(t)},me=e=>(0,L.createCodec)(ee(()=>e().enc),re(()=>e().dec));var B=require("scale-ts");var ye=(e,r=d.dec)=>(0,B.createDecoder)(t=>{let i=r(t),a=(0,B.Bytes)(i).dec(t),y;return{length:i,inner:()=>y=y||e(a)}}),le=(e,r=d.enc)=>t=>{let i=r(t.length),a=new Uint8Array(i.length+t.length);return a.set(i,0),a.set(e(t.inner()),i.length),a},O=(e,r=d)=>(0,B.createCodec)(le(e.enc,r.enc),ye(e.dec,r.dec));O.enc=le;O.dec=ye;var S=require("scale-ts");var n=require("scale-ts"),xe=(0,n.Option)(n.str),M=(0,n.Vector)(n.str),qe=(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:xe,type:d,typeName:xe,docs:M})),Ke=(0,n.Struct)({len:n.u32,type:d}),Oe=(0,n.Struct)({bitStoreType:d,bitOrderType:d}),Me=(0,n.Vector)((0,n.Struct)({name:n.str,fields:ge,index:n.u8,docs:M})),Re=(0,n.Enum)({composite:ge,variant:Me,sequence:d,array:Ke,tuple:(0,n.Vector)(d),primitive:qe,compact:d,bitSequence:Oe,historicMetaCompat:n.str}),$e=(0,n.Struct)({name:n.str,type:(0,n.Option)(d)}),ze=(0,n.Vector)($e),je=(0,n.Struct)({id:d,path:M,params:ze,def:Re,docs:M}),fe=(0,n.Vector)(je);var R=require("@polkadot-api/utils"),W=require("scale-ts"),ue=e=>{let r=W.Bytes.enc(e);return t=>r((0,R.fromHex)(t))},Ce=e=>{let r=W.Bytes.dec(e);return t=>(0,R.toHex)(r(t))},V=e=>(0,W.createCodec)(ue(e),Ce(e));V.enc=ue;V.dec=Ce;var c=require("scale-ts"),Ge=(0,c.Enum)({Blake2128:c._void,Blake2256:c._void,Blake2128Concat:c._void,Twox128:c._void,Twox256:c._void,Twox64Concat:c._void,Identity:c._void}),Xe=(0,c.Vector)(Ge),Je=(0,c.Struct)({hashers:Xe,key:d,value:d}),Qe=(0,c.Struct)({name:c.str,modifier:c.u8,type:(0,c.Enum)({plain:d,map:Je}),fallback:(0,c.Vector)(c.u8),docs:(0,c.Vector)(c.str)}),Ye=(0,c.Option)((0,c.Struct)({prefix:c.str,items:(0,c.Vector)(Qe)})),De=(0,c.Vector)((0,c.Struct)({name:c.str,storage:Ye,calls:(0,c.Option)(d),events:(0,c.Option)(d),constants:(0,c.Vector)((0,c.Struct)({name:c.str,type:d,value:V(),docs:(0,c.Vector)(c.str)})),errors:(0,c.Option)(d),index:c.u8}));var Ze=(0,S.Struct)({type:d,version:S.u8,signedExtensions:(0,S.Vector)((0,S.Struct)({identifier:S.str,type:d,additionalSigned:d}))}),$=(0,S.Struct)({lookup:fe,pallets:De,extrinsic:Ze,type:d});var P=require("scale-ts");var Ee=()=>{throw new Error("Unsupported metadata version!")},h=(0,P.createCodec)(Ee,Ee),Te=(0,P.Struct)({magicNumber:P.u32,metadata:(0,P.Enum)({v0:h,v1:h,v2:h,v3:h,v4:h,v5:h,v6:h,v7:h,v8:h,v9:h,v10:h,v11:h,v12:h,v13:h,v14:$})});var _=require("scale-ts");var Fe=(0,_.createDecoder)(e=>{let r=d.dec(e),t=Math.ceil(r/8);return{bytes:(0,_.Bytes)(t).dec(e),bitsLen:r}}),er=e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let r=d.enc(e.bitsLen),t=new Uint8Array(e.bytes.length+r.length);return t.set(r,0),t.set(e.bytes,r.length),t},be=(0,_.createCodec)(er,Fe);var z=require("scale-ts"),he=(0,z.enhanceCodec)(z.u8,e=>e.charCodeAt(0),String.fromCharCode);var j=require("scale-ts"),rr=new TextEncoder,tr=new TextDecoder,Ae=e=>(0,j.enhanceCodec)((0,j.Bytes)(e),r=>rr.encode(r),r=>tr.decode(r));m(T,l,module.exports);var ve=require("@polkadot-api/utils"),te=require("@noble/hashes/blake2b"),or={dkLen:32},nr=e=>(0,te.blake2b)(e,or),sr={dkLen:16},we=e=>(0,te.blake2b)(e,sr),oe=e=>(0,ve.mergeUint8)(we(e),e);var ne=e=>e;var Ue=require("@polkadot-api/utils"),Pe=require("scale-ts");var N=(e,r,t,i)=>new DataView(new Uint16Array([e,r,t,i]).buffer).getBigUint64(0,!0),se=2n**64n-1n,E=(e,r)=>e<<r&se|e>>64n-r,p=(e,r)=>e*r&se,C=(e,r)=>e+r&se,D=11400714785074694791n,A=14029467366897019727n,Se=1609587929392839161n,q=9650029242287828579n,ke=2870177450012600261n;function k(e,r=0n){let t=C(C(r,D),A),i=C(r,A),a=r,y=r-D,x=e.length,f=0,U=null;(function(){let o=0,v=o+x;if(x){if(U=new Uint8Array(32),x<32){U.set(e.subarray(0,x),f),f+=x;return}if(o<=v-32){let I=v-32;do{let w;w=N(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]),t=p(E(C(t,p(w,A)),31n),D),o+=8,w=N(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=p(E(C(i,p(w,A)),31n),D),o+=8,w=N(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]),a=p(E(C(a,p(w,A)),31n),D),o+=8,w=N(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=p(E(C(y,p(w,A)),31n),D),o+=8}while(o<=I)}o<v&&(U.set(e.subarray(o,v),f),f=v-o)}})(),e=U||e;let s,g=0;for(x>=32?(s=E(t,1n),s=C(s,E(i,7n)),s=C(s,E(a,12n)),s=C(s,E(y,18n)),t=p(E(p(t,A),31n),D),s=s^t,s=C(p(s,D),q),i=p(E(p(i,A),31n),D),s=s^i,s=C(p(s,D),q),a=p(E(p(a,A),31n),D),s=s^a,s=C(p(s,D),q),y=p(E(p(y,A),31n),D),s=s^y,s=C(p(s,D),q)):s=C(r,ke),s=C(s,BigInt(x));g<=f-8;){let b=N(e[g+1]<<8|e[g],e[g+3]<<8|e[g+2],e[g+5]<<8|e[g+4],e[g+7]<<8|e[g+6]);b=p(E(p(b,A),31n),D),s=C(p(E(s^b,27n),D),q),g+=8}if(g+4<=f){let b=p(N(e[g+1]<<8|e[g],e[g+3]<<8|e[g+2],0,0),D);s=C(p(E(s^b,23n),A),Se),g+=4}for(;g<f;){let b=p(N(e[g++],0,0,0),ke);s=p(E(s^b,11n),D)}let u=s>>33n;return s=p(s^u,A),u=s>>29n,s=p(s^u,Se),u=s>>32n,s^=u,s}var G=e=>{let r=new Uint8Array(16),t=new DataView(r.buffer);return t.setBigUint64(0,k(e),!0),t.setBigUint64(8,k(e,1n),!0),r},cr=e=>{let r=new Uint8Array(32),t=new DataView(r.buffer);return t.setBigUint64(0,k(e),!0),t.setBigUint64(8,k(e,1n),!0),t.setBigUint64(16,k(e,2n),!0),t.setBigUint64(24,k(e,3n),!0),r},ce=e=>(0,Ue.mergeUint8)(Pe.u64.enc(k(e)),e);var H=require("@polkadot-api/utils");var Ne=new TextEncoder,ar=e=>{let r=G(Ne.encode(e));return(t,i,...a)=>{let y=(0,H.mergeUint8)(r,G(Ne.encode(t))),x=(0,H.toHex)(y),f=a.map(u=>u[1]).map(u=>u===ne?0:u===ce?8:u===oe?16:null).filter(Boolean),U=u=>{if(!u.startsWith(x))throw new Error(`key does not match this storage (${e}.${t})`);if(f.length!==a.length)throw new Error("Impossible to decode this key");if(a.length===0)return[];let b=u.slice(x.length),o=new Array(a.length);for(let v=0,I=0;v<f.length;v++){let w=a[v][0];I+=f[v],o[v]=w.dec(b.slice(I*2)),I+=w.enc(o[v]).length}return o},s=a.map(([{enc:u},b])=>o=>b(u(o)));return{enc:(...u)=>(0,H.toHex)((0,H.mergeUint8)(y,...u.map((b,o)=>s[o](b)))),dec:i,keyDecoder:U}}};var ir=(e,r,t)=>({checksum:e,pallet:r,name:t}),dr=(e,r,t,i,a)=>({type:e,props:{checksum:r,pallet:t,name:i},codecs:a}),pr=e=>({getPayloadDescriptor:(a,y,x,f)=>({type:a,props:{checksum:y,pallet:e,name:x},codecs:f}),getStorageDescriptor:(a,y,x)=>({type:"storage",props:{checksum:a,pallet:e,name:y},codecs:x}),getTxDescriptor:(a,y,x,f,U)=>({type:"tx",props:{checksum:a,pallet:e,name:y},codecs:U,events:x,errors:f})});
"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}}};
//# sourceMappingURL=index.js.map
{
"name": "@polkadot-api/substrate-bindings",
"version": "0.0.1-a7c3ff9522dcd125241219385318703d14a465b9.1.0",
"version": "0.0.1-a8c4f3c213c8f8c3b2e1c24500e4ea5c7f2142c7.1.0",
"author": "Josep M Sobrepere (https://github.com/josepot)",

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

"@scure/base": "^1.1.1",
"scale-ts": "^1.4.2",
"@polkadot-api/utils": "0.0.1-a7c3ff9522dcd125241219385318703d14a465b9.1.0"
"scale-ts": "^1.4.3",
"@polkadot-api/utils": "0.0.1-a8c4f3c213c8f8c3b2e1c24500e4ea5c7f2142c7.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