2024-03-05 19:30:47 -05:00
|
|
|
import assert from 'assert';
|
2022-06-21 13:43:28 +01:00
|
|
|
|
2024-05-20 10:54:13 +01:00
|
|
|
import { TaprootWallet } from '../../class';
|
|
|
|
|
2022-06-21 13:43:28 +01:00
|
|
|
describe('Taproot wallet', () => {
|
|
|
|
it('can convert scriptPubKey to address', () => {
|
|
|
|
let address = TaprootWallet.scriptPubKeyToAddress('512040ef293a8a0ebaf8b351a27d89ff4b5b3822a635e4afdca77a30170c363bafa3');
|
|
|
|
assert.strictEqual(address, 'bc1pgrhjjw52p6a03v635f7cnl6ttvuz9f34ujhaefm6xqtscd3m473szkl92g');
|
2024-03-05 19:30:47 -05:00
|
|
|
address = TaprootWallet.scriptPubKeyToAddress('');
|
2022-06-21 13:43:28 +01:00
|
|
|
assert.strictEqual(address, false);
|
|
|
|
address = TaprootWallet.scriptPubKeyToAddress('trololo');
|
|
|
|
assert.strictEqual(address, false);
|
|
|
|
});
|
|
|
|
});
|