Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose utility stuff #25

Merged
merged 7 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ test
.DS_STORE
.env
.openzeppelin/unknown-1337.json
networks/5777.json
networks/5777.json
dist
14 changes: 0 additions & 14 deletions .npmignore

This file was deleted.

1 change: 1 addition & 0 deletions contracts/RevocationRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
initialize();
_disableInitializers();
}

Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"name": "@spherity/ethr-revocation-registry",
"version": "1.0.5",
"description": "The Ethereum Revocation List types for smart contract interaction.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"prepare": "npm run types",
"prepare": "npm run types && npm run compile-src",
"init": "docker-compose -f development/docker-compose.yml up -d",
"types": "npm run compile && npm run generate-types && npm run compile-types",
"generate-types": "npm run generate-truffle-types && npm run generate-ethers-types",
Expand All @@ -12,12 +14,20 @@
"compile-types": "npm run compile-truffle-types && npm run compile-ethers-types",
"compile-truffle-types": "echo 'truffle types are not supported yet for distribution'",
"compile-ethers-types": "tsc -p tsconfig.ethers.json --outDir ./types/ethers-v5/",
"compile-src": "tsc -p tsconfig.src.json --outDir ./dist/",
"migrate": "tsc -p ./tsconfig.migrate.json --outDir ./migrations && npm run compile && truffle migrate",
"migrate-goerli": "tsc -p ./tsconfig.migrate.json --outDir ./migrations && npm run compile && truffle migrate --network goerli",
"test": "npx truffle test",
"test:coverage": "npx truffle run coverage",
"compile": "npx truffle compile && apply-registry"
},
"files": [
"dist",
"types",
"contracts",
"networks",
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/spherity/Ethereum-Revocation-Registry.git"
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export {
EIP712ChangeStatusType
} from "./util"
12 changes: 12 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {TypedDataField} from "ethers";

export const EIP712ChangeStatusType = {
ChangeStatus: [
{name: 'revoked', type: 'bool'} as TypedDataField,
{name: 'namespace', type: 'address'} as TypedDataField,
{name: 'revocationList', type: 'bytes32'} as TypedDataField,
{name: 'revocationKey', type: 'bytes32'} as TypedDataField,
{name: 'signer', type: 'address'} as TypedDataField,
{name: 'nonce', type: 'uint'} as TypedDataField,
]
}
4 changes: 1 addition & 3 deletions test/meta-transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import {
changeListOwnerSigned, changeListStatusSigned,
changeStatusesInListDelegatedSigned,
changeStatusesInListSigned,
generateEIP712Params,
getEIP721DomainObject,
getNonce,
removeListDelegateSigned,
SignedFunction,
signTypedData
} from "./utils";
import {deployProxy} from "@openzeppelin/truffle-upgrades";
import {generateEIP712Params, getEIP721DomainObject, SignedFunction} from "./utils";

const RevocationRegistry: any = artifacts.require("RevocationRegistry");

Expand Down
2 changes: 2 additions & 0 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export async function signTypedData(signer: string, params: EIP712Params): Promi
});
}



interface EIP712Domain {
name: string;
version: string;
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"include": ["./src/**/*.ts"],
"compilerOptions": {
"declaration": true
}
}