Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 6096395

Browse files
committed
refactor: add file extension (.js) to non-index package imports in the packages
1 parent 4f61ed8 commit 6096395

File tree

12 files changed

+22
-23
lines changed

12 files changed

+22
-23
lines changed

packages/btc/src/bitcoin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import ecc from '@bitcoinerlab/secp256k1';
22
import * as bitcoin from 'bitcoinjs-lib';
33
import { ECPairFactory, ECPairInterface } from 'ecpair';
4-
import { isTaprootInput } from 'bitcoinjs-lib/src/psbt/bip371';
5-
import { isP2TR, isP2WPKH, isP2PKH } from 'bitcoinjs-lib/src/psbt/psbtutils';
4+
import { isTaprootInput } from 'bitcoinjs-lib/src/psbt/bip371.js';
5+
import { isP2TR, isP2WPKH, isP2PKH } from 'bitcoinjs-lib/src/psbt/psbtutils.js';
66

77
bitcoin.initEccLib(ecc);
88

packages/btc/src/preset/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cloneDeep from 'lodash/cloneDeep';
1+
import cloneDeep from 'lodash/cloneDeep.js';
22
import { bitcoin } from '../bitcoin';
33
import { ErrorCodes, TxBuildError } from '../error';
44
import { NetworkType, RgbppBtcConfig } from './types';

packages/btc/src/transaction/build.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clone from 'lodash/cloneDeep';
1+
import cloneDeep from 'lodash/cloneDeep.js';
22
import { bitcoin } from '../bitcoin';
33
import { DataSource } from '../query/source';
44
import { ErrorCodes, TxBuildError } from '../error';
@@ -76,7 +76,7 @@ export class TxBuilder {
7676
throw TxBuildError.withComment(ErrorCodes.DUPLICATED_UTXO, `hash: ${utxo.txid}, index: ${utxo.vout}`);
7777
}
7878

79-
utxo = clone(utxo);
79+
utxo = cloneDeep(utxo);
8080
this.inputs.push(utxoToInput(utxo));
8181
}
8282

