diff --git a/libs/wallet/package.json b/libs/wallet/package.json index 9b4e6c607..f10d9a9c0 100644 --- a/libs/wallet/package.json +++ b/libs/wallet/package.json @@ -4,7 +4,6 @@ "dependencies": { "@vegaprotocol/types": "0.0.7", "@vegaprotocol/utils": "0.0.11", - "ethers": "^5.6.0", "eventemitter3": "^5.0.1", "js-sha3": "^0.8.0", "zustand": "^4.5.0" diff --git a/libs/wallet/src/utils.ts b/libs/wallet/src/utils.ts index 5678a9174..d901d2885 100644 --- a/libs/wallet/src/utils.ts +++ b/libs/wallet/src/utils.ts @@ -1,4 +1,3 @@ -import { ethers } from 'ethers'; import { sha3_256 } from 'js-sha3'; import { type ApplyReferralCode, @@ -20,17 +19,16 @@ import { * Can match up the newly created order with incoming orders via a subscription */ export const determineId = (sig: string) => { - return sha3_256(ethers.utils.arrayify('0x' + sig)); + return sha3_256(new Uint8Array(hexToBytes(sig))); }; -/** - * Base64 encode a transaction object - */ -export const encodeTransaction = (tx: Transaction): string => { - return ethers.utils.base64.encode( - ethers.utils.toUtf8Bytes(JSON.stringify(tx)) - ); -}; +function hexToBytes(hex: string) { + const bytes = []; + for (let i = 0; i < hex.length; i += 2) { + bytes.push(parseInt(hex.substr(i, 2), 16)); + } + return bytes; +} /** * TODO: We may want to create a package similar to @metamask/detect-ethereum-provider as this wont suffice