Skip to content

Commit

Permalink
Merge pull request #22 from iden3/feature/support-zkevm-blockchain
Browse files Browse the repository at this point in the history
support for main and test for zkevm and sepolia network for ethereum
  • Loading branch information
vmidyllic authored Aug 16, 2023
2 parents baa0ead + 5cc340f commit d260902
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iden3/js-iden3-core",
"version": "1.0.0",
"version": "1.0.1",
"description": "Low level API to create and manipulate iden3 Claims.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
13 changes: 11 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const Constants = Object.freeze({
export enum Blockchain {
Ethereum = 'eth',
Polygon = 'polygon',
ZkEVM = 'zkevm',
Unknown = 'unknown',
NoChain = '',
ReadOnly = 'readonly'
Expand All @@ -54,6 +55,8 @@ export enum NetworkId {
Main = 'main',
Mumbai = 'mumbai',
Goerli = 'goerli',
Sepolia = 'sepolia',
Test = 'test',
Unknown = 'unknown',
NoNetwork = ''
}
Expand All @@ -79,14 +82,20 @@ export const DidMethodNetwork: {
[`${Blockchain.Polygon}:${NetworkId.Main}`]: 0b00010000 | 0b00000001,
[`${Blockchain.Polygon}:${NetworkId.Mumbai}`]: 0b00010000 | 0b00000010,
[`${Blockchain.Ethereum}:${NetworkId.Main}`]: 0b00100000 | 0b00000001,
[`${Blockchain.Ethereum}:${NetworkId.Goerli}`]: 0b00100000 | 0b00000010
[`${Blockchain.Ethereum}:${NetworkId.Goerli}`]: 0b00100000 | 0b00000010,
[`${Blockchain.Ethereum}:${NetworkId.Sepolia}`]: 0b00100000 | 0b00000011,
[`${Blockchain.ZkEVM}:${NetworkId.Main}`]: 0b00110000 | 0b00000001,
[`${Blockchain.ZkEVM}:${NetworkId.Test}`]: 0b00110000 | 0b00000010
},
[DidMethod.PolygonId]: {
[`${Blockchain.ReadOnly}:${NetworkId.NoNetwork}`]: 0b00000000,
[`${Blockchain.Polygon}:${NetworkId.Main}`]: 0b00010000 | 0b00000001,
[`${Blockchain.Polygon}:${NetworkId.Mumbai}`]: 0b00010000 | 0b00000010,
[`${Blockchain.Ethereum}:${NetworkId.Main}`]: 0b00100000 | 0b00000001,
[`${Blockchain.Ethereum}:${NetworkId.Goerli}`]: 0b00100000 | 0b00000010
[`${Blockchain.Ethereum}:${NetworkId.Goerli}`]: 0b00100000 | 0b00000010,
[`${Blockchain.Ethereum}:${NetworkId.Sepolia}`]: 0b00100000 | 0b00000011,
[`${Blockchain.ZkEVM}:${NetworkId.Main}`]: 0b00110000 | 0b00000001,
[`${Blockchain.ZkEVM}:${NetworkId.Test}`]: 0b00110000 | 0b00000010
},
[DidMethod.Other]: {
[`${Blockchain.Unknown}:${NetworkId.Unknown}`]: 0b11111111
Expand Down
14 changes: 14 additions & 0 deletions tests/did.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ describe('DID tests', () => {
chain: Blockchain.Polygon,
net: NetworkId.Mumbai,
wantDID: 'did:polygonid:polygon:mumbai:2qCU58EJgrELNZCDkSU23dQHZsBgAFWLNpNezo1g6b'
},
{
title: 'Polygon | zkEVM chain, main',
method: DidMethod.PolygonId,
chain: Blockchain.ZkEVM,
net: NetworkId.Main,
wantDID: 'did:polygonid:zkevm:main:2wQjmkL1SsgqC7AuZdUcaXsUVfEi1i58VEhm3r2r8F'
},
{
title: 'Polygon | zkEVM chain, test',
method: DidMethod.PolygonId,
chain: Blockchain.ZkEVM,
net: NetworkId.Test,
wantDID: 'did:polygonid:zkevm:test:2wcMpvr8NgWTfqN6ChaFEx1qRnLREXhjeoJ45pFyw5'
}
];

Expand Down

0 comments on commit d260902

Please sign in to comment.