From a1cc14489b7d8998f4a5fc53d95d30b3cc6c48a5 Mon Sep 17 00:00:00 2001 From: Brandon Black Date: Thu, 22 Jun 2023 13:04:26 -0700 Subject: [PATCH] fix(sdk-core): do not treat sol as a utxo-coin for approval Solana _and_ Bitcoin-like coins have `network` property. This will now only detect Bitcoin-like coins as intended. Should fix approving pending approvals for Solana. Issue: BG-79393 --- .../sdk-core/src/bitgo/pendingApproval/pendingApproval.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts b/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts index 316b068b4c..d6c0c3de1e 100644 --- a/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts +++ b/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts @@ -3,6 +3,7 @@ */ import * as _ from 'lodash'; import * as common from '../../common'; +import * as utxolib from '@bitgo/utxo-lib'; import { IBaseCoin } from '../baseCoin'; import { BitGoBase } from '../bitgoBase'; import { @@ -183,9 +184,9 @@ export class PendingApproval implements IPendingApproval { const recipients = this.info()?.transactionRequest?.buildParams?.recipients || []; const type = this.info()?.transactionRequest?.buildParams?.type; - // We only want to not recreate transactions with no recipients if it is an UTXO coin. - // There is no easy way to do this in sdk-core, but `network` is only set on UTXO coins. - if ('network' in this.baseCoin && recipients.length === 0 && type !== 'consolidate') { + // We only want to not recreate transactions with no recipients if it is a UTXO coin. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (utxolib.isValidNetwork((this.baseCoin as any).network) && recipients.length === 0 && type !== 'consolidate') { canRecreateTransaction = false; }