File tree Expand file tree Collapse file tree 4 files changed +5
-22
lines changed
modules/abstract-utxo/src Expand file tree Collapse file tree 4 files changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -400,8 +400,6 @@ export abstract class AbstractUtxoCoin
400400{
401401 abstract name : UtxoCoinName ;
402402
403- public altScriptHash ?: number ;
404- public supportAltScriptDestination ?: boolean ;
405403 public readonly amountType : 'number' | 'bigint' ;
406404
407405 protected constructor ( bitgo : BitGoBase , amountType : 'number' | 'bigint' = 'number' ) {
Original file line number Diff line number Diff line change 11import { BitGoBase } from '@bitgo/sdk-core' ;
2- import * as utxolib from '@bitgo/utxo-lib ' ;
2+ import { address as wasmAddress } from '@bitgo/wasm-utxo ' ;
33
44import { AbstractUtxoCoin } from '../../abstractUtxoCoin' ;
55import { UtxoCoinName } from '../../names' ;
@@ -34,12 +34,13 @@ export class Bch extends AbstractUtxoCoin {
3434 }
3535
3636 if ( version === 'base58' ) {
37- return utxolib . addressFormat . toCanonicalFormat ( address , this . network ) ;
37+ const script = wasmAddress . toOutputScriptWithCoin ( address , this . name ) ;
38+ return wasmAddress . fromOutputScriptWithCoin ( script , this . name , 'default' ) ;
3839 }
3940
4041 if ( version === 'cashaddr' ) {
41- const script = utxolib . addressFormat . toOutputScriptTryFormats ( address , this . network ) ;
42- return utxolib . addressFormat . fromOutputScriptWithFormat ( script , version , this . network ) ;
42+ const script = wasmAddress . toOutputScriptWithCoin ( address , this . name ) ;
43+ return wasmAddress . fromOutputScriptWithCoin ( script , this . name , 'cashaddr' ) ;
4344 }
4445
4546 throw new Error ( `invalid version ${ version } ` ) ;
Original file line number Diff line number Diff line change 11import { BitGoBase } from '@bitgo/sdk-core' ;
2- import * as utxolib from '@bitgo/utxo-lib' ;
32
43import { AbstractUtxoCoin } from '../../abstractUtxoCoin' ;
54import { UtxoCoinName } from '../../names' ;
65
76export class Ltc extends AbstractUtxoCoin {
87 readonly name : UtxoCoinName = 'ltc' ;
98
10- constructor ( bitgo : BitGoBase ) {
11- super ( bitgo ) ;
12- // use legacy script hash version, which is the current Bitcoin one
13- this . altScriptHash = utxolib . networks . bitcoin . scriptHash ;
14- // do not support alt destinations in prod
15- this . supportAltScriptDestination = false ;
16- }
17-
189 static createInstance ( bitgo : BitGoBase ) : Ltc {
1910 return new Ltc ( bitgo ) ;
2011 }
Original file line number Diff line number Diff line change 11import { BitGoBase } from '@bitgo/sdk-core' ;
2- import * as utxolib from '@bitgo/utxo-lib' ;
32
43import { UtxoCoinName } from '../../names' ;
54
@@ -8,12 +7,6 @@ import { Ltc } from './ltc';
87export class Tltc extends Ltc {
98 readonly name : UtxoCoinName = 'tltc' ;
109
11- constructor ( bitgo : BitGoBase ) {
12- super ( bitgo ) ;
13- this . altScriptHash = utxolib . networks . testnet . scriptHash ;
14- // support alt destinations on test
15- this . supportAltScriptDestination = false ;
16- }
1710 static createInstance ( bitgo : BitGoBase ) : Tltc {
1811 return new Tltc ( bitgo ) ;
1912 }
You can’t perform that action at this time.
0 commit comments