src/utils/webapi.js
This commit is contained in:
parent
5c4d3186d8
commit
c125a488c8
@ -35,10 +35,9 @@ const httpGet = async (url) => {
|
|||||||
const base58Alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
const base58Alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||||
|
|
||||||
export const hexToBase58 = (hexString) => {
|
export const hexToBase58 = (hexString) => {
|
||||||
const bytes = hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16));
|
hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16));
|
||||||
|
|
||||||
let base58String = '';
|
let base58String = '';
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
let num = BigInt('0x' + hexString);
|
let num = BigInt('0x' + hexString);
|
||||||
while (num > 0n) {
|
while (num > 0n) {
|
||||||
const remainder = num % 58n;
|
const remainder = num % 58n;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user