本文整理汇总了TypeScript中@bitgo/unspents.Codes.UnspentTypeTcomb方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Codes.UnspentTypeTcomb方法的具体用法?TypeScript Codes.UnspentTypeTcomb怎么用?TypeScript Codes.UnspentTypeTcomb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@bitgo/unspents.Codes
的用法示例。
在下文中一共展示了Codes.UnspentTypeTcomb方法的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);
});
示例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 }));
});
示例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);
}));