From e7ac487358c30593cfef0497a7e67325a893ac14 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Fri, 19 Apr 2024 15:11:08 +0200 Subject: [PATCH] deprecate cip8 commands for offchain storage. (#231) * deprecate cip8 commands for offchain storage. Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com> --------- Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com> --- .changeset/slimy-cups-listen.md | 5 +++++ packages/cli/src/commands/account/offchain-read.ts | 6 ++++-- packages/cli/src/commands/account/offchain-write.ts | 6 ++++-- packages/cli/src/utils/off-chain-data.ts | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .changeset/slimy-cups-listen.md diff --git a/.changeset/slimy-cups-listen.md b/.changeset/slimy-cups-listen.md new file mode 100644 index 000000000..e365c5477 --- /dev/null +++ b/.changeset/slimy-cups-listen.md @@ -0,0 +1,5 @@ +--- +'@celo/celocli': patch +--- + +Add deprecation notice about future removal of `account:offchain-read` and `account:offchain-write` commands. These were created to showcase ["CIP8: Expand Metadata to general off-chain storage"](https://github.com/celo-org/celo-proposals/blob/8260b49b2ec9a87ded6727fec7d9104586eb0752/CIPs/cip-0008.md), which has been abandond and they are presenting a high maintainence burden. diff --git a/packages/cli/src/commands/account/offchain-read.ts b/packages/cli/src/commands/account/offchain-read.ts index ec7d23320..ad0d07998 100644 --- a/packages/cli/src/commands/account/offchain-read.ts +++ b/packages/cli/src/commands/account/offchain-read.ts @@ -1,9 +1,9 @@ import { BasicDataWrapper } from '@celo/identity/lib/offchain-data-wrapper' import { PrivateNameAccessor, PublicNameAccessor } from '@celo/identity/lib/offchain/accessors/name' -import { Flags } from '@oclif/core' +import { Flags, ux } from '@oclif/core' import { BaseCommand } from '../../base' import { CustomArgs, CustomFlags } from '../../utils/command' -import { OffchainDataCommand } from '../../utils/off-chain-data' +import { DEPRECATION_NOTICE, OffchainDataCommand } from '../../utils/off-chain-data' export default class OffchainRead extends BaseCommand { static description = 'DEV: Reads the name from offchain storage' @@ -23,6 +23,8 @@ export default class OffchainRead extends BaseCommand { static examples = ['offchain-read 0x...', 'offchain-read 0x... --from 0x... --privateKey 0x...'] async run() { + ux.warn(DEPRECATION_NOTICE) + const kit = await this.getKit() const { args: { arg1: address }, diff --git a/packages/cli/src/commands/account/offchain-write.ts b/packages/cli/src/commands/account/offchain-write.ts index 42a2d0405..5f934c603 100644 --- a/packages/cli/src/commands/account/offchain-write.ts +++ b/packages/cli/src/commands/account/offchain-write.ts @@ -1,8 +1,8 @@ import { PrivateNameAccessor, PublicNameAccessor } from '@celo/identity/lib/offchain/accessors/name' import { privateKeyToAddress } from '@celo/utils/lib/address' -import { Flags } from '@oclif/core' +import { Flags, ux } from '@oclif/core' import { binaryPrompt } from '../../utils/cli' -import { OffchainDataCommand } from '../../utils/off-chain-data' +import { DEPRECATION_NOTICE, OffchainDataCommand } from '../../utils/off-chain-data' export default class OffchainWrite extends OffchainDataCommand { static description = 'DEV: Writes a name to offchain storage' @@ -24,6 +24,8 @@ export default class OffchainWrite extends OffchainDataCommand { ] async run() { + ux.warn(DEPRECATION_NOTICE) + const kit = await this.getKit() const { flags: { encryptTo, name, privateDEK, privateKey }, diff --git a/packages/cli/src/utils/off-chain-data.ts b/packages/cli/src/utils/off-chain-data.ts index 8242fc911..1a14b64e8 100644 --- a/packages/cli/src/utils/off-chain-data.ts +++ b/packages/cli/src/utils/off-chain-data.ts @@ -58,3 +58,6 @@ export abstract class OffchainDataCommand extends BaseCommand { : new LocalStorageWriter(directory) } } + +export const DEPRECATION_NOTICE = + 'offchain-read and offchain-write commands are deprecated as CIP8 was abandonded. They will be removed next major release.'