@polkadot-api/substrate-bindings
Advanced tools
Comparing version 0.0.1-bf38c108a73db2172976e6f3ee09904f79424cb8.1.0 to 0.0.1-bffb8194f5e6e12148f7b2104f8a4f1623c12a94.1.0
@@ -634,3 +634,33 @@ import * as scale_ts from 'scale-ts'; | ||
}>; | ||
type BlockHeader = CodecType<typeof blockHeader>; | ||
interface IBinary { | ||
asText: () => string; | ||
asHex: () => HexString; | ||
asBytes: () => Uint8Array; | ||
} | ||
declare class Binary implements IBinary { | ||
private bytes; | ||
private hex; | ||
private str; | ||
constructor(bytes: Uint8Array); | ||
constructor(hex: HexString); | ||
constructor(text: string); | ||
asText(): string; | ||
asHex(): string; | ||
asBytes(): Uint8Array; | ||
} | ||
declare const Bin: { | ||
(nBytes?: number): Codec<Binary>; | ||
enc: (nBytes?: number) => Encoder<Binary>; | ||
dec: (nBytes?: number) => Decoder<Binary>; | ||
}; | ||
declare const option: <T extends { | ||
tag: string; | ||
value: any; | ||
}, K extends T["tag"]>(tag: K, value: (T & { | ||
tag: K; | ||
})["value"]) => T; | ||
declare const Blake2256: (encoded: Uint8Array) => Uint8Array; | ||
@@ -676,3 +706,3 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array; | ||
}; | ||
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : { | ||
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol | Binary ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : { | ||
[K in keyof T]: Anonymize<T[K]>; | ||
@@ -705,2 +735,2 @@ }; | ||
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, blockHeader, char, compactBn, compactNumber, fixedStr, h64, metadata, selfDecoder, selfEncoder, v14 }; | ||
export { AccountId, Bin, Binary, 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, option, selfDecoder, selfEncoder, v14 }; |
@@ -6,2 +6,3 @@ "use strict"; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __export = (target, all) => { | ||
@@ -21,2 +22,6 @@ for (var name in all) | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
@@ -27,2 +32,4 @@ // src/index.ts | ||
AccountId: () => AccountId, | ||
Bin: () => Bin, | ||
Binary: () => Binary, | ||
Blake2128: () => Blake2128, | ||
@@ -47,2 +54,3 @@ Blake2128Concat: () => Blake2128Concat, | ||
metadata: () => metadata, | ||
option: () => option, | ||
selfDecoder: () => selfDecoder, | ||
@@ -59,2 +67,4 @@ selfEncoder: () => selfEncoder, | ||
AccountId: () => AccountId, | ||
Bin: () => Bin, | ||
Binary: () => Binary, | ||
Hex: () => Hex, | ||
@@ -70,2 +80,3 @@ OpaqueCodec: () => OpaqueCodec, | ||
metadata: () => metadata, | ||
option: () => option, | ||
selfDecoder: () => selfDecoder, | ||
@@ -447,2 +458,47 @@ selfEncoder: () => selfEncoder, | ||
// src/codecs/Binary.ts | ||
var import_utils2 = require("@polkadot-api/utils"); | ||
var import_scale_ts14 = require("scale-ts"); | ||
var textEncoder3 = new TextEncoder(); | ||
var textDecoder3 = new TextDecoder(); | ||
var Binary = class { | ||
constructor(data) { | ||
__publicField(this, "bytes"); | ||
__publicField(this, "hex", null); | ||
__publicField(this, "str", null); | ||
if (data instanceof Uint8Array) { | ||
this.bytes = data; | ||
} else if (data.match(/0[xX][0-9a-fA-F]+/)) { | ||
this.bytes = (0, import_utils2.fromHex)(data); | ||
this.hex = data; | ||
} else { | ||
this.bytes = textEncoder3.encode(data); | ||
this.str = data; | ||
} | ||
} | ||
asText() { | ||
return this.str === null ? this.str = textDecoder3.decode(this.bytes) : this.str; | ||
} | ||
asHex() { | ||
return this.hex === null ? this.hex = (0, import_utils2.toHex)(this.bytes) : this.hex; | ||
} | ||
asBytes() { | ||
return this.bytes; | ||
} | ||
}; | ||
var enc2 = (nBytes) => { | ||
const _enc = import_scale_ts14.Bytes.enc(nBytes); | ||
return (value) => _enc(value.asBytes()); | ||
}; | ||
var dec2 = (nBytes) => { | ||
const _dec = import_scale_ts14.Bytes.dec(nBytes); | ||
return (value) => new Binary(_dec(value)); | ||
}; | ||
var Bin = (nBytes) => (0, import_scale_ts14.createCodec)(enc2(nBytes), dec2(nBytes)); | ||
Bin.enc = enc2; | ||
Bin.dec = dec2; | ||
// src/codecs/helpers.ts | ||
var option = (tag, value) => ({ tag, value }); | ||
// src/index.ts | ||
@@ -452,3 +508,3 @@ __reExport(src_exports, codecs_exports, module.exports); | ||
// src/hashes/blake2.ts | ||
var import_utils2 = require("@polkadot-api/utils"); | ||
var import_utils3 = require("@polkadot-api/utils"); | ||
var import_blake2b2 = require("@noble/hashes/blake2b"); | ||
@@ -459,3 +515,3 @@ var len32 = { dkLen: 32 }; | ||
var Blake2128 = (encoded) => (0, import_blake2b2.blake2b)(encoded, len16); | ||
var Blake2128Concat = (encoded) => (0, import_utils2.mergeUint8)(Blake2128(encoded), encoded); | ||
var Blake2128Concat = (encoded) => (0, import_utils3.mergeUint8)(Blake2128(encoded), encoded); | ||
@@ -466,4 +522,4 @@ // src/hashes/identity.ts | ||
// src/hashes/twoX.ts | ||
var import_utils3 = require("@polkadot-api/utils"); | ||
var import_scale_ts14 = require("scale-ts"); | ||
var import_utils4 = require("@polkadot-api/utils"); | ||
var import_scale_ts15 = require("scale-ts"); | ||
@@ -621,15 +677,15 @@ // src/hashes/h64.ts | ||
}; | ||
var Twox64Concat = (encoded) => (0, import_utils3.mergeUint8)(import_scale_ts14.u64.enc(h64(encoded)), encoded); | ||
var Twox64Concat = (encoded) => (0, import_utils4.mergeUint8)(import_scale_ts15.u64.enc(h64(encoded)), encoded); | ||
// src/storage.ts | ||
var import_utils4 = require("@polkadot-api/utils"); | ||
var textEncoder3 = new TextEncoder(); | ||
var import_utils5 = require("@polkadot-api/utils"); | ||
var textEncoder4 = new TextEncoder(); | ||
var Storage = (pallet) => { | ||
const palledEncoded = Twox128(textEncoder3.encode(pallet)); | ||
return (name, dec2, ...encoders) => { | ||
const palletItemEncoded = (0, import_utils4.mergeUint8)( | ||
const palledEncoded = Twox128(textEncoder4.encode(pallet)); | ||
return (name, dec3, ...encoders) => { | ||
const palletItemEncoded = (0, import_utils5.mergeUint8)( | ||
palledEncoded, | ||
Twox128(textEncoder3.encode(name)) | ||
Twox128(textEncoder4.encode(name)) | ||
); | ||
const palletItemEncodedHex = (0, import_utils4.toHex)(palletItemEncoded); | ||
const palletItemEncodedHex = (0, import_utils5.toHex)(palletItemEncoded); | ||
const bytesToSkip = encoders.map((e) => e[1]).map((x) => { | ||
@@ -662,10 +718,10 @@ if (x === Identity) | ||
const fns = encoders.map( | ||
([{ enc: enc3 }, hash]) => (val) => hash(enc3(val)) | ||
([{ enc: enc4 }, hash]) => (val) => hash(enc4(val)) | ||
); | ||
const enc2 = (...args) => (0, import_utils4.toHex)( | ||
(0, import_utils4.mergeUint8)(palletItemEncoded, ...args.map((val, idx) => fns[idx](val))) | ||
const enc3 = (...args) => (0, import_utils5.toHex)( | ||
(0, import_utils5.mergeUint8)(palletItemEncoded, ...args.map((val, idx) => fns[idx](val))) | ||
); | ||
return { | ||
enc: enc2, | ||
dec: dec2, | ||
enc: enc3, | ||
dec: dec3, | ||
keyDecoder | ||
@@ -672,0 +728,0 @@ }; |
@@ -634,3 +634,33 @@ import * as scale_ts from 'scale-ts'; | ||
}>; | ||
type BlockHeader = CodecType<typeof blockHeader>; | ||
interface IBinary { | ||
asText: () => string; | ||
asHex: () => HexString; | ||
asBytes: () => Uint8Array; | ||
} | ||
declare class Binary implements IBinary { | ||
private bytes; | ||
private hex; | ||
private str; | ||
constructor(bytes: Uint8Array); | ||
constructor(hex: HexString); | ||
constructor(text: string); | ||
asText(): string; | ||
asHex(): string; | ||
asBytes(): Uint8Array; | ||
} | ||
declare const Bin: { | ||
(nBytes?: number): Codec<Binary>; | ||
enc: (nBytes?: number) => Encoder<Binary>; | ||
dec: (nBytes?: number) => Decoder<Binary>; | ||
}; | ||
declare const option: <T extends { | ||
tag: string; | ||
value: any; | ||
}, K extends T["tag"]>(tag: K, value: (T & { | ||
tag: K; | ||
})["value"]) => T; | ||
declare const Blake2256: (encoded: Uint8Array) => Uint8Array; | ||
@@ -676,3 +706,3 @@ declare const Blake2128: (encoded: Uint8Array) => Uint8Array; | ||
}; | ||
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : { | ||
type Anonymize<T> = T extends string | number | bigint | boolean | void | undefined | null | symbol | Binary ? T : T extends (...args: infer Args) => infer R ? (...args: Anonymize<Args>) => Anonymize<R> : { | ||
[K in keyof T]: Anonymize<T[K]>; | ||
@@ -705,2 +735,2 @@ }; | ||
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, blockHeader, char, compactBn, compactNumber, fixedStr, h64, metadata, selfDecoder, selfEncoder, v14 }; | ||
export { AccountId, Bin, Binary, 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, option, selfDecoder, selfEncoder, v14 }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var J=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var de=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Oe(t))!Me.call(e,d)&&d!==r&&J(e,d,{get:()=>t[d],enumerable:!(i=Ke(t,d))||i.enumerable});return e},l=(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:()=>le,Blake2128:()=>_e,Blake2128Concat:()=>ce,Blake2256:()=>pt,Hex:()=>v,Identity:()=>se,OpaqueCodec:()=>R,Self:()=>ye,Storage:()=>ut,Twox128:()=>X,Twox256:()=>yt,Twox64Concat:()=>ae,bitSequence:()=>Ae,blockHeader:()=>De,char:()=>Ue,compactBn:()=>pe,compactNumber:()=>a,fixedStr:()=>ke,h64:()=>D,metadata:()=>Se,selfDecoder:()=>te,selfEncoder:()=>ee,v14:()=>$});module.exports=Re(h);l(h,require("scale-ts"),module.exports);var p={};de(p,{AccountId:()=>le,Hex:()=>v,OpaqueCodec:()=>R,Self:()=>ye,bitSequence:()=>Ae,blockHeader:()=>De,char:()=>Ue,compactBn:()=>pe,compactNumber:()=>a,fixedStr:()=>ke,metadata:()=>Se,selfDecoder:()=>te,selfEncoder:()=>ee,v14:()=>$});l(p,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 le=(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,pe=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},Ae=(0,L.createCodec)(st,ct);var z=require("scale-ts"),Ue=(0,z.enhanceCodec)(z.u8,e=>e.charCodeAt(0),String.fromCharCode);var G=require("scale-ts"),it=new TextEncoder,at=new TextDecoder,ke=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)});l(h,p,module.exports);var Ve=require("@polkadot-api/utils"),ne=require("@noble/hashes/blake2b"),lt={dkLen:32},pt=e=>(0,ne.blake2b)(e,lt),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,A=14029467366897019727n,He=1609587929392839161n,O=9650029242287828579n,Ie=2870177450012600261n;function D(e,t=0n){let r=u(u(t,x),A),i=u(t,A),d=t,b=t-x,C=e.length,T=0,H=null;(function(){let o=0,U=o+C;if(C){if(H=new Uint8Array(32),C<32){H.set(e.subarray(0,C),T),T+=C;return}if(o<=U-32){let N=U-32;do{let k;k=_(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(k,A)),31n),x),o+=8,k=_(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(k,A)),31n),x),o+=8,k=_(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(k,A)),31n),x),o+=8,k=_(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(k,A)),31n),x),o+=8}while(o<=N)}o<U&&(H.set(e.subarray(o,U),T),T=U-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,A),31n),x),c=c^r,c=u(m(c,x),O),i=m(g(m(i,A),31n),x),c=c^i,c=u(m(c,x),O),d=m(g(m(d,A),31n),x),c=c^d,c=u(m(c,x),O),b=m(g(m(b,A),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,A),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),A),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,A),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 U=0,N=0;U<T.length;U++){let k=d[U][0];N+=T[U],o[U]=k.dec(E.slice(N*2)),N+=k.enc(o[U]).length}return o},c=d.map(([{enc:y},E])=>o=>E(y(o)));return{enc:(...y)=>(0,q.toHex)((0,q.mergeUint8)(b,...y.map((E,o)=>c[o](E)))),dec:i,keyDecoder:H}}}; | ||
"use strict";var P=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var Je=(e,t,r)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var fe=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},ee=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Ge(t))!je.call(e,d)&&d!==r&&P(e,d,{get:()=>t[d],enumerable:!(i=ze(t,d))||i.enumerable});return e},l=(e,t,r)=>(ee(e,t,"default"),r&&ee(r,t,"default"));var Qe=e=>ee(P({},"__esModule",{value:!0}),e);var W=(e,t,r)=>(Je(e,typeof t!="symbol"?t+"":t,r),r);var h={};fe(h,{AccountId:()=>ue,Bin:()=>Z,Binary:()=>O,Blake2128:()=>Me,Blake2128Concat:()=>me,Blake2256:()=>Ct,Hex:()=>v,Identity:()=>le,OpaqueCodec:()=>X,Self:()=>he,Storage:()=>Ut,Twox128:()=>F,Twox256:()=>St,Twox64Concat:()=>ye,bitSequence:()=>De,blockHeader:()=>Le,char:()=>He,compactBn:()=>be,compactNumber:()=>a,fixedStr:()=>_e,h64:()=>D,metadata:()=>Be,option:()=>Ne,selfDecoder:()=>se,selfEncoder:()=>ce,v14:()=>j});module.exports=Qe(h);l(h,require("scale-ts"),module.exports);var p={};fe(p,{AccountId:()=>ue,Bin:()=>Z,Binary:()=>O,Hex:()=>v,OpaqueCodec:()=>X,Self:()=>he,bitSequence:()=>De,blockHeader:()=>Le,char:()=>He,compactBn:()=>be,compactNumber:()=>a,fixedStr:()=>_e,metadata:()=>Be,option:()=>Ne,selfDecoder:()=>se,selfEncoder:()=>ce,v14:()=>j});l(p,require("scale-ts"));var $=require("scale-ts"),re=require("@noble/hashes/blake2b"),oe=require("@scure/base"),xe=new TextEncoder().encode("SS58PRE"),te=2,Ye=e=>{let t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return r=>{let i=(0,re.blake2b)(Uint8Array.of(...xe,...t,...r),{dkLen:64}).subarray(0,te);return oe.base58.encode(Uint8Array.of(...t,...r,...i))}};function Ze(e,t){return r=>{let i=oe.base58.decode(r),d=i.subarray(0,i[0]&64?2:1),b=i.subarray(d.length,i.length-te);if(b.length!==e)throw new Error("Invalid public key length");let C=i.subarray(d.length+b.length),T=(0,re.blake2b)(Uint8Array.of(...xe,...d,...b),{dkLen:64}).subarray(0,te);if(C[0]!==T[0]||C[1]!==T[1])throw new Error("Invalid checksum");if(Fe(d)!=t)throw new Error("Invalid SS58 prefix");return b.slice()}}var ue=(e=42,t=32)=>(0,$.enhanceCodec)((0,$.Bytes)(t),Ze(t,e),Ye(e)),Fe=e=>{let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)};var ne=require("scale-ts"),a=ne.compact,be=ne.compact;var ge=require("scale-ts"),ce=e=>{let t=r=>{let i=e();return t=i,i(r)};return r=>t(r)},se=e=>{let t=r=>{let i=e(),d=i;return t=i,d(r)};return r=>t(r)},he=e=>(0,ge.createCodec)(ce(()=>e().enc),se(()=>e().dec));var I=require("scale-ts");var Te=(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)}}),Ee=(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},X=(e,t=a)=>(0,I.createCodec)(Ee(e.enc,t.enc),Te(e.dec,t.dec));X.enc=Ee;X.dec=Te;var B=require("scale-ts");var n=require("scale-ts"),we=(0,n.Option)(n.str),z=(0,n.Vector)(n.str),et=(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}),Ce=(0,n.Vector)((0,n.Struct)({name:we,type:a,typeName:we,docs:z})),tt=(0,n.Struct)({len:n.u32,type:a}),rt=(0,n.Struct)({bitStoreType:a,bitOrderType:a}),ot=(0,n.Vector)((0,n.Struct)({name:n.str,fields:Ce,index:n.u8,docs:z})),nt=(0,n.Enum)({composite:Ce,variant:ot,sequence:a,array:tt,tuple:(0,n.Vector)(a),primitive:et,compact:a,bitSequence:rt,historicMetaCompat:n.str}),ct=(0,n.Struct)({name:n.str,type:(0,n.Option)(a)}),st=(0,n.Vector)(ct),it=(0,n.Struct)({id:a,path:z,params:st,def:nt,docs:z}),Ae=(0,n.Vector)(it);var G=require("@polkadot-api/utils"),N=require("scale-ts"),Se=e=>{let t=N.Bytes.enc(e);return r=>t((0,G.fromHex)(r))},Ue=e=>{let t=N.Bytes.dec(e);return r=>(0,G.toHex)(t(r))},v=e=>(0,N.createCodec)(Se(e),Ue(e));v.enc=Se;v.dec=Ue;var s=require("scale-ts"),at=(0,s.Enum)({Blake2128:s._void,Blake2256:s._void,Blake2128Concat:s._void,Twox128:s._void,Twox256:s._void,Twox64Concat:s._void,Identity:s._void}),dt=(0,s.Vector)(at),mt=(0,s.Struct)({hashers:dt,key:a,value:a}),lt=(0,s.Struct)({name:s.str,modifier:s.u8,type:(0,s.Enum)({plain:a,map:mt}),fallback:v(),docs:(0,s.Vector)(s.str)}),pt=(0,s.Option)((0,s.Struct)({prefix:s.str,items:(0,s.Vector)(lt)})),ke=(0,s.Vector)((0,s.Struct)({name:s.str,storage:pt,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 yt=(0,B.Struct)({type:a,version:B.u8,signedExtensions:(0,B.Vector)((0,B.Struct)({identifier:B.str,type:a,additionalSigned:a}))}),j=(0,B.Struct)({lookup:Ae,pallets:ke,extrinsic:yt,type:a});var H=require("scale-ts");var ve=()=>{throw new Error("Unsupported metadata version!")},w=(0,H.createCodec)(ve,ve),Be=(0,H.Struct)({magicNumber:H.u32,metadata:(0,H.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:j})});var L=require("scale-ts");var ft=(0,L.createDecoder)(e=>{let t=a.dec(e),r=Math.ceil(t/8);return{bytes:(0,L.Bytes)(r).dec(e),bitsLen:t}}),xt=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},De=(0,L.createCodec)(xt,ft);var J=require("scale-ts"),He=(0,J.enhanceCodec)(J.u8,e=>e.charCodeAt(0),String.fromCharCode);var Q=require("scale-ts"),ut=new TextEncoder,bt=new TextDecoder,_e=e=>(0,Q.enhanceCodec)((0,Q.Bytes)(e),t=>ut.encode(t),t=>bt.decode(t));var A=require("scale-ts");var Ve=new TextEncoder,Ie=new TextDecoder,gt=(0,A.enhanceCodec)((0,A.Bytes)(4),Ve.encode.bind(Ve),Ie.decode.bind(Ie)),ie=(0,A.Struct)({engine:gt,payload:v()}),ht=(0,A.Enum)({consensus:ie,seal:ie,preRuntime:ie,runtimeUpdated:A._void},[4,5,6,8]),ae=v(32),Le=(0,A.Struct)({parentHash:ae,number:a,stateRoot:ae,extrinsicRoot:ae,digests:(0,A.Vector)(ht)});var Y=require("@polkadot-api/utils"),M=require("scale-ts");var Tt=new TextEncoder,Et=new TextDecoder,O=class{constructor(t){W(this,"bytes");W(this,"hex",null);W(this,"str",null);t instanceof Uint8Array?this.bytes=t:t.match(/0[xX][0-9a-fA-F]+/)?(this.bytes=(0,Y.fromHex)(t),this.hex=t):(this.bytes=Tt.encode(t),this.str=t)}asText(){return this.str===null?this.str=Et.decode(this.bytes):this.str}asHex(){return this.hex===null?this.hex=(0,Y.toHex)(this.bytes):this.hex}asBytes(){return this.bytes}},qe=e=>{let t=M.Bytes.enc(e);return r=>t(r.asBytes())},Ke=e=>{let t=M.Bytes.dec(e);return r=>new O(t(r))},Z=e=>(0,M.createCodec)(qe(e),Ke(e));Z.enc=qe;Z.dec=Ke;var Ne=(e,t)=>({tag:e,value:t});l(h,p,module.exports);var Oe=require("@polkadot-api/utils"),de=require("@noble/hashes/blake2b"),wt={dkLen:32},Ct=e=>(0,de.blake2b)(e,wt),At={dkLen:16},Me=e=>(0,de.blake2b)(e,At),me=e=>(0,Oe.mergeUint8)(Me(e),e);var le=e=>e;var We=require("@polkadot-api/utils"),$e=require("scale-ts");var _=(e,t,r,i)=>new DataView(new Uint16Array([e,t,r,i]).buffer).getBigUint64(0,!0),pe=2n**64n-1n,g=(e,t)=>e<<t&pe|e>>64n-t,m=(e,t)=>e*t&pe,x=(e,t)=>e+t&pe,u=11400714785074694791n,S=14029467366897019727n,Re=1609587929392839161n,R=9650029242287828579n,Pe=2870177450012600261n;function D(e,t=0n){let r=x(x(t,u),S),i=x(t,S),d=t,b=t-u,C=e.length,T=0,V=null;(function(){let o=0,U=o+C;if(C){if(V=new Uint8Array(32),C<32){V.set(e.subarray(0,C),T),T+=C;return}if(o<=U-32){let K=U-32;do{let k;k=_(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(x(r,m(k,S)),31n),u),o+=8,k=_(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(x(i,m(k,S)),31n),u),o+=8,k=_(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(x(d,m(k,S)),31n),u),o+=8,k=_(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(x(b,m(k,S)),31n),u),o+=8}while(o<=K)}o<U&&(V.set(e.subarray(o,U),T),T=U-o)}})(),e=V||e;let c,y=0;for(C>=32?(c=g(r,1n),c=x(c,g(i,7n)),c=x(c,g(d,12n)),c=x(c,g(b,18n)),r=m(g(m(r,S),31n),u),c=c^r,c=x(m(c,u),R),i=m(g(m(i,S),31n),u),c=c^i,c=x(m(c,u),R),d=m(g(m(d,S),31n),u),c=c^d,c=x(m(c,u),R),b=m(g(m(b,S),31n),u),c=c^b,c=x(m(c,u),R)):c=x(t,Pe),c=x(c,BigInt(C));y<=T-8;){let E=_(e[y+1]<<8|e[y],e[y+3]<<8|e[y+2],e[y+5]<<8|e[y+4],e[y+7]<<8|e[y+6]);E=m(g(m(E,S),31n),u),c=x(m(g(c^E,27n),u),R),y+=8}if(y+4<=T){let E=m(_(e[y+1]<<8|e[y],e[y+3]<<8|e[y+2],0,0),u);c=x(m(g(c^E,23n),S),Re),y+=4}for(;y<T;){let E=m(_(e[y++],0,0,0),Pe);c=m(g(c^E,11n),u)}let f=c>>33n;return c=m(c^f,S),f=c>>29n,c=m(c^f,Re),f=c>>32n,c^=f,c}var F=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},St=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},ye=e=>(0,We.mergeUint8)($e.u64.enc(D(e)),e);var q=require("@polkadot-api/utils");var Xe=new TextEncoder,Ut=e=>{let t=F(Xe.encode(e));return(r,i,...d)=>{let b=(0,q.mergeUint8)(t,F(Xe.encode(r))),C=(0,q.toHex)(b),T=d.map(f=>f[1]).map(f=>f===le?0:f===ye?8:f===me?16:null).filter(Boolean),V=f=>{if(!f.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=f.slice(C.length),o=new Array(d.length);for(let U=0,K=0;U<T.length;U++){let k=d[U][0];K+=T[U],o[U]=k.dec(E.slice(K*2)),K+=k.enc(o[U]).length}return o},c=d.map(([{enc:f},E])=>o=>E(f(o)));return{enc:(...f)=>(0,q.toHex)((0,q.mergeUint8)(b,...f.map((E,o)=>c[o](E)))),dec:i,keyDecoder:V}}}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@polkadot-api/substrate-bindings", | ||
"version": "0.0.1-bf38c108a73db2172976e6f3ee09904f79424cb8.1.0", | ||
"version": "0.0.1-bffb8194f5e6e12148f7b2104f8a4f1623c12a94.1.0", | ||
"author": "Josep M Sobrepere (https://github.com/josepot)", | ||
@@ -46,3 +46,3 @@ "repository": { | ||
"scale-ts": "^1.4.3", | ||
"@polkadot-api/utils": "0.0.1-bf38c108a73db2172976e6f3ee09904f79424cb8.1.0" | ||
"@polkadot-api/utils": "0.0.1-bffb8194f5e6e12148f7b2104f8a4f1623c12a94.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
241077
2904
66911