@depay/web3-wallets-evm 16.5.4 → 17.0.0

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.
@@ -1,7 +1,6 @@
1
1
  import { request, estimate, getProvider } from '@depay/web3-client-evm';
2
2
  import Blockchains from '@depay/web3-blockchains';
3
3
  import { ethers } from 'ethers';
4
- import { WalletConnectClient } from '@depay/walletconnect-v1';
5
4
  import { SignClient } from '@depay/walletconnect-v2';
6
5
  import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
7
6
 
@@ -9,7 +8,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
9
8
  supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
10
9
  supported$1.solana = [];
11
10
 
12
- function _optionalChain$n(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11
+ function _optionalChain$l(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
13
12
  class Transaction {
14
13
 
15
14
  constructor({
@@ -34,7 +33,7 @@ class Transaction {
34
33
  this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
35
34
 
36
35
  // optional
37
- this.value = _optionalChain$n([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
36
+ this.value = _optionalChain$l([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
38
37
  this.api = api;
39
38
  this.method = method;
40
39
  this.params = params;
@@ -74,7 +73,7 @@ class Transaction {
74
73
  }
75
74
 
76
75
  getParamType(param) {
77
- if(_optionalChain$n([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
76
+ if(_optionalChain$l([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
78
77
  return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
79
78
  } else {
80
79
  return param.type
@@ -147,9 +146,9 @@ class Transaction {
147
146
  }
148
147
  }
149
148
 
150
- function _optionalChain$m(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
149
+ function _optionalChain$k(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
151
150
 
152
- const sendTransaction$3 = async ({ transaction, wallet })=> {
151
+ const sendTransaction$2 = async ({ transaction, wallet })=> {
153
152
  transaction = new Transaction(transaction);
154
153
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
155
154
  await wallet.switchTo(transaction.blockchain);
@@ -162,13 +161,13 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
162
161
  transaction.nonce = transactionCount;
163
162
  let provider = new ethers.providers.Web3Provider(wallet.getProvider(), 'any');
164
163
  let signer = provider.getSigner(0);
165
- await submit$3({ transaction, provider, signer }).then((sentTransaction)=>{
164
+ await submit$2({ transaction, provider, signer }).then((sentTransaction)=>{
166
165
  if (sentTransaction) {
167
166
  transaction.id = sentTransaction.hash;
168
167
  transaction.nonce = sentTransaction.nonce || transactionCount;
169
168
  transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
170
169
  if (transaction.sent) transaction.sent(transaction);
171
- retrieveConfirmedTransaction$3(sentTransaction).then(() => {
170
+ retrieveConfirmedTransaction$2(sentTransaction).then(() => {
172
171
  transaction._succeeded = true;
173
172
  if (transaction.succeeded) transaction.succeeded(transaction);
174
173
  }).catch((error)=>{
@@ -196,17 +195,17 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
196
195
  return transaction
197
196
  };
198
197
 
199
- const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
198
+ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
200
199
  return new Promise((resolve, reject)=>{
201
200
  try {
202
201
 
203
202
  sentTransaction.wait(1).then(resolve).catch((error)=>{
204
203
  if(
205
- (error && _optionalChain$m([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
204
+ (error && _optionalChain$k([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
206
205
  (error && error.toString().match('undefined'))
207
206
  ) {
208
207
  setTimeout(()=>{
209
- retrieveConfirmedTransaction$3(sentTransaction)
208
+ retrieveConfirmedTransaction$2(sentTransaction)
210
209
  .then(resolve)
211
210
  .catch(reject);
212
211
  }, 500);
@@ -216,11 +215,11 @@ const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
216
215
  });
217
216
  } catch(error) {
218
217
  if(
219
- (error && _optionalChain$m([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
218
+ (error && _optionalChain$k([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
220
219
  (error && error.toString().match('undefined'))
221
220
  ) {
222
221
  setTimeout(()=>{
223
- retrieveConfirmedTransaction$3(sentTransaction)
222
+ retrieveConfirmedTransaction$2(sentTransaction)
224
223
  .then(resolve)
225
224
  .catch(reject);
226
225
  }, 500);
@@ -231,15 +230,15 @@ const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
231
230
  })
232
231
  };
233
232
 
234
- const submit$3 = ({ transaction, provider, signer }) => {
233
+ const submit$2 = ({ transaction, provider, signer }) => {
235
234
  if(transaction.method) {
236
- return submitContractInteraction$3({ transaction, signer, provider })
235
+ return submitContractInteraction$2({ transaction, signer, provider })
237
236
  } else {
238
- return submitSimpleTransfer$3({ transaction, signer })
237
+ return submitSimpleTransfer$2({ transaction, signer })
239
238
  }
240
239
  };
241
240
 
242
- const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
241
+ const submitContractInteraction$2 = async ({ transaction, signer, provider })=>{
243
242
  let contract = new ethers.Contract(transaction.to, transaction.api, provider);
244
243
  let contractArguments = transaction.getContractArguments({ contract });
245
244
  let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
@@ -251,24 +250,24 @@ const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
251
250
  if(contractArguments) {
252
251
  return await method(...contractArguments, {
253
252
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
254
- gasLimit: _optionalChain$m([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
253
+ gasLimit: _optionalChain$k([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
255
254
  })
256
255
  } else {
257
256
  return await method({
258
257
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
259
- gasLimit: _optionalChain$m([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
258
+ gasLimit: _optionalChain$k([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
260
259
  })
261
260
  }
262
261
  };
263
262
 
264
- const submitSimpleTransfer$3 = ({ transaction, signer })=>{
263
+ const submitSimpleTransfer$2 = ({ transaction, signer })=>{
265
264
  return signer.sendTransaction({
266
265
  to: transaction.to,
267
266
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
268
267
  })
269
268
  };
270
269
 
271
- function _optionalChain$l(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
270
+ function _optionalChain$j(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
272
271
 
273
272
  class WindowEthereum {
274
273
 
@@ -280,35 +279,35 @@ class WindowEthereum {
280
279
 
281
280
  static __initStatic2() {this.isAvailable = async()=>{
282
281
  return (
283
- _optionalChain$l([window, 'optionalAccess', _34 => _34.ethereum]) &&
282
+ _optionalChain$j([window, 'optionalAccess', _34 => _34.ethereum]) &&
284
283
  // not MetaMask
285
- !(_optionalChain$l([window, 'optionalAccess', _35 => _35.ethereum, 'optionalAccess', _36 => _36.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
284
+ !(_optionalChain$j([window, 'optionalAccess', _35 => _35.ethereum, 'optionalAccess', _36 => _36.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
286
285
  // not Coin98
287
- !_optionalChain$l([window, 'optionalAccess', _37 => _37.coin98]) &&
286
+ !_optionalChain$j([window, 'optionalAccess', _37 => _37.coin98]) &&
288
287
  // not Trust Wallet
289
- !(_optionalChain$l([window, 'optionalAccess', _38 => _38.ethereum, 'optionalAccess', _39 => _39.isTrust]) || _optionalChain$l([window, 'optionalAccess', _40 => _40.ethereum, 'optionalAccess', _41 => _41.isTrustWallet])) &&
288
+ !(_optionalChain$j([window, 'optionalAccess', _38 => _38.ethereum, 'optionalAccess', _39 => _39.isTrust]) || _optionalChain$j([window, 'optionalAccess', _40 => _40.ethereum, 'optionalAccess', _41 => _41.isTrustWallet])) &&
290
289
  // not crypto.com
291
- !_optionalChain$l([window, 'optionalAccess', _42 => _42.ethereum, 'optionalAccess', _43 => _43.isDeficonnectProvider]) &&
290
+ !_optionalChain$j([window, 'optionalAccess', _42 => _42.ethereum, 'optionalAccess', _43 => _43.isDeficonnectProvider]) &&
292
291
  // not HyperPay
293
- !_optionalChain$l([window, 'optionalAccess', _44 => _44.ethereum, 'optionalAccess', _45 => _45.isHyperPay]) &&
292
+ !_optionalChain$j([window, 'optionalAccess', _44 => _44.ethereum, 'optionalAccess', _45 => _45.isHyperPay]) &&
294
293
  // not Phantom
295
- !(window.phantom && !window.glow && !_optionalChain$l([window, 'optionalAccess', _46 => _46.solana, 'optionalAccess', _47 => _47.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
294
+ !(window.phantom && !window.glow && !_optionalChain$j([window, 'optionalAccess', _46 => _46.solana, 'optionalAccess', _47 => _47.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
296
295
  // not Rabby
297
- !_optionalChain$l([window, 'optionalAccess', _48 => _48.ethereum, 'optionalAccess', _49 => _49.isRabby]) &&
296
+ !_optionalChain$j([window, 'optionalAccess', _48 => _48.ethereum, 'optionalAccess', _49 => _49.isRabby]) &&
298
297
  // not Backpack
299
- !_optionalChain$l([window, 'optionalAccess', _50 => _50.backpack, 'optionalAccess', _51 => _51.isBackpack]) &&
298
+ !_optionalChain$j([window, 'optionalAccess', _50 => _50.backpack, 'optionalAccess', _51 => _51.isBackpack]) &&
300
299
  // not TokenPocket
301
- !_optionalChain$l([window, 'optionalAccess', _52 => _52.ethereum, 'optionalAccess', _53 => _53.isTokenPocket]) &&
300
+ !_optionalChain$j([window, 'optionalAccess', _52 => _52.ethereum, 'optionalAccess', _53 => _53.isTokenPocket]) &&
302
301
  // not BitKeep
303
- !_optionalChain$l([window, 'optionalAccess', _54 => _54.ethereum, 'optionalAccess', _55 => _55.isBitKeep]) &&
302
+ !_optionalChain$j([window, 'optionalAccess', _54 => _54.ethereum, 'optionalAccess', _55 => _55.isBitKeep]) &&
304
303
  // not Coinbase
305
- !(_optionalChain$l([window, 'optionalAccess', _56 => _56.ethereum, 'optionalAccess', _57 => _57.isCoinbaseWallet]) || _optionalChain$l([window, 'optionalAccess', _58 => _58.ethereum, 'optionalAccess', _59 => _59.isWalletLink])) &&
304
+ !(_optionalChain$j([window, 'optionalAccess', _56 => _56.ethereum, 'optionalAccess', _57 => _57.isCoinbaseWallet]) || _optionalChain$j([window, 'optionalAccess', _58 => _58.ethereum, 'optionalAccess', _59 => _59.isWalletLink])) &&
306
305
  // MetaMask through ProviderMap
307
- !_optionalChain$l([window, 'optionalAccess', _60 => _60.ethereum, 'optionalAccess', _61 => _61.providerMap, 'optionalAccess', _62 => _62.has, 'call', _63 => _63('MetaMask')]) &&
306
+ !_optionalChain$j([window, 'optionalAccess', _60 => _60.ethereum, 'optionalAccess', _61 => _61.providerMap, 'optionalAccess', _62 => _62.has, 'call', _63 => _63('MetaMask')]) &&
308
307
  // Brave Wallet
309
- !_optionalChain$l([window, 'optionalAccess', _64 => _64.ethereum, 'optionalAccess', _65 => _65.isBraveWallet]) &&
308
+ !_optionalChain$j([window, 'optionalAccess', _64 => _64.ethereum, 'optionalAccess', _65 => _65.isBraveWallet]) &&
310
309
  // OKX Wallet
311
- !_optionalChain$l([window, 'optionalAccess', _66 => _66.okxwallet])
310
+ !_optionalChain$j([window, 'optionalAccess', _66 => _66.okxwallet])
312
311
  )
313
312
  };}
314
313
 
@@ -317,7 +316,7 @@ class WindowEthereum {
317
316
  this.logo = this.constructor.info.logo;
318
317
  this.blockchains = this.constructor.info.blockchains;
319
318
  this.sendTransaction = (transaction)=>{
320
- return sendTransaction$3({
319
+ return sendTransaction$2({
321
320
  wallet: this,
322
321
  transaction
323
322
  })
@@ -434,7 +433,7 @@ class WindowEthereum {
434
433
  }
435
434
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
436
435
 
437
- function _optionalChain$k(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
436
+ function _optionalChain$i(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
438
437
  class Binance extends WindowEthereum {
439
438
 
440
439
  static __initStatic() {this.info = {
@@ -444,7 +443,7 @@ class Binance extends WindowEthereum {
444
443
  };}
445
444
 
446
445
  static __initStatic2() {this.isAvailable = async()=>{
447
- return _optionalChain$k([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
446
+ return _optionalChain$i([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
448
447
  !window.coin98 &&
449
448
  !window.trustwallet
450
449
  };}
@@ -464,7 +463,7 @@ var logos = {
464
463
  okx: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI4LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMzYuMSAzMzYuMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzM2LjEgMzM2LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPHBhdGggZD0iTTMxMy43LDBIMjIuNEMxMCwwLDAsMTAsMCwyMi40djI5MS4zYzAsMTIuNCwxMCwyMi40LDIyLjQsMjIuNGgyOTEuM2MxMi40LDAsMjIuNC0xMCwyMi40LTIyLjRWMjIuNAoJQzMzNi4xLDEwLDMyNi4xLDAsMzEzLjcsMHoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIwNC41LDEzMC43aC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTV2LTY0LjcKCUMyMDkuNSwxMzIuOSwyMDcuMiwxMzAuNywyMDQuNSwxMzAuN3oiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDU2LjFINjUuMWMtMi43LDAtNSwyLjItNSw1djY0LjdjMCwyLjcsMi4yLDUsNSw1aDY0LjdjMi44LDAsNS0yLjIsNS01VjYxCglDMTM0LjgsNTguMywxMzIuNSw1Ni4xLDEyOS44LDU2LjF6Ii8+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNzkuMSw1Ni4xaC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTVWNjEKCUMyODQuMSw1OC4zLDI4MS45LDU2LjEsMjc5LjEsNTYuMXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDIwNS40SDY1LjFjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuOCwwLDUtMi4yLDUtNXYtNjQuNwoJQzEzNC44LDIwNy42LDEzMi41LDIwNS40LDEyOS44LDIwNS40eiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjc5LjEsMjA1LjRoLTY0LjdjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuNywwLDUtMi4yLDUtNXYtNjQuNwoJQzI4NC4xLDIwNy42LDI4MS45LDIwNS40LDI3OS4xLDIwNS40eiIvPgo8L3N2Zz4K",
465
464
  };
466
465
 
467
- function _optionalChain$j(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
466
+ function _optionalChain$h(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
468
467
  class BraveEVM extends WindowEthereum {
469
468
 
470
469
  static __initStatic() {this.info = {
@@ -474,14 +473,14 @@ class BraveEVM extends WindowEthereum {
474
473
  platform: 'evm',
475
474
  };}
476
475
 
477
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$j([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
476
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$h([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
478
477
 
479
478
  getProvider() {
480
479
  return window.ethereum
481
480
  }
482
481
  } BraveEVM.__initStatic(); BraveEVM.__initStatic2();
483
482
 
484
- function _optionalChain$i(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
483
+ function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
485
484
  class Coin98EVM extends WindowEthereum {
486
485
 
487
486
  static __initStatic() {this.info = {
@@ -491,13 +490,13 @@ class Coin98EVM extends WindowEthereum {
491
490
  platform: 'evm',
492
491
  };}
493
492
 
494
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$i([window, 'optionalAccess', _2 => _2.coin98]) };}
493
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$g([window, 'optionalAccess', _2 => _2.coin98]) };}
495
494
 
496
495
  getProvider() { return window.coin98.provider }
497
496
 
498
497
  } Coin98EVM.__initStatic(); Coin98EVM.__initStatic2();
499
498
 
500
- function _optionalChain$h(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
499
+ function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
501
500
  class CoinbaseEVM extends WindowEthereum {
502
501
 
503
502
  static __initStatic() {this.info = {
@@ -508,8 +507,8 @@ class CoinbaseEVM extends WindowEthereum {
508
507
  };}
509
508
 
510
509
  getProvider() {
511
- if(_optionalChain$h([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
512
- return _optionalChain$h([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
510
+ if(_optionalChain$f([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
511
+ return _optionalChain$f([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
513
512
  } else {
514
513
  return window.ethereum
515
514
  }
@@ -518,15 +517,15 @@ class CoinbaseEVM extends WindowEthereum {
518
517
  static __initStatic2() {this.isAvailable = async()=>{
519
518
  return(
520
519
  (
521
- _optionalChain$h([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
520
+ _optionalChain$f([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
522
521
  ) || (
523
- _optionalChain$h([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
522
+ _optionalChain$f([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
524
523
  )
525
524
  )
526
525
  };}
527
526
  } CoinbaseEVM.__initStatic(); CoinbaseEVM.__initStatic2();
528
527
 
529
- function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
528
+ function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
530
529
  class CryptoCom extends WindowEthereum {
531
530
 
532
531
  static __initStatic() {this.info = {
@@ -535,10 +534,10 @@ class CryptoCom extends WindowEthereum {
535
534
  blockchains: supported$1.evm
536
535
  };}
537
536
 
538
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$g([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
537
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
539
538
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
540
539
 
541
- function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
540
+ function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
542
541
  class ExodusEVM extends WindowEthereum {
543
542
 
544
543
  static __initStatic() {this.info = {
@@ -548,10 +547,10 @@ class ExodusEVM extends WindowEthereum {
548
547
  platform: 'evm',
549
548
  };}
550
549
 
551
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isExodus]) };}
550
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isExodus]) };}
552
551
  } ExodusEVM.__initStatic(); ExodusEVM.__initStatic2();
553
552
 
554
- function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
553
+ function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
555
554
  class HyperPay extends WindowEthereum {
556
555
 
557
556
  static __initStatic() {this.info = {
@@ -560,10 +559,10 @@ class HyperPay extends WindowEthereum {
560
559
  blockchains: supported$1.evm
561
560
  };}
562
561
 
563
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
562
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
564
563
  } HyperPay.__initStatic(); HyperPay.__initStatic2();
565
564
 
566
- function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
565
+ function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
567
566
  class MagicEdenEVM extends WindowEthereum {
568
567
 
569
568
  static __initStatic() {this.info = {
@@ -575,12 +574,12 @@ class MagicEdenEVM extends WindowEthereum {
575
574
 
576
575
  static __initStatic2() {this.isAvailable = async()=>{
577
576
  return (
578
- _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMagicEden])
577
+ _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMagicEden])
579
578
  )
580
579
  };}
581
580
  } MagicEdenEVM.__initStatic(); MagicEdenEVM.__initStatic2();
582
581
 
583
- function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
582
+ function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
584
583
  class OKXEVM extends WindowEthereum {
585
584
 
586
585
  static __initStatic() {this.info = {
@@ -592,12 +591,12 @@ class OKXEVM extends WindowEthereum {
592
591
 
593
592
  static __initStatic2() {this.isAvailable = async()=>{
594
593
  return (
595
- _optionalChain$c([window, 'optionalAccess', _2 => _2.okxwallet])
594
+ _optionalChain$a([window, 'optionalAccess', _2 => _2.okxwallet])
596
595
  )
597
596
  };}
598
597
  } OKXEVM.__initStatic(); OKXEVM.__initStatic2();
599
598
 
600
- function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
599
+ function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
601
600
  class MetaMask extends WindowEthereum {
602
601
 
603
602
  static __initStatic() {this.info = {
@@ -607,8 +606,8 @@ class MetaMask extends WindowEthereum {
607
606
  };}
608
607
 
609
608
  getProvider() {
610
- if(_optionalChain$b([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.providerMap, 'optionalAccess', _9 => _9.has, 'call', _10 => _10('MetaMask')])) {
611
- return _optionalChain$b([window, 'optionalAccess', _11 => _11.ethereum, 'optionalAccess', _12 => _12.providerMap, 'optionalAccess', _13 => _13.get, 'call', _14 => _14('MetaMask')])
609
+ if(_optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.providerMap, 'optionalAccess', _9 => _9.has, 'call', _10 => _10('MetaMask')])) {
610
+ return _optionalChain$9([window, 'optionalAccess', _11 => _11.ethereum, 'optionalAccess', _12 => _12.providerMap, 'optionalAccess', _13 => _13.get, 'call', _14 => _14('MetaMask')])
612
611
  } else {
613
612
  return window.ethereum
614
613
  }
@@ -617,16 +616,16 @@ class MetaMask extends WindowEthereum {
617
616
  static __initStatic2() {this.isAvailable = async()=>{
618
617
  return(
619
618
  (
620
- _optionalChain$b([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isMetaMask]) &&
619
+ _optionalChain$9([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isMetaMask]) &&
621
620
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
622
621
  ) || (
623
- _optionalChain$b([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.providerMap, 'optionalAccess', _19 => _19.has, 'call', _20 => _20('MetaMask')])
622
+ _optionalChain$9([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.providerMap, 'optionalAccess', _19 => _19.has, 'call', _20 => _20('MetaMask')])
624
623
  )
625
624
  )
626
625
  };}
627
626
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
628
627
 
629
- function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
628
+ function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
630
629
  class Opera extends WindowEthereum {
631
630
 
632
631
  static __initStatic() {this.info = {
@@ -635,10 +634,10 @@ class Opera extends WindowEthereum {
635
634
  blockchains: supported$1.evm
636
635
  };}
637
636
 
638
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
637
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
639
638
  } Opera.__initStatic(); Opera.__initStatic2();
640
639
 
641
- function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
640
+ function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
642
641
  class PhantomEVM extends WindowEthereum {
643
642
 
644
643
  static __initStatic() {this.info = {
@@ -652,13 +651,13 @@ class PhantomEVM extends WindowEthereum {
652
651
  return (
653
652
  window.phantom &&
654
653
  window.phantom.ethereum &&
655
- ! _optionalChain$9([window, 'optionalAccess', _4 => _4.ethereum, 'optionalAccess', _5 => _5.isMagicEden]) &&
656
- ! _optionalChain$9([window, 'optionalAccess', _6 => _6.okxwallet])
654
+ ! _optionalChain$7([window, 'optionalAccess', _4 => _4.ethereum, 'optionalAccess', _5 => _5.isMagicEden]) &&
655
+ ! _optionalChain$7([window, 'optionalAccess', _6 => _6.okxwallet])
657
656
  )
658
657
  };}
659
658
  } PhantomEVM.__initStatic(); PhantomEVM.__initStatic2();
660
659
 
661
- function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
660
+ function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
662
661
  class Rabby extends WindowEthereum {
663
662
 
664
663
  static __initStatic() {this.info = {
@@ -669,12 +668,12 @@ class Rabby extends WindowEthereum {
669
668
 
670
669
  static __initStatic2() {this.isAvailable = async()=>{
671
670
  return(
672
- _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
671
+ _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
673
672
  )
674
673
  };}
675
674
  } Rabby.__initStatic(); Rabby.__initStatic2();
676
675
 
677
- function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
676
+ function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
678
677
  class TokenPocket extends WindowEthereum {
679
678
 
680
679
  static __initStatic() {this.info = {
@@ -685,12 +684,12 @@ class TokenPocket extends WindowEthereum {
685
684
 
686
685
  static __initStatic2() {this.isAvailable = async()=>{
687
686
  return (
688
- _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
687
+ _optionalChain$5([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
689
688
  )
690
689
  };}
691
690
  } TokenPocket.__initStatic(); TokenPocket.__initStatic2();
692
691
 
693
- function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
692
+ function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
694
693
  class TrustEVM extends WindowEthereum {
695
694
 
696
695
  static __initStatic() {this.info = {
@@ -702,7 +701,7 @@ class TrustEVM extends WindowEthereum {
702
701
 
703
702
  static __initStatic2() {this.isAvailable = async()=>{
704
703
  return (
705
- (_optionalChain$6([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$6([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
704
+ (_optionalChain$4([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$4([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
706
705
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
707
706
  )
708
707
  };}
@@ -807,466 +806,10 @@ const getSmartContractWallet = async(blockchain, address)=> {
807
806
  }
808
807
  };
809
808
 
810
- function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
811
-
812
- const sendTransaction$2 = async ({ transaction, wallet })=> {
813
- transaction = new Transaction(transaction);
814
- if((await wallet.connectedTo(transaction.blockchain)) == false) {
815
- throw({ code: 'WRONG_NETWORK' })
816
- }
817
- await transaction.prepare({ wallet });
818
- const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
819
- let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
820
- transaction.nonce = transactionCount;
821
- await submit$2({ transaction, wallet }).then((tx)=>{
822
- if (tx) {
823
- let blockchain = Blockchains.findByName(transaction.blockchain);
824
- transaction.id = tx;
825
- transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
826
- if (transaction.sent) transaction.sent(transaction);
827
- retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
828
- transaction.id = sentTransaction.hash || transaction.id;
829
- transaction.url = blockchain.explorerUrlFor({ transaction });
830
- transaction.nonce = sentTransaction.nonce || transactionCount;
831
- retrieveConfirmedTransaction$2(sentTransaction).then(()=>{
832
- transaction._succeeded = true;
833
- if (transaction.succeeded) transaction.succeeded(transaction);
834
- }).catch((error)=>{
835
- if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
836
- if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
837
- transaction.id = error.replacement.hash;
838
- transaction._succeeded = true;
839
- if (transaction.succeeded) transaction.succeeded(transaction);
840
- } else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
841
- transaction.id = error.replacement.hash;
842
- transaction._failed = true;
843
- if(transaction.failed) transaction.failed(transaction, error);
844
- }
845
- } else {
846
- transaction._failed = true;
847
- if(transaction.failed) transaction.failed(transaction, error);
848
- }
849
- });
850
- });
851
- } else {
852
- throw('Submitting transaction failed!')
853
- }
854
- });
855
- return transaction
856
- };
857
-
858
- const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
859
- return new Promise((resolve, reject)=>{
860
- try {
861
-
862
- sentTransaction.wait(1).then(resolve).catch((error)=>{
863
- if(
864
- (error && _optionalChain$5([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
865
- (error && error.toString().match('undefined'))
866
- ) {
867
- setTimeout(()=>{
868
- retrieveConfirmedTransaction$2(sentTransaction)
869
- .then(resolve)
870
- .catch(reject);
871
- }, 500);
872
- } else {
873
- reject(error);
874
- }
875
- });
876
- } catch (error) {
877
- if(
878
- (error && _optionalChain$5([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
879
- (error && error.toString().match('undefined'))
880
- ) {
881
- setTimeout(()=>{
882
- retrieveConfirmedTransaction$2(sentTransaction)
883
- .then(resolve)
884
- .catch(reject);
885
- }, 500);
886
- } else {
887
- reject(error);
888
- }
889
- }
890
- })
891
- };
892
-
893
- const retrieveTransaction$1 = async ({ blockchain, tx, smartContractWallet })=>{
894
- const provider = await getProvider(blockchain);
895
- let retrieve = async()=>{
896
- try {
897
- if(smartContractWallet && smartContractWallet.retrieveTransaction) {
898
- return await smartContractWallet.retrieveTransaction({ blockchain, tx })
899
- } else {
900
- return await provider.getTransaction(tx)
901
- }
902
- } catch (e) {}
903
- };
904
-
905
- let sentTransaction;
906
- sentTransaction = await retrieve();
907
- while (!sentTransaction) {
908
- await (new Promise((resolve)=>setTimeout(resolve, 3000)));
909
- sentTransaction = await retrieve();
910
- }
911
- return sentTransaction
912
- };
913
-
914
- const submit$2 = ({ transaction, wallet }) => {
915
- if(transaction.method) {
916
- return submitContractInteraction$2({ transaction, wallet })
917
- } else {
918
- return submitSimpleTransfer$2({ transaction, wallet })
919
- }
920
- };
921
-
922
- const submitContractInteraction$2 = async ({ transaction, wallet })=>{
923
- const provider = await getProvider(transaction.blockchain);
924
- let gasPrice = await provider.getGasPrice();
925
- if(_optionalChain$5([wallet, 'access', _7 => _7.session, 'optionalAccess', _8 => _8.peerMeta, 'optionalAccess', _9 => _9.name]) === 'Uniswap Wallet') {
926
- gasPrice = undefined;
927
- } else {
928
- gasPrice = gasPrice.toHexString();
929
- }
930
- let gas;
931
- try {
932
- gas = await estimate(transaction);
933
- gas = gas.add(gas.div(10));
934
- } catch (e2) {}
935
- const data = await transaction.getData();
936
- const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
937
- const nonce = ethers.utils.hexlify(transaction.nonce);
938
- return wallet.connector.sendTransaction({
939
- from: transaction.from,
940
- to: transaction.to,
941
- value,
942
- data,
943
- gas: _optionalChain$5([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
944
- gasPrice,
945
- nonce,
946
- })
947
- };
948
-
949
- const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
950
- const provider = await getProvider(transaction.blockchain);
951
- let gasPrice = await provider.getGasPrice();
952
- if(_optionalChain$5([wallet, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.peerMeta, 'optionalAccess', _14 => _14.name]) === 'Uniswap Wallet') {
953
- gasPrice = undefined;
954
- } else {
955
- gasPrice = gasPrice.toHexString();
956
- }
957
- let gas;
958
- try {
959
- gas = await estimate(transaction);
960
- gas = gas.add(gas.div(10));
961
- } catch (e3) {}
962
- const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
963
- const nonce = ethers.utils.hexlify(transaction.nonce);
964
- return wallet.connector.sendTransaction({
965
- from: transaction.from,
966
- to: transaction.to,
967
- value,
968
- data: '0x',
969
- gas: _optionalChain$5([gas, 'optionalAccess', _15 => _15.toHexString, 'call', _16 => _16()]),
970
- gasPrice,
971
- nonce,
972
- })
973
- };
974
-
975
- function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
976
-
977
- const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
978
-
979
- let currentPlainInstance;
980
-
981
- const getPlainInstance = ()=>{
982
- if(currentPlainInstance) { return currentPlainInstance }
983
- currentPlainInstance = getWalletConnectInstance(()=>{});
984
- return currentPlainInstance
985
- };
986
-
987
- const isConnected = ()=>{
988
- return new Promise(async(resolve, reject)=>{
989
-
990
- setTimeout(()=>{
991
- delete localStorage['walletconnect'];
992
- resolve(false);
993
- }, 5000);
994
-
995
- if(!localStorage['walletconnect'] || JSON.parse(localStorage['walletconnect']).handshakeTopic.length == 0) {
996
- delete localStorage['walletconnect'];
997
- return resolve(false)
998
- }
999
-
1000
- let connector = getPlainInstance();
1001
- let accounts;
1002
-
1003
- try {
1004
- let blockNumber = await connector.sendCustomRequest({ method: 'eth_blockNumber' });
1005
- if(blockNumber) {
1006
- accounts = await connector.sendCustomRequest({ method: 'eth_accounts' });
1007
- } else {
1008
- delete localStorage['walletconnect'];
1009
- }
1010
- } catch (error) {
1011
- delete localStorage['walletconnect'];
1012
- resolve(false);
1013
- }
1014
-
1015
- return resolve(accounts && accounts.length)
1016
- })
1017
- };
1018
-
1019
- const getConnectedInstance$2 = async()=>{
1020
- if(window[KEY$1]) { return window[KEY$1] }
1021
- if(await isConnected()) { return new WalletConnectV1() }
1022
- };
1023
-
1024
- const setConnectedInstance$1 = (value)=>{
1025
- window[KEY$1] = value;
1026
- };
1027
-
1028
- const getWalletConnectInstance = (connect)=>{
1029
- return new WalletConnectClient({
1030
- bridge: "https://walletconnect.depay.com",
1031
- qrcodeModal: {
1032
- open: async(uri)=>connect({ uri }),
1033
- close: ()=>{},
1034
- }
1035
- })
1036
- };
1037
-
1038
- class WalletConnectV1 {
1039
-
1040
- static __initStatic() {this.info = {
1041
- name: 'WalletConnect',
1042
- logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMjUuNC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAtLT48c3ZnIHZlcnNpb249JzEuMScgaWQ9J0xheWVyXzEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIHg9JzBweCcgeT0nMHB4JyB2aWV3Qm94PScwIDAgNTAwIDUwMCcgc3R5bGU9J2VuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAwIDUwMDsnIHhtbDpzcGFjZT0ncHJlc2VydmUnPjxzdHlsZSB0eXBlPSd0ZXh0L2Nzcyc+IC5zdDB7ZmlsbDojNTk5MUNEO30KPC9zdHlsZT48ZyBpZD0nUGFnZS0xJz48ZyBpZD0nd2FsbGV0Y29ubmVjdC1sb2dvLWFsdCc+PHBhdGggaWQ9J1dhbGxldENvbm5lY3QnIGNsYXNzPSdzdDAnIGQ9J00xMDIuNywxNjJjODEuNS03OS44LDIxMy42LTc5LjgsMjk1LjEsMGw5LjgsOS42YzQuMSw0LDQuMSwxMC41LDAsMTQuNEwzNzQsMjE4LjkgYy0yLDItNS4zLDItNy40LDBsLTEzLjUtMTMuMmMtNTYuOC01NS43LTE0OS01NS43LTIwNS44LDBsLTE0LjUsMTQuMWMtMiwyLTUuMywyLTcuNCwwTDkxLjksMTg3Yy00LjEtNC00LjEtMTAuNSwwLTE0LjQgTDEwMi43LDE2MnogTTQ2Ny4xLDIyOS45bDI5LjksMjkuMmM0LjEsNCw0LjEsMTAuNSwwLDE0LjRMMzYyLjMsNDA1LjRjLTQuMSw0LTEwLjcsNC0xNC44LDBjMCwwLDAsMCwwLDBMMjUyLDMxMS45IGMtMS0xLTIuNy0xLTMuNywwaDBsLTk1LjUsOTMuNWMtNC4xLDQtMTAuNyw0LTE0LjgsMGMwLDAsMCwwLDAsMEwzLjQsMjczLjZjLTQuMS00LTQuMS0xMC41LDAtMTQuNGwyOS45LTI5LjIgYzQuMS00LDEwLjctNCwxNC44LDBsOTUuNSw5My41YzEsMSwyLjcsMSwzLjcsMGMwLDAsMCwwLDAsMGw5NS41LTkzLjVjNC4xLTQsMTAuNy00LDE0LjgsMGMwLDAsMCwwLDAsMGw5NS41LDkzLjUgYzEsMSwyLjcsMSwzLjcsMGw5NS41LTkzLjVDNDU2LjQsMjI1LjksNDYzLDIyNS45LDQ2Ny4xLDIyOS45eicvPjwvZz48L2c+PC9zdmc+Cg==",
1043
- blockchains: supported$1.evm
1044
- };}
1045
-
1046
- static __initStatic2() {this.isAvailable = async()=>{
1047
- return (await getConnectedInstance$2()) != undefined
1048
- };}
1049
-
1050
- constructor() {
1051
- this.name = (localStorage[KEY$1+'_name'] && localStorage[KEY$1+'_name'] != undefined) ? localStorage[KEY$1+'_name'] : this.constructor.info.name;
1052
- this.logo = (localStorage[KEY$1+'_logo'] && localStorage[KEY$1+'_logo'] != undefined) ? localStorage[KEY$1+'_logo'] : this.constructor.info.logo;
1053
- this.blockchains = this.constructor.info.blockchains;
1054
- this.sendTransaction = (transaction)=>{
1055
- return sendTransaction$2({
1056
- wallet: this,
1057
- transaction
1058
- })
1059
- };
1060
- }
1061
-
1062
- disconnect() {
1063
- setConnectedInstance$1(undefined);
1064
- localStorage[KEY$1+'_name'] = undefined;
1065
- localStorage[KEY$1+'_logo'] = undefined;
1066
- currentPlainInstance = undefined;
1067
- this.session = undefined;
1068
- }
1069
-
1070
- newWalletConnectInstance(connect) {
1071
- let instance = getWalletConnectInstance(connect);
1072
-
1073
- instance.on("disconnect", (error, payload) => {
1074
- this.disconnect();
1075
- if (error) { throw error }
1076
- });
1077
-
1078
- instance.on("modal_closed", ()=>{
1079
- setConnectedInstance$1(undefined);
1080
- this.connector = undefined;
1081
- this.session = undefined;
1082
- });
1083
-
1084
- return instance
1085
- }
1086
-
1087
- async account() {
1088
- if(!this.connector){ this.connector = getPlainInstance(); }
1089
- let accounts;
1090
- try{ accounts = await this.connector.sendCustomRequest({ method: 'eth_accounts' }); } catch (e) {}
1091
- if(accounts && accounts.length) { return ethers.utils.getAddress(accounts[0]) }
1092
- }
1093
-
1094
- async connect(options) {
1095
- let connect = (options && options.connect) ? options.connect : ({uri})=>{};
1096
- try {
1097
-
1098
- this.connector = WalletConnectV1.instance;
1099
-
1100
- if(this.connector == undefined){
1101
- this.connector = this.newWalletConnectInstance(connect);
1102
- }
1103
-
1104
- if(options && options.reconnect) {
1105
- if(this.connector) {
1106
- try{ await this.connector.killSession(); } catch (e2) {}
1107
- this.disconnect();
1108
- }
1109
- }
1110
-
1111
- if((await isConnected())) {
1112
- return await this.account()
1113
- } else {
1114
-
1115
- let session = await this.connector.connect();
1116
- this.session = session;
1117
-
1118
- if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
1119
- if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
1120
-
1121
- if(session.accounts instanceof Array && session.accounts.length) {
1122
- setConnectedInstance$1(this);
1123
- return ethers.utils.getAddress(session.accounts[0])
1124
- } else {
1125
- return
1126
- }
1127
- }
1128
-
1129
- } catch (error) {
1130
- console.log('WALLETCONNECT ERROR', error);
1131
- return undefined
1132
- }
1133
- }
1134
-
1135
- async connectedTo(input) {
1136
- let chainId = await this.connector.sendCustomRequest({ method: 'eth_chainId' });
1137
- const blockchain = Blockchains.findById(chainId);
1138
- if(!blockchain) { return false }
1139
- if(input) {
1140
- return input === blockchain.name
1141
- } else {
1142
- return blockchain.name
1143
- }
1144
- }
1145
-
1146
- switchTo(blockchainName) {
1147
- return new Promise((resolve, reject)=>{
1148
- let resolved, rejected;
1149
- const blockchain = Blockchains.findByName(blockchainName);
1150
- setTimeout(async()=>{
1151
- if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
1152
- reject({ code: 'NOT_SUPPORTED' });
1153
- } else {
1154
- resolve();
1155
- }
1156
- }, 3000);
1157
- this.connector.sendCustomRequest({
1158
- method: 'wallet_switchEthereumChain',
1159
- params: [{ chainId: blockchain.id }],
1160
- }).then(()=>{
1161
- resolved = true;
1162
- resolve();
1163
- }).catch((error)=> {
1164
- if(error && typeof error.message == 'string' && error.message.match('addEthereumChain')){ // chain not yet added
1165
- this.addNetwork(blockchainName)
1166
- .then(()=>this.switchTo(blockchainName).then(()=>{
1167
- resolved = true;
1168
- resolve();
1169
- }))
1170
- .catch(()=>{
1171
- rejected = true;
1172
- reject({ code: 'NOT_SUPPORTED' });
1173
- });
1174
- } else {
1175
- rejected = true;
1176
- reject({ code: 'NOT_SUPPORTED' });
1177
- }
1178
- });
1179
- })
1180
- }
1181
-
1182
- addNetwork(blockchainName) {
1183
- return new Promise((resolve, reject)=>{
1184
- const blockchain = Blockchains.findByName(blockchainName);
1185
- this.connector.sendCustomRequest({
1186
- method: 'wallet_addEthereumChain',
1187
- params: [{
1188
- chainId: blockchain.id,
1189
- chainName: blockchain.fullName,
1190
- nativeCurrency: {
1191
- name: blockchain.currency.name,
1192
- symbol: blockchain.currency.symbol,
1193
- decimals: blockchain.currency.decimals
1194
- },
1195
- rpcUrls: [blockchain.rpc],
1196
- blockExplorerUrls: [blockchain.explorer],
1197
- iconUrls: [blockchain.logo]
1198
- }],
1199
- }).then(resolve).catch(reject);
1200
- })
1201
- }
1202
-
1203
- on(event, callback) {
1204
- let internalCallback;
1205
- switch (event) {
1206
- case 'account':
1207
- internalCallback = (error, payload) => {
1208
- if(payload && payload.params && payload.params[0].accounts && payload.params[0].accounts instanceof Array) {
1209
- const accounts = payload.params[0].accounts.map((account)=>ethers.utils.getAddress(account));
1210
- callback(accounts[0]);
1211
- }
1212
- };
1213
- this.connector.on("session_update", internalCallback);
1214
- break
1215
- }
1216
- return internalCallback
1217
- }
1218
-
1219
- off(event, callback) {
1220
- switch (event) {
1221
- case 'account':
1222
- this.connector.off("session_update");
1223
- break
1224
- }
1225
- }
1226
-
1227
- async transactionCount({ blockchain, address }) {
1228
- const smartContractWallet = await getSmartContractWallet(blockchain, address);
1229
- if(smartContractWallet) {
1230
- return await smartContractWallet.transactionCount()
1231
- } else {
1232
- return await request({ blockchain, method: 'transactionCount', address })
1233
- }
1234
- }
1235
-
1236
- async sign(message) {
1237
- if(typeof message === 'object') {
1238
- let account = await this.account();
1239
- if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
1240
- throw({ code: 'WRONG_NETWORK' })
1241
- }
1242
- let signature = await this.connector.sendCustomRequest({
1243
- jsonrpc: '2.0',
1244
- method: 'eth_signTypedData_v4',
1245
- params: [account, JSON.stringify(message)],
1246
- });
1247
- return signature
1248
- } else if (typeof message === 'string') {
1249
- let blockchain = await this.connectedTo();
1250
- let address = await this.account();
1251
- const smartContractWallet = await getSmartContractWallet(blockchain, address);
1252
- if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
1253
- var params = [ethers.utils.toUtf8Bytes(message), address];
1254
- let signature = await this.connector.signPersonalMessage(params);
1255
- return signature
1256
- }
1257
- }
1258
- } WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
1259
-
1260
- WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
1261
- WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
1262
-
1263
809
  function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1264
810
 
1265
811
  const sendTransaction$1 = async ({ transaction, wallet })=> {
1266
812
  transaction = new Transaction(transaction);
1267
- if((await wallet.connectedTo(transaction.blockchain)) == false) {
1268
- throw({ code: 'WRONG_NETWORK' })
1269
- }
1270
813
  await transaction.prepare({ wallet });
1271
814
  let transactionCount = await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
1272
815
  transaction.nonce = transactionCount;
@@ -1402,8 +945,9 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
1402
945
  value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
1403
946
  data: await transaction.getData(),
1404
947
  gas: _optionalChain$3([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
948
+ gasLimit: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
1405
949
  gasPrice: gasPrice.toHexString(),
1406
- nonce: transaction.nonce,
950
+ nonce: ethers.utils.hexlify(transaction.nonce),
1407
951
  }]
1408
952
  }
1409
953
  }).catch((e)=>{console.log('ERROR', e);})
@@ -1427,9 +971,11 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
1427
971
  from: transaction.from,
1428
972
  to: transaction.to,
1429
973
  value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
1430
- gas: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
1431
- gasPrice: gasPrice.toHexString(),
1432
- nonce: transaction.nonce
974
+ data: '0x0',
975
+ gas: _optionalChain$3([gas, 'optionalAccess', _14 => _14.toHexString, 'call', _15 => _15()]),
976
+ gasLimit: _optionalChain$3([gas, 'optionalAccess', _16 => _16.toHexString, 'call', _17 => _17()]),
977
+ gasPrice: _optionalChain$3([gasPrice, 'optionalAccess', _18 => _18.toHexString, 'call', _19 => _19()]),
978
+ nonce: ethers.utils.hexlify(transaction.nonce)
1433
979
  }]
1434
980
  }
1435
981
  }).catch((e)=>{console.log('ERROR', e);})
@@ -1439,88 +985,6 @@ function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[
1439
985
 
1440
986
  const KEY = 'depay:wallets:wc2';
1441
987
 
1442
- // configurations for wallets that require special handling
1443
- const CONFIGURATIONS = {
1444
-
1445
- "MetaMask": {
1446
- methods: [
1447
- "eth_sendTransaction",
1448
- "personal_sign",
1449
- "eth_signTypedData",
1450
- "eth_signTypedData_v4",
1451
- "wallet_switchEthereumChain"
1452
- ],
1453
- },
1454
-
1455
- "BitGet (BitKeep)": {
1456
- methods: [
1457
- "eth_sendTransaction",
1458
- "personal_sign",
1459
- "eth_signTypedData",
1460
- "eth_signTypedData_v4",
1461
- ],
1462
- requiredNamespaces: {
1463
- eip155: {
1464
- chains: ['ethereum', 'bsc', 'polygon', 'arbitrum', 'base'].map((blockchainName)=>`eip155:${Blockchains[blockchainName].networkId}`)
1465
- }
1466
- },
1467
- optionalNamespaces: {},
1468
- },
1469
-
1470
- "BitGet": {
1471
- methods: [
1472
- "eth_sendTransaction",
1473
- "personal_sign",
1474
- "eth_signTypedData",
1475
- "eth_signTypedData_v4",
1476
- ],
1477
- requiredNamespaces: {
1478
- eip155: {
1479
- chains: ['ethereum', 'bsc', 'polygon', 'arbitrum', 'base'].map((blockchainName)=>`eip155:${Blockchains[blockchainName].networkId}`)
1480
- }
1481
- },
1482
- optionalNamespaces: {},
1483
- },
1484
-
1485
- "Uniswap Wallet": {
1486
- methods: [
1487
- "eth_sendTransaction",
1488
- "personal_sign",
1489
- "eth_signTypedData",
1490
- "eth_signTypedData_v4",
1491
- ],
1492
- requiredNamespaces: {
1493
- eip155: {
1494
- chains: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'base'].map((blockchainName)=>`eip155:${Blockchains[blockchainName].networkId}`)
1495
- }
1496
- },
1497
- optionalNamespaces: {},
1498
- },
1499
-
1500
- "Ledger Live": {
1501
- methods: [
1502
- "eth_sendTransaction",
1503
- "personal_sign",
1504
- "eth_signTypedData",
1505
- "eth_signTypedData_v4",
1506
- ],
1507
- requiredNamespaces: {},
1508
- optionalNamespaces: {
1509
- eip155: {
1510
- chains: Blockchains.all.map((blockchain)=>`eip155:${blockchain.networkId}`)
1511
- }
1512
- },
1513
- },
1514
-
1515
- "Enjin Wallet": {
1516
- methods: [
1517
- "eth_sendTransaction",
1518
- "personal_sign",
1519
- "eth_signTypedData",
1520
- ]
1521
- },
1522
- };
1523
-
1524
988
  const DEFAULT_CONFIGURATION = {
1525
989
  events: ['accountsChanged'],
1526
990
  methods: [
@@ -1554,31 +1018,23 @@ const getLastSession = async(walletName)=>{
1554
1018
  };
1555
1019
 
1556
1020
  const getWalletConnectV2Config = (walletName)=>{
1557
- const methods = _optionalChain$2([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
1558
- const events = _optionalChain$2([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
1021
+ const methods = DEFAULT_CONFIGURATION.methods;
1022
+ const events = DEFAULT_CONFIGURATION.events;
1559
1023
 
1560
1024
  let requiredNamespaces = {};
1561
- if(_optionalChain$2([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
1562
- requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
1563
- } else {
1564
- requiredNamespaces['eip155'] = {
1565
- chains: [`eip155:1`],
1566
- };
1567
- }
1025
+ requiredNamespaces['eip155'] = {
1026
+ chains: [`eip155:1`],
1027
+ };
1568
1028
  if(requiredNamespaces['eip155']) {
1569
1029
  requiredNamespaces['eip155'].methods = methods;
1570
1030
  requiredNamespaces['eip155'].events = events;
1571
1031
  }
1572
1032
 
1573
1033
  let optionalNamespaces = {};
1574
- if(_optionalChain$2([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
1575
- optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
1576
- } else {
1577
- optionalNamespaces['eip155'] = {
1578
- chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
1579
- };
1580
- }
1581
- if(_optionalChain$2([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$2([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
1034
+ optionalNamespaces['eip155'] = {
1035
+ chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
1036
+ };
1037
+ if(_optionalChain$2([optionalNamespaces, 'optionalAccess', _ => _.eip155]) && _optionalChain$2([optionalNamespaces, 'optionalAccess', _2 => _2.eip155, 'optionalAccess', _3 => _3.chains, 'optionalAccess', _4 => _4.length])) {
1582
1038
  optionalNamespaces['eip155'].methods = methods;
1583
1039
  optionalNamespaces['eip155'].events = events;
1584
1040
  }
@@ -1593,9 +1049,9 @@ const getSignClient = ()=>{
1593
1049
  projectId: localStorage[KEY+":projectId"],
1594
1050
  metadata: {
1595
1051
  name: document.title || 'dApp',
1596
- description: _optionalChain$2([document, 'access', _13 => _13.querySelector, 'call', _14 => _14('meta[name="description"]'), 'optionalAccess', _15 => _15.getAttribute, 'call', _16 => _16('content')]) || document.title || 'dApp',
1052
+ description: _optionalChain$2([document, 'access', _5 => _5.querySelector, 'call', _6 => _6('meta[name="description"]'), 'optionalAccess', _7 => _7.getAttribute, 'call', _8 => _8('content')]) || document.title || 'dApp',
1597
1053
  url: location.href,
1598
- icons: [_optionalChain$2([document, 'access', _17 => _17.querySelector, 'call', _18 => _18("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _19 => _19.href]) || `${location.origin}/favicon.ico`]
1054
+ icons: [_optionalChain$2([document, 'access', _9 => _9.querySelector, 'call', _10 => _10("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _11 => _11.href]) || `${location.origin}/favicon.ico`]
1599
1055
  }
1600
1056
  });
1601
1057
  resolve(signClient);
@@ -1613,7 +1069,7 @@ class WalletConnectV2 {
1613
1069
  };}
1614
1070
 
1615
1071
  static __initStatic2() {this.isAvailable = async(options)=>{
1616
- return !! await getLastSession(_optionalChain$2([options, 'optionalAccess', _21 => _21.walletName]))
1072
+ return !! await getLastSession(_optionalChain$2([options, 'optionalAccess', _13 => _13.walletName]))
1617
1073
  };}
1618
1074
 
1619
1075
  constructor() {
@@ -1628,17 +1084,17 @@ class WalletConnectV2 {
1628
1084
  }
1629
1085
 
1630
1086
  async account() {
1631
- if(_optionalChain$2([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
1087
+ if(_optionalChain$2([this, 'access', _14 => _14.session, 'optionalAccess', _15 => _15.namespaces, 'optionalAccess', _16 => _16.eip155, 'optionalAccess', _17 => _17.accounts, 'optionalAccess', _18 => _18.length])) {
1632
1088
  return this.session.namespaces.eip155.accounts[0].split(':')[2]
1633
1089
  }
1634
1090
  }
1635
1091
 
1636
1092
  async setSessionBlockchains() {
1637
- if(!this.session || (!_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155]) && !_optionalChain$2([this, 'access', _30 => _30.session, 'optionalAccess', _31 => _31.optionalNamespaces, 'optionalAccess', _32 => _32.eip155]))) { return }
1093
+ if(!this.session || (!_optionalChain$2([this, 'access', _19 => _19.session, 'optionalAccess', _20 => _20.namespaces, 'optionalAccess', _21 => _21.eip155]) && !_optionalChain$2([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.optionalNamespaces, 'optionalAccess', _24 => _24.eip155]))) { return }
1638
1094
  if(this.session.namespaces.eip155.chains) {
1639
- this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _33 => _33.findByNetworkId, 'call', _34 => _34(chainIdentifier.split(':')[1]), 'optionalAccess', _35 => _35.name])).filter(Boolean);
1095
+ this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _25 => _25.findByNetworkId, 'call', _26 => _26(chainIdentifier.split(':')[1]), 'optionalAccess', _27 => _27.name])).filter(Boolean);
1640
1096
  } else if(this.session.namespaces.eip155.accounts) {
1641
- this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access', _36 => _36.findByNetworkId, 'call', _37 => _37(accountIdentifier.split(':')[1]), 'optionalAccess', _38 => _38.name])).filter(Boolean);
1097
+ this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access', _28 => _28.findByNetworkId, 'call', _29 => _29(accountIdentifier.split(':')[1]), 'optionalAccess', _30 => _30.name])).filter(Boolean);
1642
1098
  }
1643
1099
  }
1644
1100
 
@@ -1648,13 +1104,13 @@ class WalletConnectV2 {
1648
1104
 
1649
1105
  try {
1650
1106
 
1651
- this.walletName = _optionalChain$2([options, 'optionalAccess', _39 => _39.name]);
1107
+ this.walletName = _optionalChain$2([options, 'optionalAccess', _31 => _31.name]);
1652
1108
 
1653
1109
  // delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
1654
1110
  this.signClient = await getSignClient();
1655
1111
 
1656
1112
  this.signClient.on("session_delete", (session)=> {
1657
- if(_optionalChain$2([session, 'optionalAccess', _40 => _40.topic]) === _optionalChain$2([this, 'access', _41 => _41.session, 'optionalAccess', _42 => _42.topic])) {
1113
+ if(_optionalChain$2([session, 'optionalAccess', _32 => _32.topic]) === _optionalChain$2([this, 'access', _33 => _33.session, 'optionalAccess', _34 => _34.topic])) {
1658
1114
  localStorage[KEY+':name'] = undefined;
1659
1115
  localStorage[KEY+':logo'] = undefined;
1660
1116
  this.signClient = undefined;
@@ -1663,14 +1119,14 @@ class WalletConnectV2 {
1663
1119
  });
1664
1120
 
1665
1121
  this.signClient.on("session_update", async(session)=> {
1666
- if(_optionalChain$2([session, 'optionalAccess', _43 => _43.topic]) === _optionalChain$2([this, 'access', _44 => _44.session, 'optionalAccess', _45 => _45.topic])) {
1122
+ if(_optionalChain$2([session, 'optionalAccess', _35 => _35.topic]) === _optionalChain$2([this, 'access', _36 => _36.session, 'optionalAccess', _37 => _37.topic])) {
1667
1123
  this.session = this.signClient.session.get(session.topic);
1668
1124
  await this.setSessionBlockchains();
1669
1125
  }
1670
1126
  });
1671
1127
 
1672
1128
  this.signClient.on("session_event", (event)=> {
1673
- if(_optionalChain$2([event, 'optionalAccess', _46 => _46.topic]) === _optionalChain$2([this, 'access', _47 => _47.session, 'optionalAccess', _48 => _48.topic])) {}
1129
+ if(_optionalChain$2([event, 'optionalAccess', _38 => _38.topic]) === _optionalChain$2([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {}
1674
1130
  });
1675
1131
 
1676
1132
  const connectWallet = async()=>{
@@ -1681,24 +1137,24 @@ class WalletConnectV2 {
1681
1137
  await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
1682
1138
  };
1683
1139
 
1684
- const lastSession = _optionalChain$2([this, 'optionalAccess', _49 => _49.walletName, 'optionalAccess', _50 => _50.length]) ? await getLastSession(this.walletName) : undefined;
1140
+ const lastSession = _optionalChain$2([this, 'optionalAccess', _41 => _41.walletName, 'optionalAccess', _42 => _42.length]) ? await getLastSession(this.walletName) : undefined;
1685
1141
  if(lastSession) {
1686
1142
  this.session = lastSession;
1687
1143
  } else {
1688
1144
  await connectWallet();
1689
1145
  }
1690
1146
 
1691
- let meta = _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.peer, 'optionalAccess', _53 => _53.metadata]);
1147
+ let meta = _optionalChain$2([this, 'access', _43 => _43.session, 'optionalAccess', _44 => _44.peer, 'optionalAccess', _45 => _45.metadata]);
1692
1148
  if(meta && meta.name) {
1693
1149
  this.name = meta.name;
1694
1150
  localStorage[KEY+':name'] = meta.name;
1695
- if(_optionalChain$2([meta, 'optionalAccess', _54 => _54.icons]) && meta.icons.length) {
1151
+ if(_optionalChain$2([meta, 'optionalAccess', _46 => _46.icons]) && meta.icons.length) {
1696
1152
  this.logo = meta.icons[0];
1697
1153
  localStorage[KEY+':logo'] = this.logo;
1698
1154
  }
1699
1155
  }
1700
- if(_optionalChain$2([options, 'optionalAccess', _55 => _55.name])) { localStorage[KEY+':name'] = this.name = options.name; }
1701
- if(_optionalChain$2([options, 'optionalAccess', _56 => _56.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
1156
+ if(_optionalChain$2([options, 'optionalAccess', _47 => _47.name])) { localStorage[KEY+':name'] = this.name = options.name; }
1157
+ if(_optionalChain$2([options, 'optionalAccess', _48 => _48.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
1702
1158
 
1703
1159
  await this.setSessionBlockchains();
1704
1160
 
@@ -1723,24 +1179,7 @@ class WalletConnectV2 {
1723
1179
 
1724
1180
  switchTo(blockchainName) {
1725
1181
  return new Promise((resolve, reject)=>{
1726
-
1727
- const blockchain = Blockchains[blockchainName];
1728
-
1729
- Promise.race([
1730
- this.signClient.request({
1731
- topic: this.session.topic,
1732
- chainId: this.getValidChainId(),
1733
- request:{
1734
- method: 'wallet_switchEthereumChain',
1735
- params: [{ chainId: blockchain.id }],
1736
- }
1737
- }),
1738
- new Promise((resolve, reject)=>setTimeout(()=>{
1739
- if(this.blockchains.indexOf(blockchainName) === -1) {
1740
- reject({ code: 'NOT_SUPPORTED' });
1741
- }
1742
- } , 8000))
1743
- ]).catch(reject);
1182
+ reject({ code: 'NOT_SUPPORTED' });
1744
1183
  })
1745
1184
  }
1746
1185
 
@@ -1755,7 +1194,7 @@ class WalletConnectV2 {
1755
1194
  switch (event) {
1756
1195
  case 'account':
1757
1196
  internalCallback = async(event)=> {
1758
- if(_optionalChain$2([event, 'optionalAccess', _57 => _57.topic]) === _optionalChain$2([this, 'access', _58 => _58.session, 'optionalAccess', _59 => _59.topic]) && event.params.event.name === 'accountsChanged') {
1197
+ if(_optionalChain$2([event, 'optionalAccess', _49 => _49.topic]) === _optionalChain$2([this, 'access', _50 => _50.session, 'optionalAccess', _51 => _51.topic]) && event.params.event.name === 'accountsChanged') {
1759
1198
  callback(await this.account());
1760
1199
  }
1761
1200
  };
@@ -2120,7 +1559,6 @@ var wallets = {
2120
1559
 
2121
1560
  // standards (not concrete wallets)
2122
1561
  WindowEthereum,
2123
- WalletConnectV1,
2124
1562
  WalletConnectV2,
2125
1563
  WalletLink
2126
1564
  };
@@ -2175,7 +1613,6 @@ const supported = [
2175
1613
  wallets.ExodusEVM,
2176
1614
 
2177
1615
  // standards (not concrete wallets)
2178
- wallets.WalletConnectV1,
2179
1616
  wallets.WalletConnectV2,
2180
1617
  wallets.WalletLink,
2181
1618
  wallets.WindowEthereum,