Move Metamask Error to OrderErrors
This commit is contained in:
parent
7f554303b4
commit
75b9e63919
@ -3,15 +3,16 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Added `ecSignOrderAsync` to first sign an order as EIP712 and fallback to EthSign",
|
"note":
|
||||||
|
"Added `ecSignOrderAsync` to first sign an order using `eth_signTypedData` and fallback to `eth_sign`.",
|
||||||
"pr": 1102
|
"pr": 1102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"note": "Added `ecSignTypedDataOrderAsync` to sign an order exclusively as EIP712",
|
"note": "Added `ecSignTypedDataOrderAsync` to sign an order exclusively using `eth_signTypedData`.",
|
||||||
"pr": 1102
|
"pr": 1102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"note": "Rename `ecSignOrderHashAsync` to `ecSignHashAsync` removing `SignerType` parameter",
|
"note": "Rename `ecSignOrderHashAsync` to `ecSignHashAsync` removing `SignerType` parameter.",
|
||||||
"pr": 1102
|
"pr": 1102
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -210,7 +210,8 @@ export const signatureUtils = {
|
|||||||
// HACK: We are unable to handle specific errors thrown since provider is not an object
|
// HACK: We are unable to handle specific errors thrown since provider is not an object
|
||||||
// under our control. It could be Metamask Web3, Ethers, or any general RPC provider.
|
// under our control. It could be Metamask Web3, Ethers, or any general RPC provider.
|
||||||
// We check for a user denying the signature request in a way that supports Metamask and
|
// We check for a user denying the signature request in a way that supports Metamask and
|
||||||
// Coinbase Wallet
|
// Coinbase Wallet. Unfortunately for signers with a different error message,
|
||||||
|
// they will receive two signature requests.
|
||||||
if (err.message.includes('User denied message signature')) {
|
if (err.message.includes('User denied message signature')) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@ -255,9 +256,7 @@ export const signatureUtils = {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Detect if Metamask to transition users to the MetamaskSubprovider
|
// Detect if Metamask to transition users to the MetamaskSubprovider
|
||||||
if ((provider as any).isMetaMask) {
|
if ((provider as any).isMetaMask) {
|
||||||
throw new Error(
|
throw new Error(OrderError.InvalidMetamaskSigner);
|
||||||
`MetaMask provider must be wrapped in a MetamaskSubprovider (from the '@0xproject/subproviders' package) in order to work with this method.`,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@ -313,9 +312,7 @@ export const signatureUtils = {
|
|||||||
}
|
}
|
||||||
// Detect if Metamask to transition users to the MetamaskSubprovider
|
// Detect if Metamask to transition users to the MetamaskSubprovider
|
||||||
if ((provider as any).isMetaMask) {
|
if ((provider as any).isMetaMask) {
|
||||||
throw new Error(
|
throw new Error(OrderError.InvalidMetamaskSigner);
|
||||||
`MetaMask provider must be wrapped in a MetamaskSubprovider (from the '@0xproject/subproviders' package) in order to work with this method.`,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(OrderError.InvalidSignature);
|
throw new Error(OrderError.InvalidSignature);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { BigNumber } from '@0xproject/utils';
|
|||||||
|
|
||||||
export enum OrderError {
|
export enum OrderError {
|
||||||
InvalidSignature = 'INVALID_SIGNATURE',
|
InvalidSignature = 'INVALID_SIGNATURE',
|
||||||
|
InvalidMetamaskSigner = "MetaMask provider must be wrapped in a MetamaskSubprovider (from the '@0xproject/subproviders' package) in order to work with this method.",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TradeSide {
|
export enum TradeSide {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user