-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add deployment address helper * chore: update lock file * chore: add address check & bump version * chore: remove mocha * feat: add jest test to package json * fix: add leading slash for types folder ignore * add exports * chore: remove async
- Loading branch information
1 parent
040463f
commit 7d69cb4
Showing
8 changed files
with
21,500 additions
and
13,965 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ coverage/ | |
coverage.json | ||
.idea | ||
build | ||
types | ||
types-ts | ||
/types | ||
/types-ts | ||
test | ||
.DS_STORE | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
moduleFileExtensions: ['js', 'json', 'ts'], | ||
rootDir: './', | ||
testEnvironment: 'node', | ||
testRegex: '.*\\.spec\\.ts$', | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
collectCoverageFrom: ['src/**/*.(t|j)s'], | ||
coverageReporters: | ||
process.env.CI === 'true' | ||
? ['text-summary', 'cobertura'] | ||
: ['lcov'], | ||
coveragePathIgnorePatterns: ['<rootDir>/node_modules/'], | ||
coverageDirectory: 'coverage', | ||
transformIgnorePatterns: [] | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {getDeployments} from "./deployments"; | ||
|
||
describe('Deployments', () => { | ||
it('should get deployments for chainId 5', async () => { | ||
await getDeployments(5) | ||
}) | ||
|
||
it('should throw an error getting deployments for chainId 999999', async () => { | ||
try { | ||
await getDeployments(999999) | ||
} catch(error: any) { | ||
if(error.message !== "There was a problem reading the deployment file for chainId '999999'") { | ||
throw new Error("Unexpected error in test") | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {NetworkDeployment} from "./types/NetworkDeployment"; | ||
|
||
const NETWORK_PATH = "../networks/" | ||
|
||
export function getDeployments(chainId: number): NetworkDeployment[] { | ||
try{ | ||
return require(NETWORK_PATH + chainId + ".json") | ||
} catch(error) { | ||
throw new Error(`There was a problem reading the deployment file for chainId '${chainId}'`) | ||
} | ||
} | ||
|
||
export function getRevocationRegistryDeployment(chainId: number): NetworkDeployment { | ||
try{ | ||
const deployments = getDeployments(chainId) | ||
if(typeof deployments === 'undefined' || deployments.length === 0) { | ||
throw new Error(`No deployments found for chainId ${chainId}`) | ||
} | ||
const deployment = deployments.find(deployment => deployment.contractName === "RevocationRegistry") | ||
if(typeof deployment === 'undefined') { | ||
throw new Error(`No Revocation Registry deployment found for chainId ${chainId}`) | ||
} | ||
return deployment | ||
} catch(error) { | ||
throw new Error(`There was a problem reading the deployment file for chainId '${chainId}: ${error}'`) | ||
} | ||
} | ||
|
||
export function getRevocationRegistryDeploymentAddress(chainId: number): string { | ||
const registry = getRevocationRegistryDeployment(chainId) | ||
if(typeof registry.address === 'undefined' || registry.address !== "") { | ||
throw new Error("Contract address has not been found") | ||
} | ||
return registry.address | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
export { | ||
EIP712DomainName, | ||
EIP712ChangeStatusType, | ||
EIP712ChangeStatusDelegatedType, | ||
EIP712ChangeStatusesInListType, | ||
EIP712ChangeStatusesInListDelegatedType, | ||
EIP712ChangeListOwnerType, | ||
EIP712AddListDelegateType, | ||
EIP712RemoveListDelegateType, | ||
EIP712ChangeListStatusType, | ||
} from "./util" | ||
EIP712DomainName, | ||
EIP712ChangeStatusType, | ||
EIP712ChangeStatusDelegatedType, | ||
EIP712ChangeStatusesInListType, | ||
EIP712ChangeStatusesInListDelegatedType, | ||
EIP712ChangeListOwnerType, | ||
EIP712AddListDelegateType, | ||
EIP712RemoveListDelegateType, | ||
EIP712ChangeListStatusType, | ||
} from "./util" | ||
|
||
export { | ||
getDeployments, | ||
getRevocationRegistryDeployment, | ||
getRevocationRegistryDeploymentAddress | ||
} from "./deployments" | ||
|
||
export { | ||
NetworkDeployment | ||
} from "./types/NetworkDeployment" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type NetworkDeployment = { | ||
contractName: string | ||
address: string | ||
transactionHash: string | ||
} |