Skip to content

Commit ed58fc3

Browse files
committed
refactor: use consts
ticket: WP-7083 TICKET: WP-7083
1 parent ed9ab25 commit ed58fc3

File tree

1 file changed

+3
-3
lines changed
  • modules/sdk-coin-trx/src

1 file changed

+3
-3
lines changed

modules/sdk-coin-trx/src/trx.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
getIsKrsRecovery,
1515
getIsUnsignedSweep,
1616
KeyPair,
17+
KeyIndices,
1718
MethodNotImplementedError,
1819
ParsedTransaction,
1920
ParseTransactionOptions,
@@ -284,11 +285,9 @@ export class Trx extends BaseCoin {
284285
throw new Error(`Invalid address: ${address}`);
285286
}
286287

287-
const userPub = keychains && keychains.length > 0 ? keychains[0].pub : undefined;
288-
const bitgoPub = keychains && keychains.length > 2 ? keychains[2].pub : undefined;
289-
290288
// Root address verification (Index 0)
291289
if (index === 0) {
290+
const bitgoPub = keychains && keychains.length > KeyIndices.BITGO ? keychains[KeyIndices.BITGO].pub : undefined;
292291
if (!bitgoPub) {
293292
throw new Error('BitGo public key required for root address verification');
294293
}
@@ -297,6 +296,7 @@ export class Trx extends BaseCoin {
297296

298297
// Receive address verification (Index > 0)
299298
if (index > 0) {
299+
const userPub = keychains && keychains.length > KeyIndices.USER ? keychains[KeyIndices.USER].pub : undefined;
300300
if (!userPub) {
301301
throw new Error('User public key required for receive address verification');
302302
}

0 commit comments

Comments
 (0)