@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.evm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-client-evm'), require('@depay/web3-blockchains'), require('ethers'), require('@depay/walletconnect-v2'), require('@depay/coinbase-wallet-sdk')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-client-evm', '@depay/web3-blockchains', 'ethers', '@depay/walletconnect-v2', '@depay/coinbase-wallet-sdk'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Client, global.Web3Blockchains, global.ethers, global.WalletConnectV2, global.CoinbaseWalletSdk
|
|
5
|
-
}(this, (function (exports, web3ClientEvm, Blockchains, ethers, walletconnectV2, coinbaseWalletSdk
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-client-evm'), require('@depay/web3-blockchains'), require('ethers'), require('@depay/walletconnect-v2'), require('@depay/coinbase-wallet-sdk')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-client-evm', '@depay/web3-blockchains', '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.ethers, global.WalletConnectV2, global.CoinbaseWalletSdk));
|
|
5
|
+
}(this, (function (exports, web3ClientEvm, Blockchains, 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
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'];
|
|
13
13
|
supported$1.svm = [];
|
|
14
14
|
|
|
15
|
-
function _optionalChain$
|
|
15
|
+
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; }
|
|
16
16
|
class Transaction {
|
|
17
17
|
|
|
18
18
|
constructor({
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
|
|
39
39
|
|
|
40
40
|
// optional
|
|
41
|
-
this.value = _optionalChain$
|
|
41
|
+
this.value = _optionalChain$q([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
42
42
|
this.api = api;
|
|
43
43
|
this.method = method;
|
|
44
44
|
this.params = params;
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
getParamType(param) {
|
|
82
|
-
if(_optionalChain$
|
|
82
|
+
if(_optionalChain$q([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
83
83
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
84
84
|
} else {
|
|
85
85
|
return param.type
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
function _optionalChain$
|
|
155
|
+
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; }
|
|
156
156
|
|
|
157
157
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
158
158
|
transaction = new Transaction(transaction);
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
try {
|
|
207
207
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
208
208
|
if(
|
|
209
|
-
(error && _optionalChain$
|
|
209
|
+
(error && _optionalChain$p([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
210
210
|
(error && error.toString().match('undefined'))
|
|
211
211
|
) {
|
|
212
212
|
setTimeout(()=>{
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
});
|
|
221
221
|
} catch(error) {
|
|
222
222
|
if(
|
|
223
|
-
(error && _optionalChain$
|
|
223
|
+
(error && _optionalChain$p([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
224
224
|
(error && error.toString().match('undefined'))
|
|
225
225
|
) {
|
|
226
226
|
setTimeout(()=>{
|
|
@@ -255,12 +255,12 @@
|
|
|
255
255
|
if(contractArguments) {
|
|
256
256
|
return await method(...contractArguments, {
|
|
257
257
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
258
|
-
gasLimit: _optionalChain$
|
|
258
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
259
259
|
})
|
|
260
260
|
} else {
|
|
261
261
|
return await method({
|
|
262
262
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
263
|
-
gasLimit: _optionalChain$
|
|
263
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
264
264
|
})
|
|
265
265
|
}
|
|
266
266
|
};
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
})
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
-
function _optionalChain$
|
|
275
|
+
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; }
|
|
276
276
|
|
|
277
277
|
class WindowEthereum {
|
|
278
278
|
|
|
@@ -284,39 +284,39 @@
|
|
|
284
284
|
|
|
285
285
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
286
286
|
return (
|
|
287
|
-
_optionalChain$
|
|
287
|
+
_optionalChain$o([window, 'optionalAccess', _38 => _38.ethereum]) &&
|
|
288
288
|
// not MetaMask
|
|
289
|
-
!(_optionalChain$
|
|
289
|
+
!(_optionalChain$o([window, 'optionalAccess', _39 => _39.ethereum, 'optionalAccess', _40 => _40.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
|
|
290
290
|
// not Coin98
|
|
291
|
-
!_optionalChain$
|
|
291
|
+
!_optionalChain$o([window, 'optionalAccess', _41 => _41.coin98]) &&
|
|
292
292
|
// not Trust Wallet
|
|
293
|
-
!(_optionalChain$
|
|
293
|
+
!(_optionalChain$o([window, 'optionalAccess', _42 => _42.ethereum, 'optionalAccess', _43 => _43.isTrust]) || _optionalChain$o([window, 'optionalAccess', _44 => _44.ethereum, 'optionalAccess', _45 => _45.isTrustWallet])) &&
|
|
294
294
|
// not crypto.com
|
|
295
|
-
!_optionalChain$
|
|
295
|
+
!_optionalChain$o([window, 'optionalAccess', _46 => _46.ethereum, 'optionalAccess', _47 => _47.isDeficonnectProvider]) &&
|
|
296
296
|
// not HyperPay
|
|
297
|
-
!_optionalChain$
|
|
297
|
+
!_optionalChain$o([window, 'optionalAccess', _48 => _48.ethereum, 'optionalAccess', _49 => _49.isHyperPay]) &&
|
|
298
298
|
// not Phantom
|
|
299
|
-
!(window.phantom && !window.glow && !_optionalChain$
|
|
299
|
+
!(window.phantom && !window.glow && !_optionalChain$o([window, 'optionalAccess', _50 => _50.solana, 'optionalAccess', _51 => _51.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
300
300
|
// not Rabby
|
|
301
|
-
!_optionalChain$
|
|
301
|
+
!_optionalChain$o([window, 'optionalAccess', _52 => _52.ethereum, 'optionalAccess', _53 => _53.isRabby]) &&
|
|
302
302
|
// not Backpack
|
|
303
|
-
!_optionalChain$
|
|
303
|
+
!_optionalChain$o([window, 'optionalAccess', _54 => _54.backpack, 'optionalAccess', _55 => _55.isBackpack]) &&
|
|
304
304
|
// not TokenPocket
|
|
305
|
-
!_optionalChain$
|
|
305
|
+
!_optionalChain$o([window, 'optionalAccess', _56 => _56.ethereum, 'optionalAccess', _57 => _57.isTokenPocket]) &&
|
|
306
306
|
// not BitKeep
|
|
307
|
-
!_optionalChain$
|
|
307
|
+
!_optionalChain$o([window, 'optionalAccess', _58 => _58.ethereum, 'optionalAccess', _59 => _59.isBitKeep]) &&
|
|
308
308
|
// not Coinbase
|
|
309
|
-
!(_optionalChain$
|
|
309
|
+
!(_optionalChain$o([window, 'optionalAccess', _60 => _60.ethereum, 'optionalAccess', _61 => _61.isCoinbaseWallet]) || _optionalChain$o([window, 'optionalAccess', _62 => _62.ethereum, 'optionalAccess', _63 => _63.isWalletLink])) &&
|
|
310
310
|
// MetaMask through ProviderMap
|
|
311
|
-
!_optionalChain$
|
|
311
|
+
!_optionalChain$o([window, 'optionalAccess', _64 => _64.ethereum, 'optionalAccess', _65 => _65.providerMap, 'optionalAccess', _66 => _66.has, 'call', _67 => _67('MetaMask')]) &&
|
|
312
312
|
// Brave Wallet
|
|
313
|
-
!_optionalChain$
|
|
313
|
+
!_optionalChain$o([window, 'optionalAccess', _68 => _68.ethereum, 'optionalAccess', _69 => _69.isBraveWallet]) &&
|
|
314
314
|
// Uniswap Wallet
|
|
315
|
-
!_optionalChain$
|
|
315
|
+
!_optionalChain$o([window, 'optionalAccess', _70 => _70.ethereum, 'optionalAccess', _71 => _71.isUniswapWallet]) &&
|
|
316
316
|
// Rainbow
|
|
317
|
-
!_optionalChain$
|
|
317
|
+
!_optionalChain$o([window, 'optionalAccess', _72 => _72.ethereum, 'optionalAccess', _73 => _73.isRainbow]) &&
|
|
318
318
|
// OKX Wallet
|
|
319
|
-
!_optionalChain$
|
|
319
|
+
!_optionalChain$o([window, 'optionalAccess', _74 => _74.okxwallet])
|
|
320
320
|
)
|
|
321
321
|
};}
|
|
322
322
|
|
|
@@ -429,9 +429,6 @@
|
|
|
429
429
|
if(typeof message === 'object') {
|
|
430
430
|
let provider = this.getProvider();
|
|
431
431
|
let account = await this.account();
|
|
432
|
-
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
433
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
434
|
-
}
|
|
435
432
|
let signature = await provider.request({
|
|
436
433
|
method: 'eth_signTypedData_v4',
|
|
437
434
|
params: [account, message],
|
|
@@ -448,7 +445,7 @@
|
|
|
448
445
|
}
|
|
449
446
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
450
447
|
|
|
451
|
-
function _optionalChain$
|
|
448
|
+
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; }
|
|
452
449
|
class Binance extends WindowEthereum {
|
|
453
450
|
|
|
454
451
|
static __initStatic() {this.info = {
|
|
@@ -458,7 +455,7 @@
|
|
|
458
455
|
};}
|
|
459
456
|
|
|
460
457
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
461
|
-
return _optionalChain$
|
|
458
|
+
return _optionalChain$n([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
462
459
|
!window.coin98 &&
|
|
463
460
|
!window.trustwallet
|
|
464
461
|
};}
|
|
@@ -478,7 +475,7 @@
|
|
|
478
475
|
okx: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI4LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMzYuMSAzMzYuMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzM2LjEgMzM2LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPHBhdGggZD0iTTMxMy43LDBIMjIuNEMxMCwwLDAsMTAsMCwyMi40djI5MS4zYzAsMTIuNCwxMCwyMi40LDIyLjQsMjIuNGgyOTEuM2MxMi40LDAsMjIuNC0xMCwyMi40LTIyLjRWMjIuNAoJQzMzNi4xLDEwLDMyNi4xLDAsMzEzLjcsMHoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIwNC41LDEzMC43aC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTV2LTY0LjcKCUMyMDkuNSwxMzIuOSwyMDcuMiwxMzAuNywyMDQuNSwxMzAuN3oiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDU2LjFINjUuMWMtMi43LDAtNSwyLjItNSw1djY0LjdjMCwyLjcsMi4yLDUsNSw1aDY0LjdjMi44LDAsNS0yLjIsNS01VjYxCglDMTM0LjgsNTguMywxMzIuNSw1Ni4xLDEyOS44LDU2LjF6Ii8+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNzkuMSw1Ni4xaC02NC43Yy0yLjcsMC01LDIuMi01LDV2NjQuN2MwLDIuNywyLjIsNSw1LDVoNjQuN2MyLjcsMCw1LTIuMiw1LTVWNjEKCUMyODQuMSw1OC4zLDI4MS45LDU2LjEsMjc5LjEsNTYuMXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyOS44LDIwNS40SDY1LjFjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuOCwwLDUtMi4yLDUtNXYtNjQuNwoJQzEzNC44LDIwNy42LDEzMi41LDIwNS40LDEyOS44LDIwNS40eiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjc5LjEsMjA1LjRoLTY0LjdjLTIuNywwLTUsMi4yLTUsNXY2NC43YzAsMi43LDIuMiw1LDUsNWg2NC43YzIuNywwLDUtMi4yLDUtNXYtNjQuNwoJQzI4NC4xLDIwNy42LDI4MS45LDIwNS40LDI3OS4xLDIwNS40eiIvPgo8L3N2Zz4K",
|
|
479
476
|
};
|
|
480
477
|
|
|
481
|
-
function _optionalChain$
|
|
478
|
+
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; }
|
|
482
479
|
class BraveEVM extends WindowEthereum {
|
|
483
480
|
|
|
484
481
|
static __initStatic() {this.info = {
|
|
@@ -488,14 +485,14 @@
|
|
|
488
485
|
platform: 'evm',
|
|
489
486
|
};}
|
|
490
487
|
|
|
491
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
488
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$m([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
492
489
|
|
|
493
490
|
getProvider() {
|
|
494
491
|
return window.ethereum
|
|
495
492
|
}
|
|
496
493
|
} BraveEVM.__initStatic(); BraveEVM.__initStatic2();
|
|
497
494
|
|
|
498
|
-
function _optionalChain$
|
|
495
|
+
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; }
|
|
499
496
|
class Coin98EVM extends WindowEthereum {
|
|
500
497
|
|
|
501
498
|
static __initStatic() {this.info = {
|
|
@@ -505,13 +502,13 @@
|
|
|
505
502
|
platform: 'evm',
|
|
506
503
|
};}
|
|
507
504
|
|
|
508
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
505
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$l([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
509
506
|
|
|
510
507
|
getProvider() { return window.coin98.provider }
|
|
511
508
|
|
|
512
509
|
} Coin98EVM.__initStatic(); Coin98EVM.__initStatic2();
|
|
513
510
|
|
|
514
|
-
function _optionalChain$
|
|
511
|
+
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; }
|
|
515
512
|
class CoinbaseEVM extends WindowEthereum {
|
|
516
513
|
|
|
517
514
|
static __initStatic() {this.info = {
|
|
@@ -522,8 +519,8 @@
|
|
|
522
519
|
};}
|
|
523
520
|
|
|
524
521
|
getProvider() {
|
|
525
|
-
if(_optionalChain$
|
|
526
|
-
return _optionalChain$
|
|
522
|
+
if(_optionalChain$k([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
523
|
+
return _optionalChain$k([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
527
524
|
} else {
|
|
528
525
|
return window.ethereum
|
|
529
526
|
}
|
|
@@ -532,15 +529,15 @@
|
|
|
532
529
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
533
530
|
return(
|
|
534
531
|
(
|
|
535
|
-
_optionalChain$
|
|
532
|
+
_optionalChain$k([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$k([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
536
533
|
) || (
|
|
537
|
-
_optionalChain$
|
|
534
|
+
_optionalChain$k([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
538
535
|
)
|
|
539
536
|
)
|
|
540
537
|
};}
|
|
541
538
|
} CoinbaseEVM.__initStatic(); CoinbaseEVM.__initStatic2();
|
|
542
539
|
|
|
543
|
-
function _optionalChain$
|
|
540
|
+
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; }
|
|
544
541
|
class CryptoCom extends WindowEthereum {
|
|
545
542
|
|
|
546
543
|
static __initStatic() {this.info = {
|
|
@@ -549,10 +546,10 @@
|
|
|
549
546
|
blockchains: supported$1.evm
|
|
550
547
|
};}
|
|
551
548
|
|
|
552
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
549
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$j([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
553
550
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
554
551
|
|
|
555
|
-
function _optionalChain$
|
|
552
|
+
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; }
|
|
556
553
|
class ExodusEVM extends WindowEthereum {
|
|
557
554
|
|
|
558
555
|
static __initStatic() {this.info = {
|
|
@@ -562,10 +559,10 @@
|
|
|
562
559
|
platform: 'evm',
|
|
563
560
|
};}
|
|
564
561
|
|
|
565
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
562
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$i([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isExodus]) };}
|
|
566
563
|
} ExodusEVM.__initStatic(); ExodusEVM.__initStatic2();
|
|
567
564
|
|
|
568
|
-
function _optionalChain$
|
|
565
|
+
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; }
|
|
569
566
|
class HyperPay extends WindowEthereum {
|
|
570
567
|
|
|
571
568
|
static __initStatic() {this.info = {
|
|
@@ -574,10 +571,10 @@
|
|
|
574
571
|
blockchains: supported$1.evm
|
|
575
572
|
};}
|
|
576
573
|
|
|
577
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
574
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$h([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
578
575
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
579
576
|
|
|
580
|
-
function _optionalChain$
|
|
577
|
+
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; }
|
|
581
578
|
class MagicEdenEVM extends WindowEthereum {
|
|
582
579
|
|
|
583
580
|
static __initStatic() {this.info = {
|
|
@@ -589,12 +586,12 @@
|
|
|
589
586
|
|
|
590
587
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
591
588
|
return (
|
|
592
|
-
_optionalChain$
|
|
589
|
+
_optionalChain$g([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMagicEden])
|
|
593
590
|
)
|
|
594
591
|
};}
|
|
595
592
|
} MagicEdenEVM.__initStatic(); MagicEdenEVM.__initStatic2();
|
|
596
593
|
|
|
597
|
-
function _optionalChain$
|
|
594
|
+
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; }
|
|
598
595
|
class MetaMask extends WindowEthereum {
|
|
599
596
|
|
|
600
597
|
static __initStatic() {this.info = {
|
|
@@ -605,7 +602,7 @@
|
|
|
605
602
|
|
|
606
603
|
static __initStatic2() {this.isMetaMask = (provider)=> {
|
|
607
604
|
return(
|
|
608
|
-
_optionalChain$
|
|
605
|
+
_optionalChain$f([provider, 'optionalAccess', _3 => _3.isMetaMask]) &&
|
|
609
606
|
Object.keys(provider).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!WalletGuard)(?!RevokeCash)/)).length == 1
|
|
610
607
|
)
|
|
611
608
|
};}
|
|
@@ -619,16 +616,16 @@
|
|
|
619
616
|
static __initStatic4() {this.isAvailable = async()=>{
|
|
620
617
|
return(
|
|
621
618
|
MetaMask.getEip6963Provider() ||
|
|
622
|
-
MetaMask.isMetaMask(_optionalChain$
|
|
619
|
+
MetaMask.isMetaMask(_optionalChain$f([window, 'optionalAccess', _4 => _4.ethereum]))
|
|
623
620
|
)
|
|
624
621
|
};}
|
|
625
622
|
|
|
626
623
|
getProvider() {
|
|
627
|
-
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$
|
|
624
|
+
return MetaMask.getEip6963Provider() || (MetaMask.isMetaMask(_optionalChain$f([window, 'optionalAccess', _5 => _5.ethereum])) && _optionalChain$f([window, 'optionalAccess', _6 => _6.ethereum]))
|
|
628
625
|
}
|
|
629
626
|
} MetaMask.__initStatic(); MetaMask.__initStatic2(); MetaMask.__initStatic3(); MetaMask.__initStatic4();
|
|
630
627
|
|
|
631
|
-
function _optionalChain$
|
|
628
|
+
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; }
|
|
632
629
|
class OKXEVM extends WindowEthereum {
|
|
633
630
|
|
|
634
631
|
static __initStatic() {this.info = {
|
|
@@ -640,12 +637,12 @@
|
|
|
640
637
|
|
|
641
638
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
642
639
|
return (
|
|
643
|
-
_optionalChain$
|
|
640
|
+
_optionalChain$e([window, 'optionalAccess', _2 => _2.okxwallet])
|
|
644
641
|
)
|
|
645
642
|
};}
|
|
646
643
|
} OKXEVM.__initStatic(); OKXEVM.__initStatic2();
|
|
647
644
|
|
|
648
|
-
function _optionalChain$
|
|
645
|
+
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; }
|
|
649
646
|
class Opera extends WindowEthereum {
|
|
650
647
|
|
|
651
648
|
static __initStatic() {this.info = {
|
|
@@ -654,10 +651,10 @@
|
|
|
654
651
|
blockchains: supported$1.evm
|
|
655
652
|
};}
|
|
656
653
|
|
|
657
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
654
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
658
655
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
659
656
|
|
|
660
|
-
function _optionalChain$
|
|
657
|
+
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; }
|
|
661
658
|
class PhantomEVM extends WindowEthereum {
|
|
662
659
|
|
|
663
660
|
static __initStatic() {this.info = {
|
|
@@ -671,17 +668,17 @@
|
|
|
671
668
|
return (
|
|
672
669
|
window.phantom &&
|
|
673
670
|
window.phantom.ethereum &&
|
|
674
|
-
! _optionalChain$
|
|
675
|
-
! _optionalChain$
|
|
671
|
+
! _optionalChain$c([window, 'optionalAccess', _4 => _4.ethereum, 'optionalAccess', _5 => _5.isMagicEden]) &&
|
|
672
|
+
! _optionalChain$c([window, 'optionalAccess', _6 => _6.okxwallet])
|
|
676
673
|
)
|
|
677
674
|
};}
|
|
678
675
|
|
|
679
676
|
getProvider() {
|
|
680
|
-
return _optionalChain$
|
|
677
|
+
return _optionalChain$c([window, 'optionalAccess', _7 => _7.phantom, 'optionalAccess', _8 => _8.ethereum]) || window.ethereum
|
|
681
678
|
}
|
|
682
679
|
} PhantomEVM.__initStatic(); PhantomEVM.__initStatic2();
|
|
683
680
|
|
|
684
|
-
function _optionalChain$
|
|
681
|
+
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; }
|
|
685
682
|
class Rabby extends WindowEthereum {
|
|
686
683
|
|
|
687
684
|
static __initStatic() {this.info = {
|
|
@@ -692,12 +689,12 @@
|
|
|
692
689
|
|
|
693
690
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
694
691
|
return(
|
|
695
|
-
_optionalChain$
|
|
692
|
+
_optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
696
693
|
)
|
|
697
694
|
};}
|
|
698
695
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
699
696
|
|
|
700
|
-
function _optionalChain$
|
|
697
|
+
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; }
|
|
701
698
|
class Rainbow extends WindowEthereum {
|
|
702
699
|
|
|
703
700
|
static __initStatic() {this.info = {
|
|
@@ -708,24 +705,24 @@
|
|
|
708
705
|
|
|
709
706
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
710
707
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
711
|
-
return _optionalChain$
|
|
708
|
+
return _optionalChain$a([provider, 'optionalAccess', _4 => _4.isRainbow])
|
|
712
709
|
}) : undefined
|
|
713
710
|
};}
|
|
714
711
|
|
|
715
712
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
716
713
|
return(
|
|
717
714
|
Rainbow.getEip6963Provider() ||
|
|
718
|
-
_optionalChain$
|
|
715
|
+
_optionalChain$a([window, 'optionalAccess', _5 => _5.rainbow, 'optionalAccess', _6 => _6.isRainbow])
|
|
719
716
|
)
|
|
720
717
|
};}
|
|
721
718
|
|
|
722
719
|
getProvider() {
|
|
723
|
-
return Rainbow.getEip6963Provider() || _optionalChain$
|
|
720
|
+
return Rainbow.getEip6963Provider() || _optionalChain$a([window, 'optionalAccess', _7 => _7.rainbow])
|
|
724
721
|
}
|
|
725
722
|
|
|
726
723
|
} Rainbow.__initStatic(); Rainbow.__initStatic2(); Rainbow.__initStatic3();
|
|
727
724
|
|
|
728
|
-
function _optionalChain$
|
|
725
|
+
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; }
|
|
729
726
|
class TokenPocket extends WindowEthereum {
|
|
730
727
|
|
|
731
728
|
static __initStatic() {this.info = {
|
|
@@ -736,12 +733,12 @@
|
|
|
736
733
|
|
|
737
734
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
738
735
|
return (
|
|
739
|
-
_optionalChain$
|
|
736
|
+
_optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
740
737
|
)
|
|
741
738
|
};}
|
|
742
739
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
743
740
|
|
|
744
|
-
function _optionalChain$
|
|
741
|
+
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; }
|
|
745
742
|
class TrustEVM extends WindowEthereum {
|
|
746
743
|
|
|
747
744
|
static __initStatic() {this.info = {
|
|
@@ -753,13 +750,13 @@
|
|
|
753
750
|
|
|
754
751
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
755
752
|
return (
|
|
756
|
-
(_optionalChain$
|
|
753
|
+
(_optionalChain$8([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$8([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
757
754
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
758
755
|
)
|
|
759
756
|
};}
|
|
760
757
|
} TrustEVM.__initStatic(); TrustEVM.__initStatic2();
|
|
761
758
|
|
|
762
|
-
function _optionalChain$
|
|
759
|
+
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; }
|
|
763
760
|
class Uniswap extends WindowEthereum {
|
|
764
761
|
|
|
765
762
|
static __initStatic() {this.info = {
|
|
@@ -770,19 +767,19 @@
|
|
|
770
767
|
|
|
771
768
|
static __initStatic2() {this.getEip6963Provider = ()=>{
|
|
772
769
|
return window['_eip6963Providers'] ? Object.values(window['_eip6963Providers']).find((provider)=>{
|
|
773
|
-
return _optionalChain$
|
|
770
|
+
return _optionalChain$7([provider, 'optionalAccess', _4 => _4.isUniswapWallet])
|
|
774
771
|
}) : undefined
|
|
775
772
|
};}
|
|
776
773
|
|
|
777
774
|
static __initStatic3() {this.isAvailable = async()=>{
|
|
778
775
|
return(
|
|
779
776
|
Uniswap.getEip6963Provider() ||
|
|
780
|
-
_optionalChain$
|
|
777
|
+
_optionalChain$7([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isUniswapWallet])
|
|
781
778
|
)
|
|
782
779
|
};}
|
|
783
780
|
|
|
784
781
|
getProvider() {
|
|
785
|
-
return Uniswap.getEip6963Provider() || (_optionalChain$
|
|
782
|
+
return Uniswap.getEip6963Provider() || (_optionalChain$7([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isUniswapWallet]) && _optionalChain$7([window, 'optionalAccess', _9 => _9.ethereum]))
|
|
786
783
|
}
|
|
787
784
|
} Uniswap.__initStatic(); Uniswap.__initStatic2(); Uniswap.__initStatic3();
|
|
788
785
|
|
|
@@ -887,7 +884,7 @@
|
|
|
887
884
|
}
|
|
888
885
|
};
|
|
889
886
|
|
|
890
|
-
function _optionalChain$
|
|
887
|
+
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; }
|
|
891
888
|
|
|
892
889
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
893
890
|
transaction = new Transaction(transaction);
|
|
@@ -938,7 +935,7 @@
|
|
|
938
935
|
try {
|
|
939
936
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
940
937
|
if(
|
|
941
|
-
(error && _optionalChain$
|
|
938
|
+
(error && _optionalChain$6([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
942
939
|
(error && error.toString().match('undefined'))
|
|
943
940
|
) {
|
|
944
941
|
setTimeout(()=>{
|
|
@@ -952,7 +949,7 @@
|
|
|
952
949
|
});
|
|
953
950
|
} catch (error) {
|
|
954
951
|
if(
|
|
955
|
-
(error && _optionalChain$
|
|
952
|
+
(error && _optionalChain$6([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
956
953
|
(error && error.toString().match('undefined'))
|
|
957
954
|
) {
|
|
958
955
|
setTimeout(()=>{
|
|
@@ -983,7 +980,7 @@
|
|
|
983
980
|
resolve(sentTransaction);
|
|
984
981
|
} catch (error) {
|
|
985
982
|
if(
|
|
986
|
-
(error && _optionalChain$
|
|
983
|
+
(error && _optionalChain$6([error, 'optionalAccess', _7 => _7.stack, 'optionalAccess', _8 => _8.match, 'call', _9 => _9('JSON-RPC error')])) ||
|
|
987
984
|
(error && error.toString().match('undefined'))
|
|
988
985
|
) {
|
|
989
986
|
setTimeout(()=>{
|
|
@@ -1025,8 +1022,8 @@
|
|
|
1025
1022
|
to: transaction.to,
|
|
1026
1023
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1027
1024
|
data: await transaction.getData(),
|
|
1028
|
-
gas: _optionalChain$
|
|
1029
|
-
gasLimit: _optionalChain$
|
|
1025
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1026
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1030
1027
|
gasPrice: gasPrice.toHexString(),
|
|
1031
1028
|
nonce: ethers.ethers.utils.hexlify(transaction.nonce),
|
|
1032
1029
|
}]
|
|
@@ -1053,16 +1050,16 @@
|
|
|
1053
1050
|
to: transaction.to,
|
|
1054
1051
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1055
1052
|
data: '0x0',
|
|
1056
|
-
gas: _optionalChain$
|
|
1057
|
-
gasLimit: _optionalChain$
|
|
1058
|
-
gasPrice: _optionalChain$
|
|
1053
|
+
gas: _optionalChain$6([gas, 'optionalAccess', _14 => _14.toHexString, 'call', _15 => _15()]),
|
|
1054
|
+
gasLimit: _optionalChain$6([gas, 'optionalAccess', _16 => _16.toHexString, 'call', _17 => _17()]),
|
|
1055
|
+
gasPrice: _optionalChain$6([gasPrice, 'optionalAccess', _18 => _18.toHexString, 'call', _19 => _19()]),
|
|
1059
1056
|
nonce: ethers.ethers.utils.hexlify(transaction.nonce)
|
|
1060
1057
|
}]
|
|
1061
1058
|
}
|
|
1062
1059
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1063
1060
|
};
|
|
1064
1061
|
|
|
1065
|
-
function _optionalChain$
|
|
1062
|
+
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; }
|
|
1066
1063
|
|
|
1067
1064
|
const KEY = 'depay:wallets:wc2';
|
|
1068
1065
|
|
|
@@ -1115,7 +1112,7 @@
|
|
|
1115
1112
|
optionalNamespaces['eip155'] = {
|
|
1116
1113
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains__default['default'][blockchain].namespace}:${Blockchains__default['default'][blockchain].networkId}`),
|
|
1117
1114
|
};
|
|
1118
|
-
if(_optionalChain$
|
|
1115
|
+
if(_optionalChain$5([optionalNamespaces, 'optionalAccess', _ => _.eip155]) && _optionalChain$5([optionalNamespaces, 'optionalAccess', _2 => _2.eip155, 'optionalAccess', _3 => _3.chains, 'optionalAccess', _4 => _4.length])) {
|
|
1119
1116
|
optionalNamespaces['eip155'].methods = methods;
|
|
1120
1117
|
optionalNamespaces['eip155'].events = events;
|
|
1121
1118
|
}
|
|
@@ -1130,9 +1127,9 @@
|
|
|
1130
1127
|
projectId: localStorage[KEY+":projectId"],
|
|
1131
1128
|
metadata: {
|
|
1132
1129
|
name: document.title || 'dApp',
|
|
1133
|
-
description: _optionalChain$
|
|
1130
|
+
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',
|
|
1134
1131
|
url: location.href,
|
|
1135
|
-
icons: [_optionalChain$
|
|
1132
|
+
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`]
|
|
1136
1133
|
}
|
|
1137
1134
|
});
|
|
1138
1135
|
resolve(signClient);
|
|
@@ -1150,7 +1147,7 @@
|
|
|
1150
1147
|
};}
|
|
1151
1148
|
|
|
1152
1149
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1153
|
-
return !! await getLastSession(_optionalChain$
|
|
1150
|
+
return !! await getLastSession(_optionalChain$5([options, 'optionalAccess', _13 => _13.walletName]))
|
|
1154
1151
|
};}
|
|
1155
1152
|
|
|
1156
1153
|
constructor() {
|
|
@@ -1165,17 +1162,17 @@
|
|
|
1165
1162
|
}
|
|
1166
1163
|
|
|
1167
1164
|
async account() {
|
|
1168
|
-
if(_optionalChain$
|
|
1165
|
+
if(_optionalChain$5([this, 'access', _14 => _14.session, 'optionalAccess', _15 => _15.namespaces, 'optionalAccess', _16 => _16.eip155, 'optionalAccess', _17 => _17.accounts, 'optionalAccess', _18 => _18.length])) {
|
|
1169
1166
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1170
1167
|
}
|
|
1171
1168
|
}
|
|
1172
1169
|
|
|
1173
1170
|
async setSessionBlockchains() {
|
|
1174
|
-
if(!this.session || (!_optionalChain$
|
|
1171
|
+
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 }
|
|
1175
1172
|
if(this.session.namespaces.eip155.chains) {
|
|
1176
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1173
|
+
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);
|
|
1177
1174
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1178
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1175
|
+
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);
|
|
1179
1176
|
}
|
|
1180
1177
|
}
|
|
1181
1178
|
|
|
@@ -1185,13 +1182,13 @@
|
|
|
1185
1182
|
|
|
1186
1183
|
try {
|
|
1187
1184
|
|
|
1188
|
-
this.walletName = _optionalChain$
|
|
1185
|
+
this.walletName = _optionalChain$5([options, 'optionalAccess', _31 => _31.name]);
|
|
1189
1186
|
|
|
1190
1187
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1191
1188
|
this.signClient = await getSignClient();
|
|
1192
1189
|
|
|
1193
1190
|
this.signClient.on("session_delete", (session)=> {
|
|
1194
|
-
if(_optionalChain$
|
|
1191
|
+
if(_optionalChain$5([session, 'optionalAccess', _32 => _32.topic]) === _optionalChain$5([this, 'access', _33 => _33.session, 'optionalAccess', _34 => _34.topic])) {
|
|
1195
1192
|
localStorage[KEY+':name'] = undefined;
|
|
1196
1193
|
localStorage[KEY+':logo'] = undefined;
|
|
1197
1194
|
this.signClient = undefined;
|
|
@@ -1200,14 +1197,14 @@
|
|
|
1200
1197
|
});
|
|
1201
1198
|
|
|
1202
1199
|
this.signClient.on("session_update", async(session)=> {
|
|
1203
|
-
if(_optionalChain$
|
|
1200
|
+
if(_optionalChain$5([session, 'optionalAccess', _35 => _35.topic]) === _optionalChain$5([this, 'access', _36 => _36.session, 'optionalAccess', _37 => _37.topic])) {
|
|
1204
1201
|
this.session = this.signClient.session.get(session.topic);
|
|
1205
1202
|
await this.setSessionBlockchains();
|
|
1206
1203
|
}
|
|
1207
1204
|
});
|
|
1208
1205
|
|
|
1209
1206
|
this.signClient.on("session_event", (event)=> {
|
|
1210
|
-
if(_optionalChain$
|
|
1207
|
+
if(_optionalChain$5([event, 'optionalAccess', _38 => _38.topic]) === _optionalChain$5([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {}
|
|
1211
1208
|
});
|
|
1212
1209
|
|
|
1213
1210
|
const connectWallet = async()=>{
|
|
@@ -1218,24 +1215,24 @@
|
|
|
1218
1215
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1219
1216
|
};
|
|
1220
1217
|
|
|
1221
|
-
const lastSession = _optionalChain$
|
|
1218
|
+
const lastSession = _optionalChain$5([this, 'optionalAccess', _41 => _41.walletName, 'optionalAccess', _42 => _42.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1222
1219
|
if(lastSession) {
|
|
1223
1220
|
this.session = lastSession;
|
|
1224
1221
|
} else {
|
|
1225
1222
|
await connectWallet();
|
|
1226
1223
|
}
|
|
1227
1224
|
|
|
1228
|
-
let meta = _optionalChain$
|
|
1225
|
+
let meta = _optionalChain$5([this, 'access', _43 => _43.session, 'optionalAccess', _44 => _44.peer, 'optionalAccess', _45 => _45.metadata]);
|
|
1229
1226
|
if(meta && meta.name) {
|
|
1230
1227
|
this.name = meta.name;
|
|
1231
1228
|
localStorage[KEY+':name'] = meta.name;
|
|
1232
|
-
if(_optionalChain$
|
|
1229
|
+
if(_optionalChain$5([meta, 'optionalAccess', _46 => _46.icons]) && meta.icons.length) {
|
|
1233
1230
|
this.logo = meta.icons[0];
|
|
1234
1231
|
localStorage[KEY+':logo'] = this.logo;
|
|
1235
1232
|
}
|
|
1236
1233
|
}
|
|
1237
|
-
if(_optionalChain$
|
|
1238
|
-
if(_optionalChain$
|
|
1234
|
+
if(_optionalChain$5([options, 'optionalAccess', _47 => _47.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1235
|
+
if(_optionalChain$5([options, 'optionalAccess', _48 => _48.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1239
1236
|
|
|
1240
1237
|
await this.setSessionBlockchains();
|
|
1241
1238
|
|
|
@@ -1275,7 +1272,7 @@
|
|
|
1275
1272
|
switch (event) {
|
|
1276
1273
|
case 'account':
|
|
1277
1274
|
internalCallback = async(event)=> {
|
|
1278
|
-
if(_optionalChain$
|
|
1275
|
+
if(_optionalChain$5([event, 'optionalAccess', _49 => _49.topic]) === _optionalChain$5([this, 'access', _50 => _50.session, 'optionalAccess', _51 => _51.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1279
1276
|
callback(await this.account());
|
|
1280
1277
|
}
|
|
1281
1278
|
};
|
|
@@ -1335,7 +1332,7 @@
|
|
|
1335
1332
|
|
|
1336
1333
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1337
1334
|
|
|
1338
|
-
function _optionalChain$
|
|
1335
|
+
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; }
|
|
1339
1336
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1340
1337
|
transaction = new Transaction(transaction);
|
|
1341
1338
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1387,7 +1384,7 @@
|
|
|
1387
1384
|
|
|
1388
1385
|
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1389
1386
|
if(
|
|
1390
|
-
(error && _optionalChain$
|
|
1387
|
+
(error && _optionalChain$4([error, 'optionalAccess', _ => _.stack, 'optionalAccess', _2 => _2.match, 'call', _3 => _3('JSON-RPC error')])) ||
|
|
1391
1388
|
(error && error.toString().match('undefined'))
|
|
1392
1389
|
) {
|
|
1393
1390
|
setTimeout(()=>{
|
|
@@ -1401,7 +1398,7 @@
|
|
|
1401
1398
|
});
|
|
1402
1399
|
} catch(error) {
|
|
1403
1400
|
if(
|
|
1404
|
-
(error && _optionalChain$
|
|
1401
|
+
(error && _optionalChain$4([error, 'optionalAccess', _4 => _4.stack, 'optionalAccess', _5 => _5.match, 'call', _6 => _6('JSON-RPC error')])) ||
|
|
1405
1402
|
(error && error.toString().match('undefined'))
|
|
1406
1403
|
) {
|
|
1407
1404
|
setTimeout(()=>{
|
|
@@ -1446,7 +1443,7 @@
|
|
|
1446
1443
|
})
|
|
1447
1444
|
};
|
|
1448
1445
|
|
|
1449
|
-
function _optionalChain$
|
|
1446
|
+
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; }
|
|
1450
1447
|
|
|
1451
1448
|
const getConnectedInstance = ()=>{
|
|
1452
1449
|
return window._connectedWalletLinkInstance
|
|
@@ -1500,10 +1497,10 @@
|
|
|
1500
1497
|
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
1501
1498
|
await connect({ uri: this.connector.qrUrl });
|
|
1502
1499
|
|
|
1503
|
-
_optionalChain$
|
|
1504
|
-
_optionalChain$
|
|
1500
|
+
_optionalChain$3([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-css-reset'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
|
|
1501
|
+
_optionalChain$3([document, 'access', _5 => _5.querySelector, 'call', _6 => _6('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _7 => _7.setAttribute, 'call', _8 => _8('style', 'display: none;')]);
|
|
1505
1502
|
setTimeout(()=>{
|
|
1506
|
-
if(_optionalChain$
|
|
1503
|
+
if(_optionalChain$3([this, 'optionalAccess', _9 => _9.connector, 'optionalAccess', _10 => _10._relay, 'optionalAccess', _11 => _11.ui, 'optionalAccess', _12 => _12.linkFlow, 'optionalAccess', _13 => _13.isOpen])){
|
|
1507
1504
|
this.connector._relay.ui.linkFlow.isOpen = false;
|
|
1508
1505
|
}
|
|
1509
1506
|
}, 10);
|
|
@@ -1605,9 +1602,6 @@
|
|
|
1605
1602
|
if(typeof message === 'object') {
|
|
1606
1603
|
let provider = this.connector;
|
|
1607
1604
|
let account = await this.account();
|
|
1608
|
-
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
1609
|
-
throw({ code: 'WRONG_NETWORK' })
|
|
1610
|
-
}
|
|
1611
1605
|
let signature = await provider.request({
|
|
1612
1606
|
method: 'eth_signTypedData_v4',
|
|
1613
1607
|
params: [account, message],
|
|
@@ -1627,24 +1621,370 @@
|
|
|
1627
1621
|
WalletLink.getConnectedInstance = getConnectedInstance;
|
|
1628
1622
|
WalletLink.setConnectedInstance = setConnectedInstance;
|
|
1629
1623
|
|
|
1624
|
+
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
|
|
1625
|
+
const generateSiweMessage = (siweMessageData) => {
|
|
1626
|
+
let siweMessage = '';
|
|
1627
|
+
|
|
1628
|
+
if (siweMessageData.scheme) {
|
|
1629
|
+
siweMessage += `${siweMessageData.scheme}://${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
1630
|
+
} else {
|
|
1631
|
+
siweMessage += `${siweMessageData.domain} wants you to sign in with your Ethereum account:\n`;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// NOTE: This differs from the ERC-4361 spec where the address is required
|
|
1635
|
+
if (siweMessageData.address) {
|
|
1636
|
+
siweMessage += `${siweMessageData.address}\n`;
|
|
1637
|
+
} else {
|
|
1638
|
+
siweMessage += '{address}\n';
|
|
1639
|
+
}
|
|
1640
|
+
siweMessage += '\n';
|
|
1641
|
+
|
|
1642
|
+
if (siweMessageData.statement) {
|
|
1643
|
+
siweMessage += `${siweMessageData.statement}\n`;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
siweMessage += '\n';
|
|
1647
|
+
|
|
1648
|
+
siweMessage += `URI: ${siweMessageData.uri}\n`;
|
|
1649
|
+
siweMessage += `Version: ${siweMessageData.version}\n`;
|
|
1650
|
+
siweMessage += `Chain ID: ${siweMessageData.chain_id}\n`;
|
|
1651
|
+
siweMessage += `Nonce: ${siweMessageData.nonce}\n`;
|
|
1652
|
+
siweMessage += `Issued At: ${siweMessageData.issued_at}\n`;
|
|
1653
|
+
|
|
1654
|
+
if (siweMessageData.expiration_time) {
|
|
1655
|
+
siweMessage += `Expiration Time: ${siweMessageData.expiration_time}\n`;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
if (siweMessageData.not_before) {
|
|
1659
|
+
siweMessage += `Not Before: ${siweMessageData.not_before}\n`;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
if (siweMessageData.request_id) {
|
|
1663
|
+
siweMessage += `Request ID: ${siweMessageData.request_id}\n`;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
return siweMessage
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/transaction/validate-payload.ts
|
|
1670
|
+
const isValidHex = (str) => {
|
|
1671
|
+
return /^0x[0-9A-Fa-f]+$/.test(str)
|
|
1672
|
+
};
|
|
1673
|
+
const processTransactionPayload = (payload) => {
|
|
1674
|
+
// Handle primitives directly
|
|
1675
|
+
if (
|
|
1676
|
+
typeof payload === 'boolean' ||
|
|
1677
|
+
typeof payload === 'string' ||
|
|
1678
|
+
payload === null ||
|
|
1679
|
+
payload === undefined
|
|
1680
|
+
) {
|
|
1681
|
+
return payload
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
// Convert numbers to strings to prevent overflow issues
|
|
1685
|
+
if (typeof payload === 'number' || typeof payload === 'bigint') {
|
|
1686
|
+
return String(payload)
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
// Handle arrays by processing each element
|
|
1690
|
+
if (Array.isArray(payload)) {
|
|
1691
|
+
return payload.map((value) => processTransactionPayload(value))
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// Handle objects
|
|
1695
|
+
if (typeof payload === 'object') {
|
|
1696
|
+
const result = { ...payload };
|
|
1697
|
+
|
|
1698
|
+
// Special handling for transaction value fields
|
|
1699
|
+
if ('value' in result && result.value !== undefined) {
|
|
1700
|
+
// Ensure it's a string
|
|
1701
|
+
if (typeof result.value !== 'string') {
|
|
1702
|
+
result.value = String(result.value);
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
if (!isValidHex(result.value)) {
|
|
1706
|
+
console.error(
|
|
1707
|
+
'Transaction value must be a valid hex string',
|
|
1708
|
+
result.value,
|
|
1709
|
+
);
|
|
1710
|
+
throw new Error(
|
|
1711
|
+
`Transaction value must be a valid hex string: ${result.value}`,
|
|
1712
|
+
)
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// Process all object properties recursively
|
|
1717
|
+
for (const key in result) {
|
|
1718
|
+
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
1719
|
+
result[key] = processTransactionPayload(result[key]);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
return result
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// Fallback for any other types
|
|
1727
|
+
return payload
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/helpers/send-webview-event.ts
|
|
1731
|
+
const sendMiniKitEvent = function(payload) {
|
|
1732
|
+
if (window.webkit) {
|
|
1733
|
+
if (
|
|
1734
|
+
window.webkit.messageHandlers &&
|
|
1735
|
+
window.webkit.messageHandlers.minikit &&
|
|
1736
|
+
window.webkit.messageHandlers.minikit.postMessage
|
|
1737
|
+
) {
|
|
1738
|
+
window.webkit.messageHandlers.minikit.postMessage(payload);
|
|
1739
|
+
}
|
|
1740
|
+
} else if (window.Android && window.Android.postMessage) {
|
|
1741
|
+
window.Android.postMessage(JSON.stringify(payload));
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/commands.ts
|
|
1746
|
+
let Command = {
|
|
1747
|
+
"Verify": 'verify',
|
|
1748
|
+
"Pay": 'pay',
|
|
1749
|
+
"WalletAuth": 'wallet-auth',
|
|
1750
|
+
"SendTransaction": 'send-transaction',
|
|
1751
|
+
"SignMessage": 'sign-message',
|
|
1752
|
+
"SignTypedData": 'sign-typed-data',
|
|
1753
|
+
"ShareContacts": 'share-contacts',
|
|
1754
|
+
"RequestPermission": 'request-permission',
|
|
1755
|
+
"GetPermissions": 'get-permissions',
|
|
1756
|
+
"SendHapticFeedback": 'send-haptic-feedback',
|
|
1757
|
+
"ShareFiles": 'share-files',
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/types/responses.ts
|
|
1761
|
+
let ResponseEvent = {
|
|
1762
|
+
"MiniAppVerifyAction": "miniapp-verify-action",
|
|
1763
|
+
"MiniAppPayment": "miniapp-payment",
|
|
1764
|
+
"MiniAppWalletAuth": "miniapp-wallet-auth",
|
|
1765
|
+
"MiniAppSendTransaction": "miniapp-send-transaction",
|
|
1766
|
+
"MiniAppSignMessage": "miniapp-sign-message",
|
|
1767
|
+
"MiniAppSignTypedData": "miniapp-sign-typed-data",
|
|
1768
|
+
"MiniAppShareContacts": "miniapp-share-contacts",
|
|
1769
|
+
"MiniAppRequestPermission": "miniapp-request-permission",
|
|
1770
|
+
"MiniAppGetPermissions": "miniapp-get-permissions",
|
|
1771
|
+
"MiniAppSendHapticFeedback": "miniapp-send-haptic-feedback",
|
|
1772
|
+
"MiniAppShareFiles": "miniapp-share-files",
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/index.ts
|
|
1776
|
+
// https://github.com/worldcoin/minikit-js/blob/main/packages/core/minikit.ts
|
|
1777
|
+
|
|
1778
|
+
class MiniKit {
|
|
1779
|
+
|
|
1780
|
+
static __initStatic() {this.MINIKIT_VERSION = 1;}
|
|
1781
|
+
|
|
1782
|
+
static __initStatic2() {this.miniKitCommandVersion = {
|
|
1783
|
+
[Command.Verify]: 1,
|
|
1784
|
+
[Command.Pay]: 1,
|
|
1785
|
+
[Command.WalletAuth]: 1,
|
|
1786
|
+
[Command.SendTransaction]: 1,
|
|
1787
|
+
[Command.SignMessage]: 1,
|
|
1788
|
+
[Command.SignTypedData]: 1,
|
|
1789
|
+
[Command.ShareContacts]: 1,
|
|
1790
|
+
[Command.RequestPermission]: 1,
|
|
1791
|
+
[Command.GetPermissions]: 1,
|
|
1792
|
+
[Command.SendHapticFeedback]: 1,
|
|
1793
|
+
[Command.ShareFiles]: 1,
|
|
1794
|
+
};}
|
|
1795
|
+
|
|
1796
|
+
static __initStatic3() {this.listeners = {
|
|
1797
|
+
[ResponseEvent.MiniAppVerifyAction]: () => {},
|
|
1798
|
+
[ResponseEvent.MiniAppPayment]: () => {},
|
|
1799
|
+
[ResponseEvent.MiniAppWalletAuth]: () => {},
|
|
1800
|
+
[ResponseEvent.MiniAppSendTransaction]: () => {},
|
|
1801
|
+
[ResponseEvent.MiniAppSignMessage]: () => {},
|
|
1802
|
+
[ResponseEvent.MiniAppSignTypedData]: () => {},
|
|
1803
|
+
[ResponseEvent.MiniAppShareContacts]: () => {},
|
|
1804
|
+
[ResponseEvent.MiniAppRequestPermission]: () => {},
|
|
1805
|
+
[ResponseEvent.MiniAppGetPermissions]: () => {},
|
|
1806
|
+
[ResponseEvent.MiniAppSendHapticFeedback]: () => {},
|
|
1807
|
+
[ResponseEvent.MiniAppShareFiles]: () => {},
|
|
1808
|
+
};}
|
|
1809
|
+
|
|
1810
|
+
static __initStatic4() {this.appId = null;}
|
|
1811
|
+
static __initStatic5() {this.user = {};}
|
|
1812
|
+
static __initStatic6() {this.isReady = false;}
|
|
1813
|
+
|
|
1814
|
+
static install(appId) {
|
|
1815
|
+
|
|
1816
|
+
if (typeof window === "undefined" || Boolean(window.MiniKit)) {
|
|
1817
|
+
return {
|
|
1818
|
+
success: false,
|
|
1819
|
+
errorCode: 'already_installed',
|
|
1820
|
+
errorMessage: 'MiniKit is already installed.'
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
if (!appId) {
|
|
1825
|
+
console.warn("App ID not provided during install");
|
|
1826
|
+
} else {
|
|
1827
|
+
MiniKit.appId = appId;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
if (!window.WorldApp) {
|
|
1831
|
+
return {
|
|
1832
|
+
success: false,
|
|
1833
|
+
errorCode: 'outside_of_worldapp',
|
|
1834
|
+
errorMessage: 'MiniApp launched outside of WorldApp.'
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
// Set user properties
|
|
1839
|
+
MiniKit.user.optedIntoOptionalAnalytics = window.WorldApp.is_optional_analytics;
|
|
1840
|
+
MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
1841
|
+
MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
1842
|
+
|
|
1843
|
+
try {
|
|
1844
|
+
window.MiniKit = MiniKit;
|
|
1845
|
+
this.sendInit();
|
|
1846
|
+
} catch (error) {
|
|
1847
|
+
console.error(
|
|
1848
|
+
'Failed to install MiniKit.',
|
|
1849
|
+
error
|
|
1850
|
+
);
|
|
1851
|
+
|
|
1852
|
+
return {
|
|
1853
|
+
success: false,
|
|
1854
|
+
errorCode: 'unknown',
|
|
1855
|
+
errorMessage: 'Failed to install MiniKit.'
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
MiniKit.isReady = true;
|
|
1860
|
+
return { success: true }
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
static sendInit() {
|
|
1864
|
+
sendWebviewEvent({
|
|
1865
|
+
command: 'init',
|
|
1866
|
+
payload: { version: this.MINIKIT_VERSION },
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
static subscribe(event, handler) {
|
|
1871
|
+
if (event === ResponseEvent.MiniAppWalletAuth) {
|
|
1872
|
+
const originalHandler = handler;
|
|
1873
|
+
const wrappedHandler = async (payload) => {
|
|
1874
|
+
if (payload.status === 'success') {
|
|
1875
|
+
MiniKit.user.walletAddress = payload.address;
|
|
1876
|
+
}
|
|
1877
|
+
originalHandler(payload);
|
|
1878
|
+
};
|
|
1879
|
+
this.listeners[event] = wrappedHandler;
|
|
1880
|
+
} else if (event === ResponseEvent.MiniAppVerifyAction) {
|
|
1881
|
+
const originalHandler = handler;
|
|
1882
|
+
const wrappedHandler = (payload) => {
|
|
1883
|
+
originalHandler(payload);
|
|
1884
|
+
};
|
|
1885
|
+
this.listeners[event] = wrappedHandler;
|
|
1886
|
+
} else {
|
|
1887
|
+
this.listeners[event] = handler;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
static unsubscribe(event) {
|
|
1892
|
+
delete this.listeners[event];
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
static trigger(event, payload) {
|
|
1896
|
+
if (!this.listeners[event]) {
|
|
1897
|
+
console.error(
|
|
1898
|
+
`No handler for event ${event}, payload: ${JSON.stringify(payload)}`
|
|
1899
|
+
);
|
|
1900
|
+
return
|
|
1901
|
+
}
|
|
1902
|
+
this.listeners[event](payload);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
static __initStatic7() {this.commands = {
|
|
1906
|
+
|
|
1907
|
+
walletAuth: (payload) => {
|
|
1908
|
+
|
|
1909
|
+
let protocol = null;
|
|
1910
|
+
try {
|
|
1911
|
+
const currentUrl = new URL(window.location.href);
|
|
1912
|
+
protocol = currentUrl.protocol.split(':')[0];
|
|
1913
|
+
} catch (error) {
|
|
1914
|
+
console.error('Failed to get current URL', error);
|
|
1915
|
+
return null
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
const siweMessage = generateSiweMessage({
|
|
1919
|
+
scheme: protocol,
|
|
1920
|
+
domain: window.location.host,
|
|
1921
|
+
statement: _nullishCoalesce(payload.statement, () => ( undefined)),
|
|
1922
|
+
uri: window.location.href,
|
|
1923
|
+
version: '1',
|
|
1924
|
+
chain_id: 480,
|
|
1925
|
+
nonce: payload.nonce,
|
|
1926
|
+
issued_at: new Date().toISOString(),
|
|
1927
|
+
expiration_time: _optionalChain$2([payload, 'access', _7 => _7.expirationTime, 'optionalAccess', _8 => _8.toISOString, 'call', _9 => _9()]),
|
|
1928
|
+
not_before: _optionalChain$2([payload, 'access', _10 => _10.notBefore, 'optionalAccess', _11 => _11.toISOString, 'call', _12 => _12()]),
|
|
1929
|
+
request_id: _nullishCoalesce(payload.requestId, () => ( undefined)),
|
|
1930
|
+
});
|
|
1931
|
+
|
|
1932
|
+
const walletAuthPayload = { siweMessage };
|
|
1933
|
+
sendMiniKitEvent({
|
|
1934
|
+
command: Command.WalletAuth,
|
|
1935
|
+
version: this.miniKitCommandVersion[Command.WalletAuth],
|
|
1936
|
+
payload: walletAuthPayload,
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
return walletAuthPayload
|
|
1940
|
+
},
|
|
1941
|
+
|
|
1942
|
+
sendTransaction: (payload) => {
|
|
1943
|
+
|
|
1944
|
+
const validatedPayload = processTransactionPayload(payload);
|
|
1945
|
+
|
|
1946
|
+
sendMiniKitEvent({
|
|
1947
|
+
command: Command.SendTransaction,
|
|
1948
|
+
version: this.miniKitCommandVersion[Command.SendTransaction],
|
|
1949
|
+
payload: validatedPayload,
|
|
1950
|
+
});
|
|
1951
|
+
|
|
1952
|
+
return validatedPayload
|
|
1953
|
+
},
|
|
1954
|
+
|
|
1955
|
+
signMessage: (payload) => {
|
|
1956
|
+
|
|
1957
|
+
sendMiniKitEvent({
|
|
1958
|
+
command: Command.SignMessage,
|
|
1959
|
+
version: this.miniKitCommandVersion[Command.SignMessage],
|
|
1960
|
+
payload,
|
|
1961
|
+
});
|
|
1962
|
+
|
|
1963
|
+
return payload
|
|
1964
|
+
},
|
|
1965
|
+
};}
|
|
1966
|
+
} MiniKit.__initStatic(); MiniKit.__initStatic2(); MiniKit.__initStatic3(); MiniKit.__initStatic4(); MiniKit.__initStatic5(); MiniKit.__initStatic6(); MiniKit.__initStatic7();
|
|
1967
|
+
|
|
1630
1968
|
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; }
|
|
1631
1969
|
|
|
1632
1970
|
class WorldApp {
|
|
1633
1971
|
|
|
1634
|
-
static __initStatic() {this.
|
|
1972
|
+
static __initStatic() {this.MiniKit = MiniKit;}
|
|
1973
|
+
|
|
1974
|
+
static __initStatic2() {this.info = {
|
|
1635
1975
|
name: 'World App',
|
|
1636
1976
|
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMzIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cmVjdCBmaWxsPSIjMDAwMDAwIiB3aWR0aD0iMzMiIGhlaWdodD0iMzIiLz4KICAgIDwvZz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjQuNywxMi41Yy0uNS0xLjEtMS4xLTItMS45LTIuOHMtMS44LTEuNS0yLjgtMS45Yy0xLjEtLjUtMi4zLS43LTMuNS0uN3MtMi40LjItMy41LjdjLTEuMS41LTIsMS4xLTIuOCwxLjlzLTEuNSwxLjgtMS45LDIuOGMtLjUsMS4xLS43LDIuMy0uNywzLjVzLjIsMi40LjcsMy41LDEuMSwyLDEuOSwyLjhjLjguOCwxLjgsMS41LDIuOCwxLjksMS4xLjUsMi4zLjcsMy41LjdzMi40LS4yLDMuNS0uNywyLTEuMSwyLjgtMS45LDEuNS0xLjgsMS45LTIuOGMuNS0xLjEuNy0yLjMuNy0zLjVzLS4yLTIuNC0uNy0zLjVaTTEzLjUsMTUuMmMuNC0xLjQsMS43LTIuNSwzLjItMi41aDYuMmMuNC44LjcsMS42LjcsMi41aC0xMC4xWk0yMy43LDE2LjhjMCwuOS0uNCwxLjctLjcsMi41aC02LjJjLTEuNSwwLTIuOC0xLjEtMy4yLTIuNWgxMC4xWk0xMS40LDEwLjljMS40LTEuNCwzLjItMi4xLDUuMS0yLjFzMy44LjcsNS4xLDIuMWguMWMwLC4xLTUsLjEtNSwuMS0xLjMsMC0yLjYuNS0zLjUsMS41LS43LjctMS4yLDEuNy0xLjQsMi43aC0yLjVjLjItMS42LjktMy4xLDIuMS00LjNaTTE2LjUsMjMuMmMtMS45LDAtMy44LS43LTUuMS0yLjEtMS4yLTEuMi0xLjktMi43LTIuMS00LjNoMi41Yy4yLDEsLjcsMS45LDEuNCwyLjcuOS45LDIuMiwxLjUsMy41LDEuNWg1LS4xYy0xLjQsMS41LTMuMiwyLjItNS4xLDIuMloiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=",
|
|
1637
1977
|
blockchains: ["worldchain"]
|
|
1638
1978
|
};}
|
|
1639
1979
|
|
|
1640
|
-
static
|
|
1980
|
+
static __initStatic3() {this.isAvailable = async()=>{
|
|
1641
1981
|
return Boolean(
|
|
1642
1982
|
_optionalChain$1([window, 'optionalAccess', _2 => _2.WorldApp])
|
|
1643
1983
|
)
|
|
1644
1984
|
};}
|
|
1645
1985
|
|
|
1646
1986
|
constructor () {
|
|
1647
|
-
|
|
1987
|
+
MiniKit.install();
|
|
1648
1988
|
this.name = this.constructor.info.name;
|
|
1649
1989
|
this.logo = this.constructor.info.logo;
|
|
1650
1990
|
this.blockchains = this.constructor.info.blockchains;
|
|
@@ -1652,25 +1992,17 @@
|
|
|
1652
1992
|
}
|
|
1653
1993
|
|
|
1654
1994
|
sendTransaction(transaction) {
|
|
1655
|
-
console.log('sendTransaction', transaction);
|
|
1656
1995
|
transaction = new Transaction(transaction);
|
|
1657
|
-
console.log('after transaction wrapping transaction.sent', transaction.sent);
|
|
1658
|
-
console.log('after transaction wrapping transaction.succeeded', transaction.succeeded);
|
|
1659
|
-
console.log('after transaction wrapping transaction.failed', transaction.failed);
|
|
1660
1996
|
|
|
1661
1997
|
return new Promise(async(resolve, reject)=>{
|
|
1662
1998
|
await transaction.prepare({ wallet: this });
|
|
1663
|
-
console.log('after prepare transaction', transaction);
|
|
1664
1999
|
transaction.nonce = (await this.transactionCount({ blockchain: 'worldchain', address: transaction.from })).toString();
|
|
1665
|
-
|
|
2000
|
+
transaction.fromBlock = await web3ClientEvm.request('worldchain://latestBlockNumber');
|
|
1666
2001
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
console.log('payload', payload);
|
|
2002
|
+
MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
|
|
2003
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSendTransaction);
|
|
1670
2004
|
if (payload.status == "success") {
|
|
1671
|
-
console.log('before transaction.accepted', transaction);
|
|
1672
2005
|
if (transaction.accepted) { transaction.accepted(); }
|
|
1673
|
-
console.log('after transaction.accepted', transaction);
|
|
1674
2006
|
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
|
|
1675
2007
|
if(transactionHash) {
|
|
1676
2008
|
resolve(transaction);
|
|
@@ -1682,9 +2014,7 @@
|
|
|
1682
2014
|
reject('Submitting transaction failed!');
|
|
1683
2015
|
}
|
|
1684
2016
|
});
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
console.log('before MiniKit.commands.sendTransaction', {
|
|
2017
|
+
MiniKit.commands.sendTransaction({
|
|
1688
2018
|
transaction: [
|
|
1689
2019
|
{
|
|
1690
2020
|
address: transaction.to,
|
|
@@ -1695,70 +2025,107 @@
|
|
|
1695
2025
|
],
|
|
1696
2026
|
permit2: [_optionalChain$1([transaction, 'access', _13 => _13.params, 'optionalAccess', _14 => _14.permit2])]
|
|
1697
2027
|
});
|
|
1698
|
-
worldcoinPrecompiled.MiniKit.commands.sendTransaction({
|
|
1699
|
-
transaction: [
|
|
1700
|
-
{
|
|
1701
|
-
address: transaction.to,
|
|
1702
|
-
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]))]),
|
|
1703
|
-
functionName: transaction.method,
|
|
1704
|
-
args: _optionalChain$1([transaction, 'access', _23 => _23.params, 'optionalAccess', _24 => _24.args])
|
|
1705
|
-
},
|
|
1706
|
-
],
|
|
1707
|
-
permit2: [_optionalChain$1([transaction, 'access', _25 => _25.params, 'optionalAccess', _26 => _26.permit2])]
|
|
1708
|
-
});
|
|
1709
|
-
console.log('after MiniKit.commands.sendTransaction');
|
|
1710
2028
|
})
|
|
1711
2029
|
}
|
|
1712
2030
|
|
|
1713
2031
|
retryFetchTransaction(transaction, payload, attempt) {
|
|
1714
|
-
console.log('Retry Fetch transaction', attempt);
|
|
1715
2032
|
return new Promise((resolve, reject)=>{
|
|
1716
2033
|
setTimeout(()=>{
|
|
1717
2034
|
this.fetchTransaction(transaction, payload, attempt+1).then(resolve).catch(reject);
|
|
1718
|
-
}, (attempt < 30 ? 500 :
|
|
2035
|
+
}, (attempt < 30 ? 500 : 2000));
|
|
1719
2036
|
})
|
|
1720
2037
|
}
|
|
1721
2038
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2039
|
+
pollTransactionIdFromWorldchain(payload) {
|
|
2040
|
+
|
|
2041
|
+
return new Promise((resolve)=>{
|
|
2042
|
+
|
|
2043
|
+
fetch(`https://public.depay.com/transactions/worldchain/${payload.transaction_id}?app_id=${payload.mini_app_id}`, {
|
|
1726
2044
|
headers: { "Content-Type": "application/json" },
|
|
1727
2045
|
}).then((response)=>{
|
|
1728
|
-
console.log('After fetch', response);
|
|
1729
2046
|
if(response.ok) {
|
|
1730
|
-
console.log('Before json');
|
|
1731
2047
|
response.json().then((transactionJSON)=>{
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
transaction.id = _optionalChain$1([transactionJSON, 'optionalAccess', _28 => _28.external_id]);
|
|
1735
|
-
transaction.url = Blockchains__default['default']['worldchain'].explorerUrlFor({ transaction });
|
|
1736
|
-
console.log('before transaction.sent', transaction.sent);
|
|
1737
|
-
if (transaction.sent) { transaction.sent(transaction); }
|
|
1738
|
-
console.log('Before provider');
|
|
1739
|
-
web3ClientEvm.getProvider('worldchain').then((provider)=>{
|
|
1740
|
-
console.log('After provider', provider);
|
|
1741
|
-
console.log('Before wait transaction', transactionJSON.external_id);
|
|
1742
|
-
provider.waitForTransaction(transactionJSON.external_id).then((receipt)=>{
|
|
1743
|
-
console.log('After receipt', receipt);
|
|
1744
|
-
if(receipt && receipt.status == 1) {
|
|
1745
|
-
transaction._succeeded = true;
|
|
1746
|
-
console.log('before transaction.succeeded', transaction.succeeded);
|
|
1747
|
-
if (transaction.succeeded) { transaction.succeeded(transaction); }
|
|
1748
|
-
resolve(transaction);
|
|
1749
|
-
} else {
|
|
1750
|
-
if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
|
|
1751
|
-
}
|
|
1752
|
-
}).catch(reject);
|
|
1753
|
-
}).catch(reject);
|
|
2048
|
+
if(_optionalChain$1([transactionJSON, 'optionalAccess', _15 => _15.external_id])) {
|
|
2049
|
+
resolve(_optionalChain$1([transactionJSON, 'optionalAccess', _16 => _16.external_id]));
|
|
1754
2050
|
} else {
|
|
1755
|
-
|
|
2051
|
+
resolve();
|
|
1756
2052
|
}
|
|
1757
|
-
}).catch(()=>
|
|
2053
|
+
}).catch(()=>resolve());
|
|
2054
|
+
} else {
|
|
2055
|
+
resolve();
|
|
2056
|
+
}
|
|
2057
|
+
}).catch((error)=>{
|
|
2058
|
+
console.log('CATCH ERROR', error);
|
|
2059
|
+
resolve();
|
|
2060
|
+
});
|
|
2061
|
+
})
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
pollEventForUserOp(transaction, payload) {
|
|
2065
|
+
|
|
2066
|
+
return new Promise((resolve)=>{
|
|
2067
|
+
|
|
2068
|
+
web3ClientEvm.rpcRequest({
|
|
2069
|
+
blockchain: 'worldchain',
|
|
2070
|
+
method: "eth_getLogs",
|
|
2071
|
+
params: [
|
|
2072
|
+
{
|
|
2073
|
+
"fromBlock": ethers.ethers.utils.hexValue(transaction.fromBlock),
|
|
2074
|
+
"toBlock": "latest",
|
|
2075
|
+
"address": "0x0000000071727De22E5E9d8BAf0edAc6f37da032", // entry point
|
|
2076
|
+
"topics": [
|
|
2077
|
+
"0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
|
|
2078
|
+
payload.userOpHash
|
|
2079
|
+
]
|
|
2080
|
+
}
|
|
2081
|
+
]
|
|
2082
|
+
}).then((responseData)=>{
|
|
2083
|
+
if(responseData && responseData instanceof Array) {
|
|
2084
|
+
let event = responseData.find((event)=>{
|
|
2085
|
+
return(!event.removed)
|
|
2086
|
+
});
|
|
2087
|
+
if(event && event.transactionHash) {
|
|
2088
|
+
return resolve(event.transactionHash)
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
resolve();
|
|
2092
|
+
}).catch(()=>resolve());
|
|
2093
|
+
})
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
fetchTransaction(transaction, payload, attempt = 1) {
|
|
2099
|
+
return new Promise((resolve, reject)=>{
|
|
2100
|
+
|
|
2101
|
+
Promise.all([
|
|
2102
|
+
this.pollTransactionIdFromWorldchain(payload),
|
|
2103
|
+
this.pollEventForUserOp(transaction, payload),
|
|
2104
|
+
]).then((results)=>{
|
|
2105
|
+
let transactionHash = results ? results.filter(Boolean)[0] : undefined;
|
|
2106
|
+
if(transactionHash) {
|
|
2107
|
+
transaction.id = transactionHash;
|
|
2108
|
+
transaction.url = Blockchains__default['default']['worldchain'].explorerUrlFor({ transaction });
|
|
2109
|
+
if (transaction.sent) { transaction.sent(transaction); }
|
|
2110
|
+
web3ClientEvm.getProvider('worldchain').then((provider)=>{
|
|
2111
|
+
provider.waitForTransaction(transactionHash).then((receipt)=>{
|
|
2112
|
+
if(receipt && receipt.status == 1) {
|
|
2113
|
+
transaction._succeeded = true;
|
|
2114
|
+
if (transaction.succeeded) { transaction.succeeded(transaction); }
|
|
2115
|
+
resolve(transaction);
|
|
2116
|
+
} else {
|
|
2117
|
+
if (transaction.failed) { transaction.failed(transaction, 'Transaction failed'); }
|
|
2118
|
+
reject(transaction);
|
|
2119
|
+
}
|
|
2120
|
+
}).catch(reject);
|
|
2121
|
+
}).catch(reject);
|
|
1758
2122
|
} else {
|
|
1759
2123
|
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
1760
2124
|
}
|
|
1761
|
-
}).catch(()=>
|
|
2125
|
+
}).catch((error)=>{
|
|
2126
|
+
console.log('CATCH ERROR!', error);
|
|
2127
|
+
this.retryFetchTransaction(transaction, payload, attempt).then(resolve).catch(reject);
|
|
2128
|
+
});
|
|
1762
2129
|
})
|
|
1763
2130
|
}
|
|
1764
2131
|
|
|
@@ -1768,37 +2135,33 @@
|
|
|
1768
2135
|
|
|
1769
2136
|
async account() {
|
|
1770
2137
|
if(!this.getProvider()) { return undefined }
|
|
1771
|
-
return
|
|
2138
|
+
return this.walletAddress()
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
walletAddress() {
|
|
2142
|
+
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]))
|
|
1772
2143
|
}
|
|
1773
2144
|
|
|
1774
2145
|
connect() {
|
|
1775
2146
|
|
|
1776
2147
|
return new Promise( async(resolve, reject)=>{
|
|
1777
2148
|
|
|
1778
|
-
if(
|
|
1779
|
-
return resolve(
|
|
2149
|
+
if(this.walletAddress()) {
|
|
2150
|
+
return resolve(this.walletAddress())
|
|
1780
2151
|
}
|
|
1781
2152
|
|
|
1782
|
-
|
|
2153
|
+
MiniKit.subscribe(ResponseEvent.MiniAppWalletAuth, async (payload) => {
|
|
2154
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppWalletAuth);
|
|
1783
2155
|
if (payload.status === "error") {
|
|
1784
2156
|
return reject(payload.message)
|
|
1785
2157
|
} else {
|
|
1786
|
-
return resolve(
|
|
2158
|
+
return resolve(this.walletAddress())
|
|
1787
2159
|
}
|
|
1788
2160
|
});
|
|
1789
2161
|
|
|
1790
|
-
|
|
1791
|
-
nonce: crypto.randomUUID().replace(/-/g, "")
|
|
1792
|
-
expirationTime: new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000),
|
|
1793
|
-
notBefore: new Date(new Date().getTime() - 24 * 60 * 60 * 1000),
|
|
1794
|
-
statement: "Connect World App (v17.6.2)"
|
|
2162
|
+
MiniKit.commands.walletAuth({
|
|
2163
|
+
nonce: crypto.randomUUID().replace(/-/g, "")
|
|
1795
2164
|
});
|
|
1796
|
-
|
|
1797
|
-
if(finalPayload.status == 'error') {
|
|
1798
|
-
return reject(finalPayload.message)
|
|
1799
|
-
} else {
|
|
1800
|
-
return resolve(worldcoinPrecompiled.MiniKit.walletAddress || _optionalChain$1([window, 'access', _31 => _31.MiniKit, 'optionalAccess', _32 => _32.walletAddress]))
|
|
1801
|
-
}
|
|
1802
2165
|
})
|
|
1803
2166
|
}
|
|
1804
2167
|
|
|
@@ -1827,12 +2190,12 @@
|
|
|
1827
2190
|
}
|
|
1828
2191
|
|
|
1829
2192
|
async transactionCount({ blockchain, address }) {
|
|
1830
|
-
if(!
|
|
2193
|
+
if(!this.walletAddress()) {
|
|
1831
2194
|
return 0
|
|
1832
2195
|
} else {
|
|
1833
2196
|
return web3ClientEvm.request({
|
|
1834
2197
|
blockchain: 'worldchain',
|
|
1835
|
-
address:
|
|
2198
|
+
address: this.walletAddress(),
|
|
1836
2199
|
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"}],
|
|
1837
2200
|
method: 'nonce'
|
|
1838
2201
|
})
|
|
@@ -1843,19 +2206,18 @@
|
|
|
1843
2206
|
|
|
1844
2207
|
return new Promise((resolve, reject)=>{
|
|
1845
2208
|
|
|
1846
|
-
|
|
2209
|
+
MiniKit.subscribe(ResponseEvent.MiniAppSignMessage, async (payload) => {
|
|
2210
|
+
MiniKit.unsubscribe(ResponseEvent.MiniAppSignMessage);
|
|
1847
2211
|
if (payload.status === "error") {
|
|
1848
2212
|
return reject()
|
|
1849
2213
|
} else {
|
|
1850
2214
|
return resolve(payload.signature)
|
|
1851
2215
|
}
|
|
1852
2216
|
});
|
|
1853
|
-
|
|
1854
|
-
worldcoinPrecompiled.MiniKit.commands.signMessage({ message });
|
|
1855
|
-
|
|
2217
|
+
MiniKit.commands.signMessage({ message });
|
|
1856
2218
|
})
|
|
1857
2219
|
}
|
|
1858
|
-
} WorldApp.__initStatic(); WorldApp.__initStatic2();
|
|
2220
|
+
} WorldApp.__initStatic(); WorldApp.__initStatic2(); WorldApp.__initStatic3();
|
|
1859
2221
|
|
|
1860
2222
|
var wallets = {
|
|
1861
2223
|
MetaMask,
|