Skip to content

Commit 9c1ec27

Browse files
committed
fix(bitgo): use import = and type to resolve errors
TICKET: WP-5182
1 parent 496326c commit 9c1ec27

File tree

10 files changed

+20
-17
lines changed

10 files changed

+20
-17
lines changed

modules/bitgo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"webpack-dev": "cross-env NODE_ENV=development webpack",
2727
"webpack-prod": "NODE_OPTIONS=--max-old-space-size=4096 cross-env NODE_ENV=production webpack",
2828
"test": "npm run coverage",
29-
"unit-test": "mocha 'dist/test/v2/unit/**/*.js' 'dist/test/unit/**/*.js'",
29+
"unit-test": "mocha 'test/v2/unit/**/*.ts' 'test/unit/**/*.ts'",
3030
"coverage": "nyc -- npm run unit-test",
3131
"integration-test": "nyc -- mocha \"test/v2/integration/**/*.ts\"",
3232
"browser-test": "karma start karma.conf.js",

modules/bitgo/test/unit/bip32path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @prettier
33
*/
44
import 'should';
5-
import { bip32, BIP32Interface } from '@bitgo/utxo-lib';
5+
import { bip32, type BIP32Interface } from '@bitgo/utxo-lib';
66
import { sanitizeLegacyPath, bitcoin } from '@bitgo/sdk-core';
77
import { getSeed } from '@bitgo/sdk-test';
88
const { HDNode, hdPath } = bitcoin;

modules/bitgo/test/unit/decryptKeychain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'should';
2-
import { decryptKeychainPrivateKey, OptionalKeychainEncryptedKey } from '@bitgo/sdk-core';
2+
import { decryptKeychainPrivateKey, type OptionalKeychainEncryptedKey } from '@bitgo/sdk-core';
33
import { BitGoAPI } from '@bitgo/sdk-api';
44

55
describe('decryptKeychainPrivateKey', () => {

modules/bitgo/test/v2/unit/accountConsolidations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { common, Wallet } from '@bitgo/sdk-core';
1212

1313
import { TestBitGo } from '@bitgo/sdk-test';
1414
import { BitGo } from '../../../src/bitgo';
15-
const algoFixtures = require('../../../../../sdk-coin-algo/test/fixtures/algo');
15+
const algoFixtures = require('../../../../sdk-coin-algo/test/fixtures/algo');
1616

1717
nock.disableNetConnect();
1818

modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @prettier
33
*/
44
import { bitgo } from '@bitgo/utxo-lib';
5-
import { AddressInfo, TransactionIO } from '@bitgo/blockapis';
6-
import { AbstractUtxoCoin, RecoveryProvider } from '@bitgo/abstract-utxo';
5+
import type { AddressInfo, TransactionIO } from '@bitgo/blockapis';
6+
import type { AbstractUtxoCoin, RecoveryProvider } from '@bitgo/abstract-utxo';
77
import * as utxolib from '@bitgo/utxo-lib';
88
import { Bch } from '@bitgo/sdk-coin-bch';
99
import { Bsv } from '@bitgo/sdk-coin-bsv';
@@ -52,13 +52,15 @@ export class MockRecoveryProvider implements RecoveryProvider {
5252
}
5353
}
5454
export class MockCrossChainRecoveryProvider<TNumber extends number | bigint> implements RecoveryProvider {
55+
public coin: AbstractUtxoCoin;
56+
public unspents: Unspent<TNumber>[];
57+
public tx: utxolib.bitgo.UtxoTransaction<TNumber>;
5558
private addressVersion: 'cashaddr' | 'base58';
5659
private addressFormat: utxolib.addressFormat.AddressFormat;
57-
constructor(
58-
public coin: AbstractUtxoCoin,
59-
public unspents: Unspent<TNumber>[],
60-
public tx: utxolib.bitgo.UtxoTransaction<TNumber>
61-
) {
60+
constructor(coin: AbstractUtxoCoin, unspents: Unspent<TNumber>[], tx: utxolib.bitgo.UtxoTransaction<TNumber>) {
61+
this.coin = coin;
62+
this.unspents = unspents;
63+
this.tx = tx;
6264
// this is how blockchair will return the data, as a cashaddr for BCH like coins
6365
// BSV supports cashaddr, but at the time of writing the SDK does not support cashaddr for bsv
6466
this.addressFormat = this.coin instanceof Bch && !(this.coin instanceof Bsv) ? 'cashaddr' : 'default';

modules/bitgo/test/v2/unit/coins/utxo/util/keychains.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
22
* @prettier
33
*/
4-
import { Triple } from '@bitgo/sdk-core';
4+
import type { Triple } from '@bitgo/sdk-core';
55
import { encrypt } from '@bitgo/sdk-api';
66
import { getSeed } from '@bitgo/sdk-test';
7-
import { bip32, BIP32Interface, bitgo } from '@bitgo/utxo-lib';
7+
import { bip32, type BIP32Interface, bitgo } from '@bitgo/utxo-lib';
88

99
type RootWalletKeys = bitgo.RootWalletKeys;
1010

modules/bitgo/test/v2/unit/errors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import 'should';
2-
const assert = require('assert');
2+
import assert from 'assert';
33
import { BitGoJsError, NodeEnvironmentError } from '@bitgo/sdk-core';
44

55
describe('Error handling', () => {
66
it('should capture stack trace', function namedFunc() {
77
const { stack } = new BitGoJsError();
8+
assert(stack);
89
assert.match(stack, /BitGoJsError/);
910
assert.match(stack, /at Context\.namedFunc/);
1011
new NodeEnvironmentError().stack!.should.match(/NodeEnvironmentError:/);

modules/bitgo/test/v2/unit/internal/opengpgUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { openpgpUtils } from '@bitgo/sdk-core';
77
import { ecc as secp256k1 } from '@bitgo/utxo-lib';
88
import * as sinon from 'sinon';
99

10-
const sodium = require('libsodium-wrappers-sumo');
10+
import sodium from 'libsodium-wrappers-sumo';
1111

1212
describe('OpenGPG Utils Tests', function () {
1313
let senderKey: { publicKey: string; privateKey: string };

modules/bitgo/test/v2/unit/internal/tssUtils/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExchangeCommitmentResponse, RequestType, SignatureShareRecord } from '@bitgo/sdk-core';
1+
import { type ExchangeCommitmentResponse, RequestType, type SignatureShareRecord } from '@bitgo/sdk-core';
22
import nock from 'nock';
33
import * as _ from 'lodash';
44

modules/bitgo/test/v2/unit/mmi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BitGo } from '../../../src/bitgo';
44
import nock from 'nock';
55
import { bip32 } from '@bitgo/utxo-lib';
66
import { common, TransactionType } from '@bitgo/sdk-core';
7-
import { AvaxC as AvaxCAccountLib, getBuilder } from '@bitgo/account-lib';
7+
import { AvaxC as AvaxCAccountLib, getBuilder } from '../../../../account-lib';
88

99
nock.enableNetConnect();
1010

0 commit comments

Comments
 (0)