From 57296f2efc27059c3215bb7017cdb152c013e08c Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Thu, 1 Feb 2024 19:45:23 +0530 Subject: [PATCH 1/6] feat: Implemenetd tx estimation Signed-off-by: tipusinghaw --- src/registrar.ts | 98 ++++++++++++++++++++++++++++++++++++++++--- tests/polygon.test.ts | 49 +++++++++++++++++++++- 2 files changed, 141 insertions(+), 6 deletions(-) diff --git a/src/registrar.ts b/src/registrar.ts index bd3c532..19e20f8 100644 --- a/src/registrar.ts +++ b/src/registrar.ts @@ -1,6 +1,7 @@ import { Contract, JsonRpcProvider, + Network, SigningKey, Wallet, computeAddress, @@ -38,14 +39,29 @@ export type ResourcePayload = { nextVersionId: string | null } +export type EstimatedTxDetails = { + transactionFee: string + gasLimit: string + gasPrice: string + maxFeePerGas: number + maxPriorityFeePerGas: number + network: string + chainId: string + method: string +} + export class PolygonDID { private registry: Contract + private contractAddress: string + private rpcUrl: string public constructor({ contractAddress, rpcUrl, signingKey, }: PolygonDidInitOptions) { + this.contractAddress = contractAddress + this.rpcUrl = rpcUrl const provider = new JsonRpcProvider(rpcUrl) const wallet = new Wallet(signingKey, provider) this.registry = new Contract( @@ -55,7 +71,8 @@ export class PolygonDID { ) } - static createKeyPair(network?: string) { + static createKeyPair(network: string) { + let did: string = '' const wallet = Wallet.createRandom() const privateKey = wallet.privateKey const address = computeAddress(privateKey) @@ -68,16 +85,13 @@ export class PolygonDID { if (network !== 'testnet' && network !== 'mainnet') { throw new Error('Invalid network provided') } - let did: string = '' if (network === 'mainnet') { did = `did:polygon:${address}` } else { did = `did:polygon:${network}:${address}` } - return { address, privateKey, publicKeyBase58, did } } - - return { address, privateKey, publicKeyBase58 } + return { address, privateKey, publicKeyBase58, did } } public async create({ @@ -293,4 +307,78 @@ export class PolygonDID { throw error } } + + public async estimateTxFee( + method: string, + argument: string[], + ): Promise { + try { + const provider = new JsonRpcProvider(this.rpcUrl) + const contract = new Contract( + this.contractAddress, + DidRegistryContract.abi, + provider, + ) + + // Encode function data + const encodedFunction = await contract.interface.encodeFunctionData( + method, + argument, + ) + + // Check if encodedFunction is null or empty + if (!encodedFunction) { + throw new Error('Error while getting encoded function details') + } + + // Estimate gas limit + const gasLimit = await provider.estimateGas({ + to: this.contractAddress, + data: encodedFunction, + }) + + // Convert gas limit to Gwei + const gasLimitGwei = parseFloat(String(gasLimit)) / 1e9 + + // Get gas price details + const gasPriceDetails = await provider.getFeeData() + + // Check if gas price details are available + if (!gasPriceDetails || !gasPriceDetails.gasPrice) { + throw new Error('Gas price details not found!') + } + + // Convert gas price to Gwei + const gasPriceGwei = parseFloat(String(gasPriceDetails.gasPrice)) / 1e9 + + // Get network details + const networkDetails: Network = await provider.getNetwork() + + // Check if network details are available + if (!networkDetails) { + throw new Error('Network details not found!') + } + + // Calculate transaction fee + const transactionFee = gasLimitGwei * gasPriceGwei + + // Create EstimatedTxDetails object + const estimatedTxDetails: EstimatedTxDetails = { + transactionFee: String(transactionFee), + gasLimit: String(gasLimitGwei), + gasPrice: String(gasPriceGwei), + maxFeePerGas: parseFloat(String(gasPriceDetails.maxFeePerGas)) / 1e9, + maxPriorityFeePerGas: + parseFloat(String(gasPriceDetails.maxPriorityFeePerGas)) / 1e9, + network: String(networkDetails.name), + chainId: String(networkDetails.chainId), + method, + } + console.log('estimatedTxDetails:::', estimatedTxDetails) + return estimatedTxDetails + } catch (error) { + console.error('Error calculating transaction fee:', error) + return null + } + } } diff --git a/tests/polygon.test.ts b/tests/polygon.test.ts index 505144c..b4a3346 100644 --- a/tests/polygon.test.ts +++ b/tests/polygon.test.ts @@ -9,6 +9,7 @@ import { describe, it, before } from 'node:test' import assert from 'node:assert' import { arrayHasKeys } from './utils/array' import { PolygonDID } from '../src/registrar' +import { SigningKey } from 'ethers' const NETWORK_URL = testContractDetails.networkUrl const CONTRACT_ADDRESS = testContractDetails.contractAddress //Can add external smart contract address @@ -43,7 +44,7 @@ describe('Registrar', () => { polygonDidRegistrar = new PolygonDID({ contractAddress: CONTRACT_ADDRESS, rpcUrl: NETWORK_URL, - privateKey: keyPair.privateKey, + signingKey: new SigningKey(`0x${keyPair.privateKey}`), }) await new Promise((r) => setTimeout(r, 5000)) }) @@ -226,4 +227,50 @@ describe('Registrar', () => { ) }) }) + + describe('test estimate transaction', () => { + let transactionDetails: any + + before(async () => { + transactionDetails = await polygonDidRegistrar.estimateTxFee( + 'createDID', + [ + '0x13cd23928Ae515b86592C630f56C138aE4c7B79a', + '68768734687ytruwytuqyetrywqt', + ], + ) + }) + console.log('transactionDetails::::', transactionDetails) + + it('should have non-empty values for transaction details', () => { + assert.ok(transactionDetails) + + assert.ok(transactionDetails.transactionFee) + assert.notStrictEqual( + transactionDetails.transactionFee, + '' || null || undefined, + ) + + assert.ok(transactionDetails.gasLimit) + assert.notStrictEqual( + transactionDetails.gasLimit, + '' || null || undefined, + ) + + assert.ok(transactionDetails.gasPrice) + assert.notStrictEqual( + transactionDetails.gasPrice, + '' || null || undefined, + ) + + assert.ok(transactionDetails.network) + assert.notStrictEqual(transactionDetails.network, '' || null || undefined) + + assert.ok(transactionDetails.chainId) + assert.notStrictEqual(transactionDetails.chainId, '' || null || undefined) + + assert.ok(transactionDetails.method) + assert.notStrictEqual(transactionDetails.method, '' || null || undefined) + }) + }) }) From 5974c98b7ec2ed355b9becacf7187b2f15e21d5d Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Mon, 5 Feb 2024 19:12:46 +0530 Subject: [PATCH 2/6] fix: added validation for empty response Signed-off-by: tipusinghaw --- src/registrar.ts | 23 ++++++++++++++++++++--- tests/fixtures/test.data.ts | 1 + tests/polygon.test.ts | 36 +++++++++++++++++------------------- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/registrar.ts b/src/registrar.ts index 19e20f8..76c2bde 100644 --- a/src/registrar.ts +++ b/src/registrar.ts @@ -126,7 +126,9 @@ export class PolygonDID { parsedDid.didAddress, stringDidDoc, ) - + if (!txnHash) { + throw new Error('Error while creating DID in registry!') + } return { did, txnHash, @@ -156,6 +158,9 @@ export class PolygonDID { parsedDid.didAddress, JSON.stringify(didDoc), ) + if (!txnHash) { + throw new Error('Error while updating DID in registry!') + } return { did, didDoc, @@ -192,7 +197,9 @@ export class PolygonDID { resourceId, stringDidDoc, ) - + if (!txnHash) { + throw new Error('Error while adding DID resource in registry!') + } return { did, resourceId, @@ -233,6 +240,10 @@ export class PolygonDID { stringDidDoc, ) + if (!txnHash) { + throw new Error('Error while updating DID resource in registry!') + } + return { did, resourceId, @@ -265,6 +276,10 @@ export class PolygonDID { resourceId, ) + if (!linkedResource) { + throw new Error(`Invalid parameters or resource does not exists!`) + } + return { did, linkedResource: JSON.parse(linkedResource), @@ -296,6 +311,9 @@ export class PolygonDID { parsedDid.didAddress, ) + if (!listLinkedResource) { + throw new Error(`Invalid parameters or resource does not exists!`) + } return { did, linkedResources: listLinkedResource.map((element: string) => { @@ -374,7 +392,6 @@ export class PolygonDID { chainId: String(networkDetails.chainId), method, } - console.log('estimatedTxDetails:::', estimatedTxDetails) return estimatedTxDetails } catch (error) { console.error('Error calculating transaction fee:', error) diff --git a/tests/fixtures/test.data.ts b/tests/fixtures/test.data.ts index 622d662..7b2dfdd 100644 --- a/tests/fixtures/test.data.ts +++ b/tests/fixtures/test.data.ts @@ -77,5 +77,6 @@ export const testDidDetails = { export const testContractDetails = { contractAddress: '0x12513116875BB3E4F098Ce74624739Ee51bAf023', + unitTestCaseContractAddess: '0x55D479D1260Dc7cA907c27292d6F49c1E8B461Af', networkUrl: 'https://rpc-mumbai.maticvigil.com', } diff --git a/tests/polygon.test.ts b/tests/polygon.test.ts index b4a3346..8a6a3a6 100644 --- a/tests/polygon.test.ts +++ b/tests/polygon.test.ts @@ -1,7 +1,6 @@ import { testDidDetails, resourceJson, - testResourceId, updateDidDocument, testContractDetails, } from './fixtures/test.data' @@ -12,7 +11,7 @@ import { PolygonDID } from '../src/registrar' import { SigningKey } from 'ethers' const NETWORK_URL = testContractDetails.networkUrl -const CONTRACT_ADDRESS = testContractDetails.contractAddress //Can add external smart contract address +const CONTRACT_ADDRESS = testContractDetails.unitTestCaseContractAddess //Can add external smart contract address describe('Registrar', () => { let polygonDidRegistrar: PolygonDID @@ -168,12 +167,15 @@ describe('Registrar', () => { }) }) - describe('test resolve all DID linked-resource by DID function', () => { - let resolveResourceByDid: any + describe('test resolve DID linked-resource by DID and resourceId function', () => { + let resolveResourceByDidAndId: any before(async () => { - resolveResourceByDid = - await polygonDidRegistrar.getResourcesByDid(polygonDID) + resolveResourceByDidAndId = + await polygonDidRegistrar.getResourceByDidAndResourceId( + polygonDID, + '9c64d7c6-5678-4bc2-91e2-d4a0688e8a76', + ) }) it('should match correct resource details after resolving linked resource with valid DID', async () => { @@ -190,21 +192,19 @@ describe('Registrar', () => { 'nextVersionId', ] - resolveResourceByDid?.linkedResource?.forEach((resource: any) => { - assert.deepStrictEqual(Object.keys(resource), expectedKeys) - }) + assert.deepStrictEqual( + Object.keys(resolveResourceByDidAndId.linkedResource), + expectedKeys, + ) }) }) - describe('test resolve DID linked-resource by DID and resourceId function', () => { + describe('test resolve all DID linked-resource by DID function', () => { let resolveResourceByDid: any before(async () => { resolveResourceByDid = - await polygonDidRegistrar.getResourceByDidAndResourceId( - polygonDID, - testResourceId, - ) + await polygonDidRegistrar.getResourcesByDid(polygonDID) }) it('should match correct resource details after resolving linked resource with valid DID', async () => { @@ -221,10 +221,9 @@ describe('Registrar', () => { 'nextVersionId', ] - assert.deepStrictEqual( - Object.keys(resolveResourceByDid.linkedResource), - expectedKeys, - ) + resolveResourceByDid?.linkedResource?.forEach((resource: any) => { + assert.deepStrictEqual(Object.keys(resource), expectedKeys) + }) }) }) @@ -240,7 +239,6 @@ describe('Registrar', () => { ], ) }) - console.log('transactionDetails::::', transactionDetails) it('should have non-empty values for transaction details', () => { assert.ok(transactionDetails) From 353830cb43cb4b37ffd6ddf60fce7895958834e8 Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Tue, 6 Feb 2024 18:40:45 +0530 Subject: [PATCH 3/6] fix: updated did resolver approach for methods Signed-off-by: tipusinghaw --- package.json | 2 + pnpm-lock.yaml | 152 +++++++++++++++++++++++++++++++++++++++++++++++ src/registrar.ts | 33 +++++----- 3 files changed, 172 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 89b534d..d922ce1 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "license": "MIT", "dependencies": { "@ayanworks/polygon-did-registry-contract": "2.0.1-alpha.3", + "@ayanworks/polygon-did-resolver": "^0.0.16-alpha.3", + "did-resolver": "^4.1.0", "@ethersproject/basex": "^5.7.0", "@ethersproject/signing-key": "^5.7.0", "@ethersproject/transactions": "^5.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d498c4..452ae09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ dependencies: '@ayanworks/polygon-did-registry-contract': specifier: 2.0.1-alpha.3 version: 2.0.1-alpha.3 + '@ayanworks/polygon-did-resolver': + specifier: ^0.0.16-alpha.3 + version: 0.0.16-alpha.8 '@ethersproject/basex': specifier: ^5.7.0 version: 5.7.0 @@ -20,6 +23,9 @@ dependencies: '@ethersproject/wallet': specifier: ^5.7.0 version: 5.7.0 + did-resolver: + specifier: ^4.1.0 + version: 4.1.0 ethers: specifier: ^6.9.0 version: 6.9.0 @@ -57,6 +63,17 @@ packages: resolution: {integrity: sha512-8FZZVAmzXZn0pjZasuxdRblL0obK91JoaoXzpM4oZ7hD5VRUbiWf7BTh17WsWc6Oaf6XtafT4csuBo11fZiUoQ==} dev: false + /@ayanworks/polygon-did-resolver@0.0.16-alpha.8: + resolution: {integrity: sha512-rTubdjbwGtvIoSpR3OWp/7SseShCZNzJ41Rd5yL/Y/xYlX8PJr2zWUM0pcUouReVQzgeAYuUphHAV0QpqWRoSQ==} + dependencies: + '@ayanworks/polygon-did-registry-contract': 2.0.1-alpha.3 + did-resolver: 4.1.0 + ethers: 5.7.2 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@babel/code-frame@7.22.10: resolution: {integrity: sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==} engines: {node: '>=6.9.0'} @@ -86,6 +103,20 @@ packages: '@jridgewell/trace-mapping': 0.3.9 dev: true + /@ethersproject/abi@5.7.0: + resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@ethersproject/abstract-provider@5.7.0: resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} dependencies: @@ -151,6 +182,21 @@ packages: '@ethersproject/bignumber': 5.7.0 dev: false + /@ethersproject/contracts@5.7.0: + resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + dev: false + /@ethersproject/hash@5.7.0: resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} dependencies: @@ -230,6 +276,34 @@ packages: '@ethersproject/logger': 5.7.0 dev: false + /@ethersproject/providers@5.7.2: + resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + bech32: 1.1.4 + ws: 7.4.6 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@ethersproject/random@5.7.0: resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} dependencies: @@ -263,6 +337,17 @@ packages: hash.js: 1.1.7 dev: false + /@ethersproject/solidity@5.7.0: + resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@ethersproject/strings@5.7.0: resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} dependencies: @@ -285,6 +370,14 @@ packages: '@ethersproject/signing-key': 5.7.0 dev: false + /@ethersproject/units@5.7.0: + resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + /@ethersproject/wallet@5.7.0: resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} dependencies: @@ -741,6 +834,10 @@ packages: engines: {node: '>=10.0.0'} dev: true + /bech32@1.1.4: + resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} + dev: false + /before-after-hook@2.2.3: resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} dev: true @@ -1121,6 +1218,10 @@ packages: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} dev: true + /did-resolver@4.1.0: + resolution: {integrity: sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==} + dev: false + /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} @@ -1305,6 +1406,44 @@ packages: engines: {node: '>=0.10.0'} dev: true + /ethers@5.7.2: + resolution: {integrity: sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/contracts': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/hdnode': 5.7.0 + '@ethersproject/json-wallets': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/pbkdf2': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/providers': 5.7.2 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + '@ethersproject/solidity': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/units': 5.7.0 + '@ethersproject/wallet': 5.7.0 + '@ethersproject/web': 5.7.1 + '@ethersproject/wordlists': 5.7.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /ethers@6.9.0: resolution: {integrity: sha512-pmfNyQzc2mseLe91FnT2vmNaTt8dDzhxZ/xItAV7uGsF4dI4ek2ufMu3rAkgQETL/TIs0GS5A+U05g9QyWnv3Q==} engines: {node: '>=14.0.0'} @@ -3296,6 +3435,19 @@ packages: typedarray-to-buffer: 3.1.5 dev: true + /ws@7.4.6: + resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /ws@8.5.0: resolution: {integrity: sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==} engines: {node: '>=10.0.0'} diff --git a/src/registrar.ts b/src/registrar.ts index 76c2bde..a55f1bf 100644 --- a/src/registrar.ts +++ b/src/registrar.ts @@ -13,6 +13,8 @@ import DidRegistryContract from '@ayanworks/polygon-did-registry-contract' import { Base58 } from '@ethersproject/basex' import { computePublicKey } from '@ethersproject/signing-key' import { v4 as uuidv4 } from 'uuid' +import { getResolver } from '@ayanworks/polygon-did-resolver' +import { Resolver } from 'did-resolver' export type PolygonDidInitOptions = { contractAddress: string @@ -54,12 +56,14 @@ export class PolygonDID { private registry: Contract private contractAddress: string private rpcUrl: string + public resolver: Resolver public constructor({ contractAddress, rpcUrl, signingKey, }: PolygonDidInitOptions) { + this.resolver = new Resolver(getResolver()) this.contractAddress = contractAddress this.rpcUrl = rpcUrl const provider = new JsonRpcProvider(rpcUrl) @@ -107,9 +111,9 @@ export class PolygonDID { const parsedDid = parseDid(did) - const resolveDidDoc = await this.registry.getDIDDoc(parsedDid.didAddress) + const didDetails = await this.resolver.resolve(did) - if (resolveDidDoc[0]) { + if (didDetails.didDocument) { throw new Error('The DID document already registered!') } @@ -152,6 +156,10 @@ export class PolygonDID { if (!didDoc && !JSON.parse(didDoc)) { throw new Error('Invalid DID has been entered!') } + const didDetails = await this.resolver.resolve(did) + if (!didDetails.didDocument) { + throw new Error(`The DID document for the given DID was not found!`) + } // Calling smart contract with update DID document on matic chain const txnHash = await this.registry.updateDIDDoc( @@ -183,12 +191,10 @@ export class PolygonDID { validateResourcePayload(resourcePayload) - const resolveDidDoc = await this.registry.getDIDDoc(parsedDid.didAddress) - - if (!resolveDidDoc[0]) { + const didDetails = await this.resolver.resolve(did) + if (!didDetails.didDocument) { throw new Error(`The DID document for the given DID was not found!`) } - const stringDidDoc = JSON.stringify(resourcePayload) const resourceId = uuidv4() @@ -226,9 +232,8 @@ export class PolygonDID { validateResourcePayload(resourcePayload) - const resolveDidDoc = await this.registry.getDIDDoc(parsedDid.didAddress) - - if (!resolveDidDoc[0]) { + const didDetails = await this.resolver.resolve(did) + if (!didDetails.didDocument) { throw new Error(`The DID document for the given DID was not found!`) } @@ -265,9 +270,8 @@ export class PolygonDID { const parsedDid = parseDid(did) - const resolveDidDoc = await this.registry.getDIDDoc(parsedDid.didAddress) - - if (!resolveDidDoc[0]) { + const didDetails = await this.resolver.resolve(did) + if (!didDetails.didDocument) { throw new Error(`The DID document for the given DID was not found!`) } @@ -301,9 +305,8 @@ export class PolygonDID { const parsedDid = parseDid(did) - const resolveDidDoc = await this.registry.getDIDDoc(parsedDid.didAddress) - - if (!resolveDidDoc[0]) { + const didDetails = await this.resolver.resolve(did) + if (!didDetails.didDocument) { throw new Error(`The DID document for the given DID was not found!`) } From c645d7f64521dd584f96a3418f9e3ff55e80c903 Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Tue, 6 Feb 2024 18:53:43 +0530 Subject: [PATCH 4/6] fix: updated lock.yaml Signed-off-by: tipusinghaw --- pnpm-lock.yaml | 197 ++++++++++++++++++++++++------------------------- 1 file changed, 97 insertions(+), 100 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24f6ebc..cf1b535 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -123,6 +123,7 @@ packages: - bufferutil - utf-8-validate dev: false + /@babel/code-frame@7.10.4: resolution: {integrity: sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==} dependencies: @@ -177,22 +178,6 @@ packages: dev: true optional: true - /@ethersproject/abi@5.7.0: - resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} - dependencies: - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/abstract-provider@5.7.0: - resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} /@babel/generator@7.23.6: resolution: {integrity: sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==} engines: {node: '>=6.9.0'} @@ -286,23 +271,6 @@ packages: dev: true optional: true - /@ethersproject/contracts@5.7.0: - resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} - dependencies: - '@ethersproject/abi': 5.7.0 - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/transactions': 5.7.0 - dev: false - - /@ethersproject/hash@5.7.0: - resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} /@babel/helper-function-name@7.23.0: resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} engines: {node: '>=6.9.0'} @@ -365,36 +333,6 @@ packages: dev: true optional: true - /@ethersproject/providers@5.7.2: - resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} - dependencies: - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/base64': 5.7.0 - '@ethersproject/basex': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.1 - '@ethersproject/properties': 5.7.0 - '@ethersproject/random': 5.7.0 - '@ethersproject/rlp': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/web': 5.7.1 - bech32: 1.1.4 - ws: 7.4.6 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - dev: false - - /@ethersproject/random@5.7.0: - resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} /@babel/helper-remap-async-to-generator@7.22.20(@babel/core@7.23.9): resolution: {integrity: sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw==} engines: {node: '>=6.9.0'} @@ -437,19 +375,6 @@ packages: dev: true optional: true - /@ethersproject/solidity@5.7.0: - resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/strings@5.7.0: - resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} /@babel/helper-split-export-declaration@7.22.6: resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} @@ -1944,6 +1869,20 @@ packages: - web-streams-polyfill dev: true + /@ethersproject/abi@5.7.0: + resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@ethersproject/abstract-provider@5.7.0: resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} dependencies: @@ -2009,6 +1948,21 @@ packages: '@ethersproject/bignumber': 5.7.0 dev: false + /@ethersproject/contracts@5.7.0: + resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + dev: false + /@ethersproject/hash@5.7.0: resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} dependencies: @@ -2088,6 +2042,34 @@ packages: '@ethersproject/logger': 5.7.0 dev: false + /@ethersproject/providers@5.7.2: + resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + bech32: 1.1.4 + ws: 7.4.6 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@ethersproject/random@5.7.0: resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} dependencies: @@ -2121,6 +2103,17 @@ packages: hash.js: 1.1.7 dev: false + /@ethersproject/solidity@5.7.0: + resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@ethersproject/strings@5.7.0: resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} dependencies: @@ -2143,6 +2136,14 @@ packages: '@ethersproject/signing-key': 5.7.0 dev: false + /@ethersproject/units@5.7.0: + resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + /@ethersproject/wallet@5.7.0: resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} dependencies: @@ -2668,7 +2669,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.22 + '@jridgewell/trace-mapping': 0.3.9 dev: true optional: true @@ -2691,16 +2692,6 @@ packages: dev: true optional: true - /@ethersproject/units@5.7.0: - resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/wallet@5.7.0: - resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} dev: true @@ -4982,9 +4973,6 @@ packages: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} dev: true - /did-resolver@4.1.0: - resolution: {integrity: sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==} - dev: false /destroy@1.2.0: resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -5000,7 +4988,6 @@ packages: /did-resolver@4.1.0: resolution: {integrity: sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==} - dev: true /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} @@ -5271,6 +5258,12 @@ packages: engines: {node: '>=0.10.0'} dev: true + /etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + dev: true + optional: true + /ethers@5.7.2: resolution: {integrity: sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==} dependencies: @@ -5308,11 +5301,6 @@ packages: - bufferutil - utf-8-validate dev: false - /etag@1.8.1: - resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} - engines: {node: '>= 0.6'} - dev: true - optional: true /ethers@6.9.0: resolution: {integrity: sha512-pmfNyQzc2mseLe91FnT2vmNaTt8dDzhxZ/xItAV7uGsF4dI4ek2ufMu3rAkgQETL/TIs0GS5A+U05g9QyWnv3Q==} @@ -8636,7 +8624,7 @@ packages: resolution: {integrity: sha512-cq/o30z9W2Wb4rzBefjv5fBalHU0rJGZCHAkf/RHSBWSSYwh8PlQTqqOJmgIIbBtpj27T6FIPXeomIjZtCNVqA==} dependencies: shell-quote: 1.8.1 - ws: 7.5.9 + ws: 7.4.6 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -10397,8 +10385,6 @@ packages: typedarray-to-buffer: 3.1.5 dev: true - /ws@7.4.6: - resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} /ws@6.2.2: resolution: {integrity: sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==} peerDependencies: @@ -10414,6 +10400,18 @@ packages: dev: true optional: true + /ws@7.4.6: + resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + /ws@7.5.9: resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==} engines: {node: '>=8.3.0'} @@ -10425,7 +10423,6 @@ packages: optional: true utf-8-validate: optional: true - dev: false dev: true optional: true From 3fb2b496078bfbd7e54d03ee89d9c2f3f70655fc Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Tue, 6 Feb 2024 18:58:09 +0530 Subject: [PATCH 5/6] fix: removed unwanted test case Signed-off-by: tipusinghaw --- tests/polygon.test.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tests/polygon.test.ts b/tests/polygon.test.ts index ebbf0f6..6b15b7c 100644 --- a/tests/polygon.test.ts +++ b/tests/polygon.test.ts @@ -276,35 +276,5 @@ describe('Registrar', () => { assert.notStrictEqual(transactionDetails.method, '' || null || undefined) }) - it('should have non-empty values for transaction details', () => { - assert.ok(transactionDetails) - - assert.ok(transactionDetails.transactionFee) - assert.notStrictEqual( - transactionDetails.transactionFee, - '' || null || undefined, - ) - - assert.ok(transactionDetails.gasLimit) - assert.notStrictEqual( - transactionDetails.gasLimit, - '' || null || undefined, - ) - - assert.ok(transactionDetails.gasPrice) - assert.notStrictEqual( - transactionDetails.gasPrice, - '' || null || undefined, - ) - - assert.ok(transactionDetails.network) - assert.notStrictEqual(transactionDetails.network, '' || null || undefined) - - assert.ok(transactionDetails.chainId) - assert.notStrictEqual(transactionDetails.chainId, '' || null || undefined) - - assert.ok(transactionDetails.method) - assert.notStrictEqual(transactionDetails.method, '' || null || undefined) - }) }) }) From 71f56a38709a32f73f0b70007b4a2a0c59a06a81 Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Tue, 6 Feb 2024 19:00:52 +0530 Subject: [PATCH 6/6] fix: formatter issue Signed-off-by: tipusinghaw --- tests/polygon.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/polygon.test.ts b/tests/polygon.test.ts index 6b15b7c..1afa719 100644 --- a/tests/polygon.test.ts +++ b/tests/polygon.test.ts @@ -275,6 +275,5 @@ describe('Registrar', () => { assert.ok(transactionDetails.method) assert.notStrictEqual(transactionDetails.method, '' || null || undefined) }) - }) })