@depay/web3-wallets-svm 18.0.8 → 18.0.9
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.
- package/dist/esm/index.evm.js +555 -188
- package/dist/esm/index.js +588 -221
- package/dist/umd/index.evm.js +563 -195
- package/dist/umd/index.js +596 -228
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { getProvider, request, estimate } from '@depay/web3-client';
|
|
1
|
+
import { getProvider, request, estimate, rpcRequest } from '@depay/web3-client';
|
|
2
2
|
import Blockchains from '@depay/web3-blockchains';
|
|
3
3
|
import { PublicKey, SystemProgram, TransactionMessage, VersionedTransaction, transact } from '@depay/solana-web3.js';
|
|
4
4
|
import { ethers } from 'ethers';
|
|
5
5
|
import { SignClient } from '@depay/walletconnect-v2';
|
|
6
6
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
7
|
-
import { MiniKit, ResponseEvent } from '@depay/worldcoin-precompiled';
|
|
8
7
|
|
|
9
|
-
function _optionalChain$
|
|
8
|
+
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; }
|
|
10
9
|
class Transaction {
|
|
11
10
|
|
|
12
11
|
constructor({
|
|
@@ -32,7 +31,7 @@ class Transaction {
|
|
|
32
31
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
33
32
|
|
|
34
33
|
// optional
|
|
35
|
-
this.value = _optionalChain$
|
|
34
|
+
this.value = _optionalChain$C([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
36
35
|
this.api = api;
|
|
37
36
|
this.method = method;
|
|
38
37
|
this.params = params;
|
|
@@ -73,7 +72,7 @@ class Transaction {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
getParamType(param) {
|
|
76
|
-
if(_optionalChain$
|
|
75
|
+
if(_optionalChain$C([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
77
76
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
78
77
|
} else {
|
|
79
78
|
return param.type
|
|
@@ -146,7 +145,7 @@ class Transaction {
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
|
|
149
|
-
function _optionalChain$
|
|
148
|
+
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; }
|
|
150
149
|
|
|
151
150
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
152
151
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -167,14 +166,14 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
167
166
|
|
|
168
167
|
const provider = await getProvider(transaction.blockchain);
|
|
169
168
|
const { value } = await provider.getSignatureStatus(signature);
|
|
170
|
-
const confirmationStatus = _optionalChain$
|
|
169
|
+
const confirmationStatus = _optionalChain$B([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
171
170
|
if(confirmationStatus) {
|
|
172
171
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
173
172
|
if (hasReachedSufficientCommitment) {
|
|
174
173
|
if(value.err) {
|
|
175
174
|
transaction._failed = true;
|
|
176
175
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
177
|
-
const failedReason = _optionalChain$
|
|
176
|
+
const failedReason = _optionalChain$B([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
178
177
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
179
178
|
} else {
|
|
180
179
|
transaction._succeeded = true;
|
|
@@ -265,7 +264,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum',
|
|
|
265
264
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'];
|
|
266
265
|
supported$1.svm = ['solana'];
|
|
267
266
|
|
|
268
|
-
function _optionalChain$
|
|
267
|
+
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; }
|
|
269
268
|
class WindowSolana {
|
|
270
269
|
|
|
271
270
|
static __initStatic() {this.info = {
|
|
@@ -276,13 +275,13 @@ class WindowSolana {
|
|
|
276
275
|
|
|
277
276
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
278
277
|
return (
|
|
279
|
-
_optionalChain$
|
|
278
|
+
_optionalChain$A([window, 'optionalAccess', _6 => _6.solana]) &&
|
|
280
279
|
// not Phantom
|
|
281
280
|
!(window.phantom && !window.glow && !window.solana.isGlow && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
282
281
|
// not Coin98
|
|
283
282
|
!window.coin98 &&
|
|
284
283
|
// not BitKeep
|
|
285
|
-
!(_optionalChain$
|
|
284
|
+
!(_optionalChain$A([window, 'optionalAccess', _7 => _7.solana]) && _optionalChain$A([window, 'optionalAccess', _8 => _8.solana, 'access', _9 => _9.isBitKeep])) &&
|
|
286
285
|
// not Glow
|
|
287
286
|
!window.solana.isGlow &&
|
|
288
287
|
// not trust
|
|
@@ -290,7 +289,7 @@ class WindowSolana {
|
|
|
290
289
|
// Brave Wallet
|
|
291
290
|
!window.solana.isBraveWallet &&
|
|
292
291
|
// OKX Wallet
|
|
293
|
-
!_optionalChain$
|
|
292
|
+
!_optionalChain$A([window, 'optionalAccess', _10 => _10.okxwallet])
|
|
294
293
|
)
|
|
295
294
|
};}
|
|
296
295
|
|
|
@@ -337,7 +336,7 @@ class WindowSolana {
|
|
|
337
336
|
let internalCallback;
|
|
338
337
|
switch (event) {
|
|
339
338
|
case 'account':
|
|
340
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
339
|
+
internalCallback = (publicKey) => callback(_optionalChain$A([publicKey, 'optionalAccess', _11 => _11.toString, 'call', _12 => _12()]));
|
|
341
340
|
this.getProvider().on('accountChanged', internalCallback);
|
|
342
341
|
break
|
|
343
342
|
}
|
|
@@ -390,7 +389,7 @@ class WindowSolana {
|
|
|
390
389
|
}
|
|
391
390
|
} WindowSolana.__initStatic(); WindowSolana.__initStatic2();
|
|
392
391
|
|
|
393
|
-
function _optionalChain$
|
|
392
|
+
function _optionalChain$z(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; }
|
|
394
393
|
|
|
395
394
|
class Backpack extends WindowSolana {
|
|
396
395
|
|
|
@@ -402,7 +401,7 @@ class Backpack extends WindowSolana {
|
|
|
402
401
|
|
|
403
402
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
404
403
|
return (
|
|
405
|
-
_optionalChain$
|
|
404
|
+
_optionalChain$z([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
406
405
|
window.backpack.isBackpack
|
|
407
406
|
)
|
|
408
407
|
};}
|
|
@@ -420,7 +419,7 @@ class Backpack extends WindowSolana {
|
|
|
420
419
|
}
|
|
421
420
|
} Backpack.__initStatic(); Backpack.__initStatic2();
|
|
422
421
|
|
|
423
|
-
function _optionalChain$
|
|
422
|
+
function _optionalChain$y(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; }
|
|
424
423
|
|
|
425
424
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
426
425
|
transaction = new Transaction(transaction);
|
|
@@ -474,7 +473,7 @@ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
|
474
473
|
try {
|
|
475
474
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
476
475
|
if(
|
|
477
|
-
(error && _optionalChain$
|
|
476
|
+
(error && _optionalChain$y([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
478
477
|
(error && error.toString().match('undefined'))
|
|
479
478
|
) {
|
|
480
479
|
setTimeout(()=>{
|
|
@@ -488,7 +487,7 @@ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
|
488
487
|
});
|
|
489
488
|
} catch(error) {
|
|
490
489
|
if(
|
|
491
|
-
(error && _optionalChain$
|
|
490
|
+
(error && _optionalChain$y([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
492
491
|
(error && error.toString().match('undefined'))
|
|
493
492
|
) {
|
|
494
493
|
setTimeout(()=>{
|
|
@@ -523,12 +522,12 @@ const submitContractInteraction$2 = async ({ transaction, signer, provider })=>{
|
|
|
523
522
|
if(contractArguments) {
|
|
524
523
|
return await method(...contractArguments, {
|
|
525
524
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
526
|
-
gasLimit: _optionalChain$
|
|
525
|
+
gasLimit: _optionalChain$y([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
527
526
|
})
|
|
528
527
|
} else {
|
|
529
528
|
return await method({
|
|
530
529
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
531
|
-
gasLimit: _optionalChain$
|
|
530
|
+
gasLimit: _optionalChain$y([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
532
531
|
})
|
|
533
532
|
}
|
|
534
533
|
};
|
|
@@ -540,7 +539,7 @@ const submitSimpleTransfer$2 = ({ transaction, signer })=>{
|
|
|
540
539
|
})
|
|
541
540
|
};
|
|
542
541
|
|
|
543
|
-
function _optionalChain$
|
|
542
|
+
function _optionalChain$x(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; }
|
|
544
543
|
|
|
545
544
|
class WindowEthereum {
|
|
546
545
|
|
|
@@ -552,39 +551,39 @@ class WindowEthereum {
|
|
|
552
551
|
|
|
553
552
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
554
553
|
return (
|
|
555
|
-
_optionalChain$
|
|
554
|
+
_optionalChain$x([window, 'optionalAccess', _38 => _38.ethereum]) &&
|
|
556
555
|
// not MetaMask
|
|
557
|
-
!(_optionalChain$
|
|
556
|
+
!(_optionalChain$x([window, 'optionalAccess', _39 => _39.ethereum, 'optionalAccess', _40 => _40.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
|
|
558
557
|
// not Coin98
|
|
559
|
-
!_optionalChain$
|
|
558
|
+
!_optionalChain$x([window, 'optionalAccess', _41 => _41.coin98]) &&
|
|
560
559
|
// not Trust Wallet
|
|
561
|
-
!(_optionalChain$
|
|
560
|
+
!(_optionalChain$x([window, 'optionalAccess', _42 => _42.ethereum, 'optionalAccess', _43 => _43.isTrust]) || _optionalChain$x([window, 'optionalAccess', _44 => _44.ethereum, 'optionalAccess', _45 => _45.isTrustWallet])) &&
|
|
562
561
|
// not crypto.com
|
|
563
|
-
!_optionalChain$
|
|
562
|
+
!_optionalChain$x([window, 'optionalAccess', _46 => _46.ethereum, 'optionalAccess', _47 => _47.isDeficonnectProvider]) &&
|
|
564
563
|
// not HyperPay
|
|
565
|
-
!_optionalChain$
|
|
564
|
+
!_optionalChain$x([window, 'optionalAccess', _48 => _48.ethereum, 'optionalAccess', _49 => _49.isHyperPay]) &&
|
|
566
565
|
// not Phantom
|
|
567
|
-
!(window.phantom && !window.glow && !_optionalChain$
|
|
566
|
+
!(window.phantom && !window.glow && !_optionalChain$x([window, 'optionalAccess', _50 => _50.solana, 'optionalAccess', _51 => _51.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
568
567
|
// not Rabby
|
|
569
|
-
!_optionalChain$
|
|
568
|
+
!_optionalChain$x([window, 'optionalAccess', _52 => _52.ethereum, 'optionalAccess', _53 => _53.isRabby]) &&
|
|
570
569
|
// not Backpack
|
|
571
|
-
!_optionalChain$
|
|
570
|
+
!_optionalChain$x([window, 'optionalAccess', _54 => _54.backpack, 'optionalAccess', _55 => _55.isBackpack]) &&
|
|
572
571
|
// not TokenPocket
|
|
573
|
-
!_optionalChain$
|
|
572
|
+
!_optionalChain$x([window, 'optionalAccess', _56 => _56.ethereum, 'optionalAccess', _57 => _57.isTokenPocket]) &&
|
|
574
573
|
// not BitKeep
|
|
575
|
-
!_optionalChain$
|
|
574
|
+
!_optionalChain$x([window, 'optionalAccess', _58 => _58.ethereum, 'optionalAccess', _59 => _59.isBitKeep]) &&
|
|
576
575
|
// not Coinbase
|
|
577
|
-
!(_optionalChain$
|
|
576
|
+
!(_optionalChain$x([window, 'optionalAccess', _60 => _60.ethereum, 'optionalAccess', _61 => _61.isCoinbaseWallet]) || _optionalChain$x([window, 'optionalAccess', _62 => _62.ethereum, 'optionalAccess', _63 => _63.isWalletLink])) &&
|
|
578
577
|
// MetaMask through ProviderMap
|
|
579
|
-
!_optionalChain$
|
|
578
|
+
!_optionalChain$x([window, 'optionalAccess', _64 => _64.ethereum, 'optionalAccess', _65 => _65.providerMap, 'optionalAccess', _66 => _66.has, 'call', _67 => _67('MetaMask')]) &&
|
|
580
579
|
// Brave Wallet
|
|
581
|
-
!_optionalChain$
|
|
580
|
+
!_optionalChain$x([window, 'optionalAccess', _68 => _68.ethereum, 'optionalAccess', _69 => _69.isBraveWallet]) &&
|
|
582
581
|
// Uniswap Wallet
|
|
583
|
-
!_optionalChain$
|
|
582
|
+
!_optionalChain$x([window, 'optionalAccess', _70 => _70.ethereum, 'optionalAccess', _71 => _71.isUniswapWallet]) &&
|
|
584
583
|
// Rainbow
|
|
585
|
-
!_optionalChain$
|
|
584
|
+
!_optionalChain$x([window, 'optionalAccess', _72 => _72.ethereum, 'optionalAccess', _73 => _73.isRainbow]) &&
|
|
586
585
|
// OKX Wallet
|
|
587
|
-
!_optionalChain$
|
|
586
|
+
!_optionalChain$x([window, 'optionalAccess', _74 => _74.okxwallet])
|
|
588
587
|
)
|
|
589
588
|
};}
|
|
590
589
|
|
|
@@ -716,7 +715,7 @@ class WindowEthereum {
|
|
|
716
715
|
}
|
|
717
716
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
718
717
|
|
|
719
|
-
function _optionalChain$
|
|
718
|
+
function _optionalChain$w(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; }
|
|
720
719
|
class Binance extends WindowEthereum {
|
|
721
720
|
|
|
722
721
|
static __initStatic() {this.info = {
|
|
@@ -726,7 +725,7 @@ class Binance extends WindowEthereum {
|
|
|
726
725
|
};}
|
|
727
726
|
|
|
728
727
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
729
|
-
return _optionalChain$
|
|
728
|
+
return _optionalChain$w([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
730
729
|
!window.coin98 &&
|
|
731
730
|
!window.trustwallet
|
|
732
731
|
};}
|
|
@@ -746,7 +745,7 @@ var logos = {
|
|
|
746
745
|
okx: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI4LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMzYuMSAzMzYuMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzM2LjEgMzM2LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPHBhdGggZD0iTTMxMy43LDBIMjIuNEMxMCwwLDAsMTAsMCwyMi40djI5MS4zYzAsMTIuNCwxMCwyMi40LDIyLjQsMjIuNGgyOTEuM2MxMi40LDAsMjIuNC0xMCwyMi40LTIyLjRWMjIuNAoJQzMzNi4xLDEwLDMyNi4xLDAsMzEzLjcsMHoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIwNC41LDEzMC43aC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTV2LTY0LjcKCUMyMDkuNSwxMzIuOSwyMDcuMiwxMzAuNywyMDQuNSwxMzAuN3oiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDU2LjFINjUuMWMtMi43LDAtNSwyLjItNSw1djY0LjdjMCwyLjcsMi4yLDUsNSw1aDY0LjdjMi44LDAsNS0yLjIsNS01VjYxCglDMTM0LjgsNTguMywxMzIuNSw1Ni4xLDEyOS44LDU2LjF6Ii8+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNzkuMSw1Ni4xaC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTVWNjEKCUMyODQuMSw1OC4zLDI4MS45LDU2LjEsMjc5LjEsNTYuMXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDIwNS40SDY1LjFjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuOCwwLDUtMi4yLDUtNXYtNjQuNwoJQzEzNC44LDIwNy42LDEzMi41LDIwNS40LDEyOS44LDIwNS40eiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjc5LjEsMjA1LjRoLTY0LjdjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuNywwLDUtMi4yLDUtNXYtNjQuNwoJQzI4NC4xLDIwNy42LDI4MS45LDIwNS40LDI3OS4xLDIwNS40eiIvPgo8L3N2Zz4K",
|
|
747
746
|
};
|
|
748
747
|
|
|
749
|
-
function _optionalChain$
|
|
748
|
+
function _optionalChain$v(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; }
|
|
750
749
|
class BraveEVM extends WindowEthereum {
|
|
751
750
|
|
|
752
751
|
static __initStatic() {this.info = {
|
|
@@ -756,14 +755,14 @@ class BraveEVM extends WindowEthereum {
|
|
|
756
755
|
platform: 'evm',
|
|
757
756
|
};}
|
|
758
757
|
|
|
759
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
758
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$v([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
760
759
|
|
|
761
760
|
getProvider() {
|
|
762
761
|
return window.ethereum
|
|
763
762
|
}
|
|
764
763
|
} BraveEVM.__initStatic(); BraveEVM.__initStatic2();
|
|
765
764
|
|
|
766
|
-
function _optionalChain$
|
|
765
|
+
function _optionalChain$u(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; }
|
|
767
766
|
class BraveSVM extends WindowSolana {
|
|
768
767
|
|
|
769
768
|
static __initStatic() {this.info = {
|
|
@@ -773,14 +772,14 @@ class BraveSVM extends WindowSolana {
|
|
|
773
772
|
platform: 'svm',
|
|
774
773
|
};}
|
|
775
774
|
|
|
776
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
775
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$u([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
777
776
|
|
|
778
777
|
getProvider() {
|
|
779
778
|
return window.braveSolana
|
|
780
779
|
}
|
|
781
780
|
} BraveSVM.__initStatic(); BraveSVM.__initStatic2();
|
|
782
781
|
|
|
783
|
-
function _optionalChain$
|
|
782
|
+
function _optionalChain$t(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; }
|
|
784
783
|
class Coin98EVM extends WindowEthereum {
|
|
785
784
|
|
|
786
785
|
static __initStatic() {this.info = {
|
|
@@ -790,13 +789,13 @@ class Coin98EVM extends WindowEthereum {
|
|
|
790
789
|
platform: 'evm',
|
|
791
790
|
};}
|
|
792
791
|
|
|
793
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
792
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$t([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
794
793
|
|
|
795
794
|
getProvider() { return window.coin98.provider }
|
|
796
795
|
|
|
797
796
|
} Coin98EVM.__initStatic(); Coin98EVM.__initStatic2();
|
|
798
797
|
|
|
799
|
-
function _optionalChain$
|
|
798
|
+
function _optionalChain$s(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; }
|
|
800
799
|
class Coin98SVM extends WindowSolana {
|
|
801
800
|
|
|
802
801
|
static __initStatic() {this.info = {
|
|
@@ -806,13 +805,13 @@ class Coin98SVM extends WindowSolana {
|
|
|
806
805
|
platform: 'svm',
|
|
807
806
|
};}
|
|
808
807
|
|
|
809
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
808
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$s([window, 'optionalAccess', _3 => _3.coin98, 'optionalAccess', _4 => _4.sol]) };}
|
|
810
809
|
|
|
811
810
|
getProvider() { return window.coin98.sol }
|
|
812
811
|
|
|
813
812
|
} Coin98SVM.__initStatic(); Coin98SVM.__initStatic2();
|
|
814
813
|
|
|
815
|
-
function _optionalChain$
|
|
814
|
+
function _optionalChain$r(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; }
|
|
816
815
|
class CoinbaseEVM extends WindowEthereum {
|
|
817
816
|
|
|
818
817
|
static __initStatic() {this.info = {
|
|
@@ -823,8 +822,8 @@ class CoinbaseEVM extends WindowEthereum {
|
|
|
823
822
|
};}
|
|
824
823
|
|
|
825
824
|
getProvider() {
|
|
826
|
-
if(_optionalChain$
|
|
827
|
-
return _optionalChain$
|
|
825
|
+
if(_optionalChain$r([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
826
|
+
return _optionalChain$r([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
828
827
|
} else {
|
|
829
828
|
return window.ethereum
|
|
830
829
|
}
|
|
@@ -833,9 +832,9 @@ class CoinbaseEVM extends WindowEthereum {
|
|
|
833
832
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
834
833
|
return(
|
|
835
834
|
(
|
|
836
|
-
_optionalChain$
|
|
835
|
+
_optionalChain$r([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$r([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
837
836
|
) || (
|
|
838
|
-
_optionalChain$
|
|
837
|
+
_optionalChain$r([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
839
838
|
)
|
|
840
839
|
)
|
|
841
840
|
};}
|
|
@@ -859,7 +858,7 @@ class CoinbaseSVM extends WindowSolana {
|
|
|
859
858
|
};}
|
|
860
859
|
} CoinbaseSVM.__initStatic(); CoinbaseSVM.__initStatic2();
|
|
861
860
|
|
|
862
|
-
function _optionalChain$
|
|
861
|
+
function _optionalChain$q(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; }
|
|
863
862
|
class CryptoCom extends WindowEthereum {
|
|
864
863
|
|
|
865
864
|
static __initStatic() {this.info = {
|
|
@@ -868,10 +867,10 @@ class CryptoCom extends WindowEthereum {
|
|
|
868
867
|
blockchains: supported$1.evm
|
|
869
868
|
};}
|
|
870
869
|
|
|
871
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
870
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$q([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
872
871
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
873
872
|
|
|
874
|
-
function _optionalChain$
|
|
873
|
+
function _optionalChain$p(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; }
|
|
875
874
|
class ExodusEVM extends WindowEthereum {
|
|
876
875
|
|
|
877
876
|
static __initStatic() {this.info = {
|
|
@@ -881,10 +880,10 @@ class ExodusEVM extends WindowEthereum {
|
|
|
881
880
|
platform: 'evm',
|
|
882
881
|
};}
|
|
883
882
|
|
|
884
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
883
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$p([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isExodus]) };}
|
|
885
884
|
} ExodusEVM.__initStatic(); ExodusEVM.__initStatic2();
|
|
886
885
|
|
|
887
|
-
function _optionalChain$
|
|
886
|
+
function _optionalChain$o(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; }
|
|
888
887
|
class ExodusSVM extends WindowSolana {
|
|
889
888
|
|
|
890
889
|
static __initStatic() {this.info = {
|
|
@@ -894,7 +893,7 @@ class ExodusSVM extends WindowSolana {
|
|
|
894
893
|
platform: 'svm',
|
|
895
894
|
};}
|
|
896
895
|
|
|
897
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
896
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$o([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isExodus]) };}
|
|
898
897
|
} ExodusSVM.__initStatic(); ExodusSVM.__initStatic2();
|
|
899
898
|
|
|
900
899
|
class Glow extends WindowSolana {
|
|
@@ -913,7 +912,7 @@ class Glow extends WindowSolana {
|
|
|
913
912
|
};}
|
|
914
913
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
915
914
|
|
|
916
|
-
function _optionalChain$
|
|
915
|
+
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; }
|
|
917
916
|
class HyperPay extends WindowEthereum {
|
|
918
917
|
|
|
919
918
|
static __initStatic() {this.info = {
|
|
@@ -922,10 +921,10 @@ class HyperPay extends WindowEthereum {
|
|
|
922
921
|
blockchains: supported$1.evm
|
|
923
922
|
};}
|
|
924
923
|
|
|
925
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
924
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$n([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
926
925
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
927
926
|
|
|
928
|
-
function _optionalChain$
|
|
927
|
+
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; }
|
|
929
928
|
class MagicEdenEVM extends WindowEthereum {
|
|
930
929
|
|
|
931
930
|
static __initStatic() {this.info = {
|
|
@@ -937,12 +936,12 @@ class MagicEdenEVM extends WindowEthereum {
|
|
|
937
936
|
|
|
938
937
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
939
938
|
return (
|
|
940
|
-
_optionalChain$
|
|
939
|
+
_optionalChain$m([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMagicEden])
|
|
941
940
|
)
|
|
942
941
|
};}
|
|
943
942
|
} MagicEdenEVM.__initStatic(); MagicEdenEVM.__initStatic2();
|
|
944
943
|
|
|
945
|
-
function _optionalChain$
|
|
944
|
+
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; }
|
|
946
945
|
class MagicEdenSVM extends WindowSolana {
|
|
947
946
|
|
|
948
947
|
static __initStatic() {this.info = {
|
|
@@ -954,12 +953,12 @@ class MagicEdenSVM extends WindowSolana {
|
|
|
954
953
|
|
|
955
954
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
956
955
|
return (
|
|
957
|
-
_optionalChain$
|
|
956
|
+
_optionalChain$l([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isMagicEden])
|
|
958
957
|
)
|
|
959
958
|
};}
|
|
960
959
|
} MagicEdenSVM.__initStatic(); MagicEdenSVM.__initStatic2();
|
|
961
960
|
|
|
962
|
-
function _optionalChain$
|
|
961
|
+
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; }
|
|
963
962
|
class MetaMask extends WindowEthereum {
|
|
964
963
|
|
|
965
964
|
static __initStatic() {this.info = {
|
|
@@ -970,7 +969,7 @@ class MetaMask extends WindowEthereum {
|
|
|
970
969
|
|
|
971
970
|
static __initStatic2() {this.isMetaMask = (provider)=> {
|
|
972
971
|
return(
|
|
973
|
-
_optionalChain$
|
|
972
|
+
_optionalChain$k([provider, 'optionalAccess', _3 => _3.isMetaMask]) &&
|
|
974
973
|
Object.keys(provider).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!WalletGuard)(?!RevokeCash)/)).length == 1
|
|
975
974
|
)
|
|
976
975
|
};}
|
|
@@ -984,16 +983,16 @@ class MetaMask extends WindowEthereum {
|
|
|
984
983
|
static __initStatic4() {this.isAvailable = async()=>{
|
|
985
984
|
return(
|
|
986
985
|
MetaMask.getEip6963Provider() ||
|
|
987
|
-
MetaMask.isMetaMask(_optionalChain$
|
|
986
|
+
MetaMask.isMetaMask(_optionalChain$k([window, 'optionalAccess', _4 => _4.ethereum]))
|
|
988
987
|
)
|
|
989
988
|
};}
|
|
990
989
|
|
|
991
990
|
getProvider() {
|
|
992
|
-
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$
|
|
991
|
+
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$k([window, 'optionalAccess', _5 => _5.ethereum])) && _optionalChain$k([window, 'optionalAccess', _6 => _6.ethereum]))
|
|
993
992
|
}
|
|
994
993
|
} MetaMask.__initStatic(); MetaMask.__initStatic2(); MetaMask.__initStatic3(); MetaMask.__initStatic4();
|
|
995
994
|
|
|
996
|
-
function _optionalChain$
|
|
995
|
+
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; }
|
|
997
996
|
class OKXEVM extends WindowEthereum {
|
|
998
997
|
|
|
999
998
|
static __initStatic() {this.info = {
|
|
@@ -1005,12 +1004,12 @@ class OKXEVM extends WindowEthereum {
|
|
|
1005
1004
|
|
|
1006
1005
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1007
1006
|
return (
|
|
1008
|
-
_optionalChain$
|
|
1007
|
+
_optionalChain$j([window, 'optionalAccess', _2 => _2.okxwallet])
|
|
1009
1008
|
)
|
|
1010
1009
|
};}
|
|
1011
1010
|
} OKXEVM.__initStatic(); OKXEVM.__initStatic2();
|
|
1012
1011
|
|
|
1013
|
-
function _optionalChain$
|
|
1012
|
+
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; }
|
|
1014
1013
|
class OKXSVM extends WindowSolana {
|
|
1015
1014
|
|
|
1016
1015
|
static __initStatic() {this.info = {
|
|
@@ -1022,12 +1021,12 @@ class OKXSVM extends WindowSolana {
|
|
|
1022
1021
|
|
|
1023
1022
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1024
1023
|
return (
|
|
1025
|
-
_optionalChain$
|
|
1024
|
+
_optionalChain$i([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isOkxWallet])
|
|
1026
1025
|
)
|
|
1027
1026
|
};}
|
|
1028
1027
|
} OKXSVM.__initStatic(); OKXSVM.__initStatic2();
|
|
1029
1028
|
|
|
1030
|
-
function _optionalChain$
|
|
1029
|
+
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; }
|
|
1031
1030
|
class Opera extends WindowEthereum {
|
|
1032
1031
|
|
|
1033
1032
|
static __initStatic() {this.info = {
|
|
@@ -1036,10 +1035,10 @@ class Opera extends WindowEthereum {
|
|
|
1036
1035
|
blockchains: supported$1.evm
|
|
1037
1036
|
};}
|
|
1038
1037
|
|
|
1039
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1038
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$h([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
1040
1039
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
1041
1040
|
|
|
1042
|
-
function _optionalChain$
|
|
1041
|
+
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; }
|
|
1043
1042
|
class PhantomEVM extends WindowEthereum {
|
|
1044
1043
|
|
|
1045
1044
|
static __initStatic() {this.info = {
|
|
@@ -1053,17 +1052,17 @@ class PhantomEVM extends WindowEthereum {
|
|
|
1053
1052
|
return (
|
|
1054
1053
|
window.phantom &&
|
|
1055
1054
|
window.phantom.ethereum &&
|
|
1056
|
-
! _optionalChain$
|
|
1057
|
-
! _optionalChain$
|
|
1055
|
+
! _optionalChain$g([window, 'optionalAccess', _4 => _4.ethereum, 'optionalAccess', _5 => _5.isMagicEden]) &&
|
|
1056
|
+
! _optionalChain$g([window, 'optionalAccess', _6 => _6.okxwallet])
|
|
1058
1057
|
)
|
|
1059
1058
|
};}
|
|
1060
1059
|
|
|
1061
1060
|
getProvider() {
|
|
1062
|
-
return _optionalChain$
|
|
1061
|
+
return _optionalChain$g([window, 'optionalAccess', _7 => _7.phantom, 'optionalAccess', _8 => _8.ethereum]) || window.ethereum
|
|
1063
1062
|
}
|
|
1064
1063
|
} PhantomEVM.__initStatic(); PhantomEVM.__initStatic2();
|
|
1065
1064
|
|
|
1066
|
-
function _optionalChain$
|
|
1065
|
+
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; }
|
|
1067
1066
|
class PhantomSVM extends WindowSolana {
|
|
1068
1067
|
|
|
1069
1068
|
static __initStatic() {this.info = {
|
|
@@ -1077,20 +1076,20 @@ class PhantomSVM extends WindowSolana {
|
|
|
1077
1076
|
return (
|
|
1078
1077
|
window.phantom &&
|
|
1079
1078
|
!window.glow &&
|
|
1080
|
-
!_optionalChain$
|
|
1081
|
-
!_optionalChain$
|
|
1082
|
-
! _optionalChain$
|
|
1083
|
-
! _optionalChain$
|
|
1079
|
+
!_optionalChain$f([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.isGlow]) &&
|
|
1080
|
+
!_optionalChain$f([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isExodus]) &&
|
|
1081
|
+
! _optionalChain$f([window, 'optionalAccess', _12 => _12.ethereum, 'optionalAccess', _13 => _13.isMagicEden]) &&
|
|
1082
|
+
! _optionalChain$f([window, 'optionalAccess', _14 => _14.okxwallet]) &&
|
|
1084
1083
|
!['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])
|
|
1085
1084
|
)
|
|
1086
1085
|
};}
|
|
1087
1086
|
|
|
1088
1087
|
getProvider() {
|
|
1089
|
-
return _optionalChain$
|
|
1088
|
+
return _optionalChain$f([window, 'optionalAccess', _15 => _15.phantom, 'optionalAccess', _16 => _16.solana]) || window.solana
|
|
1090
1089
|
}
|
|
1091
1090
|
} PhantomSVM.__initStatic(); PhantomSVM.__initStatic2();
|
|
1092
1091
|
|
|
1093
|
-
function _optionalChain$
|
|
1092
|
+
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; }
|
|
1094
1093
|
class Rabby extends WindowEthereum {
|
|
1095
1094
|
|
|
1096
1095
|
static __initStatic() {this.info = {
|
|
@@ -1101,12 +1100,12 @@ class Rabby extends WindowEthereum {
|
|
|
1101
1100
|
|
|
1102
1101
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1103
1102
|
return(
|
|
1104
|
-
_optionalChain$
|
|
1103
|
+
_optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
1105
1104
|
)
|
|
1106
1105
|
};}
|
|
1107
1106
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
1108
1107
|
|
|
1109
|
-
function _optionalChain$
|
|
1108
|
+
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; }
|
|
1110
1109
|
class Rainbow extends WindowEthereum {
|
|
1111
1110
|
|
|
1112
1111
|
static __initStatic() {this.info = {
|
|
@@ -1117,24 +1116,24 @@ class Rainbow extends WindowEthereum {
|
|
|
1117
1116
|
|
|
1118
1117
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
1119
1118
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
1120
|
-
return _optionalChain$
|
|
1119
|
+
return _optionalChain$d([provider, 'optionalAccess', _4 => _4.isRainbow])
|
|
1121
1120
|
}) : undefined
|
|
1122
1121
|
};}
|
|
1123
1122
|
|
|
1124
1123
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
1125
1124
|
return(
|
|
1126
1125
|
Rainbow.getEip6963Provider() ||
|
|
1127
|
-
_optionalChain$
|
|
1126
|
+
_optionalChain$d([window, 'optionalAccess', _5 => _5.rainbow, 'optionalAccess', _6 => _6.isRainbow])
|
|
1128
1127
|
)
|
|
1129
1128
|
};}
|
|
1130
1129
|
|
|
1131
1130
|
getProvider() {
|
|
1132
|
-
return Rainbow.getEip6963Provider() || _optionalChain$
|
|
1131
|
+
return Rainbow.getEip6963Provider() || _optionalChain$d([window, 'optionalAccess', _7 => _7.rainbow])
|
|
1133
1132
|
}
|
|
1134
1133
|
|
|
1135
1134
|
} Rainbow.__initStatic(); Rainbow.__initStatic2(); Rainbow.__initStatic3();
|
|
1136
1135
|
|
|
1137
|
-
function _optionalChain$
|
|
1136
|
+
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; }
|
|
1138
1137
|
|
|
1139
1138
|
|
|
1140
1139
|
const KEY$1 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
@@ -1225,8 +1224,8 @@ class SolanaMobileWalletAdapter {
|
|
|
1225
1224
|
await transact(
|
|
1226
1225
|
async (wallet) => {
|
|
1227
1226
|
await this.authorize(wallet);
|
|
1228
|
-
if(_optionalChain$
|
|
1229
|
-
if(_optionalChain$
|
|
1227
|
+
if(_optionalChain$c([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
1228
|
+
if(_optionalChain$c([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
1230
1229
|
}
|
|
1231
1230
|
);
|
|
1232
1231
|
return this._account
|
|
@@ -1285,7 +1284,7 @@ class SolanaMobileWalletAdapter {
|
|
|
1285
1284
|
}
|
|
1286
1285
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
1287
1286
|
|
|
1288
|
-
function _optionalChain$
|
|
1287
|
+
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; }
|
|
1289
1288
|
class Solflare extends WindowSolana {
|
|
1290
1289
|
|
|
1291
1290
|
static __initStatic() {this.info = {
|
|
@@ -1296,7 +1295,7 @@ class Solflare extends WindowSolana {
|
|
|
1296
1295
|
|
|
1297
1296
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1298
1297
|
return (
|
|
1299
|
-
_optionalChain$
|
|
1298
|
+
_optionalChain$b([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
1300
1299
|
window.solflare.isSolflare
|
|
1301
1300
|
)
|
|
1302
1301
|
};}
|
|
@@ -1306,7 +1305,7 @@ class Solflare extends WindowSolana {
|
|
|
1306
1305
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
1307
1306
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
1308
1307
|
|
|
1309
|
-
function _optionalChain$
|
|
1308
|
+
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; }
|
|
1310
1309
|
class TokenPocket extends WindowEthereum {
|
|
1311
1310
|
|
|
1312
1311
|
static __initStatic() {this.info = {
|
|
@@ -1317,12 +1316,12 @@ class TokenPocket extends WindowEthereum {
|
|
|
1317
1316
|
|
|
1318
1317
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1319
1318
|
return (
|
|
1320
|
-
_optionalChain$
|
|
1319
|
+
_optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
1321
1320
|
)
|
|
1322
1321
|
};}
|
|
1323
1322
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
1324
1323
|
|
|
1325
|
-
function _optionalChain$
|
|
1324
|
+
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; }
|
|
1326
1325
|
class TrustEVM extends WindowEthereum {
|
|
1327
1326
|
|
|
1328
1327
|
static __initStatic() {this.info = {
|
|
@@ -1334,13 +1333,13 @@ class TrustEVM extends WindowEthereum {
|
|
|
1334
1333
|
|
|
1335
1334
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1336
1335
|
return (
|
|
1337
|
-
(_optionalChain$
|
|
1336
|
+
(_optionalChain$9([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
1338
1337
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
1339
1338
|
)
|
|
1340
1339
|
};}
|
|
1341
1340
|
} TrustEVM.__initStatic(); TrustEVM.__initStatic2();
|
|
1342
1341
|
|
|
1343
|
-
function _optionalChain$
|
|
1342
|
+
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; }
|
|
1344
1343
|
class TrustSVM extends WindowSolana {
|
|
1345
1344
|
|
|
1346
1345
|
static __initStatic() {this.info = {
|
|
@@ -1351,11 +1350,11 @@ class TrustSVM extends WindowSolana {
|
|
|
1351
1350
|
};}
|
|
1352
1351
|
|
|
1353
1352
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1354
|
-
return _optionalChain$
|
|
1353
|
+
return _optionalChain$8([window, 'access', _3 => _3.solana, 'optionalAccess', _4 => _4.isTrustWallet])
|
|
1355
1354
|
};}
|
|
1356
1355
|
} TrustSVM.__initStatic(); TrustSVM.__initStatic2();
|
|
1357
1356
|
|
|
1358
|
-
function _optionalChain$
|
|
1357
|
+
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; }
|
|
1359
1358
|
class Uniswap extends WindowEthereum {
|
|
1360
1359
|
|
|
1361
1360
|
static __initStatic() {this.info = {
|
|
@@ -1366,19 +1365,19 @@ class Uniswap extends WindowEthereum {
|
|
|
1366
1365
|
|
|
1367
1366
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
1368
1367
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
1369
|
-
return _optionalChain$
|
|
1368
|
+
return _optionalChain$7([provider, 'optionalAccess', _4 => _4.isUniswapWallet])
|
|
1370
1369
|
}) : undefined
|
|
1371
1370
|
};}
|
|
1372
1371
|
|
|
1373
1372
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
1374
1373
|
return(
|
|
1375
1374
|
Uniswap.getEip6963Provider() ||
|
|
1376
|
-
_optionalChain$
|
|
1375
|
+
_optionalChain$7([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isUniswapWallet])
|
|
1377
1376
|
)
|
|
1378
1377
|
};}
|
|
1379
1378
|
|
|
1380
1379
|
getProvider() {
|
|
1381
|
-
return Uniswap.getEip6963Provider() || (_optionalChain$
|
|
1380
|
+
return Uniswap.getEip6963Provider() || (_optionalChain$7([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isUniswapWallet]) && _optionalChain$7([window, 'optionalAccess', _9 => _9.ethereum]))
|
|
1382
1381
|
}
|
|
1383
1382
|
} Uniswap.__initStatic(); Uniswap.__initStatic2(); Uniswap.__initStatic3();
|
|
1384
1383
|
|
|
@@ -1483,7 +1482,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
1483
1482
|
}
|
|
1484
1483
|
};
|
|
1485
1484
|
|
|
1486
|
-
function _optionalChain$
|
|
1485
|
+
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; }
|
|
1487
1486
|
|
|
1488
1487
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1489
1488
|
transaction = new Transaction(transaction);
|
|
@@ -1534,7 +1533,7 @@ const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
|
1534
1533
|
try {
|
|
1535
1534
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1536
1535
|
if(
|
|
1537
|
-
(error && _optionalChain$
|
|
1536
|
+
(error && _optionalChain$6([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
1538
1537
|
(error && error.toString().match('undefined'))
|
|
1539
1538
|
) {
|
|
1540
1539
|
setTimeout(()=>{
|
|
@@ -1548,7 +1547,7 @@ const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
|
1548
1547
|
});
|
|
1549
1548
|
} catch (error) {
|
|
1550
1549
|
if(
|
|
1551
|
-
(error && _optionalChain$
|
|
1550
|
+
(error && _optionalChain$6([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
1552
1551
|
(error && error.toString().match('undefined'))
|
|
1553
1552
|
) {
|
|
1554
1553
|
setTimeout(()=>{
|
|
@@ -1579,7 +1578,7 @@ const retrieveTransaction = (tx, blockchain)=>{
|
|
|
1579
1578
|
resolve(sentTransaction);
|
|
1580
1579
|
} catch (error) {
|
|
1581
1580
|
if(
|
|
1582
|
-
(error && _optionalChain$
|
|
1581
|
+
(error && _optionalChain$6([error, 'optionalAccess', _7 => _7.stack, 'optionalAccess', _8 => _8.match, 'call', _9 => _9('JSON-RPC error')])) ||
|
|
1583
1582
|
(error && error.toString().match('undefined'))
|
|
1584
1583
|
) {
|
|
1585
1584
|
setTimeout(()=>{
|
|
@@ -1621,8 +1620,8 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1621
1620
|
to: transaction.to,
|
|
1622
1621
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1623
1622
|
data: await transaction.getData(),
|
|
1624
|
-
gas: _optionalChain$
|
|
1625
|
-
gasLimit: _optionalChain$
|
|
1623
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1624
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1626
1625
|
gasPrice: gasPrice.toHexString(),
|
|
1627
1626
|
nonce: ethers.utils.hexlify(transaction.nonce),
|
|
1628
1627
|
}]
|
|
@@ -1649,16 +1648,16 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1649
1648
|
to: transaction.to,
|
|
1650
1649
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1651
1650
|
data: '0x0',
|
|
1652
|
-
gas: _optionalChain$
|
|
1653
|
-
gasLimit: _optionalChain$
|
|
1654
|
-
gasPrice: _optionalChain$
|
|
1651
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _14 => _14.toHexString, 'call', _15 => _15()]),
|
|
1652
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _16 => _16.toHexString, 'call', _17 => _17()]),
|
|
1653
|
+
gasPrice: _optionalChain$6([gasPrice, 'optionalAccess', _18 => _18.toHexString, 'call', _19 => _19()]),
|
|
1655
1654
|
nonce: ethers.utils.hexlify(transaction.nonce)
|
|
1656
1655
|
}]
|
|
1657
1656
|
}
|
|
1658
1657
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1659
1658
|
};
|
|
1660
1659
|
|
|
1661
|
-
function _optionalChain$
|
|
1660
|
+
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; }
|
|
1662
1661
|
|
|
1663
1662
|
const KEY = 'depay:wallets:wc2';
|
|
1664
1663
|
|
|
@@ -1711,7 +1710,7 @@ const getWalletConnectV2Config = (walletName)=>{
|
|
|
1711
1710
|
optionalNamespaces['eip155'] = {
|
|
1712
1711
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
1713
1712
|
};
|
|
1714
|
-
if(_optionalChain$
|
|
1713
|
+
if(_optionalChain$5([optionalNamespaces, 'optionalAccess', _ => _.eip155]) && _optionalChain$5([optionalNamespaces, 'optionalAccess', _2 => _2.eip155, 'optionalAccess', _3 => _3.chains, 'optionalAccess', _4 => _4.length])) {
|
|
1715
1714
|
optionalNamespaces['eip155'].methods = methods;
|
|
1716
1715
|
optionalNamespaces['eip155'].events = events;
|
|
1717
1716
|
}
|
|
@@ -1726,9 +1725,9 @@ const getSignClient = ()=>{
|
|
|
1726
1725
|
projectId: localStorage[KEY+":projectId"],
|
|
1727
1726
|
metadata: {
|
|
1728
1727
|
name: document.title || 'dApp',
|
|
1729
|
-
description: _optionalChain$
|
|
1728
|
+
description: _optionalChain$5([document, 'access', _5 => _5.querySelector, 'call', _6 => _6('meta[name="description"]'), 'optionalAccess', _7 => _7.getAttribute, 'call', _8 => _8('content')]) || document.title || 'dApp',
|
|
1730
1729
|
url: location.href,
|
|
1731
|
-
icons: [_optionalChain$
|
|
1730
|
+
icons: [_optionalChain$5([document, 'access', _9 => _9.querySelector, 'call', _10 => _10("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _11 => _11.href]) || `${location.origin}/favicon.ico`]
|
|
1732
1731
|
}
|
|
1733
1732
|
});
|
|
1734
1733
|
resolve(signClient);
|
|
@@ -1746,7 +1745,7 @@ class WalletConnectV2 {
|
|
|
1746
1745
|
};}
|
|
1747
1746
|
|
|
1748
1747
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1749
|
-
return !! await getLastSession(_optionalChain$
|
|
1748
|
+
return !! await getLastSession(_optionalChain$5([options, 'optionalAccess', _13 => _13.walletName]))
|
|
1750
1749
|
};}
|
|
1751
1750
|
|
|
1752
1751
|
constructor() {
|
|
@@ -1761,17 +1760,17 @@ class WalletConnectV2 {
|
|
|
1761
1760
|
}
|
|
1762
1761
|
|
|
1763
1762
|
async account() {
|
|
1764
|
-
if(_optionalChain$
|
|
1763
|
+
if(_optionalChain$5([this, 'access', _14 => _14.session, 'optionalAccess', _15 => _15.namespaces, 'optionalAccess', _16 => _16.eip155, 'optionalAccess', _17 => _17.accounts, 'optionalAccess', _18 => _18.length])) {
|
|
1765
1764
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1766
1765
|
}
|
|
1767
1766
|
}
|
|
1768
1767
|
|
|
1769
1768
|
async setSessionBlockchains() {
|
|
1770
|
-
if(!this.session || (!_optionalChain$
|
|
1769
|
+
if(!this.session || (!_optionalChain$5([this, 'access', _19 => _19.session, 'optionalAccess', _20 => _20.namespaces, 'optionalAccess', _21 => _21.eip155]) && !_optionalChain$5([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.optionalNamespaces, 'optionalAccess', _24 => _24.eip155]))) { return }
|
|
1771
1770
|
if(this.session.namespaces.eip155.chains) {
|
|
1772
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1771
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$5([Blockchains, 'access', _25 => _25.findByNetworkId, 'call', _26 => _26(chainIdentifier.split(':')[1]), 'optionalAccess', _27 => _27.name])).filter(Boolean);
|
|
1773
1772
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1774
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1773
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$5([Blockchains, 'access', _28 => _28.findByNetworkId, 'call', _29 => _29(accountIdentifier.split(':')[1]), 'optionalAccess', _30 => _30.name])).filter(Boolean);
|
|
1775
1774
|
}
|
|
1776
1775
|
}
|
|
1777
1776
|
|
|
@@ -1781,13 +1780,13 @@ class WalletConnectV2 {
|
|
|
1781
1780
|
|
|
1782
1781
|
try {
|
|
1783
1782
|
|
|
1784
|
-
this.walletName = _optionalChain$
|
|
1783
|
+
this.walletName = _optionalChain$5([options, 'optionalAccess', _31 => _31.name]);
|
|
1785
1784
|
|
|
1786
1785
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1787
1786
|
this.signClient = await getSignClient();
|
|
1788
1787
|
|
|
1789
1788
|
this.signClient.on("session_delete", (session)=> {
|
|
1790
|
-
if(_optionalChain$
|
|
1789
|
+
if(_optionalChain$5([session, 'optionalAccess', _32 => _32.topic]) === _optionalChain$5([this, 'access', _33 => _33.session, 'optionalAccess', _34 => _34.topic])) {
|
|
1791
1790
|
localStorage[KEY+':name'] = undefined;
|
|
1792
1791
|
localStorage[KEY+':logo'] = undefined;
|
|
1793
1792
|
this.signClient = undefined;
|
|
@@ -1796,14 +1795,14 @@ class WalletConnectV2 {
|
|
|
1796
1795
|
});
|
|
1797
1796
|
|
|
1798
1797
|
this.signClient.on("session_update", async(session)=> {
|
|
1799
|
-
if(_optionalChain$
|
|
1798
|
+
if(_optionalChain$5([session, 'optionalAccess', _35 => _35.topic]) === _optionalChain$5([this, 'access', _36 => _36.session, 'optionalAccess', _37 => _37.topic])) {
|
|
1800
1799
|
this.session = this.signClient.session.get(session.topic);
|
|
1801
1800
|
await this.setSessionBlockchains();
|
|
1802
1801
|
}
|
|
1803
1802
|
});
|
|
1804
1803
|
|
|
1805
1804
|
this.signClient.on("session_event", (event)=> {
|
|
1806
|
-
if(_optionalChain$
|
|
1805
|
+
if(_optionalChain$5([event, 'optionalAccess', _38 => _38.topic]) === _optionalChain$5([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {}
|
|
1807
1806
|
});
|
|
1808
1807
|
|
|
1809
1808
|
const connectWallet = async()=>{
|
|
@@ -1814,24 +1813,24 @@ class WalletConnectV2 {
|
|
|
1814
1813
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1815
1814
|
};
|
|
1816
1815
|
|
|
1817
|
-
const lastSession = _optionalChain$
|
|
1816
|
+
const lastSession = _optionalChain$5([this, 'optionalAccess', _41 => _41.walletName, 'optionalAccess', _42 => _42.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1818
1817
|
if(lastSession) {
|
|
1819
1818
|
this.session = lastSession;
|
|
1820
1819
|
} else {
|
|
1821
1820
|
await connectWallet();
|
|
1822
1821
|
}
|
|
1823
1822
|
|
|
1824
|
-
let meta = _optionalChain$
|
|
1823
|
+
let meta = _optionalChain$5([this, 'access', _43 => _43.session, 'optionalAccess', _44 => _44.peer, 'optionalAccess', _45 => _45.metadata]);
|
|
1825
1824
|
if(meta && meta.name) {
|
|
1826
1825
|
this.name = meta.name;
|
|
1827
1826
|
localStorage[KEY+':name'] = meta.name;
|
|
1828
|
-
if(_optionalChain$
|
|
1827
|
+
if(_optionalChain$5([meta, 'optionalAccess', _46 => _46.icons]) && meta.icons.length) {
|
|
1829
1828
|
this.logo = meta.icons[0];
|
|
1830
1829
|
localStorage[KEY+':logo'] = this.logo;
|
|
1831
1830
|
}
|
|
1832
1831
|
}
|
|
1833
|
-
if(_optionalChain$
|
|
1834
|
-
if(_optionalChain$
|
|
1832
|
+
if(_optionalChain$5([options, 'optionalAccess', _47 => _47.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1833
|
+
if(_optionalChain$5([options, 'optionalAccess', _48 => _48.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1835
1834
|
|
|
1836
1835
|
await this.setSessionBlockchains();
|
|
1837
1836
|
|
|
@@ -1871,7 +1870,7 @@ class WalletConnectV2 {
|
|
|
1871
1870
|
switch (event) {
|
|
1872
1871
|
case 'account':
|
|
1873
1872
|
internalCallback = async(event)=> {
|
|
1874
|
-
if(_optionalChain$
|
|
1873
|
+
if(_optionalChain$5([event, 'optionalAccess', _49 => _49.topic]) === _optionalChain$5([this, 'access', _50 => _50.session, 'optionalAccess', _51 => _51.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1875
1874
|
callback(await this.account());
|
|
1876
1875
|
}
|
|
1877
1876
|
};
|
|
@@ -1931,7 +1930,7 @@ class WalletConnectV2 {
|
|
|
1931
1930
|
|
|
1932
1931
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1933
1932
|
|
|
1934
|
-
function _optionalChain$
|
|
1933
|
+
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; }
|
|
1935
1934
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1936
1935
|
transaction = new Transaction(transaction);
|
|
1937
1936
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1983,7 +1982,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1983
1982
|
|
|
1984
1983
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1985
1984
|
if(
|
|
1986
|
-
(error && _optionalChain$
|
|
1985
|
+
(error && _optionalChain$4([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
1987
1986
|
(error && error.toString().match('undefined'))
|
|
1988
1987
|
) {
|
|
1989
1988
|
setTimeout(()=>{
|
|
@@ -1997,7 +1996,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1997
1996
|
});
|
|
1998
1997
|
} catch(error) {
|
|
1999
1998
|
if(
|
|
2000
|
-
(error && _optionalChain$
|
|
1999
|
+
(error && _optionalChain$4([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
2001
2000
|
(error && error.toString().match('undefined'))
|
|
2002
2001
|
) {
|
|
2003
2002
|
setTimeout(()=>{
|
|
@@ -2042,7 +2041,7 @@ const submitSimpleTransfer = ({ transaction, signer })=>{
|
|
|
2042
2041
|
})
|
|
2043
2042
|
};
|
|
2044
2043
|
|
|
2045
|
-
function _optionalChain$
|
|
2044
|
+
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; }
|
|
2046
2045
|
|
|
2047
2046
|
const getConnectedInstance = ()=>{
|
|
2048
2047
|
return window._connectedWalletLinkInstance
|
|
@@ -2096,10 +2095,10 @@ class WalletLink {
|
|
|
2096
2095
|
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
2097
2096
|
await connect({ uri: this.connector.qrUrl });
|
|
2098
2097
|
|
|
2099
|
-
_optionalChain$
|
|
2100
|
-
_optionalChain$
|
|
2098
|
+
_optionalChain$3([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-css-reset'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
|
|
2099
|
+
_optionalChain$3([document, 'access', _5 => _5.querySelector, 'call', _6 => _6('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _7 => _7.setAttribute, 'call', _8 => _8('style', 'display: none;')]);
|
|
2101
2100
|
setTimeout(()=>{
|
|
2102
|
-
if(_optionalChain$
|
|
2101
|
+
if(_optionalChain$3([this, 'optionalAccess', _9 => _9.connector, 'optionalAccess', _10 => _10._relay, 'optionalAccess', _11 => _11.ui, 'optionalAccess', _12 => _12.linkFlow, 'optionalAccess', _13 => _13.isOpen])){
|
|
2103
2102
|
this.connector._relay.ui.linkFlow.isOpen = false;
|
|
2104
2103
|
}
|
|
2105
2104
|
}, 10);
|
|
@@ -2223,17 +2222,363 @@ class WalletLink {
|
|
|
2223
2222
|
WalletLink.getConnectedInstance = getConnectedInstance;
|
|
2224
2223
|
WalletLink.setConnectedInstance = setConnectedInstance;
|
|
2225
2224
|
|
|
2225
|
+
function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$2(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; }// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/siwe/siwe.ts
|
|
2226
|
+
const generateSiweMessage = (siweMessageData) => {
|
|
2227
|
+
let siweMessage = '';
|
|
2228
|
+
|
|
2229
|
+
if (siweMessageData.scheme) {
|
|
2230
|
+
siweMessage += `${siweMessageData.scheme}://${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
2231
|
+
} else {
|
|
2232
|
+
siweMessage += `${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// NOTE: This differs from the ERC-4361 spec where the address is required
|
|
2236
|
+
if (siweMessageData.address) {
|
|
2237
|
+
siweMessage += `${siweMessageData.address}\n`;
|
|
2238
|
+
} else {
|
|
2239
|
+
siweMessage += '{address}\n';
|
|
2240
|
+
}
|
|
2241
|
+
siweMessage += '\n';
|
|
2242
|
+
|
|
2243
|
+
if (siweMessageData.statement) {
|
|
2244
|
+
siweMessage += `${siweMessageData.statement}\n`;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
siweMessage += '\n';
|
|
2248
|
+
|
|
2249
|
+
siweMessage += `URI: ${siweMessageData.uri}\n`;
|
|
2250
|
+
siweMessage += `Version: ${siweMessageData.version}\n`;
|
|
2251
|
+
siweMessage += `Chain ID: ${siweMessageData.chain_id}\n`;
|
|
2252
|
+
siweMessage += `Nonce: ${siweMessageData.nonce}\n`;
|
|
2253
|
+
siweMessage += `Issued At: ${siweMessageData.issued_at}\n`;
|
|
2254
|
+
|
|
2255
|
+
if (siweMessageData.expiration_time) {
|
|
2256
|
+
siweMessage += `Expiration Time: ${siweMessageData.expiration_time}\n`;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
if (siweMessageData.not_before) {
|
|
2260
|
+
siweMessage += `Not Before: ${siweMessageData.not_before}\n`;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
if (siweMessageData.request_id) {
|
|
2264
|
+
siweMessage += `Request ID: ${siweMessageData.request_id}\n`;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
return siweMessage
|
|
2268
|
+
};
|
|
2269
|
+
|
|
2270
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/transaction/validate-payload.ts
|
|
2271
|
+
const isValidHex = (str) => {
|
|
2272
|
+
return /^0x[0-9A-Fa-f]+$/.test(str)
|
|
2273
|
+
};
|
|
2274
|
+
const processTransactionPayload = (payload) => {
|
|
2275
|
+
// Handle primitives directly
|
|
2276
|
+
if (
|
|
2277
|
+
typeof payload === 'boolean' ||
|
|
2278
|
+
typeof payload === 'string' ||
|
|
2279
|
+
payload === null ||
|
|
2280
|
+
payload === undefined
|
|
2281
|
+
) {
|
|
2282
|
+
return payload
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
// Convert numbers to strings to prevent overflow issues
|
|
2286
|
+
if (typeof payload === 'number' || typeof payload === 'bigint') {
|
|
2287
|
+
return String(payload)
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
// Handle arrays by processing each element
|
|
2291
|
+
if (Array.isArray(payload)) {
|
|
2292
|
+
return payload.map((value) => processTransactionPayload(value))
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
// Handle objects
|
|
2296
|
+
if (typeof payload === 'object') {
|
|
2297
|
+
const result = { ...payload };
|
|
2298
|
+
|
|
2299
|
+
// Special handling for transaction value fields
|
|
2300
|
+
if ('value' in result && result.value !== undefined) {
|
|
2301
|
+
// Ensure it's a string
|
|
2302
|
+
if (typeof result.value !== 'string') {
|
|
2303
|
+
result.value = String(result.value);
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
if (!isValidHex(result.value)) {
|
|
2307
|
+
console.error(
|
|
2308
|
+
'Transaction value must be a valid hex string',
|
|
2309
|
+
result.value,
|
|
2310
|
+
);
|
|
2311
|
+
throw new Error(
|
|
2312
|
+
`Transaction value must be a valid hex string: ${result.value}`,
|
|
2313
|
+
)
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
// Process all object properties recursively
|
|
2318
|
+
for (const key in result) {
|
|
2319
|
+
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
2320
|
+
result[key] = processTransactionPayload(result[key]);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
return result
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
// Fallback for any other types
|
|
2328
|
+
return payload
|
|
2329
|
+
};
|
|
2330
|
+
|
|
2331
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/send-webview-event.ts
|
|
2332
|
+
const sendMiniKitEvent = function(payload) {
|
|
2333
|
+
if (window.webkit) {
|
|
2334
|
+
if (
|
|
2335
|
+
window.webkit.messageHandlers &&
|
|
2336
|
+
window.webkit.messageHandlers.minikit &&
|
|
2337
|
+
window.webkit.messageHandlers.minikit.postMessage
|
|
2338
|
+
) {
|
|
2339
|
+
window.webkit.messageHandlers.minikit.postMessage(payload);
|
|
2340
|
+
}
|
|
2341
|
+
} else if (window.Android && window.Android.postMessage) {
|
|
2342
|
+
window.Android.postMessage(JSON.stringify(payload));
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
|
|
2346
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/commands.ts
|
|
2347
|
+
let Command = {
|
|
2348
|
+
"Verify": 'verify',
|
|
2349
|
+
"Pay": 'pay',
|
|
2350
|
+
"WalletAuth": 'wallet-auth',
|
|
2351
|
+
"SendTransaction": 'send-transaction',
|
|
2352
|
+
"SignMessage": 'sign-message',
|
|
2353
|
+
"SignTypedData": 'sign-typed-data',
|
|
2354
|
+
"ShareContacts": 'share-contacts',
|
|
2355
|
+
"RequestPermission": 'request-permission',
|
|
2356
|
+
"GetPermissions": 'get-permissions',
|
|
2357
|
+
"SendHapticFeedback": 'send-haptic-feedback',
|
|
2358
|
+
"ShareFiles": 'share-files',
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/responses.ts
|
|
2362
|
+
let ResponseEvent = {
|
|
2363
|
+
"MiniAppVerifyAction": "miniapp-verify-action",
|
|
2364
|
+
"MiniAppPayment": "miniapp-payment",
|
|
2365
|
+
"MiniAppWalletAuth": "miniapp-wallet-auth",
|
|
2366
|
+
"MiniAppSendTransaction": "miniapp-send-transaction",
|
|
2367
|
+
"MiniAppSignMessage": "miniapp-sign-message",
|
|
2368
|
+
"MiniAppSignTypedData": "miniapp-sign-typed-data",
|
|
2369
|
+
"MiniAppShareContacts": "miniapp-share-contacts",
|
|
2370
|
+
"MiniAppRequestPermission": "miniapp-request-permission",
|
|
2371
|
+
"MiniAppGetPermissions": "miniapp-get-permissions",
|
|
2372
|
+
"MiniAppSendHapticFeedback": "miniapp-send-haptic-feedback",
|
|
2373
|
+
"MiniAppShareFiles": "miniapp-share-files",
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2376
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/index.ts
|
|
2377
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/minikit.ts
|
|
2378
|
+
|
|
2379
|
+
class MiniKit {
|
|
2380
|
+
|
|
2381
|
+
static __initStatic() {this.MINIKIT_VERSION = 1;}
|
|
2382
|
+
|
|
2383
|
+
static __initStatic2() {this.miniKitCommandVersion = {
|
|
2384
|
+
[Command.Verify]: 1,
|
|
2385
|
+
[Command.Pay]: 1,
|
|
2386
|
+
[Command.WalletAuth]: 1,
|
|
2387
|
+
[Command.SendTransaction]: 1,
|
|
2388
|
+
[Command.SignMessage]: 1,
|
|
2389
|
+
[Command.SignTypedData]: 1,
|
|
2390
|
+
[Command.ShareContacts]: 1,
|
|
2391
|
+
[Command.RequestPermission]: 1,
|
|
2392
|
+
[Command.GetPermissions]: 1,
|
|
2393
|
+
[Command.SendHapticFeedback]: 1,
|
|
2394
|
+
[Command.ShareFiles]: 1,
|
|
2395
|
+
};}
|
|
2396
|
+
|
|
2397
|
+
static __initStatic3() {this.listeners = {
|
|
2398
|
+
[ResponseEvent.MiniAppVerifyAction]: () => {},
|
|
2399
|
+
[ResponseEvent.MiniAppPayment]: () => {},
|
|
2400
|
+
[ResponseEvent.MiniAppWalletAuth]: () => {},
|
|
2401
|
+
[ResponseEvent.MiniAppSendTransaction]: () => {},
|
|
2402
|
+
[ResponseEvent.MiniAppSignMessage]: () => {},
|
|
2403
|
+
[ResponseEvent.MiniAppSignTypedData]: () => {},
|
|
2404
|
+
[ResponseEvent.MiniAppShareContacts]: () => {},
|
|
2405
|
+
[ResponseEvent.MiniAppRequestPermission]: () => {},
|
|
2406
|
+
[ResponseEvent.MiniAppGetPermissions]: () => {},
|
|
2407
|
+
[ResponseEvent.MiniAppSendHapticFeedback]: () => {},
|
|
2408
|
+
[ResponseEvent.MiniAppShareFiles]: () => {},
|
|
2409
|
+
};}
|
|
2410
|
+
|
|
2411
|
+
static __initStatic4() {this.appId = null;}
|
|
2412
|
+
static __initStatic5() {this.user = {};}
|
|
2413
|
+
static __initStatic6() {this.isReady = false;}
|
|
2414
|
+
|
|
2415
|
+
static install(appId) {
|
|
2416
|
+
|
|
2417
|
+
if (typeof window === "undefined" || Boolean(window.MiniKit)) {
|
|
2418
|
+
return {
|
|
2419
|
+
success: false,
|
|
2420
|
+
errorCode: 'already_installed',
|
|
2421
|
+
errorMessage: 'MiniKit is already installed.'
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
if (!appId) {
|
|
2426
|
+
console.warn("App ID not provided during install");
|
|
2427
|
+
} else {
|
|
2428
|
+
MiniKit.appId = appId;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
if (!window.WorldApp) {
|
|
2432
|
+
return {
|
|
2433
|
+
success: false,
|
|
2434
|
+
errorCode: 'outside_of_worldapp',
|
|
2435
|
+
errorMessage: 'MiniApp launched outside of WorldApp.'
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
// Set user properties
|
|
2440
|
+
MiniKit.user.optedIntoOptionalAnalytics = window.WorldApp.is_optional_analytics;
|
|
2441
|
+
MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
2442
|
+
MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
2443
|
+
|
|
2444
|
+
try {
|
|
2445
|
+
window.MiniKit = MiniKit;
|
|
2446
|
+
this.sendInit();
|
|
2447
|
+
} catch (error) {
|
|
2448
|
+
console.error(
|
|
2449
|
+
'Failed to install MiniKit.',
|
|
2450
|
+
error
|
|
2451
|
+
);
|
|
2452
|
+
|
|
2453
|
+
return {
|
|
2454
|
+
success: false,
|
|
2455
|
+
errorCode: 'unknown',
|
|
2456
|
+
errorMessage: 'Failed to install MiniKit.'
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
MiniKit.isReady = true;
|
|
2461
|
+
return { success: true }
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
static sendInit() {
|
|
2465
|
+
sendWebviewEvent({
|
|
2466
|
+
command: 'init',
|
|
2467
|
+
payload: { version: this.MINIKIT_VERSION },
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
static subscribe(event, handler) {
|
|
2472
|
+
if (event === ResponseEvent.MiniAppWalletAuth) {
|
|
2473
|
+
const originalHandler = handler;
|
|
2474
|
+
const wrappedHandler = async (payload) => {
|
|
2475
|
+
if (payload.status === 'success') {
|
|
2476
|
+
MiniKit.user.walletAddress = payload.address;
|
|
2477
|
+
}
|
|
2478
|
+
originalHandler(payload);
|
|
2479
|
+
};
|
|
2480
|
+
this.listeners[event] = wrappedHandler;
|
|
2481
|
+
} else if (event === ResponseEvent.MiniAppVerifyAction) {
|
|
2482
|
+
const originalHandler = handler;
|
|
2483
|
+
const wrappedHandler = (payload) => {
|
|
2484
|
+
originalHandler(payload);
|
|
2485
|
+
};
|
|
2486
|
+
this.listeners[event] = wrappedHandler;
|
|
2487
|
+
} else {
|
|
2488
|
+
this.listeners[event] = handler;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
static unsubscribe(event) {
|
|
2493
|
+
delete this.listeners[event];
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
static trigger(event, payload) {
|
|
2497
|
+
if (!this.listeners[event]) {
|
|
2498
|
+
console.error(
|
|
2499
|
+
`No handler for event ${event}, payload: ${JSON.stringify(payload)}`
|
|
2500
|
+
);
|
|
2501
|
+
return
|
|
2502
|
+
}
|
|
2503
|
+
this.listeners[event](payload);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
static __initStatic7() {this.commands = {
|
|
2507
|
+
|
|
2508
|
+
walletAuth: (payload) => {
|
|
2509
|
+
|
|
2510
|
+
let protocol = null;
|
|
2511
|
+
try {
|
|
2512
|
+
const currentUrl = new URL(window.location.href);
|
|
2513
|
+
protocol = currentUrl.protocol.split(':')[0];
|
|
2514
|
+
} catch (error) {
|
|
2515
|
+
console.error('Failed to get current URL', error);
|
|
2516
|
+
return null
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
const siweMessage = generateSiweMessage({
|
|
2520
|
+
scheme: protocol,
|
|
2521
|
+
domain: window.location.host,
|
|
2522
|
+
statement: _nullishCoalesce(payload.statement, () => ( undefined)),
|
|
2523
|
+
uri: window.location.href,
|
|
2524
|
+
version: '1',
|
|
2525
|
+
chain_id: 480,
|
|
2526
|
+
nonce: payload.nonce,
|
|
2527
|
+
issued_at: new Date().toISOString(),
|
|
2528
|
+
expiration_time: _optionalChain$2([payload, 'access', _7 => _7.expirationTime, 'optionalAccess', _8 => _8.toISOString, 'call', _9 => _9()]),
|
|
2529
|
+
not_before: _optionalChain$2([payload, 'access', _10 => _10.notBefore, 'optionalAccess', _11 => _11.toISOString, 'call', _12 => _12()]),
|
|
2530
|
+
request_id: _nullishCoalesce(payload.requestId, () => ( undefined)),
|
|
2531
|
+
});
|
|
2532
|
+
|
|
2533
|
+
const walletAuthPayload = { siweMessage };
|
|
2534
|
+
sendMiniKitEvent({
|
|
2535
|
+
command: Command.WalletAuth,
|
|
2536
|
+
version: this.miniKitCommandVersion[Command.WalletAuth],
|
|
2537
|
+
payload: walletAuthPayload,
|
|
2538
|
+
});
|
|
2539
|
+
|
|
2540
|
+
return walletAuthPayload
|
|
2541
|
+
},
|
|
2542
|
+
|
|
2543
|
+
sendTransaction: (payload) => {
|
|
2544
|
+
|
|
2545
|
+
const validatedPayload = processTransactionPayload(payload);
|
|
2546
|
+
|
|
2547
|
+
sendMiniKitEvent({
|
|
2548
|
+
command: Command.SendTransaction,
|
|
2549
|
+
version: this.miniKitCommandVersion[Command.SendTransaction],
|
|
2550
|
+
payload: validatedPayload,
|
|
2551
|
+
});
|
|
2552
|
+
|
|
2553
|
+
return validatedPayload
|
|
2554
|
+
},
|
|
2555
|
+
|
|
2556
|
+
signMessage: (payload) => {
|
|
2557
|
+
|
|
2558
|
+
sendMiniKitEvent({
|
|
2559
|
+
command: Command.SignMessage,
|
|
2560
|
+
version: this.miniKitCommandVersion[Command.SignMessage],
|
|
2561
|
+
payload,
|
|
2562
|
+
});
|
|
2563
|
+
|
|
2564
|
+
return payload
|
|
2565
|
+
},
|
|
2566
|
+
};}
|
|
2567
|
+
} MiniKit.__initStatic(); MiniKit.__initStatic2(); MiniKit.__initStatic3(); MiniKit.__initStatic4(); MiniKit.__initStatic5(); MiniKit.__initStatic6(); MiniKit.__initStatic7();
|
|
2568
|
+
|
|
2226
2569
|
function _optionalChain$1(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; }
|
|
2227
2570
|
|
|
2228
2571
|
class WorldApp {
|
|
2229
2572
|
|
|
2230
|
-
static __initStatic() {this.
|
|
2573
|
+
static __initStatic() {this.MiniKit = MiniKit;}
|
|
2574
|
+
|
|
2575
|
+
static __initStatic2() {this.info = {
|
|
2231
2576
|
name: 'World App',
|
|
2232
2577
|
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMzIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cmVjdCBmaWxsPSIjMDAwMDAwIiB3aWR0aD0iMzMiIGhlaWdodD0iMzIiLz4KICAgIDwvZz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjQuNywxMi41Yy0uNS0xLjEtMS4xLTItMS45LTIuOHMtMS44LTEuNS0yLjgtMS45Yy0xLjEtLjUtMi4zLS43LTMuNS0uN3MtMi40LjItMy41LjdjLTEuMS41LTIsMS4xLTIuOCwxLjlzLTEuNSwxLjgtMS45LDIuOGMtLjUsMS4xLS43LDIuMy0uNywzLjVzLjIsMi40LjcsMy41LDEuMSwyLDEuOSwyLjhjLjguOCwxLjgsMS41LDIuOCwxLjksMS4xLjUsMi4zLjcsMy41LjdzMi40LS4yLDMuNS0uNywyLTEuMSwyLjgtMS45LDEuNS0xLjgsMS45LTIuOGMuNS0xLjEuNy0yLjMuNy0zLjVzLS4yLTIuNC0uNy0zLjVaTTEzLjUsMTUuMmMuNC0xLjQsMS43LTIuNSwzLjItMi41aDYuMmMuNC44LjcsMS42LjcsMi41aC0xMC4xWk0yMy43LDE2LjhjMCwuOS0uNCwxLjctLjcsMi41aC02LjJjLTEuNSwwLTIuOC0xLjEtMy4yLTIuNWgxMC4xWk0xMS40LDEwLjljMS40LTEuNCwzLjItMi4xLDUuMS0yLjFzMy44LjcsNS4xLDIuMWguMWMwLC4xLTUsLjEtNSwuMS0xLjMsMC0yLjYuNS0zLjUsMS41LS43LjctMS4yLDEuNy0xLjQsMi43aC0yLjVjLjItMS42LjktMy4xLDIuMS00LjNaTTE2LjUsMjMuMmMtMS45LDAtMy44LS43LTUuMS0yLjEtMS4yLTEuMi0xLjktMi43LTIuMS00LjNoMi41Yy4yLDEsLjcsMS45LDEuNCwyLjcuOS45LDIuMiwxLjUsMy41LDEuNWg1LS4xYy0xLjQsMS41LTMuMiwyLjItNS4xLDIuMloiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=",
|
|
2233
2578
|
blockchains: ["worldchain"]
|
|
2234
2579
|
};}
|
|
2235
2580
|
|
|
2236
|
-
static
|
|
2581
|
+
static __initStatic3() {this.isAvailable = async()=>{
|
|
2237
2582
|
return Boolean(
|
|
2238
2583
|
_optionalChain$1([window, 'optionalAccess', _2 => _2.WorldApp])
|
|
2239
2584
|
)
|
|
@@ -2248,25 +2593,17 @@ class WorldApp {
|
|
|
2248
2593
|
}
|
|
2249
2594
|
|
|
2250
2595
|
sendTransaction(transaction) {
|
|
2251
|
-
console.log('sendTransaction', transaction);
|
|
2252
2596
|
transaction = new Transaction(transaction);
|
|
2253
|
-
console.log('after transaction wrapping transaction.sent', transaction.sent);
|
|
2254
|
-
console.log('after transaction wrapping transaction.succeeded', transaction.succeeded);
|
|
2255
|
-
console.log('after transaction wrapping transaction.failed', transaction.failed);
|
|
2256
2597
|
|
|
2257
2598
|
return new Promise(async(resolve, reject)=>{
|
|
2258
2599
|
await transaction.prepare({ wallet: this });
|
|
2259
|
-
console.log('after prepare transaction', transaction);
|
|
2260
2600
|
transaction.nonce = (await this.transactionCount({ blockchain: 'worldchain', address: transaction.from })).toString();
|
|
2261
|
-
|
|
2601
|
+
transaction.fromBlock = await request('worldchain://latestBlockNumber');
|
|
2262
2602
|
|
|
2263
|
-
console.log('before MiniKit.subscribe');
|
|
2264
2603
|
MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
|
|
2265
|
-
|
|
2604
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSendTransaction);
|
|
2266
2605
|
if (payload.status == "success") {
|
|
2267
|
-
console.log('before transaction.accepted', transaction);
|
|
2268
2606
|
if (transaction.accepted) { transaction.accepted(); }
|
|
2269
|
-
console.log('after transaction.accepted', transaction);
|
|
2270
2607
|
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
|
|
2271
2608
|
if(transactionHash) {
|
|
2272
2609
|
resolve(transaction);
|
|
@@ -2278,9 +2615,7 @@ class WorldApp {
|
|
|
2278
2615
|
reject('Submitting transaction failed!');
|
|
2279
2616
|
}
|
|
2280
2617
|
});
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
console.log('before MiniKit.commands.sendTransaction', {
|
|
2618
|
+
MiniKit.commands.sendTransaction({
|
|
2284
2619
|
transaction: [
|
|
2285
2620
|
{
|
|
2286
2621
|
address: transaction.to,
|
|
@@ -2291,70 +2626,107 @@ class WorldApp {
|
|
|
2291
2626
|
],
|
|
2292
2627
|
permit2: [_optionalChain$1([transaction, 'access', _13 => _13.params, 'optionalAccess', _14 => _14.permit2])]
|
|
2293
2628
|
});
|
|
2294
|
-
MiniKit.commands.sendTransaction({
|
|
2295
|
-
transaction: [
|
|
2296
|
-
{
|
|
2297
|
-
address: transaction.to,
|
|
2298
|
-
abi: _optionalChain$1([transaction, 'access', _15 => _15.api, 'optionalAccess', _16 => _16.filter, 'call', _17 => _17((fragment)=>fragment.name === transaction.method && _optionalChain$1([fragment, 'optionalAccess', _18 => _18.inputs, 'optionalAccess', _19 => _19.length]) === _optionalChain$1([transaction, 'access', _20 => _20.params, 'optionalAccess', _21 => _21.args, 'optionalAccess', _22 => _22.length]))]),
|
|
2299
|
-
functionName: transaction.method,
|
|
2300
|
-
args: _optionalChain$1([transaction, 'access', _23 => _23.params, 'optionalAccess', _24 => _24.args])
|
|
2301
|
-
},
|
|
2302
|
-
],
|
|
2303
|
-
permit2: [_optionalChain$1([transaction, 'access', _25 => _25.params, 'optionalAccess', _26 => _26.permit2])]
|
|
2304
|
-
});
|
|
2305
|
-
console.log('after MiniKit.commands.sendTransaction');
|
|
2306
2629
|
})
|
|
2307
2630
|
}
|
|
2308
2631
|
|
|
2309
2632
|
retryFetchTransaction(transaction, payload, attempt) {
|
|
2310
|
-
console.log('Retry Fetch transaction', attempt);
|
|
2311
2633
|
return new Promise((resolve, reject)=>{
|
|
2312
2634
|
setTimeout(()=>{
|
|
2313
2635
|
this.fetchTransaction(transaction, payload, attempt+1).then(resolve).catch(reject);
|
|
2314
|
-
}, (attempt < 30 ? 500 :
|
|
2636
|
+
}, (attempt < 30 ? 500 : 2000));
|
|
2315
2637
|
})
|
|
2316
2638
|
}
|
|
2317
2639
|
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2640
|
+
pollTransactionIdFromWorldchain(payload) {
|
|
2641
|
+
|
|
2642
|
+
return new Promise((resolve)=>{
|
|
2643
|
+
|
|
2644
|
+
fetch(`https://public.depay.com/transactions/worldchain/${payload.transaction_id}?app_id=${payload.mini_app_id}`, {
|
|
2322
2645
|
headers: { "Content-Type": "application/json" },
|
|
2323
2646
|
}).then((response)=>{
|
|
2324
|
-
console.log('After fetch', response);
|
|
2325
2647
|
if(response.ok) {
|
|
2326
|
-
console.log('Before json');
|
|
2327
2648
|
response.json().then((transactionJSON)=>{
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
transaction.id = _optionalChain$1([transactionJSON, 'optionalAccess', _28 => _28.external_id]);
|
|
2331
|
-
transaction.url = Blockchains['worldchain'].explorerUrlFor({ transaction });
|
|
2332
|
-
console.log('before transaction.sent', transaction.sent);
|
|
2333
|
-
if (transaction.sent) { transaction.sent(transaction); }
|
|
2334
|
-
console.log('Before provider');
|
|
2335
|
-
getProvider('worldchain').then((provider)=>{
|
|
2336
|
-
console.log('After provider', provider);
|
|
2337
|
-
console.log('Before wait transaction', transactionJSON.external_id);
|
|
2338
|
-
provider.waitForTransaction(transactionJSON.external_id).then((receipt)=>{
|
|
2339
|
-
console.log('After receipt', receipt);
|
|
2340
|
-
if(receipt && receipt.status == 1) {
|
|
2341
|
-
transaction._succeeded = true;
|
|
2342
|
-
console.log('before transaction.succeeded', transaction.succeeded);
|
|
2343
|
-
if (transaction.succeeded) { transaction.succeeded(transaction); }
|
|
2344
|
-
resolve(transaction);
|
|
2345
|
-
} else {
|
|
2346
|
-
if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
|
|
2347
|
-
}
|
|
2348
|
-
}).catch(reject);
|
|
2349
|
-
}).catch(reject);
|
|
2649
|
+
if(_optionalChain$1([transactionJSON, 'optionalAccess', _15 => _15.external_id])) {
|
|
2650
|
+
resolve(_optionalChain$1([transactionJSON, 'optionalAccess', _16 => _16.external_id]));
|
|
2350
2651
|
} else {
|
|
2351
|
-
|
|
2652
|
+
resolve();
|
|
2352
2653
|
}
|
|
2353
|
-
}).catch(()=>
|
|
2654
|
+
}).catch(()=>resolve());
|
|
2655
|
+
} else {
|
|
2656
|
+
resolve();
|
|
2657
|
+
}
|
|
2658
|
+
}).catch((error)=>{
|
|
2659
|
+
console.log('CATCH ERROR', error);
|
|
2660
|
+
resolve();
|
|
2661
|
+
});
|
|
2662
|
+
})
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
pollEventForUserOp(transaction, payload) {
|
|
2666
|
+
|
|
2667
|
+
return new Promise((resolve)=>{
|
|
2668
|
+
|
|
2669
|
+
rpcRequest({
|
|
2670
|
+
blockchain: 'worldchain',
|
|
2671
|
+
method: "eth_getLogs",
|
|
2672
|
+
params: [
|
|
2673
|
+
{
|
|
2674
|
+
"fromBlock": ethers.utils.hexValue(transaction.fromBlock),
|
|
2675
|
+
"toBlock": "latest",
|
|
2676
|
+
"address": "0x0000000071727De22E5E9d8BAf0edAc6f37da032", // entry point
|
|
2677
|
+
"topics": [
|
|
2678
|
+
"0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
|
|
2679
|
+
payload.userOpHash
|
|
2680
|
+
]
|
|
2681
|
+
}
|
|
2682
|
+
]
|
|
2683
|
+
}).then((responseData)=>{
|
|
2684
|
+
if(responseData && responseData instanceof Array) {
|
|
2685
|
+
let event = responseData.find((event)=>{
|
|
2686
|
+
return(!event.removed)
|
|
2687
|
+
});
|
|
2688
|
+
if(event && event.transactionHash) {
|
|
2689
|
+
return resolve(event.transactionHash)
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
resolve();
|
|
2693
|
+
}).catch(()=>resolve());
|
|
2694
|
+
})
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
fetchTransaction(transaction, payload, attempt = 1) {
|
|
2700
|
+
return new Promise((resolve, reject)=>{
|
|
2701
|
+
|
|
2702
|
+
Promise.all([
|
|
2703
|
+
this.pollTransactionIdFromWorldchain(payload),
|
|
2704
|
+
this.pollEventForUserOp(transaction, payload),
|
|
2705
|
+
]).then((results)=>{
|
|
2706
|
+
let transactionHash = results ? results.filter(Boolean)[0] : undefined;
|
|
2707
|
+
if(transactionHash) {
|
|
2708
|
+
transaction.id = transactionHash;
|
|
2709
|
+
transaction.url = Blockchains['worldchain'].explorerUrlFor({ transaction });
|
|
2710
|
+
if (transaction.sent) { transaction.sent(transaction); }
|
|
2711
|
+
getProvider('worldchain').then((provider)=>{
|
|
2712
|
+
provider.waitForTransaction(transactionHash).then((receipt)=>{
|
|
2713
|
+
if(receipt && receipt.status == 1) {
|
|
2714
|
+
transaction._succeeded = true;
|
|
2715
|
+
if (transaction.succeeded) { transaction.succeeded(transaction); }
|
|
2716
|
+
resolve(transaction);
|
|
2717
|
+
} else {
|
|
2718
|
+
if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
|
|
2719
|
+
reject(transaction);
|
|
2720
|
+
}
|
|
2721
|
+
}).catch(reject);
|
|
2722
|
+
}).catch(reject);
|
|
2354
2723
|
} else {
|
|
2355
2724
|
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
2356
2725
|
}
|
|
2357
|
-
}).catch(()=>
|
|
2726
|
+
}).catch((error)=>{
|
|
2727
|
+
console.log('CATCH ERROR!', error);
|
|
2728
|
+
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
2729
|
+
});
|
|
2358
2730
|
})
|
|
2359
2731
|
}
|
|
2360
2732
|
|
|
@@ -2364,37 +2736,33 @@ class WorldApp {
|
|
|
2364
2736
|
|
|
2365
2737
|
async account() {
|
|
2366
2738
|
if(!this.getProvider()) { return undefined }
|
|
2367
|
-
return
|
|
2739
|
+
return this.walletAddress()
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
walletAddress() {
|
|
2743
|
+
return (_optionalChain$1([window, 'access', _17 => _17.MiniKit, 'access', _18 => _18.user, 'optionalAccess', _19 => _19.walletAddress]) || _optionalChain$1([MiniKit, 'access', _20 => _20.user, 'optionalAccess', _21 => _21.walletAddress]))
|
|
2368
2744
|
}
|
|
2369
2745
|
|
|
2370
2746
|
connect() {
|
|
2371
2747
|
|
|
2372
2748
|
return new Promise( async(resolve, reject)=>{
|
|
2373
2749
|
|
|
2374
|
-
if(
|
|
2375
|
-
return resolve(
|
|
2750
|
+
if(this.walletAddress()) {
|
|
2751
|
+
return resolve(this.walletAddress())
|
|
2376
2752
|
}
|
|
2377
2753
|
|
|
2378
2754
|
MiniKit.subscribe(ResponseEvent.MiniAppWalletAuth, async (payload) => {
|
|
2755
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppWalletAuth);
|
|
2379
2756
|
if (payload.status === "error") {
|
|
2380
2757
|
return reject(payload.message)
|
|
2381
2758
|
} else {
|
|
2382
|
-
return resolve(
|
|
2759
|
+
return resolve(this.walletAddress())
|
|
2383
2760
|
}
|
|
2384
2761
|
});
|
|
2385
2762
|
|
|
2386
|
-
|
|
2387
|
-
nonce: crypto.randomUUID().replace(/-/g, "")
|
|
2388
|
-
expirationTime: new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000),
|
|
2389
|
-
notBefore: new Date(new Date().getTime() - 24 * 60 * 60 * 1000),
|
|
2390
|
-
statement: "Connect World App (v17.6.2)"
|
|
2763
|
+
MiniKit.commands.walletAuth({
|
|
2764
|
+
nonce: crypto.randomUUID().replace(/-/g, "")
|
|
2391
2765
|
});
|
|
2392
|
-
|
|
2393
|
-
if(finalPayload.status == 'error') {
|
|
2394
|
-
return reject(finalPayload.message)
|
|
2395
|
-
} else {
|
|
2396
|
-
return resolve(MiniKit.walletAddress || _optionalChain$1([window, 'access', _31 => _31.MiniKit, 'optionalAccess', _32 => _32.walletAddress]))
|
|
2397
|
-
}
|
|
2398
2766
|
})
|
|
2399
2767
|
}
|
|
2400
2768
|
|
|
@@ -2423,12 +2791,12 @@ class WorldApp {
|
|
|
2423
2791
|
}
|
|
2424
2792
|
|
|
2425
2793
|
async transactionCount({ blockchain, address }) {
|
|
2426
|
-
if(!
|
|
2794
|
+
if(!this.walletAddress()) {
|
|
2427
2795
|
return 0
|
|
2428
2796
|
} else {
|
|
2429
2797
|
return request({
|
|
2430
2798
|
blockchain: 'worldchain',
|
|
2431
|
-
address:
|
|
2799
|
+
address: this.walletAddress(),
|
|
2432
2800
|
api: [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"AddedOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"approvedHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"ApproveHash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"handler","type":"address"}],"name":"ChangedFallbackHandler","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guard","type":"address"}],"name":"ChangedGuard","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"threshold","type":"uint256"}],"name":"ChangedThreshold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"DisabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"EnabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"txHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"payment","type":"uint256"}],"name":"ExecutionFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"txHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"payment","type":"uint256"}],"name":"ExecutionSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"RemovedOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":false,"internalType":"address[]","name":"owners","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"threshold","type":"uint256"},{"indexed":false,"internalType":"address","name":"initializer","type":"address"},{"indexed":false,"internalType":"address","name":"fallbackHandler","type":"address"}],"name":"SafeSetup","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"msgHash","type":"bytes32"}],"name":"SignMsg","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"addOwnerWithThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hashToApprove","type":"bytes32"}],"name":"approveHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"approvedHashes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"changeThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signatures","type":"bytes"},{"internalType":"uint256","name":"requiredSignatures","type":"uint256"}],"name":"checkNSignatures","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signatures","type":"bytes"}],"name":"checkSignatures","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"prevModule","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"disableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"enableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"},{"internalType":"uint256","name":"safeTxGas","type":"uint256"},{"internalType":"uint256","name":"baseGas","type":"uint256"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"address","name":"refundReceiver","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"}],"name":"encodeTransactionData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"},{"internalType":"uint256","name":"safeTxGas","type":"uint256"},{"internalType":"uint256","name":"baseGas","type":"uint256"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"addresspayable","name":"refundReceiver","type":"address"},{"internalType":"bytes","name":"signatures","type":"bytes"}],"name":"execTransaction","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModule","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModuleReturnData","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"start","type":"address"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getModulesPaginated","outputs":[{"internalType":"address[]","name":"array","type":"address[]"},{"internalType":"address","name":"next","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwners","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"getStorageAt","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"},{"internalType":"uint256","name":"safeTxGas","type":"uint256"},{"internalType":"uint256","name":"baseGas","type":"uint256"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"address","name":"refundReceiver","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"}],"name":"getTransactionHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"isModuleEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"prevOwner","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"removeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enumEnum.Operation","name":"operation","type":"uint8"}],"name":"requiredTxGas","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handler","type":"address"}],"name":"setFallbackHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guard","type":"address"}],"name":"setGuard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_owners","type":"address[]"},{"internalType":"uint256","name":"_threshold","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"fallbackHandler","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"payment","type":"uint256"},{"internalType":"addresspayable","name":"paymentReceiver","type":"address"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"signedMessages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"targetContract","type":"address"},{"internalType":"bytes","name":"calldataPayload","type":"bytes"}],"name":"simulateAndRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"prevOwner","type":"address"},{"internalType":"address","name":"oldOwner","type":"address"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"swapOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],
|
|
2433
2801
|
method: 'nonce'
|
|
2434
2802
|
})
|
|
@@ -2440,18 +2808,17 @@ class WorldApp {
|
|
|
2440
2808
|
return new Promise((resolve, reject)=>{
|
|
2441
2809
|
|
|
2442
2810
|
MiniKit.subscribe(ResponseEvent.MiniAppSignMessage, async (payload) => {
|
|
2811
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSignMessage);
|
|
2443
2812
|
if (payload.status === "error") {
|
|
2444
2813
|
return reject()
|
|
2445
2814
|
} else {
|
|
2446
2815
|
return resolve(payload.signature)
|
|
2447
2816
|
}
|
|
2448
2817
|
});
|
|
2449
|
-
|
|
2450
2818
|
MiniKit.commands.signMessage({ message });
|
|
2451
|
-
|
|
2452
2819
|
})
|
|
2453
2820
|
}
|
|
2454
|
-
} WorldApp.__initStatic(); WorldApp.__initStatic2();
|
|
2821
|
+
} WorldApp.__initStatic(); WorldApp.__initStatic2(); WorldApp.__initStatic3();
|
|
2455
2822
|
|
|
2456
2823
|
var wallets = {
|
|
2457
2824
|
MetaMask,
|