Skip to content

Commit 108b8e4

Browse files
committed
refactor(sdk-coin-flrp): remove NotImplementedError from utility methods and add placeholder implementations
TICKET: WIN-8145
1 parent 3a5ff42 commit 108b8e4

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

modules/sdk-coin-flrp/src/lib/utils.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
InvalidTransactionError,
66
isValidXprv,
77
isValidXpub,
8-
NotImplementedError,
98
ParseTransactionError,
109
} from '@bitgo/sdk-core';
1110
import { FlareNetwork } from '@bitgo/statics';
@@ -17,6 +16,12 @@ import bs58 from 'bs58';
1716
import { bech32 } from 'bech32';
1817

1918
export class Utils implements BaseUtils {
19+
isValidTransactionId(txId: string): boolean {
20+
throw new Error('Method not implemented.');
21+
}
22+
isValidSignature(signature: string): boolean {
23+
throw new Error('Method not implemented.');
24+
}
2025
/**
2126
* Check if addresses in wallet match UTXO output addresses
2227
*/
@@ -260,15 +265,6 @@ export class Utils implements BaseUtils {
260265
return parseInt(outputidx.toString('hex'), 16).toString();
261266
}
262267

263-
// Required by BaseUtils interface but not implemented
264-
isValidSignature(signature: string): boolean {
265-
throw new NotImplementedError('isValidSignature not implemented');
266-
}
267-
268-
isValidTransactionId(txId: string): boolean {
269-
throw new NotImplementedError('isValidTransactionId not implemented');
270-
}
271-
272268
/**
273269
* Helper method to convert address components to string
274270
*/

modules/sdk-coin-flrp/test/unit/lib/utils.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
INVALID_SHORT_KEYPAIR_KEY,
1010
INVALID_LONG_KEYPAIR_PRV,
1111
} from '../../resources/account';
12+
import { ecc } from '@bitgo/secp256k1';
1213
import { EXPORT_IN_C } from '../../resources/transactionData/exportInC';
1314
import { IMPORT_IN_P } from '../../resources/transactionData/importInP';
1415

@@ -368,18 +369,6 @@ describe('Utils', function () {
368369
});
369370
});
370371

371-
describe('isValidSignature', function () {
372-
it('should throw NotImplementedError', function () {
373-
assert.throws(() => utils.isValidSignature(SEED_ACCOUNT.signature), /isValidSignature not implemented/);
374-
});
375-
});
376-
377-
describe('isValidTransactionId', function () {
378-
it('should throw NotImplementedError', function () {
379-
assert.throws(() => utils.isValidTransactionId(EXPORT_IN_C.txhash), /isValidTransactionId not implemented/);
380-
});
381-
});
382-
383372
describe('addressToString', function () {
384373
it('should convert address buffer to mainnet bech32 string', function () {
385374
const address = SEED_ACCOUNT.addressMainnet;
@@ -514,7 +503,6 @@ describe('Utils', function () {
514503
const privateKey = Buffer.from(SEED_ACCOUNT.privateKey, 'hex');
515504

516505
// Get original public key
517-
const { ecc } = require('@bitgo/secp256k1');
518506
const originalPubKey = Buffer.from(ecc.pointFromScalar(privateKey, true) as Uint8Array);
519507

520508
// Create signature and recover public key
@@ -529,7 +517,6 @@ describe('Utils', function () {
529517
const message = Buffer.from(SEED_ACCOUNT.message, 'utf8');
530518
const privateKey = Buffer.from(ACCOUNT_1.privateKey, 'hex');
531519

532-
const { ecc } = require('@bitgo/secp256k1');
533520
const originalPubKey = Buffer.from(ecc.pointFromScalar(privateKey, true) as Uint8Array);
534521

535522
const signature = utils.createSignature(network, message, privateKey);

0 commit comments

Comments
 (0)