@depay/web3-wallets-svm 18.0.8 → 18.0.10
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 -194
- package/dist/esm/index.js +588 -227
- package/dist/umd/index.evm.js +563 -201
- package/dist/umd/index.js +596 -234
- 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
|
|
|
@@ -697,9 +696,6 @@ class WindowEthereum {
|
|
|
697
696
|
if(typeof message === 'object') {
|
|
698
697
|
let provider = this.getProvider();
|
|
699
698
|
let account = await this.account();
|
|
700
|
-
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
701
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
702
|
-
}
|
|
703
699
|
let signature = await provider.request({
|
|
704
700
|
method: 'eth_signTypedData_v4',
|
|
705
701
|
params: [account, message],
|
|
@@ -716,7 +712,7 @@ class WindowEthereum {
|
|
|
716
712
|
}
|
|
717
713
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
718
714
|
|
|
719
|
-
function _optionalChain$
|
|
715
|
+
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
716
|
class Binance extends WindowEthereum {
|
|
721
717
|
|
|
722
718
|
static __initStatic() {this.info = {
|
|
@@ -726,7 +722,7 @@ class Binance extends WindowEthereum {
|
|
|
726
722
|
};}
|
|
727
723
|
|
|
728
724
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
729
|
-
return _optionalChain$
|
|
725
|
+
return _optionalChain$w([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
730
726
|
!window.coin98 &&
|
|
731
727
|
!window.trustwallet
|
|
732
728
|
};}
|
|
@@ -746,7 +742,7 @@ var logos = {
|
|
|
746
742
|
okx: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI4LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMzYuMSAzMzYuMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzM2LjEgMzM2LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPHBhdGggZD0iTTMxMy43LDBIMjIuNEMxMCwwLDAsMTAsMCwyMi40djI5MS4zYzAsMTIuNCwxMCwyMi40LDIyLjQsMjIuNGgyOTEuM2MxMi40LDAsMjIuNC0xMCwyMi40LTIyLjRWMjIuNAoJQzMzNi4xLDEwLDMyNi4xLDAsMzEzLjcsMHoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIwNC41LDEzMC43aC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTV2LTY0LjcKCUMyMDkuNSwxMzIuOSwyMDcuMiwxMzAuNywyMDQuNSwxMzAuN3oiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDU2LjFINjUuMWMtMi43LDAtNSwyLjItNSw1djY0LjdjMCwyLjcsMi4yLDUsNSw1aDY0LjdjMi44LDAsNS0yLjIsNS01VjYxCglDMTM0LjgsNTguMywxMzIuNSw1Ni4xLDEyOS44LDU2LjF6Ii8+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNzkuMSw1Ni4xaC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTVWNjEKCUMyODQuMSw1OC4zLDI4MS45LDU2LjEsMjc5LjEsNTYuMXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDIwNS40SDY1LjFjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuOCwwLDUtMi4yLDUtNXYtNjQuNwoJQzEzNC44LDIwNy42LDEzMi41LDIwNS40LDEyOS44LDIwNS40eiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjc5LjEsMjA1LjRoLTY0LjdjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuNywwLDUtMi4yLDUtNXYtNjQuNwoJQzI4NC4xLDIwNy42LDI4MS45LDIwNS40LDI3OS4xLDIwNS40eiIvPgo8L3N2Zz4K",
|
|
747
743
|
};
|
|
748
744
|
|
|
749
|
-
function _optionalChain$
|
|
745
|
+
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
746
|
class BraveEVM extends WindowEthereum {
|
|
751
747
|
|
|
752
748
|
static __initStatic() {this.info = {
|
|
@@ -756,14 +752,14 @@ class BraveEVM extends WindowEthereum {
|
|
|
756
752
|
platform: 'evm',
|
|
757
753
|
};}
|
|
758
754
|
|
|
759
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
755
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$v([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
760
756
|
|
|
761
757
|
getProvider() {
|
|
762
758
|
return window.ethereum
|
|
763
759
|
}
|
|
764
760
|
} BraveEVM.__initStatic(); BraveEVM.__initStatic2();
|
|
765
761
|
|
|
766
|
-
function _optionalChain$
|
|
762
|
+
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
763
|
class BraveSVM extends WindowSolana {
|
|
768
764
|
|
|
769
765
|
static __initStatic() {this.info = {
|
|
@@ -773,14 +769,14 @@ class BraveSVM extends WindowSolana {
|
|
|
773
769
|
platform: 'svm',
|
|
774
770
|
};}
|
|
775
771
|
|
|
776
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
772
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$u([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
777
773
|
|
|
778
774
|
getProvider() {
|
|
779
775
|
return window.braveSolana
|
|
780
776
|
}
|
|
781
777
|
} BraveSVM.__initStatic(); BraveSVM.__initStatic2();
|
|
782
778
|
|
|
783
|
-
function _optionalChain$
|
|
779
|
+
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
780
|
class Coin98EVM extends WindowEthereum {
|
|
785
781
|
|
|
786
782
|
static __initStatic() {this.info = {
|
|
@@ -790,13 +786,13 @@ class Coin98EVM extends WindowEthereum {
|
|
|
790
786
|
platform: 'evm',
|
|
791
787
|
};}
|
|
792
788
|
|
|
793
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
789
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$t([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
794
790
|
|
|
795
791
|
getProvider() { return window.coin98.provider }
|
|
796
792
|
|
|
797
793
|
} Coin98EVM.__initStatic(); Coin98EVM.__initStatic2();
|
|
798
794
|
|
|
799
|
-
function _optionalChain$
|
|
795
|
+
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
796
|
class Coin98SVM extends WindowSolana {
|
|
801
797
|
|
|
802
798
|
static __initStatic() {this.info = {
|
|
@@ -806,13 +802,13 @@ class Coin98SVM extends WindowSolana {
|
|
|
806
802
|
platform: 'svm',
|
|
807
803
|
};}
|
|
808
804
|
|
|
809
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
805
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$s([window, 'optionalAccess', _3 => _3.coin98, 'optionalAccess', _4 => _4.sol]) };}
|
|
810
806
|
|
|
811
807
|
getProvider() { return window.coin98.sol }
|
|
812
808
|
|
|
813
809
|
} Coin98SVM.__initStatic(); Coin98SVM.__initStatic2();
|
|
814
810
|
|
|
815
|
-
function _optionalChain$
|
|
811
|
+
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
812
|
class CoinbaseEVM extends WindowEthereum {
|
|
817
813
|
|
|
818
814
|
static __initStatic() {this.info = {
|
|
@@ -823,8 +819,8 @@ class CoinbaseEVM extends WindowEthereum {
|
|
|
823
819
|
};}
|
|
824
820
|
|
|
825
821
|
getProvider() {
|
|
826
|
-
if(_optionalChain$
|
|
827
|
-
return _optionalChain$
|
|
822
|
+
if(_optionalChain$r([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
823
|
+
return _optionalChain$r([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
828
824
|
} else {
|
|
829
825
|
return window.ethereum
|
|
830
826
|
}
|
|
@@ -833,9 +829,9 @@ class CoinbaseEVM extends WindowEthereum {
|
|
|
833
829
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
834
830
|
return(
|
|
835
831
|
(
|
|
836
|
-
_optionalChain$
|
|
832
|
+
_optionalChain$r([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$r([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
837
833
|
) || (
|
|
838
|
-
_optionalChain$
|
|
834
|
+
_optionalChain$r([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
839
835
|
)
|
|
840
836
|
)
|
|
841
837
|
};}
|
|
@@ -859,7 +855,7 @@ class CoinbaseSVM extends WindowSolana {
|
|
|
859
855
|
};}
|
|
860
856
|
} CoinbaseSVM.__initStatic(); CoinbaseSVM.__initStatic2();
|
|
861
857
|
|
|
862
|
-
function _optionalChain$
|
|
858
|
+
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
859
|
class CryptoCom extends WindowEthereum {
|
|
864
860
|
|
|
865
861
|
static __initStatic() {this.info = {
|
|
@@ -868,10 +864,10 @@ class CryptoCom extends WindowEthereum {
|
|
|
868
864
|
blockchains: supported$1.evm
|
|
869
865
|
};}
|
|
870
866
|
|
|
871
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
867
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$q([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
872
868
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
873
869
|
|
|
874
|
-
function _optionalChain$
|
|
870
|
+
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
871
|
class ExodusEVM extends WindowEthereum {
|
|
876
872
|
|
|
877
873
|
static __initStatic() {this.info = {
|
|
@@ -881,10 +877,10 @@ class ExodusEVM extends WindowEthereum {
|
|
|
881
877
|
platform: 'evm',
|
|
882
878
|
};}
|
|
883
879
|
|
|
884
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
880
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$p([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isExodus]) };}
|
|
885
881
|
} ExodusEVM.__initStatic(); ExodusEVM.__initStatic2();
|
|
886
882
|
|
|
887
|
-
function _optionalChain$
|
|
883
|
+
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
884
|
class ExodusSVM extends WindowSolana {
|
|
889
885
|
|
|
890
886
|
static __initStatic() {this.info = {
|
|
@@ -894,7 +890,7 @@ class ExodusSVM extends WindowSolana {
|
|
|
894
890
|
platform: 'svm',
|
|
895
891
|
};}
|
|
896
892
|
|
|
897
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
893
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$o([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isExodus]) };}
|
|
898
894
|
} ExodusSVM.__initStatic(); ExodusSVM.__initStatic2();
|
|
899
895
|
|
|
900
896
|
class Glow extends WindowSolana {
|
|
@@ -913,7 +909,7 @@ class Glow extends WindowSolana {
|
|
|
913
909
|
};}
|
|
914
910
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
915
911
|
|
|
916
|
-
function _optionalChain$
|
|
912
|
+
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
913
|
class HyperPay extends WindowEthereum {
|
|
918
914
|
|
|
919
915
|
static __initStatic() {this.info = {
|
|
@@ -922,10 +918,10 @@ class HyperPay extends WindowEthereum {
|
|
|
922
918
|
blockchains: supported$1.evm
|
|
923
919
|
};}
|
|
924
920
|
|
|
925
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
921
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$n([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
926
922
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
927
923
|
|
|
928
|
-
function _optionalChain$
|
|
924
|
+
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
925
|
class MagicEdenEVM extends WindowEthereum {
|
|
930
926
|
|
|
931
927
|
static __initStatic() {this.info = {
|
|
@@ -937,12 +933,12 @@ class MagicEdenEVM extends WindowEthereum {
|
|
|
937
933
|
|
|
938
934
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
939
935
|
return (
|
|
940
|
-
_optionalChain$
|
|
936
|
+
_optionalChain$m([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMagicEden])
|
|
941
937
|
)
|
|
942
938
|
};}
|
|
943
939
|
} MagicEdenEVM.__initStatic(); MagicEdenEVM.__initStatic2();
|
|
944
940
|
|
|
945
|
-
function _optionalChain$
|
|
941
|
+
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
942
|
class MagicEdenSVM extends WindowSolana {
|
|
947
943
|
|
|
948
944
|
static __initStatic() {this.info = {
|
|
@@ -954,12 +950,12 @@ class MagicEdenSVM extends WindowSolana {
|
|
|
954
950
|
|
|
955
951
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
956
952
|
return (
|
|
957
|
-
_optionalChain$
|
|
953
|
+
_optionalChain$l([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isMagicEden])
|
|
958
954
|
)
|
|
959
955
|
};}
|
|
960
956
|
} MagicEdenSVM.__initStatic(); MagicEdenSVM.__initStatic2();
|
|
961
957
|
|
|
962
|
-
function _optionalChain$
|
|
958
|
+
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
959
|
class MetaMask extends WindowEthereum {
|
|
964
960
|
|
|
965
961
|
static __initStatic() {this.info = {
|
|
@@ -970,7 +966,7 @@ class MetaMask extends WindowEthereum {
|
|
|
970
966
|
|
|
971
967
|
static __initStatic2() {this.isMetaMask = (provider)=> {
|
|
972
968
|
return(
|
|
973
|
-
_optionalChain$
|
|
969
|
+
_optionalChain$k([provider, 'optionalAccess', _3 => _3.isMetaMask]) &&
|
|
974
970
|
Object.keys(provider).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!WalletGuard)(?!RevokeCash)/)).length == 1
|
|
975
971
|
)
|
|
976
972
|
};}
|
|
@@ -984,16 +980,16 @@ class MetaMask extends WindowEthereum {
|
|
|
984
980
|
static __initStatic4() {this.isAvailable = async()=>{
|
|
985
981
|
return(
|
|
986
982
|
MetaMask.getEip6963Provider() ||
|
|
987
|
-
MetaMask.isMetaMask(_optionalChain$
|
|
983
|
+
MetaMask.isMetaMask(_optionalChain$k([window, 'optionalAccess', _4 => _4.ethereum]))
|
|
988
984
|
)
|
|
989
985
|
};}
|
|
990
986
|
|
|
991
987
|
getProvider() {
|
|
992
|
-
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$
|
|
988
|
+
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$k([window, 'optionalAccess', _5 => _5.ethereum])) && _optionalChain$k([window, 'optionalAccess', _6 => _6.ethereum]))
|
|
993
989
|
}
|
|
994
990
|
} MetaMask.__initStatic(); MetaMask.__initStatic2(); MetaMask.__initStatic3(); MetaMask.__initStatic4();
|
|
995
991
|
|
|
996
|
-
function _optionalChain$
|
|
992
|
+
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
993
|
class OKXEVM extends WindowEthereum {
|
|
998
994
|
|
|
999
995
|
static __initStatic() {this.info = {
|
|
@@ -1005,12 +1001,12 @@ class OKXEVM extends WindowEthereum {
|
|
|
1005
1001
|
|
|
1006
1002
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1007
1003
|
return (
|
|
1008
|
-
_optionalChain$
|
|
1004
|
+
_optionalChain$j([window, 'optionalAccess', _2 => _2.okxwallet])
|
|
1009
1005
|
)
|
|
1010
1006
|
};}
|
|
1011
1007
|
} OKXEVM.__initStatic(); OKXEVM.__initStatic2();
|
|
1012
1008
|
|
|
1013
|
-
function _optionalChain$
|
|
1009
|
+
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
1010
|
class OKXSVM extends WindowSolana {
|
|
1015
1011
|
|
|
1016
1012
|
static __initStatic() {this.info = {
|
|
@@ -1022,12 +1018,12 @@ class OKXSVM extends WindowSolana {
|
|
|
1022
1018
|
|
|
1023
1019
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1024
1020
|
return (
|
|
1025
|
-
_optionalChain$
|
|
1021
|
+
_optionalChain$i([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isOkxWallet])
|
|
1026
1022
|
)
|
|
1027
1023
|
};}
|
|
1028
1024
|
} OKXSVM.__initStatic(); OKXSVM.__initStatic2();
|
|
1029
1025
|
|
|
1030
|
-
function _optionalChain$
|
|
1026
|
+
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
1027
|
class Opera extends WindowEthereum {
|
|
1032
1028
|
|
|
1033
1029
|
static __initStatic() {this.info = {
|
|
@@ -1036,10 +1032,10 @@ class Opera extends WindowEthereum {
|
|
|
1036
1032
|
blockchains: supported$1.evm
|
|
1037
1033
|
};}
|
|
1038
1034
|
|
|
1039
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
1035
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$h([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
1040
1036
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
1041
1037
|
|
|
1042
|
-
function _optionalChain$
|
|
1038
|
+
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
1039
|
class PhantomEVM extends WindowEthereum {
|
|
1044
1040
|
|
|
1045
1041
|
static __initStatic() {this.info = {
|
|
@@ -1053,17 +1049,17 @@ class PhantomEVM extends WindowEthereum {
|
|
|
1053
1049
|
return (
|
|
1054
1050
|
window.phantom &&
|
|
1055
1051
|
window.phantom.ethereum &&
|
|
1056
|
-
! _optionalChain$
|
|
1057
|
-
! _optionalChain$
|
|
1052
|
+
! _optionalChain$g([window, 'optionalAccess', _4 => _4.ethereum, 'optionalAccess', _5 => _5.isMagicEden]) &&
|
|
1053
|
+
! _optionalChain$g([window, 'optionalAccess', _6 => _6.okxwallet])
|
|
1058
1054
|
)
|
|
1059
1055
|
};}
|
|
1060
1056
|
|
|
1061
1057
|
getProvider() {
|
|
1062
|
-
return _optionalChain$
|
|
1058
|
+
return _optionalChain$g([window, 'optionalAccess', _7 => _7.phantom, 'optionalAccess', _8 => _8.ethereum]) || window.ethereum
|
|
1063
1059
|
}
|
|
1064
1060
|
} PhantomEVM.__initStatic(); PhantomEVM.__initStatic2();
|
|
1065
1061
|
|
|
1066
|
-
function _optionalChain$
|
|
1062
|
+
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
1063
|
class PhantomSVM extends WindowSolana {
|
|
1068
1064
|
|
|
1069
1065
|
static __initStatic() {this.info = {
|
|
@@ -1077,20 +1073,20 @@ class PhantomSVM extends WindowSolana {
|
|
|
1077
1073
|
return (
|
|
1078
1074
|
window.phantom &&
|
|
1079
1075
|
!window.glow &&
|
|
1080
|
-
!_optionalChain$
|
|
1081
|
-
!_optionalChain$
|
|
1082
|
-
! _optionalChain$
|
|
1083
|
-
! _optionalChain$
|
|
1076
|
+
!_optionalChain$f([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.isGlow]) &&
|
|
1077
|
+
!_optionalChain$f([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isExodus]) &&
|
|
1078
|
+
! _optionalChain$f([window, 'optionalAccess', _12 => _12.ethereum, 'optionalAccess', _13 => _13.isMagicEden]) &&
|
|
1079
|
+
! _optionalChain$f([window, 'optionalAccess', _14 => _14.okxwallet]) &&
|
|
1084
1080
|
!['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])
|
|
1085
1081
|
)
|
|
1086
1082
|
};}
|
|
1087
1083
|
|
|
1088
1084
|
getProvider() {
|
|
1089
|
-
return _optionalChain$
|
|
1085
|
+
return _optionalChain$f([window, 'optionalAccess', _15 => _15.phantom, 'optionalAccess', _16 => _16.solana]) || window.solana
|
|
1090
1086
|
}
|
|
1091
1087
|
} PhantomSVM.__initStatic(); PhantomSVM.__initStatic2();
|
|
1092
1088
|
|
|
1093
|
-
function _optionalChain$
|
|
1089
|
+
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
1090
|
class Rabby extends WindowEthereum {
|
|
1095
1091
|
|
|
1096
1092
|
static __initStatic() {this.info = {
|
|
@@ -1101,12 +1097,12 @@ class Rabby extends WindowEthereum {
|
|
|
1101
1097
|
|
|
1102
1098
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1103
1099
|
return(
|
|
1104
|
-
_optionalChain$
|
|
1100
|
+
_optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
1105
1101
|
)
|
|
1106
1102
|
};}
|
|
1107
1103
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
1108
1104
|
|
|
1109
|
-
function _optionalChain$
|
|
1105
|
+
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
1106
|
class Rainbow extends WindowEthereum {
|
|
1111
1107
|
|
|
1112
1108
|
static __initStatic() {this.info = {
|
|
@@ -1117,24 +1113,24 @@ class Rainbow extends WindowEthereum {
|
|
|
1117
1113
|
|
|
1118
1114
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
1119
1115
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
1120
|
-
return _optionalChain$
|
|
1116
|
+
return _optionalChain$d([provider, 'optionalAccess', _4 => _4.isRainbow])
|
|
1121
1117
|
}) : undefined
|
|
1122
1118
|
};}
|
|
1123
1119
|
|
|
1124
1120
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
1125
1121
|
return(
|
|
1126
1122
|
Rainbow.getEip6963Provider() ||
|
|
1127
|
-
_optionalChain$
|
|
1123
|
+
_optionalChain$d([window, 'optionalAccess', _5 => _5.rainbow, 'optionalAccess', _6 => _6.isRainbow])
|
|
1128
1124
|
)
|
|
1129
1125
|
};}
|
|
1130
1126
|
|
|
1131
1127
|
getProvider() {
|
|
1132
|
-
return Rainbow.getEip6963Provider() || _optionalChain$
|
|
1128
|
+
return Rainbow.getEip6963Provider() || _optionalChain$d([window, 'optionalAccess', _7 => _7.rainbow])
|
|
1133
1129
|
}
|
|
1134
1130
|
|
|
1135
1131
|
} Rainbow.__initStatic(); Rainbow.__initStatic2(); Rainbow.__initStatic3();
|
|
1136
1132
|
|
|
1137
|
-
function _optionalChain$
|
|
1133
|
+
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
1134
|
|
|
1139
1135
|
|
|
1140
1136
|
const KEY$1 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
@@ -1225,8 +1221,8 @@ class SolanaMobileWalletAdapter {
|
|
|
1225
1221
|
await transact(
|
|
1226
1222
|
async (wallet) => {
|
|
1227
1223
|
await this.authorize(wallet);
|
|
1228
|
-
if(_optionalChain$
|
|
1229
|
-
if(_optionalChain$
|
|
1224
|
+
if(_optionalChain$c([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
1225
|
+
if(_optionalChain$c([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
1230
1226
|
}
|
|
1231
1227
|
);
|
|
1232
1228
|
return this._account
|
|
@@ -1285,7 +1281,7 @@ class SolanaMobileWalletAdapter {
|
|
|
1285
1281
|
}
|
|
1286
1282
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
1287
1283
|
|
|
1288
|
-
function _optionalChain$
|
|
1284
|
+
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
1285
|
class Solflare extends WindowSolana {
|
|
1290
1286
|
|
|
1291
1287
|
static __initStatic() {this.info = {
|
|
@@ -1296,7 +1292,7 @@ class Solflare extends WindowSolana {
|
|
|
1296
1292
|
|
|
1297
1293
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1298
1294
|
return (
|
|
1299
|
-
_optionalChain$
|
|
1295
|
+
_optionalChain$b([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
1300
1296
|
window.solflare.isSolflare
|
|
1301
1297
|
)
|
|
1302
1298
|
};}
|
|
@@ -1306,7 +1302,7 @@ class Solflare extends WindowSolana {
|
|
|
1306
1302
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
1307
1303
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
1308
1304
|
|
|
1309
|
-
function _optionalChain$
|
|
1305
|
+
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
1306
|
class TokenPocket extends WindowEthereum {
|
|
1311
1307
|
|
|
1312
1308
|
static __initStatic() {this.info = {
|
|
@@ -1317,12 +1313,12 @@ class TokenPocket extends WindowEthereum {
|
|
|
1317
1313
|
|
|
1318
1314
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1319
1315
|
return (
|
|
1320
|
-
_optionalChain$
|
|
1316
|
+
_optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
1321
1317
|
)
|
|
1322
1318
|
};}
|
|
1323
1319
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
1324
1320
|
|
|
1325
|
-
function _optionalChain$
|
|
1321
|
+
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
1322
|
class TrustEVM extends WindowEthereum {
|
|
1327
1323
|
|
|
1328
1324
|
static __initStatic() {this.info = {
|
|
@@ -1334,13 +1330,13 @@ class TrustEVM extends WindowEthereum {
|
|
|
1334
1330
|
|
|
1335
1331
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1336
1332
|
return (
|
|
1337
|
-
(_optionalChain$
|
|
1333
|
+
(_optionalChain$9([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
1338
1334
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
1339
1335
|
)
|
|
1340
1336
|
};}
|
|
1341
1337
|
} TrustEVM.__initStatic(); TrustEVM.__initStatic2();
|
|
1342
1338
|
|
|
1343
|
-
function _optionalChain$
|
|
1339
|
+
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
1340
|
class TrustSVM extends WindowSolana {
|
|
1345
1341
|
|
|
1346
1342
|
static __initStatic() {this.info = {
|
|
@@ -1351,11 +1347,11 @@ class TrustSVM extends WindowSolana {
|
|
|
1351
1347
|
};}
|
|
1352
1348
|
|
|
1353
1349
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1354
|
-
return _optionalChain$
|
|
1350
|
+
return _optionalChain$8([window, 'access', _3 => _3.solana, 'optionalAccess', _4 => _4.isTrustWallet])
|
|
1355
1351
|
};}
|
|
1356
1352
|
} TrustSVM.__initStatic(); TrustSVM.__initStatic2();
|
|
1357
1353
|
|
|
1358
|
-
function _optionalChain$
|
|
1354
|
+
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
1355
|
class Uniswap extends WindowEthereum {
|
|
1360
1356
|
|
|
1361
1357
|
static __initStatic() {this.info = {
|
|
@@ -1366,19 +1362,19 @@ class Uniswap extends WindowEthereum {
|
|
|
1366
1362
|
|
|
1367
1363
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
1368
1364
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
1369
|
-
return _optionalChain$
|
|
1365
|
+
return _optionalChain$7([provider, 'optionalAccess', _4 => _4.isUniswapWallet])
|
|
1370
1366
|
}) : undefined
|
|
1371
1367
|
};}
|
|
1372
1368
|
|
|
1373
1369
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
1374
1370
|
return(
|
|
1375
1371
|
Uniswap.getEip6963Provider() ||
|
|
1376
|
-
_optionalChain$
|
|
1372
|
+
_optionalChain$7([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isUniswapWallet])
|
|
1377
1373
|
)
|
|
1378
1374
|
};}
|
|
1379
1375
|
|
|
1380
1376
|
getProvider() {
|
|
1381
|
-
return Uniswap.getEip6963Provider() || (_optionalChain$
|
|
1377
|
+
return Uniswap.getEip6963Provider() || (_optionalChain$7([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isUniswapWallet]) && _optionalChain$7([window, 'optionalAccess', _9 => _9.ethereum]))
|
|
1382
1378
|
}
|
|
1383
1379
|
} Uniswap.__initStatic(); Uniswap.__initStatic2(); Uniswap.__initStatic3();
|
|
1384
1380
|
|
|
@@ -1483,7 +1479,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
1483
1479
|
}
|
|
1484
1480
|
};
|
|
1485
1481
|
|
|
1486
|
-
function _optionalChain$
|
|
1482
|
+
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
1483
|
|
|
1488
1484
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1489
1485
|
transaction = new Transaction(transaction);
|
|
@@ -1534,7 +1530,7 @@ const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
|
1534
1530
|
try {
|
|
1535
1531
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1536
1532
|
if(
|
|
1537
|
-
(error && _optionalChain$
|
|
1533
|
+
(error && _optionalChain$6([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
1538
1534
|
(error && error.toString().match('undefined'))
|
|
1539
1535
|
) {
|
|
1540
1536
|
setTimeout(()=>{
|
|
@@ -1548,7 +1544,7 @@ const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
|
1548
1544
|
});
|
|
1549
1545
|
} catch (error) {
|
|
1550
1546
|
if(
|
|
1551
|
-
(error && _optionalChain$
|
|
1547
|
+
(error && _optionalChain$6([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
1552
1548
|
(error && error.toString().match('undefined'))
|
|
1553
1549
|
) {
|
|
1554
1550
|
setTimeout(()=>{
|
|
@@ -1579,7 +1575,7 @@ const retrieveTransaction = (tx, blockchain)=>{
|
|
|
1579
1575
|
resolve(sentTransaction);
|
|
1580
1576
|
} catch (error) {
|
|
1581
1577
|
if(
|
|
1582
|
-
(error && _optionalChain$
|
|
1578
|
+
(error && _optionalChain$6([error, 'optionalAccess', _7 => _7.stack, 'optionalAccess', _8 => _8.match, 'call', _9 => _9('JSON-RPC error')])) ||
|
|
1583
1579
|
(error && error.toString().match('undefined'))
|
|
1584
1580
|
) {
|
|
1585
1581
|
setTimeout(()=>{
|
|
@@ -1621,8 +1617,8 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1621
1617
|
to: transaction.to,
|
|
1622
1618
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1623
1619
|
data: await transaction.getData(),
|
|
1624
|
-
gas: _optionalChain$
|
|
1625
|
-
gasLimit: _optionalChain$
|
|
1620
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1621
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1626
1622
|
gasPrice: gasPrice.toHexString(),
|
|
1627
1623
|
nonce: ethers.utils.hexlify(transaction.nonce),
|
|
1628
1624
|
}]
|
|
@@ -1649,16 +1645,16 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1649
1645
|
to: transaction.to,
|
|
1650
1646
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1651
1647
|
data: '0x0',
|
|
1652
|
-
gas: _optionalChain$
|
|
1653
|
-
gasLimit: _optionalChain$
|
|
1654
|
-
gasPrice: _optionalChain$
|
|
1648
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _14 => _14.toHexString, 'call', _15 => _15()]),
|
|
1649
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _16 => _16.toHexString, 'call', _17 => _17()]),
|
|
1650
|
+
gasPrice: _optionalChain$6([gasPrice, 'optionalAccess', _18 => _18.toHexString, 'call', _19 => _19()]),
|
|
1655
1651
|
nonce: ethers.utils.hexlify(transaction.nonce)
|
|
1656
1652
|
}]
|
|
1657
1653
|
}
|
|
1658
1654
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1659
1655
|
};
|
|
1660
1656
|
|
|
1661
|
-
function _optionalChain$
|
|
1657
|
+
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
1658
|
|
|
1663
1659
|
const KEY = 'depay:wallets:wc2';
|
|
1664
1660
|
|
|
@@ -1711,7 +1707,7 @@ const getWalletConnectV2Config = (walletName)=>{
|
|
|
1711
1707
|
optionalNamespaces['eip155'] = {
|
|
1712
1708
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
1713
1709
|
};
|
|
1714
|
-
if(_optionalChain$
|
|
1710
|
+
if(_optionalChain$5([optionalNamespaces, 'optionalAccess', _ => _.eip155]) && _optionalChain$5([optionalNamespaces, 'optionalAccess', _2 => _2.eip155, 'optionalAccess', _3 => _3.chains, 'optionalAccess', _4 => _4.length])) {
|
|
1715
1711
|
optionalNamespaces['eip155'].methods = methods;
|
|
1716
1712
|
optionalNamespaces['eip155'].events = events;
|
|
1717
1713
|
}
|
|
@@ -1726,9 +1722,9 @@ const getSignClient = ()=>{
|
|
|
1726
1722
|
projectId: localStorage[KEY+":projectId"],
|
|
1727
1723
|
metadata: {
|
|
1728
1724
|
name: document.title || 'dApp',
|
|
1729
|
-
description: _optionalChain$
|
|
1725
|
+
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
1726
|
url: location.href,
|
|
1731
|
-
icons: [_optionalChain$
|
|
1727
|
+
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
1728
|
}
|
|
1733
1729
|
});
|
|
1734
1730
|
resolve(signClient);
|
|
@@ -1746,7 +1742,7 @@ class WalletConnectV2 {
|
|
|
1746
1742
|
};}
|
|
1747
1743
|
|
|
1748
1744
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1749
|
-
return !! await getLastSession(_optionalChain$
|
|
1745
|
+
return !! await getLastSession(_optionalChain$5([options, 'optionalAccess', _13 => _13.walletName]))
|
|
1750
1746
|
};}
|
|
1751
1747
|
|
|
1752
1748
|
constructor() {
|
|
@@ -1761,17 +1757,17 @@ class WalletConnectV2 {
|
|
|
1761
1757
|
}
|
|
1762
1758
|
|
|
1763
1759
|
async account() {
|
|
1764
|
-
if(_optionalChain$
|
|
1760
|
+
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
1761
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1766
1762
|
}
|
|
1767
1763
|
}
|
|
1768
1764
|
|
|
1769
1765
|
async setSessionBlockchains() {
|
|
1770
|
-
if(!this.session || (!_optionalChain$
|
|
1766
|
+
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
1767
|
if(this.session.namespaces.eip155.chains) {
|
|
1772
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1768
|
+
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
1769
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1774
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1770
|
+
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
1771
|
}
|
|
1776
1772
|
}
|
|
1777
1773
|
|
|
@@ -1781,13 +1777,13 @@ class WalletConnectV2 {
|
|
|
1781
1777
|
|
|
1782
1778
|
try {
|
|
1783
1779
|
|
|
1784
|
-
this.walletName = _optionalChain$
|
|
1780
|
+
this.walletName = _optionalChain$5([options, 'optionalAccess', _31 => _31.name]);
|
|
1785
1781
|
|
|
1786
1782
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1787
1783
|
this.signClient = await getSignClient();
|
|
1788
1784
|
|
|
1789
1785
|
this.signClient.on("session_delete", (session)=> {
|
|
1790
|
-
if(_optionalChain$
|
|
1786
|
+
if(_optionalChain$5([session, 'optionalAccess', _32 => _32.topic]) === _optionalChain$5([this, 'access', _33 => _33.session, 'optionalAccess', _34 => _34.topic])) {
|
|
1791
1787
|
localStorage[KEY+':name'] = undefined;
|
|
1792
1788
|
localStorage[KEY+':logo'] = undefined;
|
|
1793
1789
|
this.signClient = undefined;
|
|
@@ -1796,14 +1792,14 @@ class WalletConnectV2 {
|
|
|
1796
1792
|
});
|
|
1797
1793
|
|
|
1798
1794
|
this.signClient.on("session_update", async(session)=> {
|
|
1799
|
-
if(_optionalChain$
|
|
1795
|
+
if(_optionalChain$5([session, 'optionalAccess', _35 => _35.topic]) === _optionalChain$5([this, 'access', _36 => _36.session, 'optionalAccess', _37 => _37.topic])) {
|
|
1800
1796
|
this.session = this.signClient.session.get(session.topic);
|
|
1801
1797
|
await this.setSessionBlockchains();
|
|
1802
1798
|
}
|
|
1803
1799
|
});
|
|
1804
1800
|
|
|
1805
1801
|
this.signClient.on("session_event", (event)=> {
|
|
1806
|
-
if(_optionalChain$
|
|
1802
|
+
if(_optionalChain$5([event, 'optionalAccess', _38 => _38.topic]) === _optionalChain$5([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {}
|
|
1807
1803
|
});
|
|
1808
1804
|
|
|
1809
1805
|
const connectWallet = async()=>{
|
|
@@ -1814,24 +1810,24 @@ class WalletConnectV2 {
|
|
|
1814
1810
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1815
1811
|
};
|
|
1816
1812
|
|
|
1817
|
-
const lastSession = _optionalChain$
|
|
1813
|
+
const lastSession = _optionalChain$5([this, 'optionalAccess', _41 => _41.walletName, 'optionalAccess', _42 => _42.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1818
1814
|
if(lastSession) {
|
|
1819
1815
|
this.session = lastSession;
|
|
1820
1816
|
} else {
|
|
1821
1817
|
await connectWallet();
|
|
1822
1818
|
}
|
|
1823
1819
|
|
|
1824
|
-
let meta = _optionalChain$
|
|
1820
|
+
let meta = _optionalChain$5([this, 'access', _43 => _43.session, 'optionalAccess', _44 => _44.peer, 'optionalAccess', _45 => _45.metadata]);
|
|
1825
1821
|
if(meta && meta.name) {
|
|
1826
1822
|
this.name = meta.name;
|
|
1827
1823
|
localStorage[KEY+':name'] = meta.name;
|
|
1828
|
-
if(_optionalChain$
|
|
1824
|
+
if(_optionalChain$5([meta, 'optionalAccess', _46 => _46.icons]) && meta.icons.length) {
|
|
1829
1825
|
this.logo = meta.icons[0];
|
|
1830
1826
|
localStorage[KEY+':logo'] = this.logo;
|
|
1831
1827
|
}
|
|
1832
1828
|
}
|
|
1833
|
-
if(_optionalChain$
|
|
1834
|
-
if(_optionalChain$
|
|
1829
|
+
if(_optionalChain$5([options, 'optionalAccess', _47 => _47.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1830
|
+
if(_optionalChain$5([options, 'optionalAccess', _48 => _48.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1835
1831
|
|
|
1836
1832
|
await this.setSessionBlockchains();
|
|
1837
1833
|
|
|
@@ -1871,7 +1867,7 @@ class WalletConnectV2 {
|
|
|
1871
1867
|
switch (event) {
|
|
1872
1868
|
case 'account':
|
|
1873
1869
|
internalCallback = async(event)=> {
|
|
1874
|
-
if(_optionalChain$
|
|
1870
|
+
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
1871
|
callback(await this.account());
|
|
1876
1872
|
}
|
|
1877
1873
|
};
|
|
@@ -1931,7 +1927,7 @@ class WalletConnectV2 {
|
|
|
1931
1927
|
|
|
1932
1928
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1933
1929
|
|
|
1934
|
-
function _optionalChain$
|
|
1930
|
+
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
1931
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1936
1932
|
transaction = new Transaction(transaction);
|
|
1937
1933
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1983,7 +1979,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1983
1979
|
|
|
1984
1980
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1985
1981
|
if(
|
|
1986
|
-
(error && _optionalChain$
|
|
1982
|
+
(error && _optionalChain$4([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
1987
1983
|
(error && error.toString().match('undefined'))
|
|
1988
1984
|
) {
|
|
1989
1985
|
setTimeout(()=>{
|
|
@@ -1997,7 +1993,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1997
1993
|
});
|
|
1998
1994
|
} catch(error) {
|
|
1999
1995
|
if(
|
|
2000
|
-
(error && _optionalChain$
|
|
1996
|
+
(error && _optionalChain$4([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
2001
1997
|
(error && error.toString().match('undefined'))
|
|
2002
1998
|
) {
|
|
2003
1999
|
setTimeout(()=>{
|
|
@@ -2042,7 +2038,7 @@ const submitSimpleTransfer = ({ transaction, signer })=>{
|
|
|
2042
2038
|
})
|
|
2043
2039
|
};
|
|
2044
2040
|
|
|
2045
|
-
function _optionalChain$
|
|
2041
|
+
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
2042
|
|
|
2047
2043
|
const getConnectedInstance = ()=>{
|
|
2048
2044
|
return window._connectedWalletLinkInstance
|
|
@@ -2096,10 +2092,10 @@ class WalletLink {
|
|
|
2096
2092
|
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
2097
2093
|
await connect({ uri: this.connector.qrUrl });
|
|
2098
2094
|
|
|
2099
|
-
_optionalChain$
|
|
2100
|
-
_optionalChain$
|
|
2095
|
+
_optionalChain$3([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-css-reset'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
|
|
2096
|
+
_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
2097
|
setTimeout(()=>{
|
|
2102
|
-
if(_optionalChain$
|
|
2098
|
+
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
2099
|
this.connector._relay.ui.linkFlow.isOpen = false;
|
|
2104
2100
|
}
|
|
2105
2101
|
}, 10);
|
|
@@ -2201,9 +2197,6 @@ class WalletLink {
|
|
|
2201
2197
|
if(typeof message === 'object') {
|
|
2202
2198
|
let provider = this.connector;
|
|
2203
2199
|
let account = await this.account();
|
|
2204
|
-
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2205
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
2206
|
-
}
|
|
2207
2200
|
let signature = await provider.request({
|
|
2208
2201
|
method: 'eth_signTypedData_v4',
|
|
2209
2202
|
params: [account, message],
|
|
@@ -2223,17 +2216,363 @@ class WalletLink {
|
|
|
2223
2216
|
WalletLink.getConnectedInstance = getConnectedInstance;
|
|
2224
2217
|
WalletLink.setConnectedInstance = setConnectedInstance;
|
|
2225
2218
|
|
|
2219
|
+
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
|
|
2220
|
+
const generateSiweMessage = (siweMessageData) => {
|
|
2221
|
+
let siweMessage = '';
|
|
2222
|
+
|
|
2223
|
+
if (siweMessageData.scheme) {
|
|
2224
|
+
siweMessage += `${siweMessageData.scheme}://${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
2225
|
+
} else {
|
|
2226
|
+
siweMessage += `${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
// NOTE: This differs from the ERC-4361 spec where the address is required
|
|
2230
|
+
if (siweMessageData.address) {
|
|
2231
|
+
siweMessage += `${siweMessageData.address}\n`;
|
|
2232
|
+
} else {
|
|
2233
|
+
siweMessage += '{address}\n';
|
|
2234
|
+
}
|
|
2235
|
+
siweMessage += '\n';
|
|
2236
|
+
|
|
2237
|
+
if (siweMessageData.statement) {
|
|
2238
|
+
siweMessage += `${siweMessageData.statement}\n`;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
siweMessage += '\n';
|
|
2242
|
+
|
|
2243
|
+
siweMessage += `URI: ${siweMessageData.uri}\n`;
|
|
2244
|
+
siweMessage += `Version: ${siweMessageData.version}\n`;
|
|
2245
|
+
siweMessage += `Chain ID: ${siweMessageData.chain_id}\n`;
|
|
2246
|
+
siweMessage += `Nonce: ${siweMessageData.nonce}\n`;
|
|
2247
|
+
siweMessage += `Issued At: ${siweMessageData.issued_at}\n`;
|
|
2248
|
+
|
|
2249
|
+
if (siweMessageData.expiration_time) {
|
|
2250
|
+
siweMessage += `Expiration Time: ${siweMessageData.expiration_time}\n`;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
if (siweMessageData.not_before) {
|
|
2254
|
+
siweMessage += `Not Before: ${siweMessageData.not_before}\n`;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
if (siweMessageData.request_id) {
|
|
2258
|
+
siweMessage += `Request ID: ${siweMessageData.request_id}\n`;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
return siweMessage
|
|
2262
|
+
};
|
|
2263
|
+
|
|
2264
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/transaction/validate-payload.ts
|
|
2265
|
+
const isValidHex = (str) => {
|
|
2266
|
+
return /^0x[0-9A-Fa-f]+$/.test(str)
|
|
2267
|
+
};
|
|
2268
|
+
const processTransactionPayload = (payload) => {
|
|
2269
|
+
// Handle primitives directly
|
|
2270
|
+
if (
|
|
2271
|
+
typeof payload === 'boolean' ||
|
|
2272
|
+
typeof payload === 'string' ||
|
|
2273
|
+
payload === null ||
|
|
2274
|
+
payload === undefined
|
|
2275
|
+
) {
|
|
2276
|
+
return payload
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
// Convert numbers to strings to prevent overflow issues
|
|
2280
|
+
if (typeof payload === 'number' || typeof payload === 'bigint') {
|
|
2281
|
+
return String(payload)
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
// Handle arrays by processing each element
|
|
2285
|
+
if (Array.isArray(payload)) {
|
|
2286
|
+
return payload.map((value) => processTransactionPayload(value))
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
// Handle objects
|
|
2290
|
+
if (typeof payload === 'object') {
|
|
2291
|
+
const result = { ...payload };
|
|
2292
|
+
|
|
2293
|
+
// Special handling for transaction value fields
|
|
2294
|
+
if ('value' in result && result.value !== undefined) {
|
|
2295
|
+
// Ensure it's a string
|
|
2296
|
+
if (typeof result.value !== 'string') {
|
|
2297
|
+
result.value = String(result.value);
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
if (!isValidHex(result.value)) {
|
|
2301
|
+
console.error(
|
|
2302
|
+
'Transaction value must be a valid hex string',
|
|
2303
|
+
result.value,
|
|
2304
|
+
);
|
|
2305
|
+
throw new Error(
|
|
2306
|
+
`Transaction value must be a valid hex string: ${result.value}`,
|
|
2307
|
+
)
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// Process all object properties recursively
|
|
2312
|
+
for (const key in result) {
|
|
2313
|
+
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
2314
|
+
result[key] = processTransactionPayload(result[key]);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
return result
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
// Fallback for any other types
|
|
2322
|
+
return payload
|
|
2323
|
+
};
|
|
2324
|
+
|
|
2325
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/send-webview-event.ts
|
|
2326
|
+
const sendMiniKitEvent = function(payload) {
|
|
2327
|
+
if (window.webkit) {
|
|
2328
|
+
if (
|
|
2329
|
+
window.webkit.messageHandlers &&
|
|
2330
|
+
window.webkit.messageHandlers.minikit &&
|
|
2331
|
+
window.webkit.messageHandlers.minikit.postMessage
|
|
2332
|
+
) {
|
|
2333
|
+
window.webkit.messageHandlers.minikit.postMessage(payload);
|
|
2334
|
+
}
|
|
2335
|
+
} else if (window.Android && window.Android.postMessage) {
|
|
2336
|
+
window.Android.postMessage(JSON.stringify(payload));
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
|
|
2340
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/commands.ts
|
|
2341
|
+
let Command = {
|
|
2342
|
+
"Verify": 'verify',
|
|
2343
|
+
"Pay": 'pay',
|
|
2344
|
+
"WalletAuth": 'wallet-auth',
|
|
2345
|
+
"SendTransaction": 'send-transaction',
|
|
2346
|
+
"SignMessage": 'sign-message',
|
|
2347
|
+
"SignTypedData": 'sign-typed-data',
|
|
2348
|
+
"ShareContacts": 'share-contacts',
|
|
2349
|
+
"RequestPermission": 'request-permission',
|
|
2350
|
+
"GetPermissions": 'get-permissions',
|
|
2351
|
+
"SendHapticFeedback": 'send-haptic-feedback',
|
|
2352
|
+
"ShareFiles": 'share-files',
|
|
2353
|
+
};
|
|
2354
|
+
|
|
2355
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/responses.ts
|
|
2356
|
+
let ResponseEvent = {
|
|
2357
|
+
"MiniAppVerifyAction": "miniapp-verify-action",
|
|
2358
|
+
"MiniAppPayment": "miniapp-payment",
|
|
2359
|
+
"MiniAppWalletAuth": "miniapp-wallet-auth",
|
|
2360
|
+
"MiniAppSendTransaction": "miniapp-send-transaction",
|
|
2361
|
+
"MiniAppSignMessage": "miniapp-sign-message",
|
|
2362
|
+
"MiniAppSignTypedData": "miniapp-sign-typed-data",
|
|
2363
|
+
"MiniAppShareContacts": "miniapp-share-contacts",
|
|
2364
|
+
"MiniAppRequestPermission": "miniapp-request-permission",
|
|
2365
|
+
"MiniAppGetPermissions": "miniapp-get-permissions",
|
|
2366
|
+
"MiniAppSendHapticFeedback": "miniapp-send-haptic-feedback",
|
|
2367
|
+
"MiniAppShareFiles": "miniapp-share-files",
|
|
2368
|
+
};
|
|
2369
|
+
|
|
2370
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/index.ts
|
|
2371
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/minikit.ts
|
|
2372
|
+
|
|
2373
|
+
class MiniKit {
|
|
2374
|
+
|
|
2375
|
+
static __initStatic() {this.MINIKIT_VERSION = 1;}
|
|
2376
|
+
|
|
2377
|
+
static __initStatic2() {this.miniKitCommandVersion = {
|
|
2378
|
+
[Command.Verify]: 1,
|
|
2379
|
+
[Command.Pay]: 1,
|
|
2380
|
+
[Command.WalletAuth]: 1,
|
|
2381
|
+
[Command.SendTransaction]: 1,
|
|
2382
|
+
[Command.SignMessage]: 1,
|
|
2383
|
+
[Command.SignTypedData]: 1,
|
|
2384
|
+
[Command.ShareContacts]: 1,
|
|
2385
|
+
[Command.RequestPermission]: 1,
|
|
2386
|
+
[Command.GetPermissions]: 1,
|
|
2387
|
+
[Command.SendHapticFeedback]: 1,
|
|
2388
|
+
[Command.ShareFiles]: 1,
|
|
2389
|
+
};}
|
|
2390
|
+
|
|
2391
|
+
static __initStatic3() {this.listeners = {
|
|
2392
|
+
[ResponseEvent.MiniAppVerifyAction]: () => {},
|
|
2393
|
+
[ResponseEvent.MiniAppPayment]: () => {},
|
|
2394
|
+
[ResponseEvent.MiniAppWalletAuth]: () => {},
|
|
2395
|
+
[ResponseEvent.MiniAppSendTransaction]: () => {},
|
|
2396
|
+
[ResponseEvent.MiniAppSignMessage]: () => {},
|
|
2397
|
+
[ResponseEvent.MiniAppSignTypedData]: () => {},
|
|
2398
|
+
[ResponseEvent.MiniAppShareContacts]: () => {},
|
|
2399
|
+
[ResponseEvent.MiniAppRequestPermission]: () => {},
|
|
2400
|
+
[ResponseEvent.MiniAppGetPermissions]: () => {},
|
|
2401
|
+
[ResponseEvent.MiniAppSendHapticFeedback]: () => {},
|
|
2402
|
+
[ResponseEvent.MiniAppShareFiles]: () => {},
|
|
2403
|
+
};}
|
|
2404
|
+
|
|
2405
|
+
static __initStatic4() {this.appId = null;}
|
|
2406
|
+
static __initStatic5() {this.user = {};}
|
|
2407
|
+
static __initStatic6() {this.isReady = false;}
|
|
2408
|
+
|
|
2409
|
+
static install(appId) {
|
|
2410
|
+
|
|
2411
|
+
if (typeof window === "undefined" || Boolean(window.MiniKit)) {
|
|
2412
|
+
return {
|
|
2413
|
+
success: false,
|
|
2414
|
+
errorCode: 'already_installed',
|
|
2415
|
+
errorMessage: 'MiniKit is already installed.'
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
if (!appId) {
|
|
2420
|
+
console.warn("App ID not provided during install");
|
|
2421
|
+
} else {
|
|
2422
|
+
MiniKit.appId = appId;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
if (!window.WorldApp) {
|
|
2426
|
+
return {
|
|
2427
|
+
success: false,
|
|
2428
|
+
errorCode: 'outside_of_worldapp',
|
|
2429
|
+
errorMessage: 'MiniApp launched outside of WorldApp.'
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// Set user properties
|
|
2434
|
+
MiniKit.user.optedIntoOptionalAnalytics = window.WorldApp.is_optional_analytics;
|
|
2435
|
+
MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
2436
|
+
MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
2437
|
+
|
|
2438
|
+
try {
|
|
2439
|
+
window.MiniKit = MiniKit;
|
|
2440
|
+
this.sendInit();
|
|
2441
|
+
} catch (error) {
|
|
2442
|
+
console.error(
|
|
2443
|
+
'Failed to install MiniKit.',
|
|
2444
|
+
error
|
|
2445
|
+
);
|
|
2446
|
+
|
|
2447
|
+
return {
|
|
2448
|
+
success: false,
|
|
2449
|
+
errorCode: 'unknown',
|
|
2450
|
+
errorMessage: 'Failed to install MiniKit.'
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
MiniKit.isReady = true;
|
|
2455
|
+
return { success: true }
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
static sendInit() {
|
|
2459
|
+
sendWebviewEvent({
|
|
2460
|
+
command: 'init',
|
|
2461
|
+
payload: { version: this.MINIKIT_VERSION },
|
|
2462
|
+
});
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
static subscribe(event, handler) {
|
|
2466
|
+
if (event === ResponseEvent.MiniAppWalletAuth) {
|
|
2467
|
+
const originalHandler = handler;
|
|
2468
|
+
const wrappedHandler = async (payload) => {
|
|
2469
|
+
if (payload.status === 'success') {
|
|
2470
|
+
MiniKit.user.walletAddress = payload.address;
|
|
2471
|
+
}
|
|
2472
|
+
originalHandler(payload);
|
|
2473
|
+
};
|
|
2474
|
+
this.listeners[event] = wrappedHandler;
|
|
2475
|
+
} else if (event === ResponseEvent.MiniAppVerifyAction) {
|
|
2476
|
+
const originalHandler = handler;
|
|
2477
|
+
const wrappedHandler = (payload) => {
|
|
2478
|
+
originalHandler(payload);
|
|
2479
|
+
};
|
|
2480
|
+
this.listeners[event] = wrappedHandler;
|
|
2481
|
+
} else {
|
|
2482
|
+
this.listeners[event] = handler;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
static unsubscribe(event) {
|
|
2487
|
+
delete this.listeners[event];
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
static trigger(event, payload) {
|
|
2491
|
+
if (!this.listeners[event]) {
|
|
2492
|
+
console.error(
|
|
2493
|
+
`No handler for event ${event}, payload: ${JSON.stringify(payload)}`
|
|
2494
|
+
);
|
|
2495
|
+
return
|
|
2496
|
+
}
|
|
2497
|
+
this.listeners[event](payload);
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
static __initStatic7() {this.commands = {
|
|
2501
|
+
|
|
2502
|
+
walletAuth: (payload) => {
|
|
2503
|
+
|
|
2504
|
+
let protocol = null;
|
|
2505
|
+
try {
|
|
2506
|
+
const currentUrl = new URL(window.location.href);
|
|
2507
|
+
protocol = currentUrl.protocol.split(':')[0];
|
|
2508
|
+
} catch (error) {
|
|
2509
|
+
console.error('Failed to get current URL', error);
|
|
2510
|
+
return null
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
const siweMessage = generateSiweMessage({
|
|
2514
|
+
scheme: protocol,
|
|
2515
|
+
domain: window.location.host,
|
|
2516
|
+
statement: _nullishCoalesce(payload.statement, () => ( undefined)),
|
|
2517
|
+
uri: window.location.href,
|
|
2518
|
+
version: '1',
|
|
2519
|
+
chain_id: 480,
|
|
2520
|
+
nonce: payload.nonce,
|
|
2521
|
+
issued_at: new Date().toISOString(),
|
|
2522
|
+
expiration_time: _optionalChain$2([payload, 'access', _7 => _7.expirationTime, 'optionalAccess', _8 => _8.toISOString, 'call', _9 => _9()]),
|
|
2523
|
+
not_before: _optionalChain$2([payload, 'access', _10 => _10.notBefore, 'optionalAccess', _11 => _11.toISOString, 'call', _12 => _12()]),
|
|
2524
|
+
request_id: _nullishCoalesce(payload.requestId, () => ( undefined)),
|
|
2525
|
+
});
|
|
2526
|
+
|
|
2527
|
+
const walletAuthPayload = { siweMessage };
|
|
2528
|
+
sendMiniKitEvent({
|
|
2529
|
+
command: Command.WalletAuth,
|
|
2530
|
+
version: this.miniKitCommandVersion[Command.WalletAuth],
|
|
2531
|
+
payload: walletAuthPayload,
|
|
2532
|
+
});
|
|
2533
|
+
|
|
2534
|
+
return walletAuthPayload
|
|
2535
|
+
},
|
|
2536
|
+
|
|
2537
|
+
sendTransaction: (payload) => {
|
|
2538
|
+
|
|
2539
|
+
const validatedPayload = processTransactionPayload(payload);
|
|
2540
|
+
|
|
2541
|
+
sendMiniKitEvent({
|
|
2542
|
+
command: Command.SendTransaction,
|
|
2543
|
+
version: this.miniKitCommandVersion[Command.SendTransaction],
|
|
2544
|
+
payload: validatedPayload,
|
|
2545
|
+
});
|
|
2546
|
+
|
|
2547
|
+
return validatedPayload
|
|
2548
|
+
},
|
|
2549
|
+
|
|
2550
|
+
signMessage: (payload) => {
|
|
2551
|
+
|
|
2552
|
+
sendMiniKitEvent({
|
|
2553
|
+
command: Command.SignMessage,
|
|
2554
|
+
version: this.miniKitCommandVersion[Command.SignMessage],
|
|
2555
|
+
payload,
|
|
2556
|
+
});
|
|
2557
|
+
|
|
2558
|
+
return payload
|
|
2559
|
+
},
|
|
2560
|
+
};}
|
|
2561
|
+
} MiniKit.__initStatic(); MiniKit.__initStatic2(); MiniKit.__initStatic3(); MiniKit.__initStatic4(); MiniKit.__initStatic5(); MiniKit.__initStatic6(); MiniKit.__initStatic7();
|
|
2562
|
+
|
|
2226
2563
|
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
2564
|
|
|
2228
2565
|
class WorldApp {
|
|
2229
2566
|
|
|
2230
|
-
static __initStatic() {this.
|
|
2567
|
+
static __initStatic() {this.MiniKit = MiniKit;}
|
|
2568
|
+
|
|
2569
|
+
static __initStatic2() {this.info = {
|
|
2231
2570
|
name: 'World App',
|
|
2232
2571
|
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMzIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cmVjdCBmaWxsPSIjMDAwMDAwIiB3aWR0aD0iMzMiIGhlaWdodD0iMzIiLz4KICAgIDwvZz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjQuNywxMi41Yy0uNS0xLjEtMS4xLTItMS45LTIuOHMtMS44LTEuNS0yLjgtMS45Yy0xLjEtLjUtMi4zLS43LTMuNS0uN3MtMi40LjItMy41LjdjLTEuMS41LTIsMS4xLTIuOCwxLjlzLTEuNSwxLjgtMS45LDIuOGMtLjUsMS4xLS43LDIuMy0uNywzLjVzLjIsMi40LjcsMy41LDEuMSwyLDEuOSwyLjhjLjguOCwxLjgsMS41LDIuOCwxLjksMS4xLjUsMi4zLjcsMy41LjdzMi40LS4yLDMuNS0uNywyLTEuMSwyLjgtMS45LDEuNS0xLjgsMS45LTIuOGMuNS0xLjEuNy0yLjMuNy0zLjVzLS4yLTIuNC0uNy0zLjVaTTEzLjUsMTUuMmMuNC0xLjQsMS43LTIuNSwzLjItMi41aDYuMmMuNC44LjcsMS42LjcsMi41aC0xMC4xWk0yMy43LDE2LjhjMCwuOS0uNCwxLjctLjcsMi41aC02LjJjLTEuNSwwLTIuOC0xLjEtMy4yLTIuNWgxMC4xWk0xMS40LDEwLjljMS40LTEuNCwzLjItMi4xLDUuMS0yLjFzMy44LjcsNS4xLDIuMWguMWMwLC4xLTUsLjEtNSwuMS0xLjMsMC0yLjYuNS0zLjUsMS41LS43LjctMS4yLDEuNy0xLjQsMi43aC0yLjVjLjItMS42LjktMy4xLDIuMS00LjNaTTE2LjUsMjMuMmMtMS45LDAtMy44LS43LTUuMS0yLjEtMS4yLTEuMi0xLjktMi43LTIuMS00LjNoMi41Yy4yLDEsLjcsMS45LDEuNCwyLjcuOS45LDIuMiwxLjUsMy41LDEuNWg1LS4xYy0xLjQsMS41LTMuMiwyLjItNS4xLDIuMloiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=",
|
|
2233
2572
|
blockchains: ["worldchain"]
|
|
2234
2573
|
};}
|
|
2235
2574
|
|
|
2236
|
-
static
|
|
2575
|
+
static __initStatic3() {this.isAvailable = async()=>{
|
|
2237
2576
|
return Boolean(
|
|
2238
2577
|
_optionalChain$1([window, 'optionalAccess', _2 => _2.WorldApp])
|
|
2239
2578
|
)
|
|
@@ -2248,25 +2587,17 @@ class WorldApp {
|
|
|
2248
2587
|
}
|
|
2249
2588
|
|
|
2250
2589
|
sendTransaction(transaction) {
|
|
2251
|
-
console.log('sendTransaction', transaction);
|
|
2252
2590
|
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
2591
|
|
|
2257
2592
|
return new Promise(async(resolve, reject)=>{
|
|
2258
2593
|
await transaction.prepare({ wallet: this });
|
|
2259
|
-
console.log('after prepare transaction', transaction);
|
|
2260
2594
|
transaction.nonce = (await this.transactionCount({ blockchain: 'worldchain', address: transaction.from })).toString();
|
|
2261
|
-
|
|
2595
|
+
transaction.fromBlock = await request('worldchain://latestBlockNumber');
|
|
2262
2596
|
|
|
2263
|
-
console.log('before MiniKit.subscribe');
|
|
2264
2597
|
MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
|
|
2265
|
-
|
|
2598
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSendTransaction);
|
|
2266
2599
|
if (payload.status == "success") {
|
|
2267
|
-
console.log('before transaction.accepted', transaction);
|
|
2268
2600
|
if (transaction.accepted) { transaction.accepted(); }
|
|
2269
|
-
console.log('after transaction.accepted', transaction);
|
|
2270
2601
|
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
|
|
2271
2602
|
if(transactionHash) {
|
|
2272
2603
|
resolve(transaction);
|
|
@@ -2278,9 +2609,7 @@ class WorldApp {
|
|
|
2278
2609
|
reject('Submitting transaction failed!');
|
|
2279
2610
|
}
|
|
2280
2611
|
});
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
console.log('before MiniKit.commands.sendTransaction', {
|
|
2612
|
+
MiniKit.commands.sendTransaction({
|
|
2284
2613
|
transaction: [
|
|
2285
2614
|
{
|
|
2286
2615
|
address: transaction.to,
|
|
@@ -2291,70 +2620,107 @@ class WorldApp {
|
|
|
2291
2620
|
],
|
|
2292
2621
|
permit2: [_optionalChain$1([transaction, 'access', _13 => _13.params, 'optionalAccess', _14 => _14.permit2])]
|
|
2293
2622
|
});
|
|
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
2623
|
})
|
|
2307
2624
|
}
|
|
2308
2625
|
|
|
2309
2626
|
retryFetchTransaction(transaction, payload, attempt) {
|
|
2310
|
-
console.log('Retry Fetch transaction', attempt);
|
|
2311
2627
|
return new Promise((resolve, reject)=>{
|
|
2312
2628
|
setTimeout(()=>{
|
|
2313
2629
|
this.fetchTransaction(transaction, payload, attempt+1).then(resolve).catch(reject);
|
|
2314
|
-
}, (attempt < 30 ? 500 :
|
|
2630
|
+
}, (attempt < 30 ? 500 : 2000));
|
|
2315
2631
|
})
|
|
2316
2632
|
}
|
|
2317
2633
|
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2634
|
+
pollTransactionIdFromWorldchain(payload) {
|
|
2635
|
+
|
|
2636
|
+
return new Promise((resolve)=>{
|
|
2637
|
+
|
|
2638
|
+
fetch(`https://public.depay.com/transactions/worldchain/${payload.transaction_id}?app_id=${payload.mini_app_id}`, {
|
|
2322
2639
|
headers: { "Content-Type": "application/json" },
|
|
2323
2640
|
}).then((response)=>{
|
|
2324
|
-
console.log('After fetch', response);
|
|
2325
2641
|
if(response.ok) {
|
|
2326
|
-
console.log('Before json');
|
|
2327
2642
|
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);
|
|
2643
|
+
if(_optionalChain$1([transactionJSON, 'optionalAccess', _15 => _15.external_id])) {
|
|
2644
|
+
resolve(_optionalChain$1([transactionJSON, 'optionalAccess', _16 => _16.external_id]));
|
|
2350
2645
|
} else {
|
|
2351
|
-
|
|
2646
|
+
resolve();
|
|
2352
2647
|
}
|
|
2353
|
-
}).catch(()=>
|
|
2648
|
+
}).catch(()=>resolve());
|
|
2649
|
+
} else {
|
|
2650
|
+
resolve();
|
|
2651
|
+
}
|
|
2652
|
+
}).catch((error)=>{
|
|
2653
|
+
console.log('CATCH ERROR', error);
|
|
2654
|
+
resolve();
|
|
2655
|
+
});
|
|
2656
|
+
})
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
pollEventForUserOp(transaction, payload) {
|
|
2660
|
+
|
|
2661
|
+
return new Promise((resolve)=>{
|
|
2662
|
+
|
|
2663
|
+
rpcRequest({
|
|
2664
|
+
blockchain: 'worldchain',
|
|
2665
|
+
method: "eth_getLogs",
|
|
2666
|
+
params: [
|
|
2667
|
+
{
|
|
2668
|
+
"fromBlock": ethers.utils.hexValue(transaction.fromBlock),
|
|
2669
|
+
"toBlock": "latest",
|
|
2670
|
+
"address": "0x0000000071727De22E5E9d8BAf0edAc6f37da032", // entry point
|
|
2671
|
+
"topics": [
|
|
2672
|
+
"0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
|
|
2673
|
+
payload.userOpHash
|
|
2674
|
+
]
|
|
2675
|
+
}
|
|
2676
|
+
]
|
|
2677
|
+
}).then((responseData)=>{
|
|
2678
|
+
if(responseData && responseData instanceof Array) {
|
|
2679
|
+
let event = responseData.find((event)=>{
|
|
2680
|
+
return(!event.removed)
|
|
2681
|
+
});
|
|
2682
|
+
if(event && event.transactionHash) {
|
|
2683
|
+
return resolve(event.transactionHash)
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
resolve();
|
|
2687
|
+
}).catch(()=>resolve());
|
|
2688
|
+
})
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
fetchTransaction(transaction, payload, attempt = 1) {
|
|
2694
|
+
return new Promise((resolve, reject)=>{
|
|
2695
|
+
|
|
2696
|
+
Promise.all([
|
|
2697
|
+
this.pollTransactionIdFromWorldchain(payload),
|
|
2698
|
+
this.pollEventForUserOp(transaction, payload),
|
|
2699
|
+
]).then((results)=>{
|
|
2700
|
+
let transactionHash = results ? results.filter(Boolean)[0] : undefined;
|
|
2701
|
+
if(transactionHash) {
|
|
2702
|
+
transaction.id = transactionHash;
|
|
2703
|
+
transaction.url = Blockchains['worldchain'].explorerUrlFor({ transaction });
|
|
2704
|
+
if (transaction.sent) { transaction.sent(transaction); }
|
|
2705
|
+
getProvider('worldchain').then((provider)=>{
|
|
2706
|
+
provider.waitForTransaction(transactionHash).then((receipt)=>{
|
|
2707
|
+
if(receipt && receipt.status == 1) {
|
|
2708
|
+
transaction._succeeded = true;
|
|
2709
|
+
if (transaction.succeeded) { transaction.succeeded(transaction); }
|
|
2710
|
+
resolve(transaction);
|
|
2711
|
+
} else {
|
|
2712
|
+
if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
|
|
2713
|
+
reject(transaction);
|
|
2714
|
+
}
|
|
2715
|
+
}).catch(reject);
|
|
2716
|
+
}).catch(reject);
|
|
2354
2717
|
} else {
|
|
2355
2718
|
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
2356
2719
|
}
|
|
2357
|
-
}).catch(()=>
|
|
2720
|
+
}).catch((error)=>{
|
|
2721
|
+
console.log('CATCH ERROR!', error);
|
|
2722
|
+
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
2723
|
+
});
|
|
2358
2724
|
})
|
|
2359
2725
|
}
|
|
2360
2726
|
|
|
@@ -2364,37 +2730,33 @@ class WorldApp {
|
|
|
2364
2730
|
|
|
2365
2731
|
async account() {
|
|
2366
2732
|
if(!this.getProvider()) { return undefined }
|
|
2367
|
-
return
|
|
2733
|
+
return this.walletAddress()
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
walletAddress() {
|
|
2737
|
+
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
2738
|
}
|
|
2369
2739
|
|
|
2370
2740
|
connect() {
|
|
2371
2741
|
|
|
2372
2742
|
return new Promise( async(resolve, reject)=>{
|
|
2373
2743
|
|
|
2374
|
-
if(
|
|
2375
|
-
return resolve(
|
|
2744
|
+
if(this.walletAddress()) {
|
|
2745
|
+
return resolve(this.walletAddress())
|
|
2376
2746
|
}
|
|
2377
2747
|
|
|
2378
2748
|
MiniKit.subscribe(ResponseEvent.MiniAppWalletAuth, async (payload) => {
|
|
2749
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppWalletAuth);
|
|
2379
2750
|
if (payload.status === "error") {
|
|
2380
2751
|
return reject(payload.message)
|
|
2381
2752
|
} else {
|
|
2382
|
-
return resolve(
|
|
2753
|
+
return resolve(this.walletAddress())
|
|
2383
2754
|
}
|
|
2384
2755
|
});
|
|
2385
2756
|
|
|
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)"
|
|
2757
|
+
MiniKit.commands.walletAuth({
|
|
2758
|
+
nonce: crypto.randomUUID().replace(/-/g, "")
|
|
2391
2759
|
});
|
|
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
2760
|
})
|
|
2399
2761
|
}
|
|
2400
2762
|
|
|
@@ -2423,12 +2785,12 @@ class WorldApp {
|
|
|
2423
2785
|
}
|
|
2424
2786
|
|
|
2425
2787
|
async transactionCount({ blockchain, address }) {
|
|
2426
|
-
if(!
|
|
2788
|
+
if(!this.walletAddress()) {
|
|
2427
2789
|
return 0
|
|
2428
2790
|
} else {
|
|
2429
2791
|
return request({
|
|
2430
2792
|
blockchain: 'worldchain',
|
|
2431
|
-
address:
|
|
2793
|
+
address: this.walletAddress(),
|
|
2432
2794
|
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
2795
|
method: 'nonce'
|
|
2434
2796
|
})
|
|
@@ -2440,18 +2802,17 @@ class WorldApp {
|
|
|
2440
2802
|
return new Promise((resolve, reject)=>{
|
|
2441
2803
|
|
|
2442
2804
|
MiniKit.subscribe(ResponseEvent.MiniAppSignMessage, async (payload) => {
|
|
2805
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSignMessage);
|
|
2443
2806
|
if (payload.status === "error") {
|
|
2444
2807
|
return reject()
|
|
2445
2808
|
} else {
|
|
2446
2809
|
return resolve(payload.signature)
|
|
2447
2810
|
}
|
|
2448
2811
|
});
|
|
2449
|
-
|
|
2450
2812
|
MiniKit.commands.signMessage({ message });
|
|
2451
|
-
|
|
2452
2813
|
})
|
|
2453
2814
|
}
|
|
2454
|
-
} WorldApp.__initStatic(); WorldApp.__initStatic2();
|
|
2815
|
+
} WorldApp.__initStatic(); WorldApp.__initStatic2(); WorldApp.__initStatic3();
|
|
2455
2816
|
|
|
2456
2817
|
var wallets = {
|
|
2457
2818
|
MetaMask,
|