Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump commander from 12.1.0 to 13.0.0 #1636

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/rpc-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ So you can run the rpc-proxy with:
OR `npx rpc-proxy --accounts "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158"`

- `-m, --mnemonic <mnemonic>`: The mnemonic that the proxy server will use to sign transactions.
- `-mc, --mnemonicCount <mnemonicCount>`: The number of accounts to derive from the mnemonic.
- `-mi, --mnemonicInitialIndex <mnemonicInitialIndex>`: The index from which to start deriving accounts from the
- `--mnemonicCount <mnemonicCount>`: The number of accounts to derive from the mnemonic.
- `--mnemonicInitialIndex <mnemonicInitialIndex>`: The index from which to start deriving accounts from the
mnemonic.
- -e.g.- `npx rpc-proxy -m "denial kitchen pet squirrel other broom bar gas better priority spoil cross" -mc 10 -mi 1`
- -e.g.- `npx rpc-proxy -m "denial kitchen pet squirrel other broom bar gas better priority spoil cross" --mnemonicCount 10 --mnemonicInitialIndex 1`
OR `npx rpc-proxy --mnemonic "denial kitchen pet squirrel other broom bar gas better priority spoil cross" --mnemonicCount 10 --mnemonicInitialIndex 1`
- **NOTE**: --mnemonic, --mnemonicCount, and --mnemonicInitialIndex MUST be used together.

#### Use delegation

