diff --git a/package.json b/package.json index d5a158c..f8b034b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@iden3/js-iden3-core", - "version": "1.7.0", + "version": "1.8.0", "description": "Low level API to create and manipulate iden3 Claims.", "source": "./src/index.ts", "exports": { diff --git a/src/constants.ts b/src/constants.ts index 67ea613..2a59905 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -48,6 +48,7 @@ export const Blockchain: { [k: string]: string } = { Privado: 'privado', Billions: 'billions', Linea: 'linea', + Redbelly: 'redbelly', Unknown: 'unknown', NoChain: '', ReadOnly: 'readonly' @@ -62,6 +63,8 @@ export const NetworkId: { [k: string]: string } = { Zkevm: 'zkevm', Cardona: 'cardona', Test: 'test', + Mainnet: 'mainnet', + Testnet: 'testnet', Unknown: 'unknown', NoNetwork: '' }; @@ -69,6 +72,7 @@ export const NetworkId: { [k: string]: string } = { export const DidMethod: { [k: string]: string } = { Iden3: 'iden3', PolygonId: 'polygonid', + Receptor: 'receptor', Other: '' }; @@ -90,12 +94,15 @@ export const ChainIds: { [key: string]: number } = { [`${Blockchain.Linea}:${NetworkId.Main}`]: 59144, [`${Blockchain.Linea}:${NetworkId.Sepolia}`]: 59141, [`${Blockchain.Billions}:${NetworkId.Main}`]: 45056, - [`${Blockchain.Billions}:${NetworkId.Test}`]: 6913 + [`${Blockchain.Billions}:${NetworkId.Test}`]: 6913, + [`${Blockchain.Redbelly}:${NetworkId.Mainnet}`]: 151, + [`${Blockchain.Redbelly}:${NetworkId.Testnet}`]: 153 }; export const DidMethodByte: { [key: string]: number } = { [DidMethod.Iden3]: 0b00000001, [DidMethod.PolygonId]: 0b00000010, + [DidMethod.Receptor]: 0b10000011, [DidMethod.Other]: 0b11111111 }; @@ -114,7 +121,9 @@ const blockchainNetworkMap = { [`${Blockchain.Linea}:${NetworkId.Main}`]: 0b0100_0000 | 0b0000_1001, [`${Blockchain.Linea}:${NetworkId.Sepolia}`]: 0b0100_0000 | 0b0000_1000, [`${Blockchain.Billions}:${NetworkId.Main}`]: 0b1011_0000 | 0b0000_0001, - [`${Blockchain.Billions}:${NetworkId.Test}`]: 0b1011_0000 | 0b0000_0010 + [`${Blockchain.Billions}:${NetworkId.Test}`]: 0b1011_0000 | 0b0000_0010, + [`${Blockchain.Redbelly}:${NetworkId.Mainnet}`]: 0b01010111, + [`${Blockchain.Redbelly}:${NetworkId.Testnet}`]: 0b10000011 }; // DIDMethodNetwork is map for did methods and their blockchain networks @@ -127,6 +136,9 @@ export const DidMethodNetwork: { [DidMethod.PolygonId]: { ...blockchainNetworkMap }, + [DidMethod.Receptor]: { + ...blockchainNetworkMap + }, [DidMethod.Other]: { [`${Blockchain.Unknown}:${NetworkId.Unknown}`]: 0b1111_1111 } diff --git a/tests/did.test.ts b/tests/did.test.ts index 734acad..8a76036 100644 --- a/tests/did.test.ts +++ b/tests/did.test.ts @@ -194,6 +194,20 @@ describe('DID tests', () => { chain: Blockchain.Linea, net: NetworkId.Sepolia, wantDID: 'did:iden3:linea:sepolia:28itzVLBHnMHocFAeArLFYHP59J7WN1s5JwL8yGpQw' + }, + { + title: 'Receptor | Redbelly, mainnet', + method: DidMethod.Receptor, + chain: Blockchain.Redbelly, + net: NetworkId.Mainnet, + wantDID: 'did:receptor:redbelly:mainnet:31A9FG7T3SZpaoU7b77yRBXt682Y8Z6vK7PHhgrUAAB' + }, + { + title: 'Receptor | Redbelly, testnet', + method: DidMethod.Receptor, + chain: Blockchain.Redbelly, + net: NetworkId.Testnet, + wantDID: 'did:receptor:redbelly:testnet:31Jxbg6JJG5xFqUbfEEFEKrDyBQsQHEgzN7JdBWRkCg' } ];