@0x/web3-wrapper
Advanced tools
Comparing version 7.2.10 to 7.3.0
[ | ||
{ | ||
"version": "7.3.0", | ||
"changes": [ | ||
{ | ||
"note": "Add `Web3Wrapper.signTypedDataV4Async()` (metamask EIP712)", | ||
"pr": 13 | ||
} | ||
], | ||
"timestamp": 1607481991 | ||
}, | ||
{ | ||
"timestamp": 1606873582, | ||
@@ -4,0 +14,0 @@ "version": "7.2.10", |
@@ -8,2 +8,6 @@ <!-- | ||
## v7.3.0 - _December 9, 2020_ | ||
* Add `Web3Wrapper.signTypedDataV4Async()` (metamask EIP712) (#13) | ||
## v7.2.10 - _December 2, 2020_ | ||
@@ -10,0 +14,0 @@ |
@@ -150,2 +150,9 @@ import { AbiDecoder, BigNumber } from '@0x/utils'; | ||
/** | ||
* Sign an EIP712 typed data message with a specific address's private key (MetaMask's `eth_signTypedData_v4`) | ||
* @param address Address of signer | ||
* @param typedData Typed data message to sign | ||
* @returns Signature string (as RSV) | ||
*/ | ||
signTypedDataV4Async(address: string, typedData: any): Promise<string>; | ||
/** | ||
* Fetches the latest block number | ||
@@ -152,0 +159,0 @@ * @returns Block number |
@@ -356,2 +356,19 @@ "use strict"; | ||
/** | ||
* Sign an EIP712 typed data message with a specific address's private key (MetaMask's `eth_signTypedData_v4`) | ||
* @param address Address of signer | ||
* @param typedData Typed data message to sign | ||
* @returns Signature string (as RSV) | ||
*/ | ||
signTypedDataV4Async(address, typedData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
assert_1.assert.isETHAddressHex('address', address); | ||
assert_1.assert.doesConformToSchema('typedData', typedData, json_schemas_1.schemas.eip712TypedDataSchema); | ||
const signData = yield this.sendRawPayloadAsync({ | ||
method: 'eth_signTypedData_v4', | ||
params: [address, JSON.stringify(typedData)], | ||
}); | ||
return signData; | ||
}); | ||
} | ||
/** | ||
* Fetches the latest block number | ||
@@ -358,0 +375,0 @@ * @returns Block number |
{ | ||
"name": "@0x/web3-wrapper", | ||
"version": "7.2.10", | ||
"version": "7.3.0", | ||
"engines": { | ||
@@ -74,3 +74,3 @@ "node": ">=6.12" | ||
}, | ||
"gitHead": "e5b2c8c477f85dac6956ff52085e25eb7f2030cf" | ||
"gitHead": "cdaedc34f56c3a47da693beaaaaf82153ef23ad7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
136235
2348