mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-20 04:56:12 +00:00
- @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
579 B
JavaScript
27 lines
579 B
JavaScript
import { createCodec } from 'scale-ts';
|
|
|
|
const selfEncoder = (value) => {
|
|
let cache = (x) => {
|
|
const encoder = value();
|
|
cache = encoder;
|
|
return encoder(x);
|
|
};
|
|
return (x) => cache(x);
|
|
};
|
|
const selfDecoder = (value) => {
|
|
let cache = (x) => {
|
|
const decoder = value();
|
|
const result = decoder;
|
|
cache = decoder;
|
|
return result(x);
|
|
};
|
|
return (x) => cache(x);
|
|
};
|
|
const Self = (value) => createCodec(
|
|
selfEncoder(() => value().enc),
|
|
selfDecoder(() => value().dec)
|
|
);
|
|
|
|
export { Self, selfDecoder, selfEncoder };
|
|
//# sourceMappingURL=Self.mjs.map
|