chore: remove ethers dep from wallet
This commit is contained in:
parent
1d721dc748
commit
2d98205028
@ -4,7 +4,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vegaprotocol/types": "0.0.7",
|
"@vegaprotocol/types": "0.0.7",
|
||||||
"@vegaprotocol/utils": "0.0.11",
|
"@vegaprotocol/utils": "0.0.11",
|
||||||
"ethers": "^5.6.0",
|
|
||||||
"eventemitter3": "^5.0.1",
|
"eventemitter3": "^5.0.1",
|
||||||
"js-sha3": "^0.8.0",
|
"js-sha3": "^0.8.0",
|
||||||
"zustand": "^4.5.0"
|
"zustand": "^4.5.0"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { ethers } from 'ethers';
|
|
||||||
import { sha3_256 } from 'js-sha3';
|
import { sha3_256 } from 'js-sha3';
|
||||||
import {
|
import {
|
||||||
type ApplyReferralCode,
|
type ApplyReferralCode,
|
||||||
@ -20,17 +19,16 @@ import {
|
|||||||
* Can match up the newly created order with incoming orders via a subscription
|
* Can match up the newly created order with incoming orders via a subscription
|
||||||
*/
|
*/
|
||||||
export const determineId = (sig: string) => {
|
export const determineId = (sig: string) => {
|
||||||
return sha3_256(ethers.utils.arrayify('0x' + sig));
|
return sha3_256(new Uint8Array(hexToBytes(sig)));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
function hexToBytes(hex: string) {
|
||||||
* Base64 encode a transaction object
|
const bytes = [];
|
||||||
*/
|
for (let i = 0; i < hex.length; i += 2) {
|
||||||
export const encodeTransaction = (tx: Transaction): string => {
|
bytes.push(parseInt(hex.substr(i, 2), 16));
|
||||||
return ethers.utils.base64.encode(
|
}
|
||||||
ethers.utils.toUtf8Bytes(JSON.stringify(tx))
|
return bytes;
|
||||||
);
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: We may want to create a package similar to @metamask/detect-ethereum-provider as this wont suffice
|
* TODO: We may want to create a package similar to @metamask/detect-ethereum-provider as this wont suffice
|
||||||
|
Loading…
Reference in New Issue
Block a user