aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-10-09 18:17:11 +0800
committerGitHub <noreply@github.com>2018-10-09 18:17:11 +0800
commit024bcf492ddbdceb033466aeadef220adc145332 (patch)
tree01a364d769f3eede04f4bd1e4a743784d39eea91 /packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
parent3ac9dac4f0a6b3875b7ae0ea6dd1855743768ef2 (diff)
parent75b9e639194e98febf8e378619afef2d578cbc7e (diff)
downloaddexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.gz
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.bz2
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.lz
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.xz
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.zst
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.zip
Merge pull request #1102 from 0xProject/feature/0x.js/eip712-sign-typed-data
[0x.js][order-utils][web3-wrapper] Expose eth_signTypedData functionality for order signing
Diffstat (limited to 'packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts')
-rw-r--r--packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
index f2bdda3cd..61dcbf6da 100644
--- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
@@ -47,6 +47,13 @@ describe('MnemonicWalletSubprovider', () => {
const txHex = await subprovider.signTransactionAsync(txData);
expect(txHex).to.be.equal(fixtureData.TX_DATA_ACCOUNT_1_SIGNED_RESULT);
});
+ it('signs an EIP712 sign typed data message', async () => {
+ const signature = await subprovider.signTypedDataAsync(
+ fixtureData.TEST_RPC_ACCOUNT_0,
+ fixtureData.EIP712_TEST_TYPED_DATA,
+ );
+ expect(signature).to.be.equal(fixtureData.EIP712_TEST_TYPED_DATA_SIGNED_RESULT);
+ });
});
describe('failure cases', () => {
it('throws an error if address is invalid ', async () => {
@@ -118,6 +125,20 @@ describe('MnemonicWalletSubprovider', () => {
});
provider.sendAsync(payload, callback);
});
+ it('signs an EIP712 sign typed data message with eth_signTypedData', (done: DoneCallback) => {
+ const payload = {
+ jsonrpc: '2.0',
+ method: 'eth_signTypedData',
+ params: [fixtureData.TEST_RPC_ACCOUNT_0, fixtureData.EIP712_TEST_TYPED_DATA],
+ id: 1,
+ };
+ const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
+ expect(err).to.be.a('null');
+ expect(response.result).to.be.equal(fixtureData.EIP712_TEST_TYPED_DATA_SIGNED_RESULT);
+ done();
+ });
+ provider.sendAsync(payload, callback);
+ });
});
describe('failure cases', () => {
it('should throw if `data` param not hex when calling eth_sign', (done: DoneCallback) => {