Skip to content

Commit

Permalink
fix: importing prepareData from browser
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Sep 20, 2023
1 parent d7b6c52 commit 83c8ccd
Show file tree
Hide file tree
Showing 8 changed files with 799 additions and 19 deletions.
7 changes: 3 additions & 4 deletions helpers/evm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MaxUint256 } from "@ethersproject/constants";
import { parseUnits } from "@ethersproject/units";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { ethers } from "ethers";

import {
TestSystemContract,
Expand All @@ -10,8 +11,6 @@ import {
UniswapV2Router02__factory,
} from "../typechain-types";

declare const hre: any;

const addZetaEthLiquidity = async (
signer: SignerWithAddress,
token: TestZRC20,
Expand Down Expand Up @@ -100,10 +99,10 @@ export const prepareData = (contract: string, types: string[], args: any[]) => {
};

export const prepareParams = (types: string[], args: any[]) => {
const abiCoder = hre.ethers.utils.defaultAbiCoder;
const abiCoder = ethers.utils.defaultAbiCoder;
for (let i = 0; i < args.length; i++) {
if (types[i] === "bytes32") {
args[i] = hre.ethers.utils.hexlify(hre.ethers.utils.zeroPad(args[i], 32));
args[i] = ethers.utils.hexlify(ethers.utils.zeroPad(args[i], 32));
}
}
return abiCoder.encode(types, args);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"exports": {
"./tasks": "./dist/tasks/index.js",
"./helpers": "./dist/helpers/index.js",
"./helpers/fees": "./dist/helpers/fees.js"
"./helpers/fees": "./dist/helpers/fees.js",
"./helpers/evm": "./dist/helpers/evm.js"
},
"scripts": {
"prebuild": "rimraf dist",
Expand Down
Loading

0 comments on commit 83c8ccd

Please sign in to comment.