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