Skip to content

Commit 71a4fc6

Browse files
Merge pull request #673 from syscoin/feat/add-zksync-support
feat: add support for L2 networks [zksync]
2 parents 603e5e3 + ce5c34e commit 71a4fc6

File tree

8 files changed

+44
-25
lines changed

8 files changed

+44
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@headlessui/react": "^1.6.0",
5353
"@heroicons/react": "^1.0.5",
5454
"@pollum-io/sysweb3-core": "^1.0.27",
55-
"@pollum-io/sysweb3-keyring": "^1.0.485",
55+
"@pollum-io/sysweb3-keyring": "^1.0.486",
5656
"@pollum-io/sysweb3-network": "^1.0.95",
5757
"@pollum-io/sysweb3-utils": "^1.1.235",
5858
"@reduxjs/toolkit": "^1.4.0",

source/config/consts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const MV2_OPTIONS = {
7474
const MV3_OPTIONS = {
7575
manifest_version: 3,
7676
name: 'Pali Wallet',
77-
version: '3.2.0',
77+
version: '3.2.1',
7878
icons: {
7979
16: 'assets/icons/favicon-16.png',
8080
32: 'assets/icons/favicon-32.png',

source/pages/Send/Confirm.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ export const SendConfirm = () => {
913913
const arrayValidation = [
914914
!fee?.gasLimit,
915915
!fee?.maxFeePerGas,
916-
!fee?.baseFee,
917-
!fee?.maxPriorityFeePerGas,
918916
isBitcoinBased,
919917
];
920918

@@ -925,13 +923,7 @@ export const SendConfirm = () => {
925923
Number(validateCustomGasLimit ? customFee.gasLimit : fee?.gasLimit)) /
926924
10 ** 9
927925
);
928-
}, [
929-
fee?.maxPriorityFeePerGas,
930-
fee?.gasLimit,
931-
fee?.maxFeePerGas,
932-
customFee,
933-
isBitcoinBased,
934-
]);
926+
}, [fee?.gasLimit, fee?.maxFeePerGas, customFee, isBitcoinBased]);
935927

936928
useEffect(() => {
937929
if (!copied) return;

source/scripts/Background/controllers/MainController.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
KeyringAccountType,
1010
IWalletState,
1111
CustomJsonRpcProvider,
12+
CustomL2JsonRpcProvider,
1213
} from '@pollum-io/sysweb3-keyring';
1314
import {
1415
getSysRpc,
@@ -1218,14 +1219,23 @@ class MainController extends KeyringManager {
12181219
isPolling?: boolean;
12191220
}) {
12201221
const { accounts } = store.getState().vault;
1222+
const L2Networks = [324, 300];
1223+
const isL2Network = L2Networks.includes(activeNetwork.chainId);
12211224

12221225
const currentAccount = accounts[activeAccount.type][activeAccount.id];
12231226

1224-
let internalProvider: CustomJsonRpcProvider | undefined;
1227+
let internalProvider:
1228+
| CustomJsonRpcProvider
1229+
| CustomL2JsonRpcProvider
1230+
| undefined;
12251231

12261232
if (isPolling) {
1233+
const CurrentProvider = isL2Network
1234+
? CustomL2JsonRpcProvider
1235+
: CustomJsonRpcProvider;
1236+
12271237
const abortController = new AbortController();
1228-
internalProvider = new CustomJsonRpcProvider(
1238+
internalProvider = new CurrentProvider(
12291239
abortController.signal,
12301240
activeNetwork.url
12311241
);

source/scripts/Background/controllers/balances/evm.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { ethers } from 'ethers';
22

3-
import { CustomJsonRpcProvider } from '@pollum-io/sysweb3-keyring';
3+
import {
4+
CustomJsonRpcProvider,
5+
CustomL2JsonRpcProvider,
6+
} from '@pollum-io/sysweb3-keyring';
47

58
import { IPaliAccount } from 'state/vault/types';
69
import { ONE_MILLION } from 'utils/constants';
@@ -10,7 +13,7 @@ import { IEvmBalanceController } from './types';
1013
import { zerosRepeatingAtStartOfEvmBalance } from './utils';
1114

1215
const EvmBalanceController = (
13-
web3Provider: CustomJsonRpcProvider
16+
web3Provider: CustomJsonRpcProvider | CustomL2JsonRpcProvider
1417
): IEvmBalanceController => {
1518
const getEvmBalanceForAccount = async (currentAccount: IPaliAccount) => {
1619
try {

source/scripts/Background/controllers/balances/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { CustomJsonRpcProvider } from '@pollum-io/sysweb3-keyring';
1+
import {
2+
CustomJsonRpcProvider,
3+
CustomL2JsonRpcProvider,
4+
} from '@pollum-io/sysweb3-keyring';
25

36
import { IPaliAccount } from 'state/vault/types';
47

@@ -7,14 +10,14 @@ import SyscoinBalanceController from './syscoin';
710
import { IBalancesManager } from './types';
811

912
const BalancesManager = (
10-
web3Provider: CustomJsonRpcProvider
13+
web3Provider: CustomJsonRpcProvider | CustomL2JsonRpcProvider
1114
): IBalancesManager => {
1215
const evmBalanceController = EvmBalanceController(web3Provider);
1316
const getBalanceUpdatedForAccount = async (
1417
currentAccount: IPaliAccount,
1518
isBitcoinBased: boolean,
1619
networkUrl: string,
17-
provider?: CustomJsonRpcProvider
20+
provider?: CustomJsonRpcProvider | CustomL2JsonRpcProvider
1821
) => {
1922
switch (isBitcoinBased) {
2023
case true:

source/scripts/Background/controllers/balances/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { CustomJsonRpcProvider } from '@pollum-io/sysweb3-keyring';
1+
import {
2+
CustomJsonRpcProvider,
3+
CustomL2JsonRpcProvider,
4+
} from '@pollum-io/sysweb3-keyring';
25

36
import { IPaliAccount } from 'state/vault/types';
47

@@ -18,7 +21,7 @@ export interface IBalancesManagerUtils {
1821
currentAccount: IPaliAccount,
1922
isBitcoinBased: boolean,
2023
networkUrl: string,
21-
provider?: CustomJsonRpcProvider
24+
provider?: CustomJsonRpcProvider | CustomL2JsonRpcProvider
2225
) => Promise<string>;
2326
}
2427

yarn.lock

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,10 +2379,10 @@
23792379
resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-core/-/sysweb3-core-1.0.27.tgz#2ecbf38c3b5f6821ec2bcc95472eed0a2f11cd10"
23802380
integrity sha512-HHW2ozdXCac2Xo0oUQgRk/sczBIGQCBvsqYBIwondipA3Rx4/jGC6Y9U/M4wpTi5wQ+ZD18DyEbKAVMXElGcbQ==
23812381

2382-
"@pollum-io/sysweb3-keyring@^1.0.485":
2383-
version "1.0.485"
2384-
resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-keyring/-/sysweb3-keyring-1.0.485.tgz#88095c5b87dd83e9f38e641db2ee90d5669e896c"
2385-
integrity sha512-sz6Q0Q49ObTo+ewYEcQBYW51fep5X57wkNLJialI2Y8h1mF/b4xg+dkHQvkqjEIx+05fpyVtpC4RrhiWifKTNQ==
2382+
"@pollum-io/sysweb3-keyring@^1.0.486":
2383+
version "1.0.486"
2384+
resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-keyring/-/sysweb3-keyring-1.0.486.tgz#199b75b917a3cecf5e536c49999646898bec3ba1"
2385+
integrity sha512-vZpZ7PllQT2KAbL1I75mJH8rZlCjMJi5jA/1/Gi3urSIP/JLCqhx4jQ7iVK/rkuNU0ceCT0ZT/JAmVFBHzavgQ==
23862386
dependencies:
23872387
"@bitcoinerlab/descriptors" "^2.0.1"
23882388
"@bitcoinerlab/secp256k1" "^1.0.5"
@@ -2415,6 +2415,7 @@
24152415
syscoinjs-lib "^1.0.218"
24162416
syscointx-js "^1.0.106"
24172417
web3 "^1.7.1"
2418+
zksync-ethers "5"
24182419

24192420
"@pollum-io/sysweb3-network@^1.0.95":
24202421
version "1.0.95"
@@ -7233,7 +7234,7 @@ ethers-eip712@^0.2.0:
72337234
resolved "https://registry.yarnpkg.com/ethers-eip712/-/ethers-eip712-0.2.0.tgz#52973b3a9a22638f7357283bf66624994c6e91ed"
72347235
integrity sha512-fgS196gCIXeiLwhsWycJJuxI9nL/AoUPGSQ+yvd+8wdWR+43G+J1n69LmWVWvAON0M6qNaf2BF4/M159U8fujQ==
72357236

7236-
[email protected], ethers@^5.5.4, ethers@^5.6.4, ethers@^5.6.9:
7237+
[email protected], ethers@^5.5.4, ethers@^5.6.4, ethers@^5.6.9, ethers@~5.7.0:
72377238
version "5.7.2"
72387239
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e"
72397240
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==
@@ -15270,3 +15271,10 @@ zip-webpack-plugin@^4.0.1:
1527015271
integrity sha512-G041Q4qUaog44Ynit6gs4o+o3JIv0WWfOLvc8Q3IxvPfuqd2KBHhpJWAXUB9Cm1JcWHTIOp9vS3oGMWa1p1Ehw==
1527115272
dependencies:
1527215273
yazl "^2.5.1"
15274+
15275+
zksync-ethers@5:
15276+
version "5.10.0"
15277+
resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-5.10.0.tgz#3caf25478539a3fd6e170c13555cec6a1dae32e2"
15278+
integrity sha512-OAjTGAHF9wbdkRGkj7XZuF/a1Sk/FVbwH4pmLjAKlR7mJ7sQtQhBhrPU2dCc67xLaNvEESPfwil19ES5wooYFg==
15279+
dependencies:
15280+
ethers "~5.7.0"

0 commit comments

Comments
 (0)