diff --git a/.gitignore b/.gitignore index 55c00fd..615ca28 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ test .DS_STORE .env .openzeppelin/unknown-1337.json -networks/5777.json \ No newline at end of file +networks/5777.json +dist \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 51950bd..0000000 --- a/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -node_modules -migrations -development/ -coverage/ -coverage.json -.idea -test -migrations-ts -README.md -.solhint.json -tsconfig.migrate.json -.DS_STORE -.openzeppelin/unknown-1337.json -.env \ No newline at end of file diff --git a/contracts/RevocationRegistry.sol b/contracts/RevocationRegistry.sol index 7143e73..e6b283b 100644 --- a/contracts/RevocationRegistry.sol +++ b/contracts/RevocationRegistry.sol @@ -36,6 +36,7 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade /// @custom:oz-upgrades-unsafe-allow constructor constructor() { + initialize(); _disableInitializers(); } diff --git a/package.json b/package.json index a918d24..f5ae456 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..b454755 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +export { + EIP712ChangeStatusType +} from "./util" \ No newline at end of file diff --git a/src/util.ts b/src/util.ts new file mode 100644 index 0000000..c6a8d61 --- /dev/null +++ b/src/util.ts @@ -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, + ] +} \ No newline at end of file diff --git a/test/meta-transactions.test.ts b/test/meta-transactions.test.ts index 1bcecbf..5d0739b 100644 --- a/test/meta-transactions.test.ts +++ b/test/meta-transactions.test.ts @@ -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"); diff --git a/test/utils.ts b/test/utils.ts index 33021f9..3795f45 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -127,6 +127,8 @@ export async function signTypedData(signer: string, params: EIP712Params): Promi }); } + + interface EIP712Domain { name: string; version: string; diff --git a/tsconfig.src.json b/tsconfig.src.json new file mode 100644 index 0000000..82988ac --- /dev/null +++ b/tsconfig.src.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["./src/**/*.ts"], + "compilerOptions": { + "declaration": true + } +} \ No newline at end of file