diff options
author | Jacob Evans <jacob@dekz.net> | 2018-10-01 18:37:13 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-10-05 09:59:24 +0800 |
commit | adcfaa2e80389f69e196b602955cee858a1eb40f (patch) | |
tree | d97a4c65982f5062ef70d357b6bad1181dec0292 /packages/web3-wrapper | |
parent | 119f8c94495a15ef43298a77abc87fb9d33b4bb3 (diff) | |
download | dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar.gz dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar.bz2 dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar.lz dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar.xz dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.tar.zst dexon-sol-tools-adcfaa2e80389f69e196b602955cee858a1eb40f.zip |
Expose eth_signTypedData functionality for order signing
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index d52c1cb6e..df6879a48 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -315,6 +315,21 @@ export class Web3Wrapper { return signData; } /** + * Sign an EIP712 typed data message with a specific address's private key (`eth_signTypedData`) + * @param address Address of signer + * @param typedData Typed data message to sign + * @returns Signature string (might be VRS or RSV depending on the Signer) + */ + public async signTypedDataAsync(address: string, typedData: object): Promise<string> { + assert.isETHAddressHex('address', address); + assert.doesConformToSchema('typedData', typedData, schemas.eip712TypedData); + const signData = await this.sendRawPayloadAsync<string>({ + method: 'eth_signTypedData', + params: [address, typedData], + }); + return signData; + } + /** * Fetches the latest block number * @returns Block number */ |