Skip to content

Commit

Permalink
patch eth-permit
Browse files Browse the repository at this point in the history
  • Loading branch information
gorgos committed Oct 9, 2020
1 parent e93edb3 commit a7b337d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Package for implementing the ERC20 permit (EIP-2612)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"postinstall": "patch-package",
"test": "npx buidler --network localhost test"
},
"repository": {
"type": "git",
Expand All @@ -22,9 +23,6 @@
"bugs": {
"url": "https://github.com/soliditylabs/ERC20-permit/issues"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"homepage": "https://github.com/soliditylabs/ERC20-permit#readme",
"devDependencies": {
"@nomiclabs/buidler": "^1.4.7",
Expand All @@ -39,7 +37,12 @@
"ethereumjs-common": "^1.5.2",
"ethereumjs-tx": "^2.1.2",
"ganache-cli": "^6.11.0",
"patch-package": "^6.2.2",
"solc": "^0.7.2",
"web3": "^1.3.0"
}
},
"directories": {
"test": "test"
},
"dependencies": {}
}
21 changes: 21 additions & 0 deletions patches/eth-permit+0.1.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/node_modules/eth-permit/dist/rpc.js b/node_modules/eth-permit/dist/rpc.js
index 050c552..d993dec 100644
--- a/node_modules/eth-permit/dist/rpc.js
+++ b/node_modules/eth-permit/dist/rpc.js
@@ -14,6 +14,7 @@ const randomId = () => Math.floor(Math.random() * 10000000000);
exports.send = (provider, method, params) => new Promise((resolve, reject) => {
const payload = {
id: randomId(),
+ jsonrpc: '2.0',
method,
params,
};
@@ -38,7 +39,7 @@ exports.send = (provider, method, params) => new Promise((resolve, reject) => {
});
exports.signData = (provider, fromAddress, typeData) => __awaiter(void 0, void 0, void 0, function* () {
const _typeData = typeof typeData === 'string' ? typeData : JSON.stringify(typeData);
- const result = yield exports.send(provider, 'eth_signTypedData_v4', [fromAddress, _typeData]);
+ const result = yield exports.send(provider, 'eth_signTypedData', [fromAddress, JSON.parse(_typeData)]);
return {
r: result.slice(0, 66),
s: '0x' + result.slice(66, 130),

0 comments on commit a7b337d

Please sign in to comment.