aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/web3-wrapper/src')
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts15
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
*/