@polkadot-api/substrate-bindings
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -129,3 +129,3 @@ import * as scale_ts from 'scale-ts'; | ||
declare const blockHeader: Codec<{ | ||
declare const blockHeader: scale_ts.Codec<{ | ||
parentHash: HexString; | ||
@@ -575,2 +575,3 @@ number: number; | ||
}>; | ||
declare const decAnyMetadata: (input: Uint8Array | HexString) => CodecType<typeof metadata>; | ||
@@ -1094,3 +1095,3 @@ declare const extrinsic$1: scale_ts.Codec<{ | ||
type EncoderWithHash<T> = [Codec<T>, (input: Uint8Array) => Uint8Array]; | ||
declare const Storage: (pallet: string) => <T, A extends Array<EncoderWithHash<any>>>(name: string, dec: Decoder<T>, ...encoders_0: A) => { | ||
declare const Storage: (pallet: string) => <T, A extends Array<EncoderWithHash<any>>>(name: string, dec: Decoder<T>, ...encoders: A) => { | ||
enc: (...args: { [K in keyof A]: A[K] extends EncoderWithHash<infer V> ? V : unknown; }) => string; | ||
@@ -1101,2 +1102,2 @@ dec: Decoder<T>; | ||
export { AccountId, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, Blake3256, Blake3256Concat, type BlockHeader, type EncoderWithHash, Enum, type EnumVariant, type ExtractEnumValue, FixedSizeBinary, type GetEnum, Hex, type HexString, Identity, type SS58AddressInfo, type SS58String, Self, Storage, Twox128, Twox256, Twox64Concat, 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, Bin, Binary, type BitSequence, Blake2128, Blake2128Concat, Blake2256, Blake3256, Blake3256Concat, type BlockHeader, type EncoderWithHash, Enum, type EnumVariant, type ExtractEnumValue, FixedSizeBinary, type GetEnum, Hex, type HexString, Identity, type SS58AddressInfo, type SS58String, Self, Storage, Twox128, Twox256, Twox64Concat, type V14, type V14Extrinsic, type V14Lookup, type V15, type V15Extrinsic, Variant, _Enum, bitSequence, blockHeader, char, compactBn, compactNumber, decAnyMetadata, ethAccount, fixedStr, fromBufferToBase58, getSs58AddressInfo, h64, metadata, selfDecoder, selfEncoder, v14, v15 }; |
@@ -456,2 +456,26 @@ 'use strict'; | ||
const empty = new Uint8Array(); | ||
const Always = (value) => scaleTs.createCodec( | ||
() => empty, | ||
() => value | ||
); | ||
const extrinsic$1 = scaleTs.Struct({ | ||
type: compactNumber, | ||
version: scaleTs.u8, | ||
signedExtensions: scaleTs.Vector( | ||
scaleTs.Struct({ | ||
identifier: scaleTs.str, | ||
type: compactNumber, | ||
additionalSigned: compactNumber | ||
}) | ||
) | ||
}); | ||
const v14 = scaleTs.Struct({ | ||
lookup, | ||
pallets: scaleTs.Vector(scaleTs.Struct({ ...v14Pallet, docs: Always([]) })), | ||
extrinsic: extrinsic$1, | ||
type: compactNumber, | ||
apis: Always([]) | ||
}); | ||
const runtimeApi = scaleTs.Struct({ | ||
@@ -475,3 +499,3 @@ name: scaleTs.str, | ||
const extrinsic$1 = scaleTs.Struct({ | ||
const extrinsic = scaleTs.Struct({ | ||
version: scaleTs.u8, | ||
@@ -493,3 +517,3 @@ address: compactNumber, | ||
pallets: scaleTs.Vector(scaleTs.Struct(v15Pallet)), | ||
extrinsic: extrinsic$1, | ||
extrinsic, | ||
type: compactNumber, | ||
@@ -505,26 +529,2 @@ apis: scaleTs.Vector(runtimeApi), | ||
const empty = new Uint8Array(); | ||
const Always = (value) => scaleTs.createCodec( | ||
() => empty, | ||
() => value | ||
); | ||
const extrinsic = scaleTs.Struct({ | ||
type: compactNumber, | ||
version: scaleTs.u8, | ||
signedExtensions: scaleTs.Vector( | ||
scaleTs.Struct({ | ||
identifier: scaleTs.str, | ||
type: compactNumber, | ||
additionalSigned: compactNumber | ||
}) | ||
) | ||
}); | ||
const v14 = scaleTs.Struct({ | ||
lookup, | ||
pallets: scaleTs.Vector(scaleTs.Struct({ ...v14Pallet, docs: Always([]) })), | ||
extrinsic, | ||
type: compactNumber, | ||
apis: Always([]) | ||
}); | ||
const unsupportedFn = () => { | ||
@@ -558,2 +558,24 @@ throw new Error("Unsupported metadata version!"); | ||
}); | ||
const opaqueBytes = scaleTs.Bytes(); | ||
const optionOpaque = scaleTs.Option(opaqueBytes); | ||
const opaqueOpaqueBytes = scaleTs.Tuple(scaleTs.compact, opaqueBytes); | ||
const decAnyMetadata = (input) => { | ||
try { | ||
return metadata.dec(input); | ||
} catch (_) { | ||
} | ||
try { | ||
return metadata.dec(optionOpaque.dec(input)); | ||
} catch (_) { | ||
} | ||
try { | ||
return metadata.dec(opaqueBytes.dec(input)); | ||
} catch (_) { | ||
} | ||
try { | ||
return metadata.dec(opaqueOpaqueBytes.dec(input)[1]); | ||
} catch (_) { | ||
} | ||
throw null; | ||
}; | ||
@@ -909,2 +931,3 @@ const len32$1 = { dkLen: 32 }; | ||
exports.compactNumber = compactNumber; | ||
exports.decAnyMetadata = decAnyMetadata; | ||
exports.ethAccount = ethAccount; | ||
@@ -911,0 +934,0 @@ exports.fixedStr = fixedStr; |
{ | ||
"name": "@polkadot-api/substrate-bindings", | ||
"version": "0.7.0", | ||
"version": "0.8.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
215353
2913