@depay/web3-wallets-evm 15.14.1 → 15.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.evm.js +584 -104
- package/dist/esm/index.js +505 -92
- package/dist/esm/index.solana.js +585 -105
- package/dist/umd/index.evm.js +574 -95
- package/dist/umd/index.js +508 -96
- package/dist/umd/index.solana.js +575 -96
- package/package.json +2 -2
package/dist/esm/index.evm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { getProvider, request as request$1, estimate } from '@depay/web3-client-evm';
|
|
1
|
+
import { getProvider as getProvider$3, request as request$1, estimate as estimate$1 } from '@depay/web3-client-evm';
|
|
2
2
|
import Blockchains from '@depay/web3-blockchains';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
5
|
+
import { Core, SignClient } from '@depay/walletconnect-v2';
|
|
5
6
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
6
7
|
|
|
7
8
|
var _global$1 = (typeof global !== "undefined" ? global :
|
|
@@ -42134,7 +42135,7 @@ lib.u8;
|
|
|
42134
42135
|
lib.vec;
|
|
42135
42136
|
lib.vecU8;
|
|
42136
42137
|
|
|
42137
|
-
function _optionalChain$
|
|
42138
|
+
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; }
|
|
42138
42139
|
class Transaction {
|
|
42139
42140
|
|
|
42140
42141
|
constructor({
|
|
@@ -42159,7 +42160,7 @@ class Transaction {
|
|
|
42159
42160
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
42160
42161
|
|
|
42161
42162
|
// optional
|
|
42162
|
-
this.value = _optionalChain$
|
|
42163
|
+
this.value = _optionalChain$j([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
42163
42164
|
this.api = api;
|
|
42164
42165
|
this.method = method;
|
|
42165
42166
|
this.params = params;
|
|
@@ -42255,15 +42256,15 @@ class Transaction {
|
|
|
42255
42256
|
}
|
|
42256
42257
|
}
|
|
42257
42258
|
|
|
42258
|
-
function _optionalChain$
|
|
42259
|
+
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; }
|
|
42259
42260
|
|
|
42260
42261
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
42261
42262
|
const MAX_POLLS = 240; // 120 seconds
|
|
42262
42263
|
|
|
42263
|
-
const sendTransaction$
|
|
42264
|
+
const sendTransaction$5 = async ({ transaction, wallet })=> {
|
|
42264
42265
|
transaction = new Transaction(transaction);
|
|
42265
42266
|
await transaction.prepare({ wallet });
|
|
42266
|
-
await submit$
|
|
42267
|
+
await submit$4({ transaction, wallet }).then((signature)=>{
|
|
42267
42268
|
if(signature) {
|
|
42268
42269
|
transaction.id = signature;
|
|
42269
42270
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
@@ -42274,16 +42275,16 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
|
42274
42275
|
count++;
|
|
42275
42276
|
if(count >= MAX_POLLS) { return clearInterval(interval) }
|
|
42276
42277
|
|
|
42277
|
-
const provider = await getProvider(transaction.blockchain);
|
|
42278
|
+
const provider = await getProvider$3(transaction.blockchain);
|
|
42278
42279
|
const { value } = await provider.getSignatureStatus(signature);
|
|
42279
|
-
const confirmationStatus = _optionalChain$
|
|
42280
|
+
const confirmationStatus = _optionalChain$i([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
42280
42281
|
if(confirmationStatus) {
|
|
42281
42282
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
42282
42283
|
if (hasReachedSufficientCommitment) {
|
|
42283
42284
|
if(value.err) {
|
|
42284
42285
|
transaction._failed = true;
|
|
42285
42286
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
42286
|
-
const failedReason = _optionalChain$
|
|
42287
|
+
const failedReason = _optionalChain$i([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
42287
42288
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
42288
42289
|
} else {
|
|
42289
42290
|
transaction._succeeded = true;
|
|
@@ -42300,7 +42301,7 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
|
42300
42301
|
return transaction
|
|
42301
42302
|
};
|
|
42302
42303
|
|
|
42303
|
-
const submit$
|
|
42304
|
+
const submit$4 = async({ transaction, wallet })=> {
|
|
42304
42305
|
|
|
42305
42306
|
let result = await submitThroughWallet({ transaction, wallet });
|
|
42306
42307
|
|
|
@@ -42318,7 +42319,7 @@ const submit$3 = async({ transaction, wallet })=> {
|
|
|
42318
42319
|
};
|
|
42319
42320
|
|
|
42320
42321
|
const submitDirectly = async(tx, from) =>{
|
|
42321
|
-
let provider = await getProvider('solana');
|
|
42322
|
+
let provider = await getProvider$3('solana');
|
|
42322
42323
|
return await provider.sendRawTransaction(tx.serialize())
|
|
42323
42324
|
};
|
|
42324
42325
|
|
|
@@ -42326,14 +42327,14 @@ const submitThroughWallet = async({ transaction, wallet })=> {
|
|
|
42326
42327
|
if(transaction.instructions) {
|
|
42327
42328
|
return submitInstructions({ transaction, wallet })
|
|
42328
42329
|
} else {
|
|
42329
|
-
return submitSimpleTransfer$
|
|
42330
|
+
return submitSimpleTransfer$4({ transaction, wallet })
|
|
42330
42331
|
}
|
|
42331
42332
|
};
|
|
42332
42333
|
|
|
42333
|
-
const submitSimpleTransfer$
|
|
42334
|
+
const submitSimpleTransfer$4 = async ({ transaction, wallet })=> {
|
|
42334
42335
|
let fromPubkey = new PublicKey$1(await wallet.account());
|
|
42335
42336
|
let toPubkey = new PublicKey$1(transaction.to);
|
|
42336
|
-
const provider = await getProvider(transaction.blockchain);
|
|
42337
|
+
const provider = await getProvider$3(transaction.blockchain);
|
|
42337
42338
|
let recentBlockhash = (await provider.getLatestBlockhash()).blockhash;
|
|
42338
42339
|
const instructions = [
|
|
42339
42340
|
SystemProgram.transfer({
|
|
@@ -42353,7 +42354,7 @@ const submitSimpleTransfer$3 = async ({ transaction, wallet })=> {
|
|
|
42353
42354
|
|
|
42354
42355
|
const submitInstructions = async ({ transaction, wallet })=> {
|
|
42355
42356
|
let fromPubkey = new PublicKey$1(await wallet.account());
|
|
42356
|
-
const provider = await getProvider(transaction.blockchain);
|
|
42357
|
+
const provider = await getProvider$3(transaction.blockchain);
|
|
42357
42358
|
let recentBlockhash = (await provider.getLatestBlockhash()).blockhash;
|
|
42358
42359
|
const messageV0 = new TransactionMessage({
|
|
42359
42360
|
payerKey: fromPubkey,
|
|
@@ -42361,7 +42362,7 @@ const submitInstructions = async ({ transaction, wallet })=> {
|
|
|
42361
42362
|
instructions: transaction.instructions,
|
|
42362
42363
|
}).compileToV0Message(
|
|
42363
42364
|
transaction.alts ? await Promise.all(transaction.alts.map(async(alt)=>{
|
|
42364
|
-
return (await getProvider('solana')).getAddressLookupTable(new PublicKey$1(alt)).then((res) => res.value)
|
|
42365
|
+
return (await getProvider$3('solana')).getAddressLookupTable(new PublicKey$1(alt)).then((res) => res.value)
|
|
42365
42366
|
})) : undefined);
|
|
42366
42367
|
const transactionV0 = new VersionedTransaction(messageV0);
|
|
42367
42368
|
if(transaction.signers && transaction.signers.length) {
|
|
@@ -42374,7 +42375,7 @@ let supported$2 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
|
|
|
42374
42375
|
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42375
42376
|
supported$2.solana = [];
|
|
42376
42377
|
|
|
42377
|
-
function _optionalChain$
|
|
42378
|
+
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; }
|
|
42378
42379
|
class WindowSolana {
|
|
42379
42380
|
|
|
42380
42381
|
static __initStatic() {this.info = {
|
|
@@ -42385,7 +42386,7 @@ class WindowSolana {
|
|
|
42385
42386
|
|
|
42386
42387
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
42387
42388
|
return (
|
|
42388
|
-
_optionalChain$
|
|
42389
|
+
_optionalChain$h([window, 'optionalAccess', _2 => _2.solana]) &&
|
|
42389
42390
|
!(window.phantom && !window.glow && !window.solana.isGlow) &&
|
|
42390
42391
|
!window.coin98 &&
|
|
42391
42392
|
!window.solana.isGlow
|
|
@@ -42397,7 +42398,7 @@ class WindowSolana {
|
|
|
42397
42398
|
this.logo = this.constructor.info.logo;
|
|
42398
42399
|
this.blockchains = this.constructor.info.blockchains;
|
|
42399
42400
|
this.sendTransaction = (transaction)=>{
|
|
42400
|
-
return sendTransaction$
|
|
42401
|
+
return sendTransaction$5({
|
|
42401
42402
|
wallet: this,
|
|
42402
42403
|
transaction
|
|
42403
42404
|
})
|
|
@@ -42435,7 +42436,7 @@ class WindowSolana {
|
|
|
42435
42436
|
let internalCallback;
|
|
42436
42437
|
switch (event) {
|
|
42437
42438
|
case 'account':
|
|
42438
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
42439
|
+
internalCallback = (publicKey) => callback(_optionalChain$h([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
|
|
42439
42440
|
this.getProvider().on('accountChanged', internalCallback);
|
|
42440
42441
|
break
|
|
42441
42442
|
}
|
|
@@ -43022,6 +43023,73 @@ let cache = function ({ call, key, expires = 0 }) {
|
|
|
43022
43023
|
})
|
|
43023
43024
|
};
|
|
43024
43025
|
|
|
43026
|
+
const getProvider = async (blockchain)=>{
|
|
43027
|
+
|
|
43028
|
+
if(supported$1.evm.includes(blockchain)) {
|
|
43029
|
+
|
|
43030
|
+
|
|
43031
|
+
return await EVM.getProvider(blockchain)
|
|
43032
|
+
|
|
43033
|
+
|
|
43034
|
+
} else if(supported$1.solana.includes(blockchain)) {
|
|
43035
|
+
|
|
43036
|
+
|
|
43037
|
+
return await Solana.getProvider(blockchain)
|
|
43038
|
+
|
|
43039
|
+
|
|
43040
|
+
} else {
|
|
43041
|
+
throw 'Unknown blockchain: ' + blockchain
|
|
43042
|
+
}
|
|
43043
|
+
};
|
|
43044
|
+
|
|
43045
|
+
const getContractArguments = ({ contract, method, params })=>{
|
|
43046
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
43047
|
+
return fragment.name == method
|
|
43048
|
+
});
|
|
43049
|
+
|
|
43050
|
+
if(params instanceof Array) {
|
|
43051
|
+
return params
|
|
43052
|
+
} else if (params instanceof Object) {
|
|
43053
|
+
return fragment.inputs.map((input) => {
|
|
43054
|
+
return params[input.name]
|
|
43055
|
+
})
|
|
43056
|
+
}
|
|
43057
|
+
};
|
|
43058
|
+
|
|
43059
|
+
var estimateEVM = ({ provider, from, to, value, method, api, params }) => {
|
|
43060
|
+
if(typeof api == "undefined"){
|
|
43061
|
+
return provider.estimateGas({ from, to, value })
|
|
43062
|
+
} else {
|
|
43063
|
+
let contract = new ethers.Contract(to, api, provider);
|
|
43064
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
43065
|
+
return fragment.name == method
|
|
43066
|
+
});
|
|
43067
|
+
if(contract[method] === undefined) {
|
|
43068
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
43069
|
+
}
|
|
43070
|
+
let contractMethod = contract.estimateGas[method];
|
|
43071
|
+
let contractArguments = getContractArguments({ contract, method, params });
|
|
43072
|
+
if(contractArguments) {
|
|
43073
|
+
return contractMethod(...contractArguments, { from, value })
|
|
43074
|
+
} else {
|
|
43075
|
+
return contractMethod({ from, value })
|
|
43076
|
+
}
|
|
43077
|
+
}
|
|
43078
|
+
};
|
|
43079
|
+
|
|
43080
|
+
let estimate = async function ({ blockchain, from, to, value, method, api, params, cache: cache$1 }) {
|
|
43081
|
+
if(!supported$1.includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain }
|
|
43082
|
+
if(typeof value == 'undefined') { value = '0'; }
|
|
43083
|
+
|
|
43084
|
+
const provider = await getProvider(blockchain);
|
|
43085
|
+
|
|
43086
|
+
return await cache({
|
|
43087
|
+
expires: cache$1 || 0,
|
|
43088
|
+
key: [blockchain, from, to, value, method, params],
|
|
43089
|
+
call: async()=>estimateEVM({ provider, from, to, value, method, api, params })
|
|
43090
|
+
})
|
|
43091
|
+
};
|
|
43092
|
+
|
|
43025
43093
|
let paramsToContractArgs = ({ contract, method, params }) => {
|
|
43026
43094
|
let fragment = contract.interface.fragments.find((fragment) => {
|
|
43027
43095
|
return fragment.name == method
|
|
@@ -43257,7 +43325,7 @@ const request = async function (url, options) {
|
|
|
43257
43325
|
})
|
|
43258
43326
|
};
|
|
43259
43327
|
|
|
43260
|
-
function _optionalChain$
|
|
43328
|
+
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; }
|
|
43261
43329
|
class Backpack extends WindowSolana {
|
|
43262
43330
|
|
|
43263
43331
|
static __initStatic() {this.info = {
|
|
@@ -43268,7 +43336,7 @@ class Backpack extends WindowSolana {
|
|
|
43268
43336
|
|
|
43269
43337
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43270
43338
|
return (
|
|
43271
|
-
_optionalChain$
|
|
43339
|
+
_optionalChain$g([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
43272
43340
|
window.backpack.isBackpack
|
|
43273
43341
|
)
|
|
43274
43342
|
};}
|
|
@@ -43286,7 +43354,7 @@ class Backpack extends WindowSolana {
|
|
|
43286
43354
|
}
|
|
43287
43355
|
} Backpack.__initStatic(); Backpack.__initStatic2();
|
|
43288
43356
|
|
|
43289
|
-
const sendTransaction$
|
|
43357
|
+
const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
43290
43358
|
transaction = new Transaction(transaction);
|
|
43291
43359
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
43292
43360
|
await wallet.switchTo(transaction.blockchain);
|
|
@@ -43299,7 +43367,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
43299
43367
|
transaction.nonce = transactionCount;
|
|
43300
43368
|
let provider = new ethers.providers.Web3Provider(wallet.getProvider(), 'any');
|
|
43301
43369
|
let signer = provider.getSigner(0);
|
|
43302
|
-
await submit$
|
|
43370
|
+
await submit$3({ transaction, provider, signer }).then((sentTransaction)=>{
|
|
43303
43371
|
if (sentTransaction) {
|
|
43304
43372
|
transaction.id = sentTransaction.hash;
|
|
43305
43373
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
@@ -43333,15 +43401,15 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
43333
43401
|
return transaction
|
|
43334
43402
|
};
|
|
43335
43403
|
|
|
43336
|
-
const submit$
|
|
43404
|
+
const submit$3 = ({ transaction, provider, signer }) => {
|
|
43337
43405
|
if(transaction.method) {
|
|
43338
|
-
return submitContractInteraction$
|
|
43406
|
+
return submitContractInteraction$3({ transaction, signer, provider })
|
|
43339
43407
|
} else {
|
|
43340
|
-
return submitSimpleTransfer$
|
|
43408
|
+
return submitSimpleTransfer$3({ transaction, signer })
|
|
43341
43409
|
}
|
|
43342
43410
|
};
|
|
43343
43411
|
|
|
43344
|
-
const submitContractInteraction$
|
|
43412
|
+
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
43345
43413
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
43346
43414
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
43347
43415
|
let method = transaction.method;
|
|
@@ -43363,14 +43431,14 @@ const submitContractInteraction$2 = ({ transaction, signer, provider })=>{
|
|
|
43363
43431
|
}
|
|
43364
43432
|
};
|
|
43365
43433
|
|
|
43366
|
-
const submitSimpleTransfer$
|
|
43434
|
+
const submitSimpleTransfer$3 = ({ transaction, signer })=>{
|
|
43367
43435
|
return signer.sendTransaction({
|
|
43368
43436
|
to: transaction.to,
|
|
43369
43437
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
43370
43438
|
})
|
|
43371
43439
|
};
|
|
43372
43440
|
|
|
43373
|
-
function _optionalChain$
|
|
43441
|
+
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; }
|
|
43374
43442
|
class WindowEthereum {
|
|
43375
43443
|
|
|
43376
43444
|
static __initStatic() {this.info = {
|
|
@@ -43381,17 +43449,17 @@ class WindowEthereum {
|
|
|
43381
43449
|
|
|
43382
43450
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43383
43451
|
return (
|
|
43384
|
-
_optionalChain$
|
|
43452
|
+
_optionalChain$f([window, 'optionalAccess', _23 => _23.ethereum]) &&
|
|
43385
43453
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length != 1 && // MetaMask
|
|
43386
|
-
!_optionalChain$
|
|
43387
|
-
!(_optionalChain$
|
|
43388
|
-
!_optionalChain$
|
|
43389
|
-
!_optionalChain$
|
|
43390
|
-
!_optionalChain$
|
|
43391
|
-
!_optionalChain$
|
|
43392
|
-
!_optionalChain$
|
|
43393
|
-
!_optionalChain$
|
|
43394
|
-
!(_optionalChain$
|
|
43454
|
+
!_optionalChain$f([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
|
|
43455
|
+
!(_optionalChain$f([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$f([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
|
|
43456
|
+
!_optionalChain$f([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
|
|
43457
|
+
!_optionalChain$f([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
|
|
43458
|
+
!_optionalChain$f([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
|
|
43459
|
+
!_optionalChain$f([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
|
|
43460
|
+
!_optionalChain$f([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
|
|
43461
|
+
!_optionalChain$f([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
|
|
43462
|
+
!(_optionalChain$f([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
|
|
43395
43463
|
)
|
|
43396
43464
|
};}
|
|
43397
43465
|
|
|
@@ -43400,7 +43468,7 @@ class WindowEthereum {
|
|
|
43400
43468
|
this.logo = this.constructor.info.logo;
|
|
43401
43469
|
this.blockchains = this.constructor.info.blockchains;
|
|
43402
43470
|
this.sendTransaction = (transaction)=>{
|
|
43403
|
-
return sendTransaction$
|
|
43471
|
+
return sendTransaction$4({
|
|
43404
43472
|
wallet: this,
|
|
43405
43473
|
transaction
|
|
43406
43474
|
})
|
|
@@ -43503,7 +43571,7 @@ class WindowEthereum {
|
|
|
43503
43571
|
}
|
|
43504
43572
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
43505
43573
|
|
|
43506
|
-
function _optionalChain$
|
|
43574
|
+
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; }
|
|
43507
43575
|
class Binance extends WindowEthereum {
|
|
43508
43576
|
|
|
43509
43577
|
static __initStatic() {this.info = {
|
|
@@ -43513,7 +43581,7 @@ class Binance extends WindowEthereum {
|
|
|
43513
43581
|
};}
|
|
43514
43582
|
|
|
43515
43583
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43516
|
-
return _optionalChain$
|
|
43584
|
+
return _optionalChain$e([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
43517
43585
|
!window.coin98
|
|
43518
43586
|
};}
|
|
43519
43587
|
|
|
@@ -43521,7 +43589,7 @@ class Binance extends WindowEthereum {
|
|
|
43521
43589
|
|
|
43522
43590
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
43523
43591
|
|
|
43524
|
-
function _optionalChain$
|
|
43592
|
+
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; }
|
|
43525
43593
|
class Brave extends WindowEthereum {
|
|
43526
43594
|
|
|
43527
43595
|
static __initStatic() {this.info = {
|
|
@@ -43530,10 +43598,10 @@ class Brave extends WindowEthereum {
|
|
|
43530
43598
|
blockchains: supported$2.evm
|
|
43531
43599
|
};}
|
|
43532
43600
|
|
|
43533
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43601
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
43534
43602
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
43535
43603
|
|
|
43536
|
-
function _optionalChain$
|
|
43604
|
+
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; }
|
|
43537
43605
|
class Coin98 extends WindowEthereum {
|
|
43538
43606
|
|
|
43539
43607
|
static __initStatic() {this.info = {
|
|
@@ -43542,10 +43610,10 @@ class Coin98 extends WindowEthereum {
|
|
|
43542
43610
|
blockchains: supported$2.evm
|
|
43543
43611
|
};}
|
|
43544
43612
|
|
|
43545
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43613
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
43546
43614
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
43547
43615
|
|
|
43548
|
-
function _optionalChain$
|
|
43616
|
+
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; }
|
|
43549
43617
|
class Coinbase extends WindowEthereum {
|
|
43550
43618
|
|
|
43551
43619
|
static __initStatic() {this.info = {
|
|
@@ -43554,10 +43622,10 @@ class Coinbase extends WindowEthereum {
|
|
|
43554
43622
|
blockchains: supported$2.evm
|
|
43555
43623
|
};}
|
|
43556
43624
|
|
|
43557
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
43625
|
+
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$b([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$b([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
|
|
43558
43626
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
43559
43627
|
|
|
43560
|
-
function _optionalChain$
|
|
43628
|
+
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; }
|
|
43561
43629
|
class CryptoCom extends WindowEthereum {
|
|
43562
43630
|
|
|
43563
43631
|
static __initStatic() {this.info = {
|
|
@@ -43566,7 +43634,7 @@ class CryptoCom extends WindowEthereum {
|
|
|
43566
43634
|
blockchains: supported$2.evm
|
|
43567
43635
|
};}
|
|
43568
43636
|
|
|
43569
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43637
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
43570
43638
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
43571
43639
|
|
|
43572
43640
|
class Glow extends WindowSolana {
|
|
@@ -43585,7 +43653,7 @@ class Glow extends WindowSolana {
|
|
|
43585
43653
|
};}
|
|
43586
43654
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
43587
43655
|
|
|
43588
|
-
function _optionalChain$
|
|
43656
|
+
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; }
|
|
43589
43657
|
class HyperPay extends WindowEthereum {
|
|
43590
43658
|
|
|
43591
43659
|
static __initStatic() {this.info = {
|
|
@@ -43594,10 +43662,10 @@ class HyperPay extends WindowEthereum {
|
|
|
43594
43662
|
blockchains: supported$2.evm
|
|
43595
43663
|
};}
|
|
43596
43664
|
|
|
43597
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43665
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
43598
43666
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
43599
43667
|
|
|
43600
|
-
function _optionalChain$
|
|
43668
|
+
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; }
|
|
43601
43669
|
class MetaMask extends WindowEthereum {
|
|
43602
43670
|
|
|
43603
43671
|
static __initStatic() {this.info = {
|
|
@@ -43608,13 +43676,13 @@ class MetaMask extends WindowEthereum {
|
|
|
43608
43676
|
|
|
43609
43677
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43610
43678
|
return(
|
|
43611
|
-
_optionalChain$
|
|
43679
|
+
_optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
|
|
43612
43680
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
43613
43681
|
)
|
|
43614
43682
|
};}
|
|
43615
43683
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
43616
43684
|
|
|
43617
|
-
function _optionalChain$
|
|
43685
|
+
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; }
|
|
43618
43686
|
class Opera extends WindowEthereum {
|
|
43619
43687
|
|
|
43620
43688
|
static __initStatic() {this.info = {
|
|
@@ -43623,7 +43691,7 @@ class Opera extends WindowEthereum {
|
|
|
43623
43691
|
blockchains: supported$2.evm
|
|
43624
43692
|
};}
|
|
43625
43693
|
|
|
43626
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
43694
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
43627
43695
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
43628
43696
|
|
|
43629
43697
|
class Phantom extends WindowSolana {
|
|
@@ -43641,7 +43709,7 @@ class Phantom extends WindowSolana {
|
|
|
43641
43709
|
};}
|
|
43642
43710
|
} Phantom.__initStatic(); Phantom.__initStatic2();
|
|
43643
43711
|
|
|
43644
|
-
function _optionalChain$
|
|
43712
|
+
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; }
|
|
43645
43713
|
class Rabby extends WindowEthereum {
|
|
43646
43714
|
|
|
43647
43715
|
static __initStatic() {this.info = {
|
|
@@ -43652,13 +43720,13 @@ class Rabby extends WindowEthereum {
|
|
|
43652
43720
|
|
|
43653
43721
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43654
43722
|
return(
|
|
43655
|
-
_optionalChain$
|
|
43723
|
+
_optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
43656
43724
|
)
|
|
43657
43725
|
};}
|
|
43658
43726
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
43659
43727
|
|
|
43660
|
-
function _optionalChain$
|
|
43661
|
-
const KEY$
|
|
43728
|
+
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; }
|
|
43729
|
+
const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
43662
43730
|
|
|
43663
43731
|
const base64StringToPublicKey = (base64String)=> {
|
|
43664
43732
|
const binaryString = window.atob(base64String);
|
|
@@ -43703,8 +43771,8 @@ class SolanaMobileWalletAdapter {
|
|
|
43703
43771
|
};}
|
|
43704
43772
|
|
|
43705
43773
|
constructor() {
|
|
43706
|
-
this.name = (localStorage[KEY$
|
|
43707
|
-
this.logo = (localStorage[KEY$
|
|
43774
|
+
this.name = (localStorage[KEY$2+'_name'] && localStorage[KEY$2+'_name'] != undefined) ? localStorage[KEY$2+'_name'] : this.constructor.info.name;
|
|
43775
|
+
this.logo = (localStorage[KEY$2+'_logo'] && localStorage[KEY$2+'_logo'] != undefined) ? localStorage[KEY$2+'_logo'] : this.constructor.info.logo;
|
|
43708
43776
|
this.blockchains = this.constructor.info.blockchains;
|
|
43709
43777
|
this.sendTransaction = (transaction)=>{
|
|
43710
43778
|
return sendTransaction({
|
|
@@ -43746,8 +43814,8 @@ class SolanaMobileWalletAdapter {
|
|
|
43746
43814
|
await transact(
|
|
43747
43815
|
async (wallet) => {
|
|
43748
43816
|
await this.authorize(wallet);
|
|
43749
|
-
if(_optionalChain$
|
|
43750
|
-
if(_optionalChain$
|
|
43817
|
+
if(_optionalChain$5([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
|
|
43818
|
+
if(_optionalChain$5([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
|
|
43751
43819
|
}
|
|
43752
43820
|
);
|
|
43753
43821
|
return this._account
|
|
@@ -43806,7 +43874,7 @@ class SolanaMobileWalletAdapter {
|
|
|
43806
43874
|
}
|
|
43807
43875
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
43808
43876
|
|
|
43809
|
-
function _optionalChain$
|
|
43877
|
+
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; }
|
|
43810
43878
|
class Solflare extends WindowSolana {
|
|
43811
43879
|
|
|
43812
43880
|
static __initStatic() {this.info = {
|
|
@@ -43817,7 +43885,7 @@ class Solflare extends WindowSolana {
|
|
|
43817
43885
|
|
|
43818
43886
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
43819
43887
|
return (
|
|
43820
|
-
_optionalChain$
|
|
43888
|
+
_optionalChain$4([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
43821
43889
|
window.solflare.isSolflare
|
|
43822
43890
|
)
|
|
43823
43891
|
};}
|
|
@@ -43827,7 +43895,7 @@ class Solflare extends WindowSolana {
|
|
|
43827
43895
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
43828
43896
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
43829
43897
|
|
|
43830
|
-
function _optionalChain$
|
|
43898
|
+
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; }
|
|
43831
43899
|
class Trust extends WindowEthereum {
|
|
43832
43900
|
|
|
43833
43901
|
static __initStatic() {this.info = {
|
|
@@ -43836,7 +43904,7 @@ class Trust extends WindowEthereum {
|
|
|
43836
43904
|
blockchains: supported$2.evm
|
|
43837
43905
|
};}
|
|
43838
43906
|
|
|
43839
|
-
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$
|
|
43907
|
+
static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$3([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$3([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
|
|
43840
43908
|
} Trust.__initStatic(); Trust.__initStatic2();
|
|
43841
43909
|
|
|
43842
43910
|
const transactionApiBlockchainNames = {
|
|
@@ -43877,7 +43945,7 @@ class Safe {
|
|
|
43877
43945
|
}
|
|
43878
43946
|
|
|
43879
43947
|
async retrieveTransaction({ blockchain, tx }) {
|
|
43880
|
-
const provider = await getProvider(blockchain);
|
|
43948
|
+
const provider = await getProvider$3(blockchain);
|
|
43881
43949
|
let jsonResult = await fetch(`https://safe-transaction-${transactionApiBlockchainNames[blockchain]}.safe.global/api/v1/multisig-transactions/${tx}/`)
|
|
43882
43950
|
.then((response) => response.json())
|
|
43883
43951
|
.catch((error) => { console.error('Error:', error); });
|
|
@@ -43896,7 +43964,7 @@ class Safe {
|
|
|
43896
43964
|
}
|
|
43897
43965
|
|
|
43898
43966
|
const isSmartContractWallet = async(blockchain, address)=>{
|
|
43899
|
-
const provider = await getProvider(blockchain);
|
|
43967
|
+
const provider = await getProvider$3(blockchain);
|
|
43900
43968
|
const code = await provider.getCode(address);
|
|
43901
43969
|
return (code != '0x')
|
|
43902
43970
|
};
|
|
@@ -43928,7 +43996,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
43928
43996
|
}
|
|
43929
43997
|
};
|
|
43930
43998
|
|
|
43931
|
-
const sendTransaction$
|
|
43999
|
+
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
43932
44000
|
transaction = new Transaction(transaction);
|
|
43933
44001
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
43934
44002
|
throw({ code: 'WRONG_NETWORK' })
|
|
@@ -43937,13 +44005,13 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
43937
44005
|
const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
|
|
43938
44006
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
43939
44007
|
transaction.nonce = transactionCount;
|
|
43940
|
-
await submit$
|
|
44008
|
+
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
43941
44009
|
if (tx) {
|
|
43942
44010
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
43943
44011
|
transaction.id = tx;
|
|
43944
44012
|
transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
|
|
43945
44013
|
if (transaction.sent) transaction.sent(transaction);
|
|
43946
|
-
retrieveTransaction({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
44014
|
+
retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
|
|
43947
44015
|
transaction.id = sentTransaction.hash || transaction.id;
|
|
43948
44016
|
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
43949
44017
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
@@ -43974,8 +44042,8 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
43974
44042
|
return transaction
|
|
43975
44043
|
};
|
|
43976
44044
|
|
|
43977
|
-
const retrieveTransaction = async ({ blockchain, tx, smartContractWallet })=>{
|
|
43978
|
-
const provider = await getProvider(blockchain);
|
|
44045
|
+
const retrieveTransaction$1 = async ({ blockchain, tx, smartContractWallet })=>{
|
|
44046
|
+
const provider = await getProvider$3(blockchain);
|
|
43979
44047
|
let retrieve = async()=>{
|
|
43980
44048
|
try {
|
|
43981
44049
|
if(smartContractWallet && smartContractWallet.retrieveTransaction) {
|
|
@@ -43995,18 +44063,18 @@ const retrieveTransaction = async ({ blockchain, tx, smartContractWallet })=>{
|
|
|
43995
44063
|
return sentTransaction
|
|
43996
44064
|
};
|
|
43997
44065
|
|
|
43998
|
-
const submit$
|
|
44066
|
+
const submit$2 = ({ transaction, wallet }) => {
|
|
43999
44067
|
if(transaction.method) {
|
|
44000
|
-
return submitContractInteraction$
|
|
44068
|
+
return submitContractInteraction$2({ transaction, wallet })
|
|
44001
44069
|
} else {
|
|
44002
|
-
return submitSimpleTransfer$
|
|
44070
|
+
return submitSimpleTransfer$2({ transaction, wallet })
|
|
44003
44071
|
}
|
|
44004
44072
|
};
|
|
44005
44073
|
|
|
44006
|
-
const submitContractInteraction$
|
|
44007
|
-
const provider = await getProvider(transaction.blockchain);
|
|
44074
|
+
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
44075
|
+
const provider = await getProvider$3(transaction.blockchain);
|
|
44008
44076
|
const gasPrice = await provider.getGasPrice();
|
|
44009
|
-
let gas = await estimate(transaction);
|
|
44077
|
+
let gas = await estimate$1(transaction);
|
|
44010
44078
|
const data = await transaction.getData();
|
|
44011
44079
|
const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
|
|
44012
44080
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
@@ -44022,10 +44090,10 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
44022
44090
|
})
|
|
44023
44091
|
};
|
|
44024
44092
|
|
|
44025
|
-
const submitSimpleTransfer$
|
|
44026
|
-
const provider = await getProvider(transaction.blockchain);
|
|
44093
|
+
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
44094
|
+
const provider = await getProvider$3(transaction.blockchain);
|
|
44027
44095
|
const gasPrice = await provider.getGasPrice();
|
|
44028
|
-
const gas = await estimate(transaction);
|
|
44096
|
+
const gas = await estimate$1(transaction);
|
|
44029
44097
|
const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
|
|
44030
44098
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
44031
44099
|
return wallet.connector.sendTransaction({
|
|
@@ -44039,9 +44107,9 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
44039
44107
|
})
|
|
44040
44108
|
};
|
|
44041
44109
|
|
|
44042
|
-
function _optionalChain(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; }
|
|
44110
|
+
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; }
|
|
44043
44111
|
|
|
44044
|
-
const KEY = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
44112
|
+
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
44045
44113
|
|
|
44046
44114
|
let currentPlainInstance;
|
|
44047
44115
|
|
|
@@ -44083,13 +44151,13 @@ const isConnected = ()=>{
|
|
|
44083
44151
|
})
|
|
44084
44152
|
};
|
|
44085
44153
|
|
|
44086
|
-
const getConnectedInstance$
|
|
44087
|
-
if(window[KEY]) { return window[KEY] }
|
|
44154
|
+
const getConnectedInstance$2 = async()=>{
|
|
44155
|
+
if(window[KEY$1]) { return window[KEY$1] }
|
|
44088
44156
|
if(await isConnected()) { return new WalletConnectV1() }
|
|
44089
44157
|
};
|
|
44090
44158
|
|
|
44091
|
-
const setConnectedInstance$
|
|
44092
|
-
window[KEY] = value;
|
|
44159
|
+
const setConnectedInstance$2 = (value)=>{
|
|
44160
|
+
window[KEY$1] = value;
|
|
44093
44161
|
};
|
|
44094
44162
|
|
|
44095
44163
|
const getWalletConnectInstance = (connect)=>{
|
|
@@ -44111,15 +44179,15 @@ class WalletConnectV1 {
|
|
|
44111
44179
|
};}
|
|
44112
44180
|
|
|
44113
44181
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
44114
|
-
return (await getConnectedInstance$
|
|
44182
|
+
return (await getConnectedInstance$2()) != undefined
|
|
44115
44183
|
};}
|
|
44116
44184
|
|
|
44117
44185
|
constructor() {
|
|
44118
|
-
this.name = (localStorage[KEY+'_name'] && localStorage[KEY+'_name'] != undefined) ? localStorage[KEY+'_name'] : this.constructor.info.name;
|
|
44119
|
-
this.logo = (localStorage[KEY+'_logo'] && localStorage[KEY+'_logo'] != undefined) ? localStorage[KEY+'_logo'] : this.constructor.info.logo;
|
|
44186
|
+
this.name = (localStorage[KEY$1+'_name'] && localStorage[KEY$1+'_name'] != undefined) ? localStorage[KEY$1+'_name'] : this.constructor.info.name;
|
|
44187
|
+
this.logo = (localStorage[KEY$1+'_logo'] && localStorage[KEY$1+'_logo'] != undefined) ? localStorage[KEY$1+'_logo'] : this.constructor.info.logo;
|
|
44120
44188
|
this.blockchains = this.constructor.info.blockchains;
|
|
44121
44189
|
this.sendTransaction = (transaction)=>{
|
|
44122
|
-
return sendTransaction$
|
|
44190
|
+
return sendTransaction$3({
|
|
44123
44191
|
wallet: this,
|
|
44124
44192
|
transaction
|
|
44125
44193
|
})
|
|
@@ -44127,9 +44195,9 @@ class WalletConnectV1 {
|
|
|
44127
44195
|
}
|
|
44128
44196
|
|
|
44129
44197
|
disconnect() {
|
|
44130
|
-
setConnectedInstance$
|
|
44131
|
-
localStorage[KEY+'_name'] = undefined;
|
|
44132
|
-
localStorage[KEY+'_logo'] = undefined;
|
|
44198
|
+
setConnectedInstance$2(undefined);
|
|
44199
|
+
localStorage[KEY$1+'_name'] = undefined;
|
|
44200
|
+
localStorage[KEY$1+'_logo'] = undefined;
|
|
44133
44201
|
currentPlainInstance = undefined;
|
|
44134
44202
|
}
|
|
44135
44203
|
|
|
@@ -44142,7 +44210,7 @@ class WalletConnectV1 {
|
|
|
44142
44210
|
});
|
|
44143
44211
|
|
|
44144
44212
|
instance.on("modal_closed", ()=>{
|
|
44145
|
-
setConnectedInstance$
|
|
44213
|
+
setConnectedInstance$2(undefined);
|
|
44146
44214
|
this.connector = undefined;
|
|
44147
44215
|
});
|
|
44148
44216
|
|
|
@@ -44179,11 +44247,11 @@ class WalletConnectV1 {
|
|
|
44179
44247
|
|
|
44180
44248
|
let { accounts, chainId } = await this.connector.connect();
|
|
44181
44249
|
|
|
44182
|
-
if(_optionalChain([options, 'optionalAccess', _ => _.name])) { localStorage[KEY+'_name'] = this.name = options.name; }
|
|
44183
|
-
if(_optionalChain([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY+'_logo'] = this.logo = options.logo; }
|
|
44250
|
+
if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
44251
|
+
if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
44184
44252
|
|
|
44185
44253
|
if(accounts instanceof Array && accounts.length) {
|
|
44186
|
-
setConnectedInstance$
|
|
44254
|
+
setConnectedInstance$2(this);
|
|
44187
44255
|
accounts = accounts.map((account)=>ethers.utils.getAddress(account));
|
|
44188
44256
|
|
|
44189
44257
|
return accounts[0]
|
|
@@ -44310,8 +44378,418 @@ class WalletConnectV1 {
|
|
|
44310
44378
|
}
|
|
44311
44379
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
44312
44380
|
|
|
44313
|
-
WalletConnectV1.getConnectedInstance = getConnectedInstance$
|
|
44314
|
-
WalletConnectV1.setConnectedInstance = setConnectedInstance$
|
|
44381
|
+
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
44382
|
+
WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
|
|
44383
|
+
|
|
44384
|
+
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; }
|
|
44385
|
+
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
44386
|
+
transaction = new Transaction(transaction);
|
|
44387
|
+
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
44388
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
44389
|
+
}
|
|
44390
|
+
await transaction.prepare({ wallet });
|
|
44391
|
+
let transactionCount = await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
44392
|
+
transaction.nonce = transactionCount;
|
|
44393
|
+
await submit$1({ transaction, wallet }).then(async (response)=>{
|
|
44394
|
+
if(typeof response == 'string') {
|
|
44395
|
+
let blockchain = Blockchains[transaction.blockchain];
|
|
44396
|
+
transaction.id = response;
|
|
44397
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
44398
|
+
if (transaction.sent) transaction.sent(transaction);
|
|
44399
|
+
let sentTransaction = await retrieveTransaction(transaction.id, transaction.blockchain);
|
|
44400
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
44401
|
+
if(!sentTransaction) {
|
|
44402
|
+
transaction._failed = true;
|
|
44403
|
+
console.log('Error retrieving transaction');
|
|
44404
|
+
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
44405
|
+
} else {
|
|
44406
|
+
sentTransaction.wait(1).then(() => {
|
|
44407
|
+
transaction._succeeded = true;
|
|
44408
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
44409
|
+
}).catch((error)=>{
|
|
44410
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
44411
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
44412
|
+
transaction.id = error.replacement.hash;
|
|
44413
|
+
transaction._succeeded = true;
|
|
44414
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
44415
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
44416
|
+
transaction.id = error.replacement.hash;
|
|
44417
|
+
transaction._failed = true;
|
|
44418
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
44419
|
+
}
|
|
44420
|
+
} else {
|
|
44421
|
+
transaction._failed = true;
|
|
44422
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
44423
|
+
}
|
|
44424
|
+
});
|
|
44425
|
+
}
|
|
44426
|
+
} else {
|
|
44427
|
+
throw(response)
|
|
44428
|
+
}
|
|
44429
|
+
});
|
|
44430
|
+
return transaction
|
|
44431
|
+
};
|
|
44432
|
+
|
|
44433
|
+
const retrieveTransaction = async (tx, blockchain)=>{
|
|
44434
|
+
let sentTransaction;
|
|
44435
|
+
const provider = await getProvider(blockchain);
|
|
44436
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
44437
|
+
const maxRetries = 120;
|
|
44438
|
+
let attempt = 1;
|
|
44439
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
44440
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
44441
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
44442
|
+
attempt++;
|
|
44443
|
+
}
|
|
44444
|
+
return sentTransaction
|
|
44445
|
+
};
|
|
44446
|
+
|
|
44447
|
+
const submit$1 = ({ transaction, wallet }) => {
|
|
44448
|
+
if(transaction.method) {
|
|
44449
|
+
return submitContractInteraction$1({ transaction, wallet })
|
|
44450
|
+
} else {
|
|
44451
|
+
return submitSimpleTransfer$1({ transaction, wallet })
|
|
44452
|
+
}
|
|
44453
|
+
};
|
|
44454
|
+
|
|
44455
|
+
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
44456
|
+
const provider = await getProvider(transaction.blockchain);
|
|
44457
|
+
const blockchain = Blockchains[transaction.blockchain];
|
|
44458
|
+
const gas = await estimate(transaction);
|
|
44459
|
+
const gasPrice = await provider.getGasPrice();
|
|
44460
|
+
return wallet.signClient.request({
|
|
44461
|
+
topic: wallet.session.topic,
|
|
44462
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44463
|
+
request: {
|
|
44464
|
+
method: 'eth_sendTransaction',
|
|
44465
|
+
params: [{
|
|
44466
|
+
from: transaction.from,
|
|
44467
|
+
to: transaction.to,
|
|
44468
|
+
value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
|
|
44469
|
+
data: await transaction.getData(),
|
|
44470
|
+
gas: gas.toHexString(),
|
|
44471
|
+
gasPrice: gasPrice.toHexString(),
|
|
44472
|
+
nonce: transaction.nonce,
|
|
44473
|
+
}]
|
|
44474
|
+
}
|
|
44475
|
+
})
|
|
44476
|
+
};
|
|
44477
|
+
|
|
44478
|
+
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
44479
|
+
const provider = await getProvider(transaction.blockchain);
|
|
44480
|
+
let blockchain = Blockchains[transaction.blockchain];
|
|
44481
|
+
const gas = await estimate(transaction);
|
|
44482
|
+
const gasPrice = await provider.getGasPrice();
|
|
44483
|
+
return wallet.signClient.request({
|
|
44484
|
+
topic: wallet.session.topic,
|
|
44485
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44486
|
+
request: {
|
|
44487
|
+
method: 'eth_sendTransaction',
|
|
44488
|
+
params: [{
|
|
44489
|
+
from: transaction.from,
|
|
44490
|
+
to: transaction.to,
|
|
44491
|
+
value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
|
|
44492
|
+
gas: gas.toHexString(),
|
|
44493
|
+
gasPrice: gasPrice.toHexString(),
|
|
44494
|
+
nonce: transaction.nonce
|
|
44495
|
+
}]
|
|
44496
|
+
}
|
|
44497
|
+
}).catch((e)=>{console.log('ERROR', e);})
|
|
44498
|
+
};
|
|
44499
|
+
|
|
44500
|
+
function _optionalChain(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; }
|
|
44501
|
+
const KEY = 'depay:wallets:wc2';
|
|
44502
|
+
|
|
44503
|
+
const getLastSession = async()=>{
|
|
44504
|
+
if(!localStorage[KEY+":projectId"]) { return }
|
|
44505
|
+
let signClient = await getSignClient(new Core({ projectId: localStorage[KEY+":projectId"] }));
|
|
44506
|
+
const existingSessions = signClient.find(getWalletConnectV2Config());
|
|
44507
|
+
const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
|
|
44508
|
+
if(lastSession && lastSession.expiry > Math.ceil(Date.now()/1000)) {
|
|
44509
|
+
try {
|
|
44510
|
+
if(await getConnectedChainId(signClient, lastSession)) {
|
|
44511
|
+
return lastSession
|
|
44512
|
+
}
|
|
44513
|
+
} catch (e) {}
|
|
44514
|
+
}
|
|
44515
|
+
};
|
|
44516
|
+
|
|
44517
|
+
const getConnectedChainId = async(signClient, session)=>{
|
|
44518
|
+
let results = (await Promise.all(session.namespaces.eip155.chains.map((identifier)=>{
|
|
44519
|
+
return Promise.race([
|
|
44520
|
+
new Promise((resolve)=>{setTimeout(resolve, 1500);}),
|
|
44521
|
+
signClient.request({
|
|
44522
|
+
topic: session.topic,
|
|
44523
|
+
chainId: identifier,
|
|
44524
|
+
request: {
|
|
44525
|
+
method: 'eth_chainId'
|
|
44526
|
+
}
|
|
44527
|
+
})
|
|
44528
|
+
])
|
|
44529
|
+
})));
|
|
44530
|
+
return results.filter(Boolean)[0]
|
|
44531
|
+
};
|
|
44532
|
+
|
|
44533
|
+
const getConnectedInstance$1 = async()=>{
|
|
44534
|
+
if(localStorage[KEY+":projectId"]) {
|
|
44535
|
+
const lastSession = await getLastSession();
|
|
44536
|
+
if(lastSession) {
|
|
44537
|
+
return new WalletConnectV2()
|
|
44538
|
+
}
|
|
44539
|
+
}
|
|
44540
|
+
};
|
|
44541
|
+
|
|
44542
|
+
const setConnectedInstance$1 = (value)=>{
|
|
44543
|
+
};
|
|
44544
|
+
|
|
44545
|
+
const getWalletConnectV2Config = ()=>{
|
|
44546
|
+
const methods = [
|
|
44547
|
+
"eth_sendTransaction",
|
|
44548
|
+
"personal_sign",
|
|
44549
|
+
"eth_chainId",
|
|
44550
|
+
"eth_accounts",
|
|
44551
|
+
"wallet_switchEthereumChain",
|
|
44552
|
+
];
|
|
44553
|
+
|
|
44554
|
+
const events = ['accountsChanged'];
|
|
44555
|
+
|
|
44556
|
+
let requiredNamespaces = {};
|
|
44557
|
+
requiredNamespaces['eip155'] = {
|
|
44558
|
+
methods,
|
|
44559
|
+
events,
|
|
44560
|
+
chains: [`eip155:1`],
|
|
44561
|
+
};
|
|
44562
|
+
|
|
44563
|
+
let optionalNamespaces = {};
|
|
44564
|
+
optionalNamespaces['eip155'] = {
|
|
44565
|
+
methods,
|
|
44566
|
+
events,
|
|
44567
|
+
chains: supported$2.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
44568
|
+
};
|
|
44569
|
+
|
|
44570
|
+
return { requiredNamespaces, optionalNamespaces }
|
|
44571
|
+
};
|
|
44572
|
+
|
|
44573
|
+
const getSignClient = async(core)=>{
|
|
44574
|
+
return await SignClient.init({
|
|
44575
|
+
core,
|
|
44576
|
+
metadata: {
|
|
44577
|
+
name: document.title || 'dApp',
|
|
44578
|
+
description: _optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('meta[name="description"]'), 'optionalAccess', _3 => _3.getAttribute, 'call', _4 => _4('content')]) || document.title || 'dApp',
|
|
44579
|
+
url: location.href,
|
|
44580
|
+
icons: [_optionalChain([document, 'access', _5 => _5.querySelector, 'call', _6 => _6("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _7 => _7.href]) || `${location.origin}/favicon.ico`]
|
|
44581
|
+
}
|
|
44582
|
+
})
|
|
44583
|
+
};
|
|
44584
|
+
|
|
44585
|
+
class WalletConnectV2 {
|
|
44586
|
+
|
|
44587
|
+
static __initStatic() {this.info = {
|
|
44588
|
+
name: 'WalletConnect V2',
|
|
44589
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMjUuNC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAtLT48c3ZnIHZlcnNpb249JzEuMScgaWQ9J0xheWVyXzEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIHg9JzBweCcgeT0nMHB4JyB2aWV3Qm94PScwIDAgNTAwIDUwMCcgc3R5bGU9J2VuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAwIDUwMDsnIHhtbDpzcGFjZT0ncHJlc2VydmUnPjxzdHlsZSB0eXBlPSd0ZXh0L2Nzcyc+IC5zdDB7ZmlsbDojNTk5MUNEO30KPC9zdHlsZT48ZyBpZD0nUGFnZS0xJz48ZyBpZD0nd2FsbGV0Y29ubmVjdC1sb2dvLWFsdCc+PHBhdGggaWQ9J1dhbGxldENvbm5lY3QnIGNsYXNzPSdzdDAnIGQ9J00xMDIuNywxNjJjODEuNS03OS44LDIxMy42LTc5LjgsMjk1LjEsMGw5LjgsOS42YzQuMSw0LDQuMSwxMC41LDAsMTQuNEwzNzQsMjE4LjkgYy0yLDItNS4zLDItNy40LDBsLTEzLjUtMTMuMmMtNTYuOC01NS43LTE0OS01NS43LTIwNS44LDBsLTE0LjUsMTQuMWMtMiwyLTUuMywyLTcuNCwwTDkxLjksMTg3Yy00LjEtNC00LjEtMTAuNSwwLTE0LjQgTDEwMi43LDE2MnogTTQ2Ny4xLDIyOS45bDI5LjksMjkuMmM0LjEsNCw0LjEsMTAuNSwwLDE0LjRMMzYyLjMsNDA1LjRjLTQuMSw0LTEwLjcsNC0xNC44LDBjMCwwLDAsMCwwLDBMMjUyLDMxMS45IGMtMS0xLTIuNy0xLTMuNywwaDBsLTk1LjUsOTMuNWMtNC4xLDQtMTAuNyw0LTE0LjgsMGMwLDAsMCwwLDAsMEwzLjQsMjczLjZjLTQuMS00LTQuMS0xMC41LDAtMTQuNGwyOS45LTI5LjIgYzQuMS00LDEwLjctNCwxNC44LDBsOTUuNSw5My41YzEsMSwyLjcsMSwzLjcsMGMwLDAsMCwwLDAsMGw5NS41LTkzLjVjNC4xLTQsMTAuNy00LDE0LjgsMGMwLDAsMCwwLDAsMGw5NS41LDkzLjUgYzEsMSwyLjcsMSwzLjcsMGw5NS41LTkzLjVDNDU2LjQsMjI1LjksNDYzLDIyNS45LDQ2Ny4xLDIyOS45eicvPjwvZz48L2c+PC9zdmc+Cg==",
|
|
44590
|
+
blockchains: supported$2.evm
|
|
44591
|
+
};}
|
|
44592
|
+
|
|
44593
|
+
static __initStatic2() {this.isAvailable = ()=>{
|
|
44594
|
+
return getConnectedInstance$1() != undefined
|
|
44595
|
+
};}
|
|
44596
|
+
|
|
44597
|
+
constructor() {
|
|
44598
|
+
this.name = (localStorage[KEY+':name'] && localStorage[KEY+':name'] != undefined) ? localStorage[KEY+':name'] : this.constructor.info.name;
|
|
44599
|
+
this.logo = (localStorage[KEY+':logo'] && localStorage[KEY+':logo'] != undefined) ? localStorage[KEY+':logo'] : this.constructor.info.logo;
|
|
44600
|
+
this.blockchains = this.constructor.info.blockchains;
|
|
44601
|
+
this.connector = WalletConnect.instance || this.newWalletConnectInstance();
|
|
44602
|
+
WalletConnect.instance = this.connector;
|
|
44603
|
+
this.sendTransaction = (transaction)=>{
|
|
44604
|
+
return sendTransaction$2({
|
|
44605
|
+
wallet: this,
|
|
44606
|
+
transaction
|
|
44607
|
+
})
|
|
44608
|
+
};
|
|
44609
|
+
}
|
|
44610
|
+
|
|
44611
|
+
newWalletConnectInstance() {
|
|
44612
|
+
if(!localStorage[KEY+":projectId"]) { throw(`localStorage['${KEY+":projectId"}'] is not set!`) }
|
|
44613
|
+
return new Core({ projectId: localStorage[KEY+":projectId"] })
|
|
44614
|
+
}
|
|
44615
|
+
|
|
44616
|
+
async account() {
|
|
44617
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44618
|
+
const connectedBlockchain = Blockchains.findById(connectedChainId);
|
|
44619
|
+
const accounts = await this.signClient.request({
|
|
44620
|
+
topic: this.session.topic,
|
|
44621
|
+
chainId: `${connectedBlockchain.namespace}:${connectedBlockchain.networkId}`,
|
|
44622
|
+
request:{
|
|
44623
|
+
method: 'eth_accounts',
|
|
44624
|
+
params: [{ chainId: connectedBlockchain.id }],
|
|
44625
|
+
}
|
|
44626
|
+
});
|
|
44627
|
+
return accounts ? accounts[0] : undefined
|
|
44628
|
+
}
|
|
44629
|
+
|
|
44630
|
+
async connect(options) {
|
|
44631
|
+
|
|
44632
|
+
let connect = (options && options.connect) ? options.connect : ({uri})=>{};
|
|
44633
|
+
|
|
44634
|
+
try {
|
|
44635
|
+
|
|
44636
|
+
// delete localStorage[`wc@2:client:0.3//session`] // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
|
|
44637
|
+
this.signClient = await getSignClient(this.connector);
|
|
44638
|
+
|
|
44639
|
+
this.signClient.on("session_delete", (session)=> {
|
|
44640
|
+
if(_optionalChain([session, 'optionalAccess', _8 => _8.topic]) === _optionalChain([this, 'access', _9 => _9.session, 'optionalAccess', _10 => _10.topic])) {
|
|
44641
|
+
localStorage[KEY+':name'] = undefined;
|
|
44642
|
+
localStorage[KEY+':logo'] = undefined;
|
|
44643
|
+
this.connector = undefined;
|
|
44644
|
+
WalletConnect.instance = undefined;
|
|
44645
|
+
this.signClient = undefined;
|
|
44646
|
+
this.session = undefined;
|
|
44647
|
+
}
|
|
44648
|
+
});
|
|
44649
|
+
|
|
44650
|
+
this.signClient.on("session_update", async(session)=> {
|
|
44651
|
+
if(_optionalChain([session, 'optionalAccess', _11 => _11.topic]) === _optionalChain([this, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.topic])) {
|
|
44652
|
+
this.session = this.signClient.session.get(session.topic);
|
|
44653
|
+
}
|
|
44654
|
+
});
|
|
44655
|
+
|
|
44656
|
+
this.signClient.on("session_event", (event)=> {
|
|
44657
|
+
if(_optionalChain([event, 'optionalAccess', _14 => _14.topic]) === _optionalChain([this, 'access', _15 => _15.session, 'optionalAccess', _16 => _16.topic])) {
|
|
44658
|
+
}
|
|
44659
|
+
});
|
|
44660
|
+
|
|
44661
|
+
const lastSession = await getLastSession();
|
|
44662
|
+
if(lastSession) {
|
|
44663
|
+
this.session = lastSession;
|
|
44664
|
+
}
|
|
44665
|
+
|
|
44666
|
+
const connectWallet = async()=>{
|
|
44667
|
+
const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config());
|
|
44668
|
+
await connect({ uri });
|
|
44669
|
+
this.session = await approval();
|
|
44670
|
+
};
|
|
44671
|
+
|
|
44672
|
+
if(!this.session){ await connectWallet(); }
|
|
44673
|
+
|
|
44674
|
+
let meta = _optionalChain([this, 'access', _17 => _17.session, 'optionalAccess', _18 => _18.peer, 'optionalAccess', _19 => _19.metadata]);
|
|
44675
|
+
if(meta && meta.name) {
|
|
44676
|
+
this.name = meta.name;
|
|
44677
|
+
localStorage[KEY+':name'] = meta.name;
|
|
44678
|
+
if(_optionalChain([meta, 'optionalAccess', _20 => _20.icons]) && meta.icons.length) {
|
|
44679
|
+
this.logo = meta.icons[0];
|
|
44680
|
+
localStorage[KEY+':logo'] = this.logo;
|
|
44681
|
+
}
|
|
44682
|
+
}
|
|
44683
|
+
|
|
44684
|
+
let connectedChainId;
|
|
44685
|
+
for(var i = 0; i<3; i++) {
|
|
44686
|
+
await new Promise((resolve)=>{setTimeout(resolve, 500);});
|
|
44687
|
+
connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44688
|
+
if(connectedChainId){ break }
|
|
44689
|
+
}
|
|
44690
|
+
|
|
44691
|
+
if(!connectedChainId) { await connectWallet(); }
|
|
44692
|
+
|
|
44693
|
+
let connectedBlockchain = Blockchains.findById(connectedChainId);
|
|
44694
|
+
|
|
44695
|
+
return await this.account()
|
|
44696
|
+
|
|
44697
|
+
} catch (error) {
|
|
44698
|
+
console.log('WALLETCONNECT ERROR', error);
|
|
44699
|
+
}
|
|
44700
|
+
}
|
|
44701
|
+
|
|
44702
|
+
async connectedTo(input) {
|
|
44703
|
+
let chainId = await getConnectedChainId(this.signClient, this.session);
|
|
44704
|
+
if(!chainId) { return false }
|
|
44705
|
+
const blockchain = Blockchains.findById(chainId);
|
|
44706
|
+
if(!blockchain) { return false }
|
|
44707
|
+
if(input) {
|
|
44708
|
+
return input === blockchain.name
|
|
44709
|
+
} else {
|
|
44710
|
+
return blockchain.name
|
|
44711
|
+
}
|
|
44712
|
+
}
|
|
44713
|
+
|
|
44714
|
+
switchTo(blockchainName) {
|
|
44715
|
+
return new Promise((resolve, reject)=>{
|
|
44716
|
+
let resolved, rejected;
|
|
44717
|
+
const blockchain = Blockchains[blockchainName];
|
|
44718
|
+
setTimeout(async()=>{
|
|
44719
|
+
if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
|
|
44720
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
44721
|
+
} else {
|
|
44722
|
+
this.connectedChainId = `${blockchain.namespace}:${blockchain.networkId}`;
|
|
44723
|
+
resolve();
|
|
44724
|
+
}
|
|
44725
|
+
}, 4000);
|
|
44726
|
+
this.session.namespaces.eip155.chains.map((identifier)=>{
|
|
44727
|
+
return Promise.race([
|
|
44728
|
+
new Promise((resolve)=>{setTimeout(resolve, 1500);}),
|
|
44729
|
+
this.signClient.request({
|
|
44730
|
+
topic: this.session.topic,
|
|
44731
|
+
chainId: identifier,
|
|
44732
|
+
request:{
|
|
44733
|
+
method: 'wallet_switchEthereumChain',
|
|
44734
|
+
params: [{ chainId: blockchain.id }],
|
|
44735
|
+
}
|
|
44736
|
+
})
|
|
44737
|
+
])
|
|
44738
|
+
});
|
|
44739
|
+
})
|
|
44740
|
+
}
|
|
44741
|
+
|
|
44742
|
+
addNetwork(blockchainName) {
|
|
44743
|
+
return new Promise((resolve, reject)=>{
|
|
44744
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
44745
|
+
})
|
|
44746
|
+
}
|
|
44747
|
+
|
|
44748
|
+
on(event, callback) {
|
|
44749
|
+
let internalCallback;
|
|
44750
|
+
switch (event) {
|
|
44751
|
+
case 'account':
|
|
44752
|
+
internalCallback = async(event)=> {
|
|
44753
|
+
if(_optionalChain([event, 'optionalAccess', _21 => _21.topic]) === _optionalChain([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.topic]) && event.params.event.name === 'accountsChanged') {
|
|
44754
|
+
callback(await this.account());
|
|
44755
|
+
}
|
|
44756
|
+
};
|
|
44757
|
+
this.signClient.on("session_event", internalCallback);
|
|
44758
|
+
break
|
|
44759
|
+
}
|
|
44760
|
+
return internalCallback
|
|
44761
|
+
}
|
|
44762
|
+
|
|
44763
|
+
off(event, callback) {
|
|
44764
|
+
switch (event) {
|
|
44765
|
+
case 'account':
|
|
44766
|
+
this.signClient.off("session_event", callback);
|
|
44767
|
+
break
|
|
44768
|
+
}
|
|
44769
|
+
}
|
|
44770
|
+
|
|
44771
|
+
async sign(message) {
|
|
44772
|
+
const address = await this.account();
|
|
44773
|
+
const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
44774
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44775
|
+
const blockchain = Blockchains.findById(connectedChainId);
|
|
44776
|
+
let signature = await this.signClient.request({
|
|
44777
|
+
topic: this.session.topic,
|
|
44778
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44779
|
+
request:{
|
|
44780
|
+
method: 'personal_sign',
|
|
44781
|
+
params
|
|
44782
|
+
}
|
|
44783
|
+
});
|
|
44784
|
+
if(typeof signature == 'object') {
|
|
44785
|
+
signature = ethers.utils.hexlify(signature);
|
|
44786
|
+
}
|
|
44787
|
+
return signature
|
|
44788
|
+
}
|
|
44789
|
+
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
44790
|
+
|
|
44791
|
+
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
44792
|
+
WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
|
|
44315
44793
|
|
|
44316
44794
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
44317
44795
|
transaction = new Transaction(transaction);
|
|
@@ -44554,6 +45032,7 @@ var wallets = {
|
|
|
44554
45032
|
WindowSolana,
|
|
44555
45033
|
SolanaMobileWalletAdapter,
|
|
44556
45034
|
WalletConnectV1,
|
|
45035
|
+
WalletConnectV2,
|
|
44557
45036
|
WalletLink
|
|
44558
45037
|
};
|
|
44559
45038
|
|
|
@@ -44600,6 +45079,7 @@ const supported = [
|
|
|
44600
45079
|
wallets.CryptoCom,
|
|
44601
45080
|
wallets.HyperPay,
|
|
44602
45081
|
wallets.WalletConnectV1,
|
|
45082
|
+
wallets.WalletConnectV2,
|
|
44603
45083
|
wallets.WalletLink,
|
|
44604
45084
|
wallets.WindowEthereum,
|
|
44605
45085
|
];
|