Skip to content

Commit

Permalink
upd: webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
nitinmittal23 committed Aug 5, 2024
1 parent c302b7d commit c30c349
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 1,332 deletions.
2 changes: 1 addition & 1 deletion examples/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
USER1_FROM=0x
USER1_PRIVATE_KEY=0x
USER2_FROM=0x
GOERLI_ROOT_RPC=
ROOT_RPC=
MATIC_RPC=
ZKEVM_RPC=
PROOF_API=
35 changes: 13 additions & 22 deletions examples/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,35 @@ if (env.error) {
module.exports = {
rpc: {
pos: {
parent: process.env.GOERLI_ROOT_RPC,
child: process.env.MATIC_RPC || 'https://rpc-mumbai.matic.today',
parent: process.env.ROOT_RPC || 'https://rpc.sepolia.org',
child: process.env.MATIC_RPC || 'https://rpc-amoy.polygon.technology',
},
zkEvm: {
parent: process.env.GOERLI_ROOT_RPC,
child: process.env.ZKEVM_RPC || 'https://rpc.public.zkevm-test.net',
parent: process.env.ROOT_RPC || 'https://rpc.sepolia.org',
child: process.env.ZKEVM_RPC || 'https://rpc.cardona.zkevm-rpc.com',
},
},
pos: {
parent: {
erc20: '0x655f2166b0709cd575202630952d71e2bb0d61af',
erc721: '0x16F7EF3774c59264C46E5063b1111bCFd6e7A72f',
erc1155: '0x2e3Ef7931F2d0e4a7da3dea950FF3F19269d9063',
chainManagerAddress: '0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74', // Address of RootChainManager for POS Portal
erc20: '0xb480378044d92C96D16589Eb95986df6a97F2cFB',
erc721: '0x421DbB7B5dFCb112D7a13944DeFB80b28eC5D22C',
erc1155: '0x095DD31b6473c4a32548d2A5B09e0f2F3F30d8F1',
chainManagerAddress: '0xb991E39a401136348Dee93C75143B159FabF483f',
},
child: {
erc721: '0xbD88C3A7c0e242156a46Fbdf87141Aa6D0c0c649',
erc20: '0xfe4F5145f6e09952a5ba9e956ED0C25e3Fa4c7F1',
weth: '0x714550C2C1Ea08688607D86ed8EeF4f5E4F22323',
erc1155: '0xA07e45A987F19E25176c877d98388878622623FA',
erc20: '0xf3202E7270a10E599394d8A7dA2F4Fbd475e96bA',
erc721: '0x02f83d4110D3595872481f677Ae323D50Aa09209',
erc1155: '0x488AfDFef019f511E343becb98B7c24ee02fA639',
},
},
zkEvm: {
parent: {
bridgeAdapter: "0x5eB6485573C2Ea289554A044e1D34b41958c0842",
ether: '0x0000000000000000000000000000000000000000',
// erc20: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', // WETH
// erc20: '0x5C221E77624690fff6dd741493D735a17716c26B' // DAI
// erc20: '0x27b4861cf36453b9478cd5416426ca6fbd06f67a', // DAI TEMP
// erc20: '0xe7e7ad60b75614829be79a3014c5c6aeb006e079', // UNI TEMP
erc20: '0x4701Aa9471d7bfAc765D87dcb1Ea6BB23AD32733' // Polygon
erc20: '0x3fd0A53F4Bf853985a95F4Eb3F9C9FDE1F8e2b53', // MATIC
},
child: {
bridgeAdapter: "0x6b0393fD45B1a95EfB1bcd93536DaB44417119C3",
ether: '0x0000000000000000000000000000000000000000',
// erc20: '0x270969e59d170fB576cBB5E254493e9bfB13684f', // WETH
// erc20: '0x08bd5b6d0237FaAED3C5E04fB131de2f843aC756', // DAI
erc20: '0x73DeceDCa3d3aD2fFdB7FD5afd819a11dbc297f5' // Polygon
erc20: '0x244f21e2cDB60e9B6C9aEbB96FFe04489831F881' // MATIC
},
},
SYNCER_URL: 'https://testnetv3-syncer.api.matic.network/api/v1', // Backend service which syncs the Matic sidechain state to a MySQL database which we use for faster querying. This comes in handy especially for constructing withdrawal proofs while exiting assets from Plasma.
Expand Down
2 changes: 1 addition & 1 deletion examples/utils_pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (config.proofApi) {
const privateKey = config.user1.privateKey
const userAddress = config.user1.address

const getPOSClient = (network = 'testnet', version = 'mumbai') => {
const getPOSClient = (network = 'testnet', version = 'amoy') => {
const posClient = new POSClient()
return posClient.init({
log: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/utils_zkevm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use(Web3ClientPlugin)
const privateKey = config.user1.privateKey
const userAddress = config.user1.address

const getZkEvmClient = (optional = {}, network = 'testnet', version = 'blueberry') => {
const getZkEvmClient = (optional = {}, network = 'testnet', version = 'cardona') => {
const zkEvmClient = new ZkEvmClient()
return zkEvmClient.init({
...optional,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maticnetwork/maticjs",
"version": "3.8.3-beta.2",
"version": "3.9.0",
"description": "Javascript developer library for interacting with Matic Network",
"main": "dist/npm.export.js",
"types": "dist/ts/index.d.ts",
Expand All @@ -14,18 +14,14 @@
],
"scripts": {
"clean": "rimraf dist",
"build": "tsc",
"build:link": "webpack && npm link",
"build:dev": "webpack",
"build:prod": "webpack --env build",
"deploy": "npm run clean && npm run build:dev && npm run build:prod",
"prepublishOnly": "npm run deploy",
"lint": "tslint src/**/*.ts",
"lint:fix": "tslint src/**/*.ts --fix",
"build:test": "npm run build:link && npm run test",
"test": "cd test && npm run install:lib:test",
"debug": "webpack && cd test && npm run link:lib:debug",
"testrpc": "ganache-cli --mnemonic 'clock radar mass judge dismiss just intact mind resemble fringe diary casino' --gasLimit 13000000"
"debug": "webpack && cd test && npm run link:lib:debug"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseWeb3Client } from "../abstracts";
import { EmptyBigNumber } from "../implementation";
import { Converter } from "./converter";
import { BaseWeb3Client } from "../abstracts/base_web3_client";

export * from "./use";
export * from "./event_bus";
Expand Down
35 changes: 12 additions & 23 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,34 @@ dotenv.config({
module.exports = {
rpc: {
pos: {
parent: process.env.GOERLI_ROOT_RPC || "https://rpc.ankr.com/eth_goerli",
child: process.env.MATIC_RPC || 'https://rpc-mumbai.matic.today',
parent: process.env.GOERLI_ROOT_RPC || "https://rpc.sepolia.org",
child: process.env.MATIC_RPC || 'https://rpc-amoy.polygon.technology',
},
zkEvm: {
parent: process.env.GOERLI_ROOT_RPC || "https://rpc.ankr.com/eth_goerli",
child: process.env.ZKEVM_RPC || 'https://rpc.public.zkevm-test.net',
parent: process.env.GOERLI_ROOT_RPC || "https://rpc.sepolia.org",
child: process.env.ZKEVM_RPC || 'https://rpc.cardona.zkevm-rpc.com',
},
},
pos: {
parent: {
// erc20: '0x3f152b63ec5ca5831061b2dccfb29a874c317502',
erc20: '0x655f2166b0709cd575202630952d71e2bb0d61af',
erc721: '0x16f7ef3774c59264c46e5063b1111bcfd6e7a72f',
// erc721: '0x5a08d01e07714146747950CE07BB0f741445D1b8',
erc1155: '0x2e3Ef7931F2d0e4a7da3dea950FF3F19269d9063',
chainManagerAddress: '0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74', // Address of RootChainManager proxy for POS Portal
erc20: '0xb480378044d92C96D16589Eb95986df6a97F2cFB',
erc721: '0x421DbB7B5dFCb112D7a13944DeFB80b28eC5D22C',
erc1155: '0x095DD31b6473c4a32548d2A5B09e0f2F3F30d8F1',
chainManagerAddress: '0xb991E39a401136348Dee93C75143B159FabF483f',
},
child: {
erc721: '0xbD88C3A7c0e242156a46Fbdf87141Aa6D0c0c649',
erc20: '0xfe4F5145f6e09952a5ba9e956ED0C25e3Fa4c7F1',
// erc20: '0xA0D9f8282cD48d22Fd875E43Be32793124f8eD47',
weth: '0x714550C2C1Ea08688607D86ed8EeF4f5E4F22323',
erc1155: '0xA07e45A987F19E25176c877d98388878622623FA',
erc20: '0xf3202E7270a10E599394d8A7dA2F4Fbd475e96bA',
erc721: '0x02f83d4110D3595872481f677Ae323D50Aa09209',
erc1155: '0x488AfDFef019f511E343becb98B7c24ee02fA639',
},
},
zkEvm: {
parent: {
ether: '0x0000000000000000000000000000000000000000',
// erc20: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', // WETH
// erc20: '0xD7E55eB808693D5Ff81a3391c59886C7E0449f35' // DAI
// erc20: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', // UNI
erc20: '0x4701Aa9471d7bfAc765D87dcb1Ea6BB23AD32733', // MATIC
erc20: '0xdac17f958d2ee523a2206206994597c13d831ec7' // USDT
erc20: '0x3fd0A53F4Bf853985a95F4Eb3F9C9FDE1F8e2b53', // MATIC
},
child: {
ether: '0x0000000000000000000000000000000000000000',
// erc20: '0x3ce1bab7b7bAE26775F81Ee3576a99f0EAd5B33C', // WETH
// erc20: '0x0cdA85ADE5C84C386B69b562d1722642748DD194', // DAI
// erc20: '0x378588D64A464d61c646e5e86F4DA5277e65802C', // UNI
erc20: '0x244f21e2cDB60e9B6C9aEbB96FFe04489831F881' // MATIC
},
},
Expand Down
12 changes: 2 additions & 10 deletions test/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,12 @@ const from = user1.address;
const to = user2.address;

const execute = async () => {
// return console.log(
// Converter.toHex('matic-bor-receipt-'),
// Buffer.from('matic-bor-receipt-', 'utf-8'),
// toBuffer(Converter.toHex('matic-bor-receipt-'))
// )


const privateKey = user1.privateKey;
const mumbaiERC20 = pos.child.erc20;
const goerliERC20 = pos.parent.erc20;

const client = new POSClient();


await client.init({
log: true,
network: 'testnet',
Expand All @@ -49,7 +41,7 @@ const execute = async () => {
const mumbaiERC721Token = client.erc721(pos.child.erc721);
const goerliERC1155Token = client.erc1155(pos.parent.erc1155, true);
const mumbaiERC1155Token = client.erc1155(pos.child.erc1155);

console.log(client.client.parent)
let tx = await client.depositEther(1, "0xD7Fbe63Db5201f71482Fa47ecC4Be5e5B125eF07", {
returnTransaction: true
})
Expand Down Expand Up @@ -326,7 +318,7 @@ const executeZkEvm = async () => {
// console.log("receipt", await tx.getReceipt());
}

executeZkEvm().then(_ => {
execute().then(_ => {
process.exit(0)
}).catch(err => {
console.error(err);
Expand Down
1 change: 0 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "index.spec.js",
"scripts": {
"test:jest": "cross-env NODE_ENV=test jest --runInBand",
"link:lib": "npm link @maticnetwork/maticjs",
"debug": "dotenv node debug.js",
"link:lib:debug": "npm run link:lib && npm run debug"
Expand Down
9 changes: 0 additions & 9 deletions test/specs/index.ts

This file was deleted.

84 changes: 0 additions & 84 deletions test/specs/map_promise.spec.ts

This file was deleted.

26 changes: 0 additions & 26 deletions test/specs/pos/client.ts

This file was deleted.

Loading

0 comments on commit c30c349

Please sign in to comment.