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