From d8d5d69ed2e8aabde16fddfb690402fbed0a4370 Mon Sep 17 00:00:00 2001 From: nazreen <10964594+nazreen@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:24:38 -0800 Subject: [PATCH] param to flag --- examples/lzapp-migration/README.md | 4 ++-- .../lzapp-migration/tasks/solana/createOFT.ts | 12 +++++------- .../lzapp-migration/tasks/solana/setAuthority.ts | 10 +++------- examples/oft-solana/README.md | 15 +++++++-------- examples/oft-solana/tasks/solana/createOFT.ts | 12 +++++------- examples/oft-solana/tasks/solana/setAuthority.ts | 10 +++------- 6 files changed, 25 insertions(+), 38 deletions(-) diff --git a/examples/lzapp-migration/README.md b/examples/lzapp-migration/README.md index 04d47e6775..2c3700dd6a 100644 --- a/examples/lzapp-migration/README.md +++ b/examples/lzapp-migration/README.md @@ -217,7 +217,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia :information_source: For **OFT** and **OFT Mint-and-Burn Adapter**, the SPL token's Mint Authority is set to the **Mint Authority Multisig**, which always has the **OFT Store** as a signer. The multisig is fixed to needing 1 of N signatures. -:information_source: For **OFT** and **OFT Mint-And-Burn Adapter**, you have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store true`, which means only the **OFT Store** will be a signer for the \_Mint Authority Multisig\*. +:information_source: For **OFT** and **OFT Mint-And-Burn Adapter**, you have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store`, which means only the **OFT Store** will be a signer for the \_Mint Authority Multisig\*. :warning: If you choose to go with `--only-oft-store`, you will not be able to add in other signers/minters or update the Mint Authority, and the Freeze Authority will be immediately renounced. The token Mint Authority will be fixed Mint Authority Multisig address while the Freeze Authority will be set to None. @@ -227,7 +227,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia pnpm hardhat lz:oft:solana:create --eid 40168 --program-id ``` -:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store true`. +:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store`. :information_source: You can also specify `--amount ` to have the OFT minted to your deployer address upon token creation. diff --git a/examples/lzapp-migration/tasks/solana/createOFT.ts b/examples/lzapp-migration/tasks/solana/createOFT.ts index 0b92938c31..186b56ba9c 100644 --- a/examples/lzapp-migration/tasks/solana/createOFT.ts +++ b/examples/lzapp-migration/tasks/solana/createOFT.ts @@ -143,11 +143,9 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco .addParam('symbol', 'Token Symbol', 'MOFT', devtoolsTypes.string) .addParam('tokenMetadataIsMutable', 'Token metadata is mutable', true, devtoolsTypes.boolean) .addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true) - .addOptionalParam( + .addFlag( 'onlyOftStore', - 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.', - false, - devtoolsTypes.boolean + 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.' ) .addParam( 'tokenProgram', @@ -205,13 +203,13 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco if (!additionalMintersAsStrings) { if (!onlyOftStore) { throw new Error( - 'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store true. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.' + 'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.' ) } } if (freezeAuthorityStr && !onlyOftStore) { - throw new Error('`--freeze-authority` is only supported in `--only-oft-store true` mode') + throw new Error('`--freeze-authority` is only supported in `--only-oft-store` mode') } if (onlyOftStore && additionalMintersAsStrings && additionalMintersAsStrings?.length > 0) { @@ -222,7 +220,7 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco if (onlyOftStore && !ci) { const continueWithOnlyOftStore = await promptToContinue( - `You have chosen \`--only-oft-store true\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?` + `You have chosen \`--only-oft-store\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?` ) if (!continueWithOnlyOftStore) { return diff --git a/examples/lzapp-migration/tasks/solana/setAuthority.ts b/examples/lzapp-migration/tasks/solana/setAuthority.ts index 404a2f4be6..124e859a02 100644 --- a/examples/lzapp-migration/tasks/solana/setAuthority.ts +++ b/examples/lzapp-migration/tasks/solana/setAuthority.ts @@ -94,11 +94,9 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and .addParam('programId', 'The OFT Program id') .addParam('escrow', 'The OFT Escrow public key') .addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true) - .addOptionalParam( + .addFlag( 'onlyOftStore', - 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.', - false, - devtoolsTypes.boolean + 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.' ) .addParam( 'tokenProgram', @@ -123,9 +121,7 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and const tokenProgram = publicKey(tokenProgramStr) if (!additionalMintersAsStrings) { if (!onlyOftStore) { - throw new Error( - 'If you want to proceed with only the OFTStore, please specify --only-oft-store true' - ) + throw new Error('If you want to proceed with only the OFTStore, please specify --only-oft-store') } console.log( 'No additional minters specified. This will result in only the OFTStore being able to mint new tokens.' diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index b773a558cd..5707ca89be 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -208,7 +208,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia ### Create the Solana OFT ```bash -pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --only-oft-store true --amount 100000000000 +pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --only-oft-store --amount 100000000000 ``` The above command will create a Solana OFT which will have only the OFT Store as the Mint Authority and will also mint 100 OFT (given the default 9 decimals on Solana, this would be `100_000_000_000` in raw amount). @@ -317,7 +317,7 @@ This section explains the three different options available for creating OFTs on - **Note**: Preferred option when you don't have an existing token ```bash -pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --only-oft-store true --amount 100000000000 +pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --only-oft-store --amount 100000000000 ``` ### OFT Adapter @@ -452,9 +452,8 @@ npx hardhat --help Comma-separated list of additional minters _Default: undefined_ -- **`--only-oft-store`** (boolean) - If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore. - _Default: false_ +- **`--only-oft-store`** (flag) + If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore. - **`--freeze-authority`** (string) The Freeze Authority address (only supported in onlyOftStore mode) @@ -476,13 +475,13 @@ The following parameters are only used for Mint-And-Burn Adapter (MABA) mode: :information_source: For **OFT**, the SPL token's Mint Authority is set to the **Mint Authority Multisig**, which always has the **OFT Store** as a signer. The multisig is fixed to needing 1 of N signatures. -:information_source: You have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store true`, which means only the **OFT Store** will be a signer for the **Mint Authority Multisig**. +:information_source: You have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store`, which means only the **OFT Store** will be a signer for the **Mint Authority Multisig**. :warning: If you choose to go with `--only-oft-store`, you will not be able to add in other signers/minters or update the Mint Authority, and the Freeze Authority will be immediately renounced. The token Mint Authority will be fixed Mint Authority Multisig address while the Freeze Authority will be set to None. ##### Important Notes -:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store true`. +:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store`.
pnpm hardhat lz:oft:solana:debug --eid @@ -512,7 +511,7 @@ const solanaContract: OmniPointHardhat = { This is only relevant for **OFT**. If you opted to include the `--amount` flag in the create step, that means you already have minted some Solana OFT and you can skip this section. -:information_source: This is only possible if you specified your deployer address as part of the `--additional-minters` flag when creating the Solana OFT. If you had chosen `--only-oft-store true`, you will not be able to mint your OFT on Solana. +:information_source: This is only possible if you specified your deployer address as part of the `--additional-minters` flag when creating the Solana OFT. If you had chosen `--only-oft-store`, you will not be able to mint your OFT on Solana. First, you need to create the Associated Token Account for your address. diff --git a/examples/oft-solana/tasks/solana/createOFT.ts b/examples/oft-solana/tasks/solana/createOFT.ts index a9c8f56319..bfbe640897 100644 --- a/examples/oft-solana/tasks/solana/createOFT.ts +++ b/examples/oft-solana/tasks/solana/createOFT.ts @@ -143,11 +143,9 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco .addParam('symbol', 'Token Symbol', 'MOFT', devtoolsTypes.string) .addParam('tokenMetadataIsMutable', 'Token metadata is mutable', true, devtoolsTypes.boolean) .addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true) - .addOptionalParam( + .addFlag( 'onlyOftStore', - 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.', - false, - devtoolsTypes.boolean + 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.' ) .addParam( 'tokenProgram', @@ -205,13 +203,13 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco if (!additionalMintersAsStrings) { if (!onlyOftStore) { throw new Error( - 'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store true. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.' + 'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.' ) } } if (freezeAuthorityStr && !onlyOftStore) { - throw new Error('`--freeze-authority` is only supported in `--only-oft-store true` mode') + throw new Error('`--freeze-authority` is only supported in `--only-oft-store` mode') } if (onlyOftStore && additionalMintersAsStrings && additionalMintersAsStrings?.length > 0) { @@ -222,7 +220,7 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco if (onlyOftStore && !ci) { const continueWithOnlyOftStore = await promptToContinue( - `You have chosen \`--only-oft-store true\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?` + `You have chosen \`--only-oft-store\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?` ) if (!continueWithOnlyOftStore) { return diff --git a/examples/oft-solana/tasks/solana/setAuthority.ts b/examples/oft-solana/tasks/solana/setAuthority.ts index 56d8b84070..ad48bc78da 100644 --- a/examples/oft-solana/tasks/solana/setAuthority.ts +++ b/examples/oft-solana/tasks/solana/setAuthority.ts @@ -94,11 +94,9 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and .addParam('programId', 'The OFT Program id') .addParam('escrow', 'The OFT Escrow public key') .addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true) - .addOptionalParam( + .addFlag( 'onlyOftStore', - 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.', - false, - devtoolsTypes.boolean + 'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.' ) .addParam( 'tokenProgram', @@ -123,9 +121,7 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and const tokenProgram = publicKey(tokenProgramStr) if (!additionalMintersAsStrings) { if (!onlyOftStore) { - throw new Error( - 'If you want to proceed with only the OFTStore, please specify --only-oft-store true' - ) + throw new Error('If you want to proceed with only the OFTStore, please specify --only-oft-store') } console.log( 'No additional minters specified. This will result in only the OFTStore being able to mint new tokens.'