以编程方式创建 Hyperledger 钱包

Create Hyperledger Wallet Programmatically

使用以下命令:

const wallet = await this.bizNetworkConnection.cardStore.getWallet('admin@proak-hyperledger-network');

我可以从默认路径获取钱包:'˜/.composer/client-data/admin@proak-hyperledger-network'

但是我不能使用默认路径,所以我想创建钱包。 有类似的方法吗?

let wallet = new Wallet(args)

我找到了指定钱包路径的方法。您需要将一些选项传递给 BusinessNetworkConnection.

constructor() {
    let connectionOptions = {}
    connectionOptions = {
        wallet : {
          type: 'composer-wallet-filesystem',
          options : {
            storePath : '/tmp/.composer'
          }
        }
      };
    this.bizNetworkConnection = new BusinessNetworkConnection(connectionOptions);
  }