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