當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Codes.PurposeTcomb方法代碼示例

本文整理匯總了TypeScript中@bitgo/unspents.Codes.PurposeTcomb方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Codes.PurposeTcomb方法的具體用法?TypeScript Codes.PurposeTcomb怎麽用?TypeScript Codes.PurposeTcomb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@bitgo/unspents.Codes的用法示例。


在下文中一共展示了Codes.PurposeTcomb方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('should generate 3/3 custom chain p2shP2wsh address', function() {
      const addressType = Codes.UnspentTypeTcomb('p2shP2wsh');
      const chain = Codes.forType(addressType)[Codes.PurposeTcomb('external')];
      const generatedAddress = coin.generateAddress({ keychains, threshold: 3, addressType, chain, index: 756 });
      const generatedTestAddress = testCoin.generateAddress({
        keychains,
        threshold: 3,
        addressType: Codes.UnspentTypeTcomb('p2shP2wsh'),
        chain,
        index: 756
      });

      [generatedAddress, generatedTestAddress].forEach((currentAddress) => {
        currentAddress.chain.should.equal(chain);
        currentAddress.index.should.equal(756);
        currentAddress.coinSpecific.outputScript.should.equal('a914ad395d176042ce737e4f5b65c0eb5de703a4e80087');
        currentAddress.coinSpecific.redeemScript.should.equal('0020d15d8d124adb4c213905ebb2cec8517faf38ae0ec4f7b4f1cfa358e6cc06a93d');
        currentAddress.coinSpecific.witnessScript.should.equal('532102bb8096d5c12e8b0ee50dd2b14f63dd09c8494b5a0a730794a0e392a6f2a3b2a8210366dbf2135105dc65eed5173c1acf1a902fc2e9dd366b9a6fa0e682c0fb4c21a32102bf998121d4d09d4305b025b5d2de8a7e954fe96179a1dfc076ad11ad4751c99e53ae');
      });

      generatedAddress.address.should.equal('3HUwYRepxeeHMedeU9tTkMRF3Udi6ZibEj');
      generatedTestAddress.address.should.equal('2N939cAara79dZSGC9HWLNJQWFpqsutd5dW');

      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,代碼行數:28,代碼來源: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


注:本文中的@bitgo/unspents.Codes.PurposeTcomb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。