From a388e5121cf38482c47e718ef0e2a04150e78abb Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Mon, 26 Aug 2024 20:53:15 +0200 Subject: [PATCH] Remove base64-arraybuffer --- .changelog/2048.trivial.md | 1 + package.json | 1 - src/app/lib/helpers.ts | 7 +++---- yarn.lock | 5 ----- 4 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 .changelog/2048.trivial.md diff --git a/.changelog/2048.trivial.md b/.changelog/2048.trivial.md new file mode 100644 index 0000000000..88815efa5a --- /dev/null +++ b/.changelog/2048.trivial.md @@ -0,0 +1 @@ +Remove base64-arraybuffer diff --git a/package.json b/package.json index 86270cfe3f..7d07f47647 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "@oasisprotocol/ionic-ledger-hw-transport-ble": "6.0.0", "@oasisprotocol/ledger": "1.0.0", "@reduxjs/toolkit": "1.9.7", - "base64-arraybuffer": "1.0.2", "bignumber.js": "9.1.2", "bip39": "3.1.0", "body-scroll-lock": "4.0.0-beta.0", diff --git a/src/app/lib/helpers.ts b/src/app/lib/helpers.ts index ad50cce27c..46c81c1955 100644 --- a/src/app/lib/helpers.ts +++ b/src/app/lib/helpers.ts @@ -1,13 +1,12 @@ -import { quantity, staking, types } from '@oasisprotocol/client' -import { decode as base64decode, encode as base64encode } from 'base64-arraybuffer' +import { misc, quantity, staking, types } from '@oasisprotocol/client' import BigNumber from 'bignumber.js' import { StringifiedBigInt } from 'types/StringifiedBigInt' import { consensusDecimals, type ParaTimeConfig } from '../../config' export const uint2hex = (uint: Uint8Array) => Buffer.from(uint).toString('hex') export const hex2uint = (hex: string) => new Uint8Array(Buffer.from(hex, 'hex')) -export const base64ToUint = (value: string) => new Uint8Array(base64decode(value)) -export const uintToBase64 = (value: Uint8Array) => base64encode(value) +export const base64ToUint = (value: string) => misc.fromBase64(value) +export const uintToBase64 = (value: Uint8Array) => misc.toBase64(value) export const shortPublicKey = async (publicKey: Uint8Array) => { return await staking.addressFromPublicKey(publicKey) diff --git a/yarn.lock b/yarn.lock index 5adc2aabe7..c4a816b83b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3945,11 +3945,6 @@ base-x@^3.0.8: dependencies: safe-buffer "^5.0.1" -base64-arraybuffer@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc" - integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ== - base64-js@^1.3.1, base64-js@^1.5.1: version "1.5.1" resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"