Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions modules/abstract-utxo/src/abstractUtxoCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ export abstract class AbstractUtxoCoin
{
abstract name: UtxoCoinName;

public altScriptHash?: number;
public supportAltScriptDestination?: boolean;
public readonly amountType: 'number' | 'bigint';

protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
Expand Down
9 changes: 5 additions & 4 deletions modules/abstract-utxo/src/impl/bch/bch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BitGoBase } from '@bitgo/sdk-core';
import * as utxolib from '@bitgo/utxo-lib';
import { address as wasmAddress } from '@bitgo/wasm-utxo';

import { AbstractUtxoCoin } from '../../abstractUtxoCoin';
import { UtxoCoinName } from '../../names';
Expand Down Expand Up @@ -34,12 +34,13 @@ export class Bch extends AbstractUtxoCoin {
}

if (version === 'base58') {
return utxolib.addressFormat.toCanonicalFormat(address, this.network);
const script = wasmAddress.toOutputScriptWithCoin(address, this.name);
return wasmAddress.fromOutputScriptWithCoin(script, this.name, 'default');
}

if (version === 'cashaddr') {
const script = utxolib.addressFormat.toOutputScriptTryFormats(address, this.network);
return utxolib.addressFormat.fromOutputScriptWithFormat(script, version, this.network);
const script = wasmAddress.toOutputScriptWithCoin(address, this.name);
return wasmAddress.fromOutputScriptWithCoin(script, this.name, 'cashaddr');
}

throw new Error(`invalid version ${version}`);
Expand Down
9 changes: 0 additions & 9 deletions modules/abstract-utxo/src/impl/ltc/ltc.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { BitGoBase } from '@bitgo/sdk-core';
import * as utxolib from '@bitgo/utxo-lib';

import { AbstractUtxoCoin } from '../../abstractUtxoCoin';
import { UtxoCoinName } from '../../names';

export class Ltc extends AbstractUtxoCoin {
readonly name: UtxoCoinName = 'ltc';

constructor(bitgo: BitGoBase) {
super(bitgo);
// use legacy script hash version, which is the current Bitcoin one
this.altScriptHash = utxolib.networks.bitcoin.scriptHash;
// do not support alt destinations in prod
this.supportAltScriptDestination = false;
}

static createInstance(bitgo: BitGoBase): Ltc {
return new Ltc(bitgo);
}
Expand Down
7 changes: 0 additions & 7 deletions modules/abstract-utxo/src/impl/ltc/tltc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BitGoBase } from '@bitgo/sdk-core';
import * as utxolib from '@bitgo/utxo-lib';

import { UtxoCoinName } from '../../names';

Expand All @@ -8,12 +7,6 @@ import { Ltc } from './ltc';
export class Tltc extends Ltc {
readonly name: UtxoCoinName = 'tltc';

constructor(bitgo: BitGoBase) {
super(bitgo);
this.altScriptHash = utxolib.networks.testnet.scriptHash;
// support alt destinations on test
this.supportAltScriptDestination = false;
}
static createInstance(bitgo: BitGoBase): Tltc {
return new Tltc(bitgo);
}
Expand Down