• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript unspents.Codes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@bitgo/unspents.Codes的典型用法代码示例。如果您正苦于以下问题:TypeScript Codes类的具体用法?TypeScript Codes怎么用?TypeScript Codes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Codes类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('should generate 3/3 custom chain p2wsh bech32 address', function() {
      const generatedAddress = coin.generateAddress({
        keychains,
        threshold: 3,
        addressType: Codes.UnspentTypeTcomb('p2wsh'),
        chain: 20,
        index: 756
      });
      const generatedTestAddress = testCoin.generateAddress({
        keychains,
        threshold: 3,
        addressType: Codes.UnspentTypeTcomb('p2wsh'),
        chain: 20,
        index: 756
      });

      [generatedAddress, generatedTestAddress].forEach((currentAddress) => {
        currentAddress.chain.should.equal(20);
        currentAddress.index.should.equal(756);
        currentAddress.coinSpecific.outputScript.should.equal('0020c8fc4f071770e15f21a13ba48c6f32421daed431a74e00e13d0187990964bbce');
        should.not.exist(currentAddress.coinSpecific.redeemScript);
        currentAddress.coinSpecific.witnessScript.should.equal('532103db7ec7ef3c549705582d6bb5ee258b3bc14d147ec3b069dfd4fd80adb4e9373e210387b1f7cacb6e0c78b79062e94ed0aee691bdfa34a0d1b522103c434205587ad52102044a9f965fd9b54d82e5afe9d4338d0f59027a4e11cff3a39b90fbf5978ae7e753ae');
      });

      generatedAddress.address.should.equal('bc1qer7y7pchwrs47gdp8wjgcmejggw6a4p35a8qpcfaqxrejztyh08q3ezxp6');
      generatedTestAddress.address.should.equal('tb1qer7y7pchwrs47gdp8wjgcmejggw6a4p35a8qpcfaqxrejztyh08qx35fm4');

      coin.isValidAddress(generatedAddress.address).should.equal(true);
      testCoin.isValidAddress(generatedTestAddress.address).should.equal(true);
      coin.isValidAddress(generatedTestAddress.address).should.equal(false);
      testCoin.isValidAddress(generatedAddress.address).should.equal(false);
    });
开发者ID:BitGo,项目名称:BitGoJS,代码行数:32,代码来源:btc.ts


示例2: it

 it('should generate 3/3 custom chain segwit address', () => {
   const addressType = Codes.UnspentTypeTcomb('p2shP2wsh');
   const chain = Codes.forType(addressType)[Codes.PurposeTcomb('external')];
   const generatedAddress = coin.generateAddress({ keychains, threshold: 3, addressType, chain, index: 756 });
   generatedAddress.chain.should.equal(chain);
   generatedAddress.index.should.equal(756);
   generatedAddress.coinSpecific.outputScript.should.equal('a914ad395d176042ce737e4f5b65c0eb5de703a4e80087');
   generatedAddress.coinSpecific.redeemScript.should.equal('0020d15d8d124adb4c213905ebb2cec8517faf38ae0ec4f7b4f1cfa358e6cc06a93d');
   generatedAddress.coinSpecific.witnessScript.should.equal('532102bb8096d5c12e8b0ee50dd2b14f63dd09c8494b5a0a730794a0e392a6f2a3b2a8210366dbf2135105dc65eed5173c1acf1a902fc2e9dd366b9a6fa0e682c0fb4c21a32102bf998121d4d09d4305b025b5d2de8a7e954fe96179a1dfc076ad11ad4751c99e53ae');
   generatedAddress.address.should.equal('AXZoGP21jtz45T9CuhtCUcKQNZGgvwqfdS');
 });
开发者ID:BitGo,项目名称:BitGoJS,代码行数:11,代码来源:btg.ts


