ghost-portal/packages/page-alliance/src/util.ts
Tarik Gul 384049fb6b
2025 (#11172)
* 2025

* update ci scripts to add access to scripts
2025-01-03 03:59:53 +02:00

23 lines
680 B
TypeScript

// Copyright 2017-2025 @polkadot/app-alliance authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletAllianceCid } from '@polkadot/types/lookup';
import type { Registry } from '@polkadot/types/types';
import type { Cid } from './types.js';
import { fromIpfsCid, toIpfsCid } from '@polkadot/react-params/util';
export function createPalletCid (registry: Registry, cid: string): PalletAllianceCid | null {
const expanded = fromIpfsCid(cid);
return expanded && registry.createType('PalletAllianceCid', expanded);
}
export function createCid (cid: PalletAllianceCid): Cid {
return {
cid,
ipfs: toIpfsCid(cid),
key: cid.toHex()
};
}