@injectivelabs/wallet-wallet-connect 1.16.32 → 1.16.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86,12 +86,20 @@ class WalletConnect extends wallet_base_1.BaseConcreteStrategy {
86
86
  }
87
87
  async signEip712TypedData(eip712json, address, options = {}) {
88
88
  const wc = await this.getConnectedWalletConnect();
89
- console.log('signEip712TypedData', options?.txTimeout);
89
+ // Ensure it's a number, within range [300, 604800]
90
+ let txTimeout;
91
+ if (options?.txTimeout !== undefined) {
92
+ const timeout = Number(options.txTimeout);
93
+ txTimeout =
94
+ isNaN(timeout) || timeout < 300 ? undefined : Math.min(timeout, 604800);
95
+ }
96
+ // todo: @thomas to improve this to emit an event instead of logging to the console
97
+ console.log('signEip712TypedData', txTimeout);
90
98
  try {
91
99
  return await wc.request({
92
100
  method: 'eth_signTypedData_v4',
93
101
  params: [address, eip712json],
94
- }, options?.txTimeout || undefined);
102
+ }, txTimeout || undefined);
95
103
  }
96
104
  catch (e) {
97
105
  throw new exceptions_1.WalletConnectException(new Error(e.message), {
@@ -83,12 +83,20 @@ export class WalletConnect extends BaseConcreteStrategy {
83
83
  }
84
84
  async signEip712TypedData(eip712json, address, options = {}) {
85
85
  const wc = await this.getConnectedWalletConnect();
86
- console.log('signEip712TypedData', options?.txTimeout);
86
+ // Ensure it's a number, within range [300, 604800]
87
+ let txTimeout;
88
+ if (options?.txTimeout !== undefined) {
89
+ const timeout = Number(options.txTimeout);
90
+ txTimeout =
91
+ isNaN(timeout) || timeout < 300 ? undefined : Math.min(timeout, 604800);
92
+ }
93
+ // todo: @thomas to improve this to emit an event instead of logging to the console
94
+ console.log('signEip712TypedData', txTimeout);
87
95
  try {
88
96
  return await wc.request({
89
97
  method: 'eth_signTypedData_v4',
90
98
  params: [address, eip712json],
91
- }, options?.txTimeout || undefined);
99
+ }, txTimeout || undefined);
92
100
  }
93
101
  catch (e) {
94
102
  throw new WalletConnectException(new Error(e.message), {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-wallet-connect",
3
3
  "description": "Wallet connect strategy for use with @injectivelabs/wallet-core.",
4
- "version": "1.16.32",
4
+ "version": "1.16.34",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -58,15 +58,15 @@
58
58
  "dependencies": {
59
59
  "@bangjelkoski/wallet-connect-ethereum-provider": "2.17.2",
60
60
  "@bangjelkoski/wc-ethereum-provider": "2.18.1",
61
- "@injectivelabs/exceptions": "1.16.32",
62
- "@injectivelabs/sdk-ts": "1.16.32",
63
- "@injectivelabs/ts-types": "1.16.32",
64
- "@injectivelabs/wallet-base": "1.16.32"
61
+ "@injectivelabs/exceptions": "1.16.34",
62
+ "@injectivelabs/sdk-ts": "1.16.34",
63
+ "@injectivelabs/ts-types": "1.16.34",
64
+ "@injectivelabs/wallet-base": "1.16.34"
65
65
  },
66
66
  "devDependencies": {
67
67
  "shx": "^0.3.4"
68
68
  },
69
- "gitHead": "e4461cec60f6f1255f5cb63194ce855520cbeb2e",
69
+ "gitHead": "a77a9cea69fd19e201c3c5ebf14860c7b54cc76e",
70
70
  "typedoc": {
71
71
  "entryPoint": "./src/index.ts",
72
72
  "readmeFile": "./README.md",