示例3: it

    it('should generate p2sh-wrapped segwit address', () => {
      const addressType = Codes.UnspentTypeTcomb('p2shP2wsh');
      const chain = Codes.forType(addressType)[Codes.PurposeTcomb('external')];
      const generatedAddress = coin.generateAddress({ keychains, addressType, chain });
      const generatedTestAddress = testCoin.generateAddress({ keychains, addressType, chain });

      [generatedAddress, generatedTestAddress].forEach((currentAddress) => {
        currentAddress.chain.should.equal(chain);
        currentAddress.index.should.equal(0);
        currentAddress.coinSpecific.outputScript.should.equal('a9147ff13f3faeba4d439ef40604f7c127951e77eb6a87');
        currentAddress.coinSpecific.redeemScript.should.equal('00207aad7d57b238a09b5daa10ff47c54483b7f2ad47f3f0c0aa230958b9df334260');
        currentAddress.coinSpecific.witnessScript.should.equal('52210304fcea3fb05f6e8a8fe91db2087bdd13b18102a0b10a77c1fdbb326b0ce7cec421028242a3ea9e20d4e6b78e3f0dde21aff86a623d48322681b203b6827e22d04a9d2102ceec88b222a55ec67d1414b523bcfc0f53eb6ac012ba91744a4ed8eb448d55f753ae');
      });

      generatedAddress.address.should.equal('MKZf3w3b2hACjfJNbqifSYPixNkZjxBTg9');
      generatedTestAddress.address.should.equal('QYGUvoRti8sDH8R4oCPDKYa1zQp7UWCfAA');

      coin.verifyAddress(_.extend({}, generatedAddress, { keychains }));
      testCoin.verifyAddress(_.extend({}, generatedTestAddress, { keychains }));
    });
开发者ID:BitGo,项目名称:BitGoJS,代码行数:20,代码来源:ltc.ts


示例4: before

 before(co(function *() {
   basecoin = bitgo.coin('tbtc');
   const walletData = {
     id: '5a78dd561c6258a907f1eeaee132f796',
     users: [
       {
         user: '543c11ed356d00cb7600000b98794503',
         permissions: [
           'admin',
           'view',
           'spend'
         ]
       }
     ],
     coin: 'tbch',
     label: 'Signature Verification Wallet',
     m: 2,
     n: 3,
     keys: [
       '5a78dd56bfe424aa07aa068651b194fd',
       '5a78dd5674a70eb4079f58797dfe2f5e',
       '5a78dd561c6258a907f1eea9f1d079e2'
     ],
     tags: [
       '5a78dd561c6258a907f1eeaee132f796'
     ],
     disableTransactionNotifications: false,
     freeze: {},
     deleted: false,
     approvalsRequired: 1,
     isCold: true,
     coinSpecific: {},
     admin: {
       policy: {
         id: '5a78dd561c6258a907f1eeaf50991950',
         version: 0,
         date: '2018-02-05T22:40:22.761Z',
         mutableUpToDate: '2018-02-07T22:40:22.761Z',
         rules: []
       }
     },
     clientFlags: [],
     balance: 650000000,
     confirmedBalance: 650000000,
     spendableBalance: 650000000,
     balanceString: '650000000',
     confirmedBalanceString: '650000000',
     spendableBalanceString: '650000000',
     receiveAddress: {
       id: '5b5f83121d13489f7ff32f9d5729c6de',
       address: 'tb1qtxxqmkkdx4n4lcp0nt2cct89uh3h3dlcu940kw9fcqyyq36peh0st94hfp',
       chain: 20,
       index: 2,
       coin: 'tbtc',
       wallet: '5b5f81a78d2152514ab99a15ee9e0781',
       coinSpecific: {
         witnessScript: '522103d4788cda52f91c1f6c82eb91491ca76108c9c5f0839bc4f02eccc55fedb3311c210391bcef9dcc89570a79ba3c7514e65cd48e766a8868eca2769fa9242fdcc796662102ef3c5ebac4b54df70dea1bb2655126368be10ca0462382fcb730e55cddd2dd6a53ae'
       },
       addressType: Codes.UnspentTypeTcomb('p2wsh')
     },
     pendingApprovals: []
   };
   wallet = new Wallet(bitgo, basecoin, walletData);
 }));
开发者ID:BitGo,项目名称:BitGoJS,代码行数:64,代码来源:btc.ts



注:本文中的@bitgo/unspents.Codes类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript chronodb.ChronoDB类代码示例发布时间:2022-05-28
下一篇:
TypeScript ValidatorProvider.ValidatorProvider类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap