@polkadot-api/substrate-bindings
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -68,2 +68,41 @@ import * as scale_ts from 'scale-ts'; | ||
interface Discriminant<T extends {}> { | ||
is<K extends keyof T>(this: { | ||
type: keyof T; | ||
value: T[keyof T]; | ||
}, type: K): this is { | ||
type: K; | ||
value: T[K]; | ||
}; | ||
as<K extends keyof T>(type: K): T[K]; | ||
} | ||
type EnumVariant<T extends { | ||
type: string; | ||
value?: any; | ||
}, K extends T["type"]> = T & { | ||
type: K; | ||
}; | ||
type ExtractEnumValue<T extends { | ||
type: string; | ||
value?: any; | ||
}, K extends string> = EnumVariant<T, K>["value"]; | ||
type ValueArg<V> = undefined extends V ? [value?: V] : [value: V]; | ||
interface EnumFn { | ||
<T extends { | ||
type: string; | ||
value: any; | ||
}, K extends T["type"]>(type: K, ...[value]: ValueArg<ExtractEnumValue<T, K>>): EnumVariant<T, K>; | ||
} | ||
type Enum<T extends {}> = { | ||
[K in keyof T & string]: { | ||
type: K; | ||
value: T[K]; | ||
}; | ||
}[keyof T & string] & Discriminant<T>; | ||
declare const Enum: EnumFn; | ||
type GetEnum<T extends Enum<any>> = { | ||
[K in T["type"]]: (...args: ExtractEnumValue<T, K> extends undefined ? [] : [value: ExtractEnumValue<T, K>]) => EnumVariant<T, K>; | ||
}; | ||
declare const _Enum: {}; | ||
type Tuple<T, N extends number> = readonly [T, ...T[]] & { | ||
@@ -77,44 +116,6 @@ length: N; | ||
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]>>; | ||
<O extends StringRecord<Codec<any>>>(inner: O, indexes?: RestrictedLenTuple<number, O> | undefined): Codec<Enum<{ [K in keyof O]: CodecType<O[K]>; }>>; | ||
enc: <O_1 extends StringRecord<Encoder<any>>>(inner: O_1, x?: RestrictedLenTuple<number, O_1> | undefined) => Encoder<Enum<{ [K_1 in keyof O_1]: EncoderType<O_1[K_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]: DecoderType<O_2[K_2]>; }>>; | ||
}; | ||
@@ -130,22 +131,15 @@ | ||
digests: Enum<{ | ||
type: "consensus"; | ||
value: { | ||
consensus: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "seal"; | ||
value: { | ||
seal: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "preRuntime"; | ||
value: { | ||
preRuntime: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "runtimeUpdated"; | ||
value: undefined; | ||
runtimeUpdated: undefined; | ||
}>[]; | ||
@@ -1155,9 +1149,2 @@ }>; | ||
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, type AssetDescriptor, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, FixedSizeBinary, 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 V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, v15 }; | ||
export { AccountId, type AssetDescriptor, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type EnumVariant, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, FixedSizeBinary, 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 V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, v15 }; |
@@ -324,2 +324,18 @@ "use strict"; | ||
var import_utils3 = require("@polkadot-api/utils"); | ||
// src/types/enum.ts | ||
var Enum = (type, value) => { | ||
return { | ||
type, | ||
value, | ||
as(_type) { | ||
if (type !== _type) | ||
throw new Error(`Enum.as(${_type}) used with actual type ${type}`); | ||
return value; | ||
}, | ||
is(_type) { | ||
return type === _type; | ||
} | ||
}; | ||
}; | ||
var _Enum = new Proxy( | ||
@@ -333,12 +349,4 @@ {}, | ||
); | ||
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 | ||
}); | ||
// src/codecs/scale/Variant.ts | ||
var VariantEnc = (...args) => { | ||
@@ -345,0 +353,0 @@ const enc3 = import_scale_ts10.Enum.enc(...args); |
@@ -68,2 +68,41 @@ import * as scale_ts from 'scale-ts'; | ||
interface Discriminant<T extends {}> { | ||
is<K extends keyof T>(this: { | ||
type: keyof T; | ||
value: T[keyof T]; | ||
}, type: K): this is { | ||
type: K; | ||
value: T[K]; | ||
}; | ||
as<K extends keyof T>(type: K): T[K]; | ||
} | ||
type EnumVariant<T extends { | ||
type: string; | ||
value?: any; | ||
}, K extends T["type"]> = T & { | ||
type: K; | ||
}; | ||
type ExtractEnumValue<T extends { | ||
type: string; | ||
value?: any; | ||
}, K extends string> = EnumVariant<T, K>["value"]; | ||
type ValueArg<V> = undefined extends V ? [value?: V] : [value: V]; | ||
interface EnumFn { | ||
<T extends { | ||
type: string; | ||
value: any; | ||
}, K extends T["type"]>(type: K, ...[value]: ValueArg<ExtractEnumValue<T, K>>): EnumVariant<T, K>; | ||
} | ||
type Enum<T extends {}> = { | ||
[K in keyof T & string]: { | ||
type: K; | ||
value: T[K]; | ||
}; | ||
}[keyof T & string] & Discriminant<T>; | ||
declare const Enum: EnumFn; | ||
type GetEnum<T extends Enum<any>> = { | ||
[K in T["type"]]: (...args: ExtractEnumValue<T, K> extends undefined ? [] : [value: ExtractEnumValue<T, K>]) => EnumVariant<T, K>; | ||
}; | ||
declare const _Enum: {}; | ||
type Tuple<T, N extends number> = readonly [T, ...T[]] & { | ||
@@ -77,44 +116,6 @@ length: N; | ||
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]>>; | ||
<O extends StringRecord<Codec<any>>>(inner: O, indexes?: RestrictedLenTuple<number, O> | undefined): Codec<Enum<{ [K in keyof O]: CodecType<O[K]>; }>>; | ||
enc: <O_1 extends StringRecord<Encoder<any>>>(inner: O_1, x?: RestrictedLenTuple<number, O_1> | undefined) => Encoder<Enum<{ [K_1 in keyof O_1]: EncoderType<O_1[K_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]: DecoderType<O_2[K_2]>; }>>; | ||
}; | ||
@@ -130,22 +131,15 @@ | ||
digests: Enum<{ | ||
type: "consensus"; | ||
value: { | ||
consensus: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "seal"; | ||
value: { | ||
seal: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "preRuntime"; | ||
value: { | ||
preRuntime: { | ||
engine: string; | ||
payload: HexString; | ||
}; | ||
} | { | ||
type: "runtimeUpdated"; | ||
value: undefined; | ||
runtimeUpdated: undefined; | ||
}>[]; | ||
@@ -1155,9 +1149,2 @@ }>; | ||
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, type AssetDescriptor, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, FixedSizeBinary, 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 V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, v15 }; | ||
export { AccountId, type AssetDescriptor, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, type BlockHeader, type ConstFromDescriptors, type Descriptors, type Discriminant, type EncoderWithHash, Enum, type EnumVariant, type ErrorsFromDescriptors, type EventsFromDescriptors, type ExtractEnumValue, FixedSizeBinary, 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 V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, v15 }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var J=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var st=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},at=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of ot(t))!ct.call(e,d)&&d!==r&&J(e,d,{get:()=>t[d],enumerable:!(a=nt(t,d))||a.enumerable});return e};var dt=e=>at(J({},"__esModule",{value:!0}),e);var Q=(e,t,r)=>(st(e,typeof t!="symbol"?t+"":t,r),r),Ue=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var B=(e,t,r)=>(Ue(e,t,"read from private field"),r?r.call(e):t.get(e)),Y=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Z=(e,t,r,a)=>(Ue(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r);var Qt={};it(Qt,{AccountId:()=>ut,Bin:()=>le,Binary:()=>W,Blake2128:()=>Qe,Blake2128Concat:()=>ke,Blake2256:()=>Gt,Bytes:()=>n.Bytes,Enum:()=>ge,FixedSizeBinary:()=>pe,Hex:()=>U,Identity:()=>Ae,Option:()=>n.Option,Result:()=>n.Result,Self:()=>St,Storage:()=>Jt,Struct:()=>n.Struct,Tuple:()=>n.Tuple,Twox128:()=>ie,Twox256:()=>zt,Twox64Concat:()=>Ce,Variant:()=>X,Vector:()=>n.Vector,_Enum:()=>kt,_void:()=>n._void,bitSequence:()=>Tt,blockHeader:()=>Vt,bool:()=>n.bool,char:()=>ht,compact:()=>n.compact,compactBn:()=>ft,compactNumber:()=>c,createCodec:()=>n.createCodec,createDecoder:()=>n.createDecoder,enhanceCodec:()=>n.enhanceCodec,enhanceDecoder:()=>n.enhanceDecoder,enhanceEncoder:()=>n.enhanceEncoder,ethAccount:()=>wt,fixedStr:()=>vt,fromBufferToBase58:()=>ue,getSs58AddressInfo:()=>ye,h64:()=>K,i128:()=>n.i128,i16:()=>n.i16,i256:()=>n.i256,i32:()=>n.i32,i64:()=>n.i64,i8:()=>n.i8,metadata:()=>ze,selfDecoder:()=>Ie,selfEncoder:()=>Le,str:()=>n.str,u128:()=>n.u128,u16:()=>n.u16,u256:()=>n.u256,u32:()=>n.u32,u64:()=>n.u64,u8:()=>n.u8,v14:()=>ve,v15:()=>Ee});module.exports=dt(Qt);var ee=require("scale-ts");var de=require("@scure/base"),me=require("@noble/hashes/blake2b"),Ve=new TextEncoder().encode("SS58PRE"),ae=2,ye=e=>{try{let t=de.base58.decode(e),r=t.subarray(0,t[0]&64?2:1),a=t.subarray(r.length,t.length-ae),d=t.subarray(r.length+a.length),T=(0,me.blake2b)(Uint8Array.of(...Ve,...r,...a),{dkLen:64}).subarray(0,ae);return d[0]===T[0]&&d[1]===T[1]?{isValid:!0,ss58Format:mt(r),publicKey:a.slice()}:{isValid:!1}}catch{return{isValid:!1}}},mt=e=>{let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},ue=e=>{let t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return r=>{let a=(0,me.blake2b)(Uint8Array.of(...Ve,...t,...r),{dkLen:64}).subarray(0,ae);return de.base58.encode(Uint8Array.of(...t,...r,...a))}};function yt(e,t){return r=>{let a=ye(r);if(!a.isValid)throw new Error("Invalid checksum");let{publicKey:d}=a;if(d.length!==e)throw new Error("Invalid public key length");return d}}var ut=(e=42,t=32)=>(0,ee.enhanceCodec)((0,ee.Bytes)(t),yt(t,e),ue(e));var j=require("scale-ts"),te=require("@polkadot-api/utils");var pt=new TextEncoder,lt=new TextDecoder,O,I,R,q=class q{constructor(t){Y(this,O,void 0);Y(this,I,null);Y(this,R,null);Q(this,"asText",()=>B(this,R)===null?Z(this,R,lt.decode(B(this,O))):B(this,R));Q(this,"asHex",()=>B(this,I)===null?Z(this,I,(0,te.toHex)(B(this,O))):B(this,I));Q(this,"asBytes",()=>B(this,O));Z(this,O,t)}static fromText(t){return new q(pt.encode(t))}static fromHex(t){return new q((0,te.fromHex)(t))}static fromBytes(t){return new q(t)}};O=new WeakMap,I=new WeakMap,R=new WeakMap;var W=q,pe=class e extends W{constructor(t){super(t)}static fromArray(t){return new e(new Uint8Array(t))}},Ke=e=>{let t=j.Bytes.enc(e);return r=>t(r.asBytes())},Be=e=>{let t=j.Bytes.dec(e);return r=>W.fromBytes(t(r))},le=e=>(0,j.createCodec)(Ke(e),Be(e));le.enc=Ke;le.dec=Be;var _=require("scale-ts");var fe=require("scale-ts"),c=fe.compact,ft=fe.compact;var xt=(0,_.createDecoder)(e=>{let t=c.dec(e),r=Math.ceil(t/8);return{bytes:(0,_.Bytes)(r).dec(e),bitsLen:t}}),gt=e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let t=c.enc(e.bitsLen),r=new Uint8Array(e.bytes.length+t.length);return r.set(t,0),r.set(e.bytes,t.length),r},Tt=(0,_.createCodec)(gt,xt);var re=require("scale-ts"),ht=(0,re.enhanceCodec)(re.u8,e=>e.charCodeAt(0),String.fromCharCode);var ne=require("@polkadot-api/utils"),F=require("scale-ts"),De=e=>{let t=F.Bytes.enc(e);return r=>t((0,ne.fromHex)(r))},Oe=e=>{let t=F.Bytes.dec(e);return r=>(0,ne.toHex)(t(r))},U=e=>(0,F.createCodec)(De(e),Oe(e));U.enc=De;U.dec=Oe;var oe=require("scale-ts"),bt=new TextEncoder,Et=new TextDecoder,vt=e=>(0,oe.enhanceCodec)((0,oe.Bytes)(e),t=>bt.encode(t),t=>Et.decode(t));var n=require("scale-ts");var He=require("scale-ts"),Le=e=>{let t=r=>{let a=e();return t=a,a(r)};return r=>t(r)},Ie=e=>{let t=r=>{let a=e(),d=a;return t=a,d(r)};return r=>t(r)},St=e=>(0,He.createCodec)(Le(()=>e().enc),Ie(()=>e().dec));var G=require("scale-ts"),xe=require("@polkadot-api/utils"),kt=new Proxy({},{get(e,t){return r=>ge(t,r)}}),ge=(e,t)=>({as:r=>{if(r!==e)throw new Error(`Enum.as(${r}) used with actual type ${e}`);return t},is:r=>r===e,type:e,value:t}),Re=(...e)=>{let t=G.Enum.enc(...e);return r=>t({tag:r.type,value:r.value})},_e=(...e)=>{let t=G.Enum.dec(...e);return r=>{let{tag:a,value:d}=t(r);return ge(a,d)}},X=(e,...t)=>(0,G.createCodec)(Re((0,xe.mapObject)(e,([r])=>r),...t),_e((0,xe.mapObject)(e,([,r])=>r),...t));X.enc=Re;X.dec=_e;var N=require("@polkadot-api/utils"),P=require("scale-ts"),Pe=require("@noble/hashes/sha3"),Ne=e=>{let t=e.slice(2),r=(0,N.toHex)((0,Pe.keccak_256)(t)).slice(2),a=new Array(40);for(let d=0;d<40;d++){let T=parseInt(r[d],16),h=t[d];a[d]=T>7?h.toUpperCase():h}return`0x${a.join("")}`},At=(0,P.Bytes)(20)[1],wt=(0,P.createCodec)(e=>{let t=(0,N.fromHex)(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);let r=(0,N.toHex)(t);if(e===r||e===r.toUpperCase())return t;if(Ne(r)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},(0,P.createDecoder)(e=>Ne((0,N.toHex)(At(e)))));var Me=new TextEncoder,$e=new TextDecoder,Ct=(0,n.enhanceCodec)((0,n.Bytes)(4),Me.encode.bind(Me),$e.decode.bind($e)),Te=(0,n.Struct)({engine:Ct,payload:U()}),Ut=X({consensus:Te,seal:Te,preRuntime:Te,runtimeUpdated:n._void},[4,5,6,8]),he=U(32),Vt=(0,n.Struct)({parentHash:he,number:c,stateRoot:he,extrinsicRoot:he,digests:(0,n.Vector)(Ut)});var D=require("scale-ts");var p=require("scale-ts");var i=require("scale-ts");var ce=require("scale-ts"),A=(0,ce.Vector)(ce.str);var qe=(0,i.Option)(i.str),Kt=(0,i.Enum)({bool:i._void,char:i._void,str:i._void,u8:i._void,u16:i._void,u32:i._void,u64:i._void,u128:i._void,u256:i._void,i8:i._void,i16:i._void,i32:i._void,i64:i._void,i128:i._void,i256:i._void}),We=(0,i.Vector)((0,i.Struct)({name:qe,type:c,typeName:qe,docs:A})),Bt=(0,i.Struct)({len:i.u32,type:c}),Dt=(0,i.Struct)({bitStoreType:c,bitOrderType:c}),Ot=(0,i.Vector)((0,i.Struct)({name:i.str,fields:We,index:i.u8,docs:A})),Ht=(0,i.Enum)({composite:We,variant:Ot,sequence:c,array:Bt,tuple:(0,i.Vector)(c),primitive:Kt,compact:c,bitSequence:Dt}),Lt=(0,i.Struct)({name:i.str,type:(0,i.Option)(c)}),It=(0,i.Vector)(Lt),Rt=(0,i.Struct)({id:c,path:A,params:It,def:Ht,docs:A}),se=(0,i.Vector)(Rt);var m=require("scale-ts");var _t=(0,m.Enum)({Blake2128:m._void,Blake2256:m._void,Blake2128Concat:m._void,Twox128:m._void,Twox256:m._void,Twox64Concat:m._void,Identity:m._void}),Nt=(0,m.Vector)(_t),Pt=(0,m.Struct)({hashers:Nt,key:c,value:c}),Mt=(0,m.Struct)({name:m.str,modifier:m.u8,type:(0,m.Enum)({plain:c,map:Pt}),fallback:U(),docs:A}),$t=(0,m.Option)((0,m.Struct)({prefix:m.str,items:(0,m.Vector)(Mt)})),be={name:m.str,storage:$t,calls:(0,m.Option)(c),events:(0,m.Option)(c),constants:(0,m.Vector)((0,m.Struct)({name:m.str,type:c,value:U(),docs:A})),errors:(0,m.Option)(c),index:m.u8},je={...be,docs:A};var V=require("scale-ts");var Fe=(0,V.Struct)({name:V.str,methods:(0,V.Vector)((0,V.Struct)({name:V.str,inputs:(0,V.Vector)((0,V.Struct)({name:V.str,type:c})),output:c,docs:A})),docs:A});var qt=(0,p.Struct)({version:p.u8,address:c,call:c,signature:c,extra:c,signedExtensions:(0,p.Vector)((0,p.Struct)({identifier:p.str,type:c,additionalSigned:c}))}),Ee=(0,p.Struct)({lookup:se,pallets:(0,p.Vector)((0,p.Struct)(je)),extrinsic:qt,type:c,apis:(0,p.Vector)(Fe),outerEnums:(0,p.Struct)({call:c,event:c,error:c}),custom:(0,p.Vector)((0,p.Tuple)(p.str,(0,p.Struct)({type:c,value:U()})))});var E=require("scale-ts");var Wt=new Uint8Array,Ge=e=>(0,E.createCodec)(()=>Wt,()=>e),jt=(0,E.Struct)({type:c,version:E.u8,signedExtensions:(0,E.Vector)((0,E.Struct)({identifier:E.str,type:c,additionalSigned:c}))}),ve=(0,E.Struct)({lookup:se,pallets:(0,E.Vector)((0,E.Struct)({...be,docs:Ge([])})),extrinsic:jt,type:c,apis:Ge([])});var Xe=()=>{throw new Error("Unsupported metadata version!")},v=(0,D.createCodec)(Xe,Xe),ze=(0,D.Struct)({magicNumber:D.u32,metadata:(0,D.Enum)({v0:v,v1:v,v2:v,v3:v,v4:v,v5:v,v6:v,v7:v,v8:v,v9:v,v10:v,v11:v,v12:v,v13:v,v14:ve,v15:Ee})});var Je=require("@polkadot-api/utils"),Se=require("@noble/hashes/blake2b"),Ft={dkLen:32},Gt=e=>(0,Se.blake2b)(e,Ft),Xt={dkLen:16},Qe=e=>(0,Se.blake2b)(e,Xt),ke=e=>(0,Je.mergeUint8)(Qe(e),e);var Ae=e=>e;var et=require("@polkadot-api/utils"),tt=require("scale-ts");var H=(e,t,r,a)=>new DataView(new Uint16Array([e,t,r,a]).buffer).getBigUint64(0,!0),we=2n**64n-1n,g=(e,t)=>e<<t&we|e>>64n-t,y=(e,t)=>e*t&we,f=(e,t)=>e+t&we,x=11400714785074694791n,S=14029467366897019727n,Ye=1609587929392839161n,z=9650029242287828579n,Ze=2870177450012600261n;function K(e,t=0n){let r=f(f(t,x),S),a=f(t,S),d=t,T=t-x,h=e.length,w=0,L=null;(function(){let o=0,k=o+h;if(h){if(L=new Uint8Array(32),h<32){L.set(e.subarray(0,h),w),w+=h;return}if(o<=k-32){let $=k-32;do{let C;C=H(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=y(g(f(r,y(C,S)),31n),x),o+=8,C=H(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=y(g(f(a,y(C,S)),31n),x),o+=8,C=H(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=y(g(f(d,y(C,S)),31n),x),o+=8,C=H(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=y(g(f(T,y(C,S)),31n),x),o+=8}while(o<=$)}o<k&&(L.set(e.subarray(o,k),w),w=k-o)}})(),e=L||e;let s,u=0;for(h>=32?(s=g(r,1n),s=f(s,g(a,7n)),s=f(s,g(d,12n)),s=f(s,g(T,18n)),r=y(g(y(r,S),31n),x),s=s^r,s=f(y(s,x),z),a=y(g(y(a,S),31n),x),s=s^a,s=f(y(s,x),z),d=y(g(y(d,S),31n),x),s=s^d,s=f(y(s,x),z),T=y(g(y(T,S),31n),x),s=s^T,s=f(y(s,x),z)):s=f(t,Ze),s=f(s,BigInt(h));u<=w-8;){let b=H(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]);b=y(g(y(b,S),31n),x),s=f(y(g(s^b,27n),x),z),u+=8}if(u+4<=w){let b=y(H(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],0,0),x);s=f(y(g(s^b,23n),S),Ye),u+=4}for(;u<w;){let b=y(H(e[u++],0,0,0),Ze);s=y(g(s^b,11n),x)}let l=s>>33n;return s=y(s^l,S),l=s>>29n,s=y(s^l,Ye),l=s>>32n,s^=l,s}var ie=e=>{let t=new Uint8Array(16),r=new DataView(t.buffer);return r.setBigUint64(0,K(e),!0),r.setBigUint64(8,K(e,1n),!0),t},zt=e=>{let t=new Uint8Array(32),r=new DataView(t.buffer);return r.setBigUint64(0,K(e),!0),r.setBigUint64(8,K(e,1n),!0),r.setBigUint64(16,K(e,2n),!0),r.setBigUint64(24,K(e,3n),!0),t},Ce=e=>(0,et.mergeUint8)(tt.u64.enc(K(e)),e);var M=require("@polkadot-api/utils");var rt=new TextEncoder,Jt=e=>{let t=ie(rt.encode(e));return(r,a,...d)=>{let T=(0,M.mergeUint8)(t,ie(rt.encode(r))),h=(0,M.toHex)(T),w=d.map(l=>l[1]).map(l=>l===Ae?0:l===Ce?8:l===ke?16:null).filter(Boolean),L=l=>{if(!l.startsWith(h))throw new Error(`key does not match this storage (${e}.${r})`);if(w.length!==d.length)throw new Error("Impossible to decode this key");if(d.length===0)return[];let b=l.slice(h.length),o=new Array(d.length);for(let k=0,$=0;k<w.length;k++){let C=d[k][0];$+=w[k],o[k]=C.dec(b.slice($*2)),$+=C.enc(o[k]).length}return o},s=d.map(([{enc:l},b])=>o=>b(l(o)));return{enc:(...l)=>(0,M.toHex)((0,M.mergeUint8)(T,...l.map((b,o)=>s[o](b)))),dec:a,keyDecoder:L}}}; | ||
"use strict";var J=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var st=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},at=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of ot(t))!ct.call(e,d)&&d!==r&&J(e,d,{get:()=>t[d],enumerable:!(a=nt(t,d))||a.enumerable});return e};var dt=e=>at(J({},"__esModule",{value:!0}),e);var Q=(e,t,r)=>(st(e,typeof t!="symbol"?t+"":t,r),r),Ue=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var B=(e,t,r)=>(Ue(e,t,"read from private field"),r?r.call(e):t.get(e)),Y=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Z=(e,t,r,a)=>(Ue(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r);var Qt={};it(Qt,{AccountId:()=>pt,Bin:()=>fe,Binary:()=>W,Blake2128:()=>Qe,Blake2128Concat:()=>Se,Blake2256:()=>Gt,Bytes:()=>n.Bytes,Enum:()=>ce,FixedSizeBinary:()=>le,Hex:()=>U,Identity:()=>ve,Option:()=>n.Option,Result:()=>n.Result,Self:()=>kt,Storage:()=>Jt,Struct:()=>n.Struct,Tuple:()=>n.Tuple,Twox128:()=>ae,Twox256:()=>zt,Twox64Concat:()=>Ce,Variant:()=>X,Vector:()=>n.Vector,_Enum:()=>St,_void:()=>n._void,bitSequence:()=>Tt,blockHeader:()=>Vt,bool:()=>n.bool,char:()=>ht,compact:()=>n.compact,compactBn:()=>ft,compactNumber:()=>c,createCodec:()=>n.createCodec,createDecoder:()=>n.createDecoder,enhanceCodec:()=>n.enhanceCodec,enhanceDecoder:()=>n.enhanceDecoder,enhanceEncoder:()=>n.enhanceEncoder,ethAccount:()=>wt,fixedStr:()=>At,fromBufferToBase58:()=>ue,getSs58AddressInfo:()=>pe,h64:()=>K,i128:()=>n.i128,i16:()=>n.i16,i256:()=>n.i256,i32:()=>n.i32,i64:()=>n.i64,i8:()=>n.i8,metadata:()=>ze,selfDecoder:()=>Ie,selfEncoder:()=>Le,str:()=>n.str,u128:()=>n.u128,u16:()=>n.u16,u256:()=>n.u256,u32:()=>n.u32,u64:()=>n.u64,u8:()=>n.u8,v14:()=>Ae,v15:()=>Ee});module.exports=dt(Qt);var ee=require("scale-ts");var me=require("@scure/base"),ye=require("@noble/hashes/blake2b"),Ve=new TextEncoder().encode("SS58PRE"),de=2,pe=e=>{try{let t=me.base58.decode(e),r=t.subarray(0,t[0]&64?2:1),a=t.subarray(r.length,t.length-de),d=t.subarray(r.length+a.length),T=(0,ye.blake2b)(Uint8Array.of(...Ve,...r,...a),{dkLen:64}).subarray(0,de);return d[0]===T[0]&&d[1]===T[1]?{isValid:!0,ss58Format:mt(r),publicKey:a.slice()}:{isValid:!1}}catch{return{isValid:!1}}},mt=e=>{let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},ue=e=>{let t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return r=>{let a=(0,ye.blake2b)(Uint8Array.of(...Ve,...t,...r),{dkLen:64}).subarray(0,de);return me.base58.encode(Uint8Array.of(...t,...r,...a))}};function yt(e,t){return r=>{let a=pe(r);if(!a.isValid)throw new Error("Invalid checksum");let{publicKey:d}=a;if(d.length!==e)throw new Error("Invalid public key length");return d}}var pt=(e=42,t=32)=>(0,ee.enhanceCodec)((0,ee.Bytes)(t),yt(t,e),ue(e));var F=require("scale-ts"),te=require("@polkadot-api/utils");var ut=new TextEncoder,lt=new TextDecoder,O,I,_,q=class q{constructor(t){Y(this,O,void 0);Y(this,I,null);Y(this,_,null);Q(this,"asText",()=>B(this,_)===null?Z(this,_,lt.decode(B(this,O))):B(this,_));Q(this,"asHex",()=>B(this,I)===null?Z(this,I,(0,te.toHex)(B(this,O))):B(this,I));Q(this,"asBytes",()=>B(this,O));Z(this,O,t)}static fromText(t){return new q(ut.encode(t))}static fromHex(t){return new q((0,te.fromHex)(t))}static fromBytes(t){return new q(t)}};O=new WeakMap,I=new WeakMap,_=new WeakMap;var W=q,le=class e extends W{constructor(t){super(t)}static fromArray(t){return new e(new Uint8Array(t))}},Ke=e=>{let t=F.Bytes.enc(e);return r=>t(r.asBytes())},Be=e=>{let t=F.Bytes.dec(e);return r=>W.fromBytes(t(r))},fe=e=>(0,F.createCodec)(Ke(e),Be(e));fe.enc=Ke;fe.dec=Be;var R=require("scale-ts");var xe=require("scale-ts"),c=xe.compact,ft=xe.compact;var xt=(0,R.createDecoder)(e=>{let t=c.dec(e),r=Math.ceil(t/8);return{bytes:(0,R.Bytes)(r).dec(e),bitsLen:t}}),gt=e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);let t=c.enc(e.bitsLen),r=new Uint8Array(e.bytes.length+t.length);return r.set(t,0),r.set(e.bytes,t.length),r},Tt=(0,R.createCodec)(gt,xt);var re=require("scale-ts"),ht=(0,re.enhanceCodec)(re.u8,e=>e.charCodeAt(0),String.fromCharCode);var ne=require("@polkadot-api/utils"),j=require("scale-ts"),De=e=>{let t=j.Bytes.enc(e);return r=>t((0,ne.fromHex)(r))},Oe=e=>{let t=j.Bytes.dec(e);return r=>(0,ne.toHex)(t(r))},U=e=>(0,j.createCodec)(De(e),Oe(e));U.enc=De;U.dec=Oe;var oe=require("scale-ts"),bt=new TextEncoder,Et=new TextDecoder,At=e=>(0,oe.enhanceCodec)((0,oe.Bytes)(e),t=>bt.encode(t),t=>Et.decode(t));var n=require("scale-ts");var He=require("scale-ts"),Le=e=>{let t=r=>{let a=e();return t=a,a(r)};return r=>t(r)},Ie=e=>{let t=r=>{let a=e(),d=a;return t=a,d(r)};return r=>t(r)},kt=e=>(0,He.createCodec)(Le(()=>e().enc),Ie(()=>e().dec));var G=require("scale-ts"),ge=require("@polkadot-api/utils");var ce=(e,t)=>({type:e,value:t,as(r){if(e!==r)throw new Error(`Enum.as(${r}) used with actual type ${e}`);return t},is(r){return e===r}}),St=new Proxy({},{get(e,t){return r=>ce(t,r)}});var _e=(...e)=>{let t=G.Enum.enc(...e);return r=>t({tag:r.type,value:r.value})},Re=(...e)=>{let t=G.Enum.dec(...e);return r=>{let{tag:a,value:d}=t(r);return ce(a,d)}},X=(e,...t)=>(0,G.createCodec)(_e((0,ge.mapObject)(e,([r])=>r),...t),Re((0,ge.mapObject)(e,([,r])=>r),...t));X.enc=_e;X.dec=Re;var N=require("@polkadot-api/utils"),P=require("scale-ts"),Pe=require("@noble/hashes/sha3"),Ne=e=>{let t=e.slice(2),r=(0,N.toHex)((0,Pe.keccak_256)(t)).slice(2),a=new Array(40);for(let d=0;d<40;d++){let T=parseInt(r[d],16),h=t[d];a[d]=T>7?h.toUpperCase():h}return`0x${a.join("")}`},vt=(0,P.Bytes)(20)[1],wt=(0,P.createCodec)(e=>{let t=(0,N.fromHex)(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);let r=(0,N.toHex)(t);if(e===r||e===r.toUpperCase())return t;if(Ne(r)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},(0,P.createDecoder)(e=>Ne((0,N.toHex)(vt(e)))));var Me=new TextEncoder,$e=new TextDecoder,Ct=(0,n.enhanceCodec)((0,n.Bytes)(4),Me.encode.bind(Me),$e.decode.bind($e)),Te=(0,n.Struct)({engine:Ct,payload:U()}),Ut=X({consensus:Te,seal:Te,preRuntime:Te,runtimeUpdated:n._void},[4,5,6,8]),he=U(32),Vt=(0,n.Struct)({parentHash:he,number:c,stateRoot:he,extrinsicRoot:he,digests:(0,n.Vector)(Ut)});var D=require("scale-ts");var u=require("scale-ts");var i=require("scale-ts");var se=require("scale-ts"),v=(0,se.Vector)(se.str);var qe=(0,i.Option)(i.str),Kt=(0,i.Enum)({bool:i._void,char:i._void,str:i._void,u8:i._void,u16:i._void,u32:i._void,u64:i._void,u128:i._void,u256:i._void,i8:i._void,i16:i._void,i32:i._void,i64:i._void,i128:i._void,i256:i._void}),We=(0,i.Vector)((0,i.Struct)({name:qe,type:c,typeName:qe,docs:v})),Bt=(0,i.Struct)({len:i.u32,type:c}),Dt=(0,i.Struct)({bitStoreType:c,bitOrderType:c}),Ot=(0,i.Vector)((0,i.Struct)({name:i.str,fields:We,index:i.u8,docs:v})),Ht=(0,i.Enum)({composite:We,variant:Ot,sequence:c,array:Bt,tuple:(0,i.Vector)(c),primitive:Kt,compact:c,bitSequence:Dt}),Lt=(0,i.Struct)({name:i.str,type:(0,i.Option)(c)}),It=(0,i.Vector)(Lt),_t=(0,i.Struct)({id:c,path:v,params:It,def:Ht,docs:v}),ie=(0,i.Vector)(_t);var m=require("scale-ts");var Rt=(0,m.Enum)({Blake2128:m._void,Blake2256:m._void,Blake2128Concat:m._void,Twox128:m._void,Twox256:m._void,Twox64Concat:m._void,Identity:m._void}),Nt=(0,m.Vector)(Rt),Pt=(0,m.Struct)({hashers:Nt,key:c,value:c}),Mt=(0,m.Struct)({name:m.str,modifier:m.u8,type:(0,m.Enum)({plain:c,map:Pt}),fallback:U(),docs:v}),$t=(0,m.Option)((0,m.Struct)({prefix:m.str,items:(0,m.Vector)(Mt)})),be={name:m.str,storage:$t,calls:(0,m.Option)(c),events:(0,m.Option)(c),constants:(0,m.Vector)((0,m.Struct)({name:m.str,type:c,value:U(),docs:v})),errors:(0,m.Option)(c),index:m.u8},Fe={...be,docs:v};var V=require("scale-ts");var je=(0,V.Struct)({name:V.str,methods:(0,V.Vector)((0,V.Struct)({name:V.str,inputs:(0,V.Vector)((0,V.Struct)({name:V.str,type:c})),output:c,docs:v})),docs:v});var qt=(0,u.Struct)({version:u.u8,address:c,call:c,signature:c,extra:c,signedExtensions:(0,u.Vector)((0,u.Struct)({identifier:u.str,type:c,additionalSigned:c}))}),Ee=(0,u.Struct)({lookup:ie,pallets:(0,u.Vector)((0,u.Struct)(Fe)),extrinsic:qt,type:c,apis:(0,u.Vector)(je),outerEnums:(0,u.Struct)({call:c,event:c,error:c}),custom:(0,u.Vector)((0,u.Tuple)(u.str,(0,u.Struct)({type:c,value:U()})))});var E=require("scale-ts");var Wt=new Uint8Array,Ge=e=>(0,E.createCodec)(()=>Wt,()=>e),Ft=(0,E.Struct)({type:c,version:E.u8,signedExtensions:(0,E.Vector)((0,E.Struct)({identifier:E.str,type:c,additionalSigned:c}))}),Ae=(0,E.Struct)({lookup:ie,pallets:(0,E.Vector)((0,E.Struct)({...be,docs:Ge([])})),extrinsic:Ft,type:c,apis:Ge([])});var Xe=()=>{throw new Error("Unsupported metadata version!")},A=(0,D.createCodec)(Xe,Xe),ze=(0,D.Struct)({magicNumber:D.u32,metadata:(0,D.Enum)({v0:A,v1:A,v2:A,v3:A,v4:A,v5:A,v6:A,v7:A,v8:A,v9:A,v10:A,v11:A,v12:A,v13:A,v14:Ae,v15:Ee})});var Je=require("@polkadot-api/utils"),ke=require("@noble/hashes/blake2b"),jt={dkLen:32},Gt=e=>(0,ke.blake2b)(e,jt),Xt={dkLen:16},Qe=e=>(0,ke.blake2b)(e,Xt),Se=e=>(0,Je.mergeUint8)(Qe(e),e);var ve=e=>e;var et=require("@polkadot-api/utils"),tt=require("scale-ts");var H=(e,t,r,a)=>new DataView(new Uint16Array([e,t,r,a]).buffer).getBigUint64(0,!0),we=2n**64n-1n,g=(e,t)=>e<<t&we|e>>64n-t,y=(e,t)=>e*t&we,f=(e,t)=>e+t&we,x=11400714785074694791n,k=14029467366897019727n,Ye=1609587929392839161n,z=9650029242287828579n,Ze=2870177450012600261n;function K(e,t=0n){let r=f(f(t,x),k),a=f(t,k),d=t,T=t-x,h=e.length,w=0,L=null;(function(){let o=0,S=o+h;if(h){if(L=new Uint8Array(32),h<32){L.set(e.subarray(0,h),w),w+=h;return}if(o<=S-32){let $=S-32;do{let C;C=H(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=y(g(f(r,y(C,k)),31n),x),o+=8,C=H(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=y(g(f(a,y(C,k)),31n),x),o+=8,C=H(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=y(g(f(d,y(C,k)),31n),x),o+=8,C=H(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=y(g(f(T,y(C,k)),31n),x),o+=8}while(o<=$)}o<S&&(L.set(e.subarray(o,S),w),w=S-o)}})(),e=L||e;let s,p=0;for(h>=32?(s=g(r,1n),s=f(s,g(a,7n)),s=f(s,g(d,12n)),s=f(s,g(T,18n)),r=y(g(y(r,k),31n),x),s=s^r,s=f(y(s,x),z),a=y(g(y(a,k),31n),x),s=s^a,s=f(y(s,x),z),d=y(g(y(d,k),31n),x),s=s^d,s=f(y(s,x),z),T=y(g(y(T,k),31n),x),s=s^T,s=f(y(s,x),z)):s=f(t,Ze),s=f(s,BigInt(h));p<=w-8;){let b=H(e[p+1]<<8|e[p],e[p+3]<<8|e[p+2],e[p+5]<<8|e[p+4],e[p+7]<<8|e[p+6]);b=y(g(y(b,k),31n),x),s=f(y(g(s^b,27n),x),z),p+=8}if(p+4<=w){let b=y(H(e[p+1]<<8|e[p],e[p+3]<<8|e[p+2],0,0),x);s=f(y(g(s^b,23n),k),Ye),p+=4}for(;p<w;){let b=y(H(e[p++],0,0,0),Ze);s=y(g(s^b,11n),x)}let l=s>>33n;return s=y(s^l,k),l=s>>29n,s=y(s^l,Ye),l=s>>32n,s^=l,s}var ae=e=>{let t=new Uint8Array(16),r=new DataView(t.buffer);return r.setBigUint64(0,K(e),!0),r.setBigUint64(8,K(e,1n),!0),t},zt=e=>{let t=new Uint8Array(32),r=new DataView(t.buffer);return r.setBigUint64(0,K(e),!0),r.setBigUint64(8,K(e,1n),!0),r.setBigUint64(16,K(e,2n),!0),r.setBigUint64(24,K(e,3n),!0),t},Ce=e=>(0,et.mergeUint8)(tt.u64.enc(K(e)),e);var M=require("@polkadot-api/utils");var rt=new TextEncoder,Jt=e=>{let t=ae(rt.encode(e));return(r,a,...d)=>{let T=(0,M.mergeUint8)(t,ae(rt.encode(r))),h=(0,M.toHex)(T),w=d.map(l=>l[1]).map(l=>l===ve?0:l===Ce?8:l===Se?16:null).filter(Boolean),L=l=>{if(!l.startsWith(h))throw new Error(`key does not match this storage (${e}.${r})`);if(w.length!==d.length)throw new Error("Impossible to decode this key");if(d.length===0)return[];let b=l.slice(h.length),o=new Array(d.length);for(let S=0,$=0;S<w.length;S++){let C=d[S][0];$+=w[S],o[S]=C.dec(b.slice($*2)),$+=C.enc(o[S]).length}return o},s=d.map(([{enc:l},b])=>o=>b(l(o)));return{enc:(...l)=>(0,M.toHex)((0,M.mergeUint8)(T,...l.map((b,o)=>s[o](b)))),dec:a,keyDecoder:L}}}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@polkadot-api/substrate-bindings", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Josep M Sobrepere (https://github.com/josepot)", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319550
4035