Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Fix walletpath option in wallet command #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

japidei
Copy link

@japidei japidei commented May 1, 2023

Example error:

$ weft wallet ls --walletpath ./_cfg/_wallets/DigiBank
weft wallet ls

Lists Application Wallet identities

Opciones:
      --help          Muestra ayuda  [booleano]
  -v, --version       Muestra número de versión  [booleano]
  -w, --walletpath    Path to application wallet  [requerido]
  -c, --compat        Set to use the 1.4 wallet format  [booleano] [defecto: false]
  -r, --createwallet  Create the wallet if not present  [booleano] [defecto: false]
  -f, --force         If the identity is already present, force overwrite it  [booleano] [defecto: false]

TypeError: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at Object.resolve (node:path:1102:7)
    at resolveWalletPath (/opt/homebrew/lib/node_modules/@hyperledger-labs/weft/src/userutils.ts:12:19)
    at /opt/homebrew/lib/node_modules/@hyperledger-labs/weft/src/cli.ts:267:53
    at Generator.next (<anonymous>)
    at /opt/homebrew/lib/node_modules/@hyperledger-labs/weft/lib/cli.js:32:71
    at new Promise (<anonymous>)
    at __awaiter (/opt/homebrew/lib/node_modules/@hyperledger-labs/weft/lib/cli.js:28:12)
    at Object.handler (/opt/homebrew/lib/node_modules/@hyperledger-labs/weft/src/cli.ts:265:33) {
  code: 'ERR_INVALID_ARG_TYPE'
}

After the fix:

weft wallet ls --wallet ./_cfg/_wallets/DigiBank
Listing application wallet identities /Users/japi/tmp/_cfg/_wallets/DigiBank
Complete
> digibankadmin
> digibankcaadmin

The problem occurs because it uses args['wallet'] instead of args['walletpath']:

        .command(
            'ls',
            'Lists Application Wallet identities',
            (yargs: any) => {
                return yargs;
            },
            async (args: any) => {
                // resolve the supplied gateway and wallet paths
                const walletPath = resolveWalletPath(args['wallet'] as string);
                log({ msg: 'Listing application wallet identities', val: walletPath });

                const idtools = new Identities(walletPath);
                idtools.list();
            },
        );

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant