Skip to content

Commit

Permalink
Merge pull request #432 from maticnetwork/global-index
Browse files Browse the repository at this point in the history
Global index
  • Loading branch information
py-zoid committed Mar 19, 2024
2 parents 9505e87 + 3f6a354 commit 414bc74
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maticnetwork/maticjs",
"version": "3.8.0",
"version": "3.8.2",
"description": "Javascript developer library for interacting with Matic Network",
"main": "dist/npm.export.js",
"types": "dist/ts/index.d.ts",
Expand Down
11 changes: 9 additions & 2 deletions src/utils/abi_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ export class ABIManager {
}

getABI(contractName: string, bridgeType = 'plasma'): Promise<any> {
const targetBridgeABICache = cache[this.networkName][this.version].
abi[bridgeType];
let targetBridgeABICache;

if (
cache[this.networkName] && cache[this.networkName][this.version] &&
cache[this.networkName][this.version].abi
) {
targetBridgeABICache = cache[this.networkName][this.version].abi[bridgeType];
}


if (targetBridgeABICache) {
const abiForContract = targetBridgeABICache[contractName];
Expand Down
2 changes: 1 addition & 1 deletion src/zkevm/bridge_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class BridgeUtil {
}

computeGlobalIndex(indexLocal: number, indexRollup: number, sourceNetworkId: number) {
if (sourceNetworkId === 0) {
if (BigInt(sourceNetworkId) === BigInt(0)) {
return BigInt(indexLocal) + _GLOBAL_INDEX_MAINNET_FLAG;
} else {
return BigInt(indexLocal) + BigInt(indexRollup) * BigInt(2 ** 32);
Expand Down

0 comments on commit 414bc74

Please sign in to comment.