aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-12-21 06:45:06 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-12-21 06:45:06 +0800
commit7c7085c9328ce41c97469dc50232737814a7b95f (patch)
tree17a605c5dc38836791b0a14e0acf02054a294f82 /packages/contract-wrappers
parentbbe9862aa6c0e495c58ee028d8e4964b63377d1c (diff)
downloaddexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar.gz
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar.bz2
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar.lz
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar.xz
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.tar.zst
dexon-sol-tools-7c7085c9328ce41c97469dc50232737814a7b95f.zip
feature(contract-wrappers): add support for Trust Wallet signature denial errors when trying to sense signature denial from a provider
Diffstat (limited to 'packages/contract-wrappers')
-rw-r--r--packages/contract-wrappers/CHANGELOG.json8
-rw-r--r--packages/contract-wrappers/src/utils/constants.ts3
-rw-r--r--packages/contract-wrappers/src/utils/decorators.ts5
3 files changed, 14 insertions, 2 deletions
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 9475e5a88..d39027797 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,13 @@
[
{
+ "version": "4.1.4",
+ "changes": [
+ {
+ "note": "Add support for Trust Wallet signature denial error"
+ }
+ ]
+ },
+ {
"version": "4.1.3",
"changes": [
{
diff --git a/packages/contract-wrappers/src/utils/constants.ts b/packages/contract-wrappers/src/utils/constants.ts
index c587ba526..94afdc112 100644
--- a/packages/contract-wrappers/src/utils/constants.ts
+++ b/packages/contract-wrappers/src/utils/constants.ts
@@ -14,5 +14,6 @@ export const constants = {
ZERO_AMOUNT: new BigNumber(0),
ONE_AMOUNT: new BigNumber(1),
ETHER_TOKEN_DECIMALS: 18,
- USER_DENIED_SIGNATURE_PATTERN: 'User denied transaction signature',
+ METAMASK_USER_DENIED_SIGNATURE_PATTERN: 'User denied transaction signature',
+ TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN: 'cancelled',
};
diff --git a/packages/contract-wrappers/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts
index a4207ae4c..3acfa3a88 100644
--- a/packages/contract-wrappers/src/utils/decorators.ts
+++ b/packages/contract-wrappers/src/utils/decorators.ts
@@ -30,7 +30,10 @@ const schemaErrorTransformer = (error: Error) => {
};
const signatureRequestErrorTransformer = (error: Error) => {
- if (_.includes(error.message, constants.USER_DENIED_SIGNATURE_PATTERN)) {
+ if (
+ _.includes(error.message, constants.METAMASK_USER_DENIED_SIGNATURE_PATTERN) ||
+ _.includes(error.message, constants.TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN)
+ ) {
const errMsg = ContractWrappersError.SignatureRequestDenied;
return new Error(errMsg);
}