Skip to content

Commit b5ebaab

Browse files
committed
refactor: using JSONBigInt for stringifying create token data
1 parent f03f728 commit b5ebaab

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/components/Reown/modals/CreateTokenModal.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,8 @@ import React, { useEffect, useState } from 'react';
99
import { t } from 'ttag';
1010
import { useDispatch } from 'react-redux';
1111
import { setCreateTokenStatusReady } from '../../../actions';
12+
import { JSONBigInt } from '@hathor/wallet-lib/lib/utils/bigint';
1213

13-
/**
14-
* Custom replacer function for JSON.stringify to handle BigInt values
15-
* @param {string} key - The key of the value being stringified
16-
* @param {any} value - The value being stringified
17-
* @returns {any} - The processed value
18-
*/
19-
const bigIntReplacer = (_key, value) => {
20-
if (typeof value === 'bigint') {
21-
return value.toString();
22-
}
23-
return value;
24-
};
2514

2615
/**
2716
* Modal for handling token creation requests from dApps
@@ -44,7 +33,7 @@ export function CreateTokenModal({ data, onAccept, onReject }) {
4433
// Process the data to handle BigInt values
4534
const processedData = React.useMemo(() => {
4635
try {
47-
return JSON.stringify(data.data, bigIntReplacer, 2);
36+
return JSONBigInt.stringify(data.data, 2);
4837
} catch (error) {
4938
console.error('Error stringifying token data:', error);
5039
return 'Error displaying token data. Please check console for details.';

0 commit comments

Comments
 (0)