mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-04-22 03:17:56 +00:00
31467f90d4
- @pezkuwi/papi-utils (rebrand of @polkadot-api/utils) - @pezkuwi/bizinikiwi-bindings (rebrand of @polkadot-api/substrate-bindings) - @pezkuwi/metadata-builders (rebrand of @polkadot-api/metadata-builders) - @pezkuwi/merkleize-metadata (rebrand of @polkadot-api/merkleize-metadata) All @polkadot-api references replaced with @pezkuwi equivalents.
27 lines
683 B
JavaScript
27 lines
683 B
JavaScript
import { enhanceCodec, u8 } from 'scale-ts';
|
|
|
|
const TYPES = {
|
|
bare: 0,
|
|
0: "bare",
|
|
general: 1,
|
|
1: "general",
|
|
signed: 2,
|
|
2: "signed"
|
|
};
|
|
const extrinsicFormat = enhanceCodec(
|
|
u8,
|
|
({ version, type }) => version + (TYPES[type] << 6),
|
|
(v) => {
|
|
const version = v & 63;
|
|
const type = v >> 6;
|
|
if (version === 4 && (type === TYPES.bare || type === TYPES.signed))
|
|
return { version, type: TYPES[type] };
|
|
if (version === 5 && (type === TYPES.bare || type === TYPES.general))
|
|
return { version, type: TYPES[type] };
|
|
throw new Error(`ExtrinsicFormat ${v} not valid`);
|
|
}
|
|
);
|
|
|
|
export { extrinsicFormat };
|
|
//# sourceMappingURL=extrinsic-format.mjs.map
|