如何在bitgo Js中创建钱包后从响应数组中获取特定值

时间:2018-05-23 12:51:08

标签: node.js

这是我的数组,想要从中获取值:

{ wallet:
   Wallet {
     bitgo:
      BitGo {
        _baseUrl: 'https://test.bitgo.com',
        env: 'test',
        _baseApiUrl: 'https://test.bitgo.com/api/v1',
          del: [Function] },
     baseCoin:
      BaseCoin {
        network: [Object],
        coinKeychains: [Keychains] },
     _wallet:
      { id: '5b055bae749a9ba207410c65ff58c325',
        users: [Array],
        coin: 'tltc',
        label: 'My Test Wallet',
        m: 2,
        n: 3,
        pendingApprovals: [] } },
  userKeychain:
   { id: '47i3ygdhfhdhjfj84378r'
     users: [ '3w65gsdhfgshg93w2r2839'],
     pub: 'zsnadfsheg94t854tidghfhdhgdhh kladjfghgdhfhdhfghdhhfghgh',
     ethAddress: '0xzxder4tewre79618eceret3a2eabf6c8',
     encryptedPrv: '{}',
     prv: ' },
  backupKeychain:
   { id: '54idhjfhdj9a9ba207410c505912c1b1',
     users: [ '90jdfjgbja7007sdjbgjffc7a5065006' ],
     pub: '',
     ethAddress: '0x753ce0sdfvsdsgdf8baef8sdfesdfssfs2bdd8cb',
     prv: '',
     source: 'backup' },
  bitgoKeychain:
   { id: '5b055bad39230ccc07814e0589388100',
     users: [ '5ac1fd5563fa7007d5a17fc7a5065006' ],
     pub: '',
     ethAddress: '0xbfdgfdgdfdgfhfgtr6756ghfghfg719320fcc7e',
     isBitGo: true },

}

//这里想要获取userKeychain,backupKeychain和bitgoKeychain 请帮助获取此值。是否有任何函数可以访问此值或需要bitgo Js中的任何解析方法。

1 个答案:

答案 0 :(得分:0)

您可以使用以下方式获取: wallet.wallet._wallet.id 这将为您提供钱包ID。要获取userKeychain值,请使用 wallet.userKeychain