File tree Expand file tree Collapse file tree
modules/abstract-utxo/src/impl/bch Expand file tree Collapse file tree 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 } ` ) ;
You can’t perform that action at this time.
0 commit comments