本文整理汇总了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);
});
示例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');
});
示例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 }));
});