Skip to content

Commit 2a8db7a

Browse files
committed
refactor: BigInt -> n
1 parent 791fd97 commit 2a8db7a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

packages/hathor-rpc-handler/__tests__/rpcMethods/sendNanoContractTx.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('sendNanoContractTx', () => {
6868
const expectedActions = [
6969
{
7070
...(rpcRequest.params.actions[0] as unknown as NanoContractActionWithStringAmount),
71-
amount: BigInt(100), // Expected conversion to BigInt
71+
amount: 100n, // Expected conversion to BigInt
7272
}
7373
];
7474

@@ -147,11 +147,11 @@ describe('sendNanoContractTx', () => {
147147
const expectedActions = [
148148
{
149149
...stringActions[0],
150-
amount: BigInt(100),
150+
amount: 100n,
151151
},
152152
{
153153
...stringActions[1],
154-
amount: BigInt(200),
154+
amount: 200n,
155155
},
156156
];
157157

@@ -268,7 +268,7 @@ describe('sendNanoContractTx', () => {
268268
args: rpcRequest.params.args,
269269
actions: [{
270270
...originalAction,
271-
amount: BigInt(100), // Convert amount to BigInt
271+
amount: 100n, // Convert amount to BigInt
272272
}],
273273
};
274274

packages/hathor-rpc-handler/__tests__/rpcMethods/sendTransaction.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('sendTransaction', () => {
5757
inputs: [{
5858
txId: 'testTxId',
5959
index: 0,
60-
value: 100,
60+
value: 100n,
6161
address: 'testAddress',
6262
token: '00',
6363
}],
@@ -104,13 +104,13 @@ describe('sendTransaction', () => {
104104
data: {
105105
outputs: [{
106106
address: 'testAddress',
107-
value: BigInt(100),
107+
value: 100n,
108108
token: '00',
109109
}],
110110
inputs: [{
111111
txId: 'testTxId',
112112
index: 0,
113-
value: 100,
113+
value: 100n,
114114
address: 'testAddress',
115115
token: '00',
116116
}],
@@ -149,7 +149,7 @@ describe('sendTransaction', () => {
149149
expect.arrayContaining([
150150
expect.objectContaining({
151151
type: 'data',
152-
value: BigInt(1),
152+
value: 1n,
153153
token: '00',
154154
data: ['test data'],
155155
}),

packages/hathor-rpc-handler/src/rpcMethods/sendTransaction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export async function sendTransaction(
104104
const result = { ...output };
105105

106106
if (result.type === 'data' || (result.data && result.data.length > 0)) {
107-
result.value = BigInt(1);
107+
result.value = 1n;
108108
result.token = constants.NATIVE_TOKEN_UID;
109109
}
110110

0 commit comments

Comments
 (0)