Skip to content
Merged
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
7 changes: 4 additions & 3 deletions modules/abstract-utxo/src/abstractUtxoCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ export abstract class AbstractUtxoCoin
{
public altScriptHash?: number;
public supportAltScriptDestination?: boolean;
public defaultSdkBackend: SdkBackend = 'utxolib';
public readonly amountType: 'number' | 'bigint';
private readonly _network: utxolib.Network;

Expand Down Expand Up @@ -536,17 +537,17 @@ export abstract class AbstractUtxoCoin

decodeTransaction<TNumber extends number | bigint>(
input: Buffer | string,
decodeWith?: SdkBackend
decodeWith: SdkBackend = this.defaultSdkBackend
): DecodedTransaction<TNumber> {
if (typeof input === 'string') {
const buffer = stringToBufferTryFormats(input, ['hex', 'base64']);
return this.decodeTransaction(buffer, decodeWith);
}

if (utxolib.bitgo.isPsbt(input)) {
return decodePsbtWith(input, this.network, decodeWith ?? 'utxolib');
return decodePsbtWith(input, this.network, decodeWith);
} else {
if (decodeWith ?? 'utxolib' !== 'utxolib') {
if (decodeWith !== 'utxolib') {
console.error('received decodeWith hint %s, ignoring for legacy transaction', decodeWith);
}
return utxolib.bitgo.createTransactionFromBuffer(input, this.network, {
Expand Down