merge development
This commit is contained in:
@@ -6,8 +6,14 @@ import Web3 = require('web3');
|
||||
import Web3ProviderEngine = require('web3-provider-engine');
|
||||
|
||||
import { LedgerSubprovider } from '../../src';
|
||||
import { DoneCallback, LedgerCommunicationClient, LedgerSubproviderErrors } from '../../src/types';
|
||||
import {
|
||||
DoneCallback,
|
||||
LedgerCommunicationClient,
|
||||
LedgerSubproviderErrors,
|
||||
WalletSubproviderErrors,
|
||||
} from '../../src/types';
|
||||
import { chaiSetup } from '../chai_setup';
|
||||
import { fixtureData } from '../utils/fixture_data';
|
||||
import { ganacheSubprovider } from '../utils/ganache_subprovider';
|
||||
import { reportCallbackErrors } from '../utils/report_callback_errors';
|
||||
|
||||
@@ -75,7 +81,7 @@ describe('LedgerSubprovider', () => {
|
||||
expect(accounts.length).to.be.equal(numberOfAccounts);
|
||||
});
|
||||
it('signs a personal message', async () => {
|
||||
const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world'));
|
||||
const data = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
|
||||
const ecSignatureHex = await ledgerSubprovider.signPersonalMessageAsync(data);
|
||||
expect(ecSignatureHex).to.be.equal(
|
||||
'0xa6cc284bff14b42bdf5e9286730c152be91719d478605ec46b3bebcd0ae491480652a1a7b742ceb0213d1e744316e285f41f878d8af0b8e632cbca4c279132d001',
|
||||
@@ -136,7 +142,7 @@ describe('LedgerSubprovider', () => {
|
||||
provider.sendAsync(payload, callback);
|
||||
});
|
||||
it('signs a personal message with personal_sign', (done: DoneCallback) => {
|
||||
const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer('hello world'));
|
||||
const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
|
||||
const payload = {
|
||||
jsonrpc: '2.0',
|
||||
method: 'personal_sign',
|
||||
@@ -219,7 +225,7 @@ describe('LedgerSubprovider', () => {
|
||||
};
|
||||
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
|
||||
expect(err).to.not.be.a('null');
|
||||
expect(err.message).to.be.equal(LedgerSubproviderErrors.SenderInvalidOrNotSupplied);
|
||||
expect(err.message).to.be.equal(WalletSubproviderErrors.SenderInvalidOrNotSupplied);
|
||||
done();
|
||||
});
|
||||
provider.sendAsync(payload, callback);
|
||||
@@ -238,7 +244,7 @@ describe('LedgerSubprovider', () => {
|
||||
};
|
||||
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
|
||||
expect(err).to.not.be.a('null');
|
||||
expect(err.message).to.be.equal(LedgerSubproviderErrors.SenderInvalidOrNotSupplied);
|
||||
expect(err.message).to.be.equal(WalletSubproviderErrors.SenderInvalidOrNotSupplied);
|
||||
done();
|
||||
});
|
||||
provider.sendAsync(payload, callback);
|
||||
|
Reference in New Issue
Block a user