diff options
author | Jacob Evans <jacob@dekz.net> | 2018-10-09 15:26:13 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-10-09 16:01:36 +0800 |
commit | 9e8031d5e3cf94cabe07685be510397367e90413 (patch) | |
tree | 548a3918ed9eb5325db3973d76924907b142aae0 /packages/subproviders/src | |
parent | e1236a484623e9d2caab823c476175cb255ae816 (diff) | |
download | dexon-sol-tools-9e8031d5e3cf94cabe07685be510397367e90413.tar.gz dexon-sol-tools-9e8031d5e3cf94cabe07685be510397367e90413.tar.zst dexon-sol-tools-9e8031d5e3cf94cabe07685be510397367e90413.zip |
Throw and handle errors from Providers.
In web3 wrapper when a response contains an error field we throw this rather than return response.result which is often undefined.
In Signature Utils we handle the error thrown when a user rejects the signing dialogue to prevent double signing.
Exposed the ZeroExTransaction JSON schema.
In Website only use the MetamaskSubprovider if we can detect the provider is Metamask
Diffstat (limited to 'packages/subproviders/src')
-rw-r--r-- | packages/subproviders/src/index.ts | 8 | ||||
-rw-r--r-- | packages/subproviders/src/subproviders/private_key_wallet.ts | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 6a8100e68..9f4dac58b 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -57,4 +57,10 @@ export { EIP712Parameter, } from '@0xproject/types'; -export { JSONRPCRequestPayload, Provider, JSONRPCResponsePayload, JSONRPCErrorCallback } from 'ethereum-types'; +export { + JSONRPCRequestPayload, + Provider, + JSONRPCResponsePayload, + JSONRPCErrorCallback, + JSONRPCResponseError, +} from 'ethereum-types'; diff --git a/packages/subproviders/src/subproviders/private_key_wallet.ts b/packages/subproviders/src/subproviders/private_key_wallet.ts index 96e4190ed..e89c4c186 100644 --- a/packages/subproviders/src/subproviders/private_key_wallet.ts +++ b/packages/subproviders/src/subproviders/private_key_wallet.ts @@ -106,7 +106,7 @@ export class PrivateKeyWalletSubprovider extends BaseWalletSubprovider { `Requested to sign message with address: ${address}, instantiated with address: ${this._address}`, ); } - const dataBuff = signTypedDataUtils.signTypedDataHash(typedData); + const dataBuff = signTypedDataUtils.generateTypedDataHash(typedData); const sig = ethUtil.ecsign(dataBuff, this._privateKeyBuffer); const rpcSig = ethUtil.toRpcSig(sig.v, sig.r, sig.s); return rpcSig; |