- `-e, --enableDelegation`: Whether to enable delegation.
- `-dp, --delegatorPrivateKey <delegatorPrivateKey>`: The private key of the delegator.
- `-du, --delegatorUrl <delegatorUrl>`: The URL of the delegator.
- -e.g.- `npx rpc-proxy -e -dp 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158`
- `--delegatorPrivateKey <delegatorPrivateKey>`: The private key of the delegator.
- `-d, --delegatorUrl <delegatorUrl>`: The URL of the delegator.
- -e.g.- `npx rpc-proxy -e --delegatorPrivateKey 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158`
OR `npx rpc-proxy --enableDelegation --delegatorPrivateKey 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158`
- -e.g.- `npx rpc-proxy -e -du https://sponsor-testnet.vechain.energy/by/...`
- -e.g.- `npx rpc-proxy -e -d https://sponsor-testnet.vechain.energy/by/...`
OR `npx rpc-proxy --enableDelegation --delegatorUrl https://sponsor-testnet.vechain.energy/by/...`
- **NOTE**: --delegatorPrivateKey and --delegatorUrl are mutually exclusive.
- **NOTE**: if --enableDelegation is used, --delegatorPrivateKey OR --delegatorUrl MUST be used.
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@vechain/sdk-errors": "2.0.0-beta.1",
"@vechain/sdk-logging": "2.0.0-beta.1",
"@vechain/sdk-network": "2.0.0-beta.1",
"commander": "^12.1.0",
"commander": "^13.0.0",
"cors": "^2.8.5",
"express": "^4.21.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const ArgsValidatorAndGetter = {
'ArgsValidatorAndGetter.delegation()',
'Both delegator private key and delegator URL are provided. Only one can be provided',
{
flag: '{-dp , --delegatorPrivateKey}, {-du , --delegatorUrl}',
flag: '{--delegatorPrivateKey}, {-d , --delegatorUrl}',
value: `{value not provided for security reason} , {${options.delegatorUrl as string}}`
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const ArgsValidator = {
'ArgsValidator.mnemonicFields()',
'Invalid count provided. The parameter must be an integer',
{
flag: '-mc , --mnemonicCount',
flag: '--mnemonicCount',
value: String(mnemonicCount)
}
);
Expand All @@ -236,7 +236,7 @@ const ArgsValidator = {
'ArgsValidator.mnemonicFields()',
'Invalid initial index provided. The parameter must be an integer',
{
flag: '-mi , --mnemonicInitialIndex',
flag: '--mnemonicInitialIndex',
value: String(mnemonicInitialIndex)
}
);
Expand Down Expand Up @@ -266,7 +266,7 @@ const ArgsValidator = {
'ArgsValidator.delegatorPrivateKey()',
'An invalid delegator private key provided.',
{
flag: '-dp , --delegatorPrivateKey',
flag: '--delegatorPrivateKey',
value: 'Value will not be shown for security reasons'
}
);
Expand All @@ -290,7 +290,7 @@ const ArgsValidator = {
'ArgsValidator.delegatorUrl()',
'Invalid delegator url provided. The parameter must be a valid url',
{
flag: '-du , --delegatorUrl',
flag: '-d , --delegatorUrl',
value: delegatorUrl
}
);
Expand Down
16 changes: 8 additions & 8 deletions packages/rpc-proxy/src/utils/args/args-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { Command, Option, type OptionValues } from 'commander';
* * Where accounts is a space separated list of private keys (e.g. "PK1 PK2 PK3 ...")
*
* rpc-proxy {-m|--mnemonic} <mnemonic> - Mnemonic to use for signing transactions
* rpc-proxy {-mc|--mnemonicCount} <count> - Number of accounts to derive from the mnemonic
* rpc-proxy {-mi|--mnemonicInitialIndex} <index> - Initial index to start deriving accounts from the mnemonic
* rpc-proxy {--mnemonicCount} <count> - Number of accounts to derive from the mnemonic
* rpc-proxy {--mnemonicInitialIndex} <index> - Initial index to start deriving accounts from the mnemonic
*
* rpc-proxy {-e|--enableDelegation} - Enable delegation
* rpc-proxy {-dp|--delegatorPrivateKey} <delegatorPrivateKey> - Delegator private key
* rpc-proxy {-du|--delegatorUrl} <delegatorUrl> - Delegator URL
* rpc-proxy {--delegatorPrivateKey} <delegatorPrivateKey> - Delegator private key
* rpc-proxy {-d|--delegatorUrl} <delegatorUrl> - Delegator URL
*
* rpc-proxy {-v|--verbose} - Enable verbose logging
*
Expand Down Expand Up @@ -63,13 +63,13 @@ function getOptionsFromCommandLine(
)
.addOption(
new Option(
'-mc, --mnemonicCount <count>',
'--mnemonicCount <count>',
'Number of accounts to derive from the mnemonic'
)
)
.addOption(
new Option(
'-mi, --mnemonicInitialIndex <index>',
'--mnemonicInitialIndex <index>',
'Initial index to start deriving accounts from the mnemonic'
)
)
Expand All @@ -80,14 +80,14 @@ function getOptionsFromCommandLine(
// Delegator configuration (private key)
.addOption(
new Option(
'-dp, --delegatorPrivateKey <delegatorPrivateKey>',
'--delegatorPrivateKey <delegatorPrivateKey>',
'Delegator private key'
)
)

// Delegator configuration (url)
.addOption(
new Option('-du, --delegatorUrl <delegatorUrl>', 'Delegator URL')
new Option('-d, --delegatorUrl <delegatorUrl>', 'Delegator URL')
)

// Enable verbose logging
Expand Down
12 changes: 8 additions & 4 deletions packages/rpc-proxy/src/utils/args/env-to-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ function getArgsFromEnv(): string[] {
getCliFieldFromEnv('-p', process.env.PORT, 'PORT'),
getCliFieldFromEnv('-a', process.env.ACCOUNTS, 'ACCOUNTS'),
getCliFieldFromEnv('-m', process.env.MNEMONIC, 'MNEMONIC'),
getCliFieldFromEnv('-mc', process.env.MNEMONIC_COUNT, 'MNEMONIC_COUNT'),
getCliFieldFromEnv(
'-mi',
'--mnemonicCount',
process.env.MNEMONIC_COUNT,
'MNEMONIC_COUNT'
),
getCliFieldFromEnv(
'--mnemonicInitialIndex',
process.env.MNEMONIC_INITIAL_INDEX,
'MNEMONIC_INITIAL_INDEX'
),
Expand All @@ -45,11 +49,11 @@ function getArgsFromEnv(): string[] {
'ENABLE_DELEGATION'
),
getCliFieldFromEnv(
'-dp',
'--delegatorPrivateKey',
process.env.DELEGATOR_PRIVATE_KEY,
'DELEGATOR_PRIVATE_KEY'
),
getCliFieldFromEnv('-du', process.env.DELEGATOR_URL, 'DELEGATOR_URL'),
getCliFieldFromEnv('-d', process.env.DELEGATOR_URL, 'DELEGATOR_URL'),
getCliFieldFromEnv('-v', process.env.VERBOSE, 'VERBOSE'),
getCliFieldFromEnv(
'-c',
Expand Down
13 changes: 3 additions & 10 deletions packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ describe('Args options tests', () => {
'program',
'-m',
'expire pair material agent north ostrich fortune level cousin snow mixture nurse',
'-mi',
'--mnemonicInitialIndex',
'1',
'-mc',
'--mnemonicCount',
'2'
]
].forEach((args) => {
Expand Down Expand Up @@ -161,13 +161,6 @@ describe('Args options tests', () => {
'program',
'--delegatorPrivateKey',
'8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158'
],
// Short syntax
[
'path',
'program',
'-dp',
'8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158'
]
].forEach((args) => {
const delegatorPrivateKeyOption = getOptionsFromCommandLine(
Expand All @@ -190,7 +183,7 @@ describe('Args options tests', () => {
// Normal syntax
['path', 'program', '--delegatorUrl', 'http://localhost:8080'],
// Short syntax
['path', 'program', '-du', 'http://localhost:8080']
['path', 'program', '-d', 'http://localhost:8080']
].forEach((args) => {
const delegatorUrlOption = getOptionsFromCommandLine(
'1.0.0',
Expand Down
Loading
Loading