@@ -115,7 +115,7 @@ export class TxBuilder {
115115
};
116116
}
117117
if ('address' in output || 'script' in output) {
118-
result = clone(output);
118+
result = cloneDeep(output);
119119
}
120120
if (!result) {
121121
throw new TxBuildError(ErrorCodes.UNSUPPORTED_OUTPUT);
@@ -149,8 +149,8 @@ export class TxBuilder {
149149
changeIndex: number;
150150
}> {
151151
const { address, publicKey, feeRate, changeAddress, deductFromOutputs, excludeUtxos } = props;
152-
const originalInputs = clone(this.inputs);
153-
const originalOutputs = clone(this.outputs);
152+
const originalInputs = cloneDeep(this.inputs);
153+
const originalOutputs = cloneDeep(this.outputs);
154154

155155
// Create a cache key to enable the internal caching, prevent querying the Utxo[] too often
156156
// TODO: consider provide an option to disable the cache
@@ -174,8 +174,8 @@ export class TxBuilder {
174174
while (!isFeeExpected) {
175175
if (isLoopedOnce) {
176176
previousFee = currentFee;
177-
this.inputs = clone(originalInputs);
178-
this.outputs = clone(originalOutputs);
177+
this.inputs = cloneDeep(originalInputs);
178+
this.outputs = cloneDeep(originalOutputs);
179179
}
180180

181181
const { needCollect, needReturn, inputsTotal } = this.summary();
@@ -527,8 +527,8 @@ export class TxBuilder {
527527
minUtxoSatoshi: this.minUtxoSatoshi,
528528
});
529529

530-
tx.inputs = clone(this.inputs);
531-
tx.outputs = clone(this.outputs);
530+
tx.inputs = cloneDeep(this.inputs);
531+
tx.outputs = cloneDeep(this.outputs);
532532

533533
return tx;
534534
}

packages/btc/src/transaction/fee.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { ECPairInterface } from 'ecpair';
21
import { AddressType } from '../address';
32
import { NetworkType } from '../preset/types';
43
import { toXOnly, tweakSigner } from '../utils';
54
import { networkTypeToNetwork } from '../preset/network';
65
import { isP2trScript, isP2wpkhScript } from '../script';
7-
import { bitcoin, ECPair, isTaprootInput } from '../bitcoin';
6+
import { ECPairInterface, bitcoin, ECPair, isTaprootInput } from '../bitcoin';
87
import { Utxo } from './utxo';
98

109
interface FeeEstimateAccount {

packages/btc/src/transaction/utxo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cloneDeep from 'lodash/cloneDeep';
1+
import cloneDeep from 'lodash/cloneDeep.js';
22
import { ErrorCodes, TxBuildError } from '../error';
33
import { DataSource } from '../query/source';
44
import { AddressType, AddressToPubkeyMap } from '../address';

packages/ckb/src/rgbpp/btc-time.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '../utils';
2828
import { buildSpvClientCellDep } from '../utils';
2929
import { blockchain } from '@ckb-lumos/base';
30-
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses';
30+
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses.js';
3131

3232
export const buildBtcTimeUnlockWitness = (btcTxProof: Hex): Hex => {
3333
const btcTimeUnlock = BTCTimeUnlock.pack({ btcTxProof: blockchain.Bytes.pack(btcTxProof) });

packages/ckb/src/rgbpp/btc-transfer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
scriptToHash,
4545
serializeWitnessArgs,
4646
} from '@nervosnetwork/ckb-sdk-utils';
47-
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses';
47+
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses.js';
4848

4949
/**
5050
* Generate the virtual ckb transaction for the btc transfer tx

packages/ckb/src/rgbpp/ckb-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import {
2222
u8ToHex,
2323
} from '../utils';
2424
import { InputsCapacityNotEnoughError } from '../error';
25-
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses';
25+
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses.js';
2626
import { buildSpvClientCellDep } from '../utils';
2727
import { RGBPPUnlock, Uint16 } from '../schemas/generated/rgbpp';
28-
import { Bytes } from '@ckb-lumos/base/lib/blockchain';
28+
import { Bytes } from '@ckb-lumos/base/lib/blockchain.js';
2929

3030
export const buildRgbppUnlockWitness = (
3131
btcTxBytes: Hex,

packages/ckb/src/spore/spore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {
4949
scriptToHash,
5050
serializeWitnessArgs,
5151
} from '@nervosnetwork/ckb-sdk-utils';
52-
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses';
52+
import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses.js';
5353

5454
/**
5555
* Generate the virtual ckb transaction for creating spores

packages/ckb/src/utils/ckb-tx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { calculateTransactionFee as calculateTxFee } from '@nervosnetwork/ckb-sdk-utils/lib/calculateTransactionFee';
1+
import { calculateTransactionFee as calculateTxFee } from '@nervosnetwork/ckb-sdk-utils/lib/calculateTransactionFee.js';
22
import { RawClusterData, packRawClusterData, SporeDataProps, packRawSporeData } from '@spore-sdk/core';
33
import { remove0x, u64ToLe } from './hex';
44
import {

packages/ckb/src/utils/spore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
assembleCreateClusterAction,
99
assembleCreateSporeAction,
1010
assembleTransferClusterAction,
11-
} from '@spore-sdk/core/lib/cobuild';
11+
} from '@spore-sdk/core/lib/cobuild/index.js';
1212
import { u64ToLe } from './hex';
1313
import { Hex, IndexerCell, SporesCreateCobuildParams } from '../types';
1414
import { NoRgbppLiveCellError, RgbppSporeTypeMismatchError, RgbppUtxoBindMultiTypeAssetsError } from '../error';

packages/service/src/service/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pickBy from 'lodash/pickBy';
1+
import pickBy from 'lodash/pickBy.js';
22
import { isDomain } from '../utils';
33
import { BtcAssetsApiError, ErrorCodes } from '../error';
44
import { BaseApis, BaseApiRequestOptions, BtcAssetsApiToken, BtcAssetsApiContext, Json } from '../types';

0 commit comments

Comments
 (0)