@depay/web3-wallets-evm 16.2.10 → 16.2.12
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 +110 -32
- package/dist/esm/index.js +119 -41
- package/dist/umd/index.evm.js +110 -32
- package/dist/umd/index.js +119 -41
- package/package.json +1 -1
package/dist/esm/index.evm.js
CHANGED
|
@@ -9,7 +9,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
|
|
|
9
9
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
10
10
|
supported$1.solana = [];
|
|
11
11
|
|
|
12
|
-
function _optionalChain$
|
|
12
|
+
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; }
|
|
13
13
|
class Transaction {
|
|
14
14
|
|
|
15
15
|
constructor({
|
|
@@ -34,7 +34,7 @@ class Transaction {
|
|
|
34
34
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
35
35
|
|
|
36
36
|
// optional
|
|
37
|
-
this.value = _optionalChain$
|
|
37
|
+
this.value = _optionalChain$j([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
38
38
|
this.api = api;
|
|
39
39
|
this.method = method;
|
|
40
40
|
this.params = params;
|
|
@@ -74,7 +74,7 @@ class Transaction {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
getParamType(param) {
|
|
77
|
-
if(_optionalChain$
|
|
77
|
+
if(_optionalChain$j([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
78
78
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
79
79
|
} else {
|
|
80
80
|
return param.type
|
|
@@ -147,6 +147,8 @@ class Transaction {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
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; }
|
|
151
|
+
|
|
150
152
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
151
153
|
transaction = new Transaction(transaction);
|
|
152
154
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -166,7 +168,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
166
168
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
167
169
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
168
170
|
if (transaction.sent) transaction.sent(transaction);
|
|
169
|
-
sentTransaction
|
|
171
|
+
retrieveConfirmedTransaction$3(sentTransaction).then(() => {
|
|
170
172
|
transaction._succeeded = true;
|
|
171
173
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
172
174
|
}).catch((error)=>{
|
|
@@ -194,6 +196,35 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
194
196
|
return transaction
|
|
195
197
|
};
|
|
196
198
|
|
|
199
|
+
const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
|
|
200
|
+
return new Promise((resolve, reject)=>{
|
|
201
|
+
try {
|
|
202
|
+
|
|
203
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
204
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$i([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
205
|
+
setTimeout(()=>{
|
|
206
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
207
|
+
.then(resolve)
|
|
208
|
+
.catch(reject);
|
|
209
|
+
}, 500);
|
|
210
|
+
} else {
|
|
211
|
+
reject(error);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
} catch(error) {
|
|
215
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$i([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
216
|
+
setTimeout(()=>{
|
|
217
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
218
|
+
.then(resolve)
|
|
219
|
+
.catch(reject);
|
|
220
|
+
}, 500);
|
|
221
|
+
} else {
|
|
222
|
+
reject(error);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
};
|
|
227
|
+
|
|
197
228
|
const submit$3 = ({ transaction, provider, signer }) => {
|
|
198
229
|
if(transaction.method) {
|
|
199
230
|
return submitContractInteraction$3({ transaction, signer, provider })
|
|
@@ -671,7 +702,6 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
671
702
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
672
703
|
transaction.nonce = transactionCount;
|
|
673
704
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
674
|
-
console.log('tx', tx);
|
|
675
705
|
if (tx) {
|
|
676
706
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
677
707
|
transaction.id = tx;
|
|
@@ -710,9 +740,21 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
710
740
|
|
|
711
741
|
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
712
742
|
return new Promise((resolve, reject)=>{
|
|
743
|
+
try {
|
|
713
744
|
|
|
714
|
-
|
|
715
|
-
|
|
745
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
746
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
747
|
+
setTimeout(()=>{
|
|
748
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
749
|
+
.then(resolve)
|
|
750
|
+
.catch(reject);
|
|
751
|
+
}, 500);
|
|
752
|
+
} else {
|
|
753
|
+
reject(error);
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
} catch (error) {
|
|
757
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
716
758
|
setTimeout(()=>{
|
|
717
759
|
retrieveConfirmedTransaction$2(sentTransaction)
|
|
718
760
|
.then(resolve)
|
|
@@ -721,7 +763,7 @@ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
|
721
763
|
} else {
|
|
722
764
|
reject(error);
|
|
723
765
|
}
|
|
724
|
-
}
|
|
766
|
+
}
|
|
725
767
|
})
|
|
726
768
|
};
|
|
727
769
|
|
|
@@ -757,7 +799,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
757
799
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
758
800
|
const provider = await getProvider(transaction.blockchain);
|
|
759
801
|
let gasPrice = await provider.getGasPrice();
|
|
760
|
-
if(_optionalChain$5([wallet, 'access',
|
|
802
|
+
if(_optionalChain$5([wallet, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.peerMeta, 'optionalAccess', _7 => _7.name]) === 'Uniswap Wallet') {
|
|
761
803
|
gasPrice = undefined;
|
|
762
804
|
} else {
|
|
763
805
|
gasPrice = gasPrice.toHexString();
|
|
@@ -781,7 +823,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
781
823
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
782
824
|
const provider = await getProvider(transaction.blockchain);
|
|
783
825
|
let gasPrice = await provider.getGasPrice();
|
|
784
|
-
if(_optionalChain$5([wallet, 'access',
|
|
826
|
+
if(_optionalChain$5([wallet, 'access', _8 => _8.session, 'optionalAccess', _9 => _9.peerMeta, 'optionalAccess', _10 => _10.name]) === 'Uniswap Wallet') {
|
|
785
827
|
gasPrice = undefined;
|
|
786
828
|
} else {
|
|
787
829
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1108,7 +1150,6 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1108
1150
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1109
1151
|
if(!sentTransaction) {
|
|
1110
1152
|
transaction._failed = true;
|
|
1111
|
-
console.log('Error retrieving transaction');
|
|
1112
1153
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1113
1154
|
} else {
|
|
1114
1155
|
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
@@ -1140,35 +1181,60 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1140
1181
|
|
|
1141
1182
|
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1142
1183
|
return new Promise((resolve, reject)=>{
|
|
1184
|
+
try {
|
|
1185
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1186
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1187
|
+
setTimeout(()=>{
|
|
1188
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1189
|
+
.then(resolve)
|
|
1190
|
+
.catch(reject);
|
|
1191
|
+
}, 500);
|
|
1192
|
+
} else {
|
|
1193
|
+
reject(error);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
} catch (error) {
|
|
1197
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1198
|
+
setTimeout(()=>{
|
|
1199
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1200
|
+
.then(resolve)
|
|
1201
|
+
.catch(reject);
|
|
1202
|
+
}, 500);
|
|
1203
|
+
} else {
|
|
1204
|
+
reject(error);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
})
|
|
1208
|
+
};
|
|
1143
1209
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1210
|
+
const retrieveTransaction = (tx, blockchain)=>{
|
|
1211
|
+
return new Promise(async(resolve, reject)=>{
|
|
1212
|
+
try {
|
|
1213
|
+
let sentTransaction;
|
|
1214
|
+
const provider = await getProvider(blockchain);
|
|
1215
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1216
|
+
const maxRetries = 120;
|
|
1217
|
+
let attempt = 1;
|
|
1218
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1219
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1220
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1221
|
+
attempt++;
|
|
1222
|
+
}
|
|
1223
|
+
resolve(sentTransaction);
|
|
1224
|
+
} catch (error) {
|
|
1225
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]))) {
|
|
1146
1226
|
setTimeout(()=>{
|
|
1147
|
-
|
|
1227
|
+
retrieveTransaction(tx, blockchain)
|
|
1148
1228
|
.then(resolve)
|
|
1149
1229
|
.catch(reject);
|
|
1150
1230
|
}, 500);
|
|
1151
1231
|
} else {
|
|
1152
1232
|
reject(error);
|
|
1153
1233
|
}
|
|
1154
|
-
}
|
|
1234
|
+
}
|
|
1155
1235
|
})
|
|
1156
1236
|
};
|
|
1157
1237
|
|
|
1158
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1159
|
-
let sentTransaction;
|
|
1160
|
-
const provider = await getProvider(blockchain);
|
|
1161
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1162
|
-
const maxRetries = 120;
|
|
1163
|
-
let attempt = 1;
|
|
1164
|
-
while (attempt <= maxRetries && !sentTransaction) {
|
|
1165
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1166
|
-
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1167
|
-
attempt++;
|
|
1168
|
-
}
|
|
1169
|
-
return sentTransaction
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
1238
|
const submit$1 = ({ transaction, wallet }) => {
|
|
1173
1239
|
if(transaction.method) {
|
|
1174
1240
|
return submitContractInteraction$1({ transaction, wallet })
|
|
@@ -1652,9 +1718,21 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1652
1718
|
|
|
1653
1719
|
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
1654
1720
|
return new Promise((resolve, reject)=>{
|
|
1721
|
+
try {
|
|
1655
1722
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1723
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1724
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1725
|
+
setTimeout(()=>{
|
|
1726
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
1727
|
+
.then(resolve)
|
|
1728
|
+
.catch(reject);
|
|
1729
|
+
}, 500);
|
|
1730
|
+
} else {
|
|
1731
|
+
reject(error);
|
|
1732
|
+
}
|
|
1733
|
+
});
|
|
1734
|
+
} catch(error) {
|
|
1735
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1658
1736
|
setTimeout(()=>{
|
|
1659
1737
|
retrieveConfirmedTransaction(sentTransaction)
|
|
1660
1738
|
.then(resolve)
|
|
@@ -1663,7 +1741,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
1663
1741
|
} else {
|
|
1664
1742
|
reject(error);
|
|
1665
1743
|
}
|
|
1666
|
-
}
|
|
1744
|
+
}
|
|
1667
1745
|
})
|
|
1668
1746
|
};
|
|
1669
1747
|
|
package/dist/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
|
6
6
|
import { SignClient } from '@depay/walletconnect-v2';
|
|
7
7
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
8
8
|
|
|
9
|
-
function _optionalChain$
|
|
9
|
+
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; }
|
|
10
10
|
class Transaction {
|
|
11
11
|
|
|
12
12
|
constructor({
|
|
@@ -31,7 +31,7 @@ class Transaction {
|
|
|
31
31
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
32
32
|
|
|
33
33
|
// optional
|
|
34
|
-
this.value = _optionalChain$
|
|
34
|
+
this.value = _optionalChain$p([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
35
35
|
this.api = api;
|
|
36
36
|
this.method = method;
|
|
37
37
|
this.params = params;
|
|
@@ -71,7 +71,7 @@ class Transaction {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
getParamType(param) {
|
|
74
|
-
if(_optionalChain$
|
|
74
|
+
if(_optionalChain$p([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
75
75
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
76
76
|
} else {
|
|
77
77
|
return param.type
|
|
@@ -144,7 +144,7 @@ class Transaction {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
function _optionalChain$
|
|
147
|
+
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; }
|
|
148
148
|
|
|
149
149
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
150
150
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -165,14 +165,14 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
|
165
165
|
|
|
166
166
|
const provider = await getProvider(transaction.blockchain);
|
|
167
167
|
const { value } = await provider.getSignatureStatus(signature);
|
|
168
|
-
const confirmationStatus = _optionalChain$
|
|
168
|
+
const confirmationStatus = _optionalChain$o([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
169
169
|
if(confirmationStatus) {
|
|
170
170
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
171
171
|
if (hasReachedSufficientCommitment) {
|
|
172
172
|
if(value.err) {
|
|
173
173
|
transaction._failed = true;
|
|
174
174
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
175
|
-
const failedReason = _optionalChain$
|
|
175
|
+
const failedReason = _optionalChain$o([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
176
176
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
177
177
|
} else {
|
|
178
178
|
transaction._succeeded = true;
|
|
@@ -263,7 +263,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum',
|
|
|
263
263
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
264
264
|
supported$1.solana = ['solana'];
|
|
265
265
|
|
|
266
|
-
function _optionalChain$
|
|
266
|
+
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; }
|
|
267
267
|
class WindowSolana {
|
|
268
268
|
|
|
269
269
|
static __initStatic() {this.info = {
|
|
@@ -274,13 +274,13 @@ class WindowSolana {
|
|
|
274
274
|
|
|
275
275
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
276
276
|
return (
|
|
277
|
-
_optionalChain$
|
|
277
|
+
_optionalChain$n([window, 'optionalAccess', _5 => _5.solana]) &&
|
|
278
278
|
// not Phantom
|
|
279
279
|
!(window.phantom && !window.glow && !window.solana.isGlow && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
280
280
|
// not Coin98
|
|
281
281
|
!window.coin98 &&
|
|
282
282
|
// not BitKeep
|
|
283
|
-
!(_optionalChain$
|
|
283
|
+
!(_optionalChain$n([window, 'optionalAccess', _6 => _6.solana]) && _optionalChain$n([window, 'optionalAccess', _7 => _7.solana, 'access', _8 => _8.isBitKeep])) &&
|
|
284
284
|
// not Glow
|
|
285
285
|
!window.solana.isGlow
|
|
286
286
|
)
|
|
@@ -329,7 +329,7 @@ class WindowSolana {
|
|
|
329
329
|
let internalCallback;
|
|
330
330
|
switch (event) {
|
|
331
331
|
case 'account':
|
|
332
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
332
|
+
internalCallback = (publicKey) => callback(_optionalChain$n([publicKey, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]));
|
|
333
333
|
this.getProvider().on('accountChanged', internalCallback);
|
|
334
334
|
break
|
|
335
335
|
}
|
|
@@ -382,7 +382,7 @@ class WindowSolana {
|
|
|
382
382
|
}
|
|
383
383
|
} WindowSolana.__initStatic(); WindowSolana.__initStatic2();
|
|
384
384
|
|
|
385
|
-
function _optionalChain$
|
|
385
|
+
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; }
|
|
386
386
|
|
|
387
387
|
class Backpack extends WindowSolana {
|
|
388
388
|
|
|
@@ -394,7 +394,7 @@ class Backpack extends WindowSolana {
|
|
|
394
394
|
|
|
395
395
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
396
396
|
return (
|
|
397
|
-
_optionalChain$
|
|
397
|
+
_optionalChain$m([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
398
398
|
window.backpack.isBackpack
|
|
399
399
|
)
|
|
400
400
|
};}
|
|
@@ -412,6 +412,8 @@ class Backpack extends WindowSolana {
|
|
|
412
412
|
}
|
|
413
413
|
} Backpack.__initStatic(); Backpack.__initStatic2();
|
|
414
414
|
|
|
415
|
+
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; }
|
|
416
|
+
|
|
415
417
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
416
418
|
transaction = new Transaction(transaction);
|
|
417
419
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -431,7 +433,7 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
431
433
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
432
434
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
433
435
|
if (transaction.sent) transaction.sent(transaction);
|
|
434
|
-
sentTransaction
|
|
436
|
+
retrieveConfirmedTransaction$3(sentTransaction).then(() => {
|
|
435
437
|
transaction._succeeded = true;
|
|
436
438
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
437
439
|
}).catch((error)=>{
|
|
@@ -459,6 +461,35 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
459
461
|
return transaction
|
|
460
462
|
};
|
|
461
463
|
|
|
464
|
+
const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
|
|
465
|
+
return new Promise((resolve, reject)=>{
|
|
466
|
+
try {
|
|
467
|
+
|
|
468
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
469
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$l([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
470
|
+
setTimeout(()=>{
|
|
471
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
472
|
+
.then(resolve)
|
|
473
|
+
.catch(reject);
|
|
474
|
+
}, 500);
|
|
475
|
+
} else {
|
|
476
|
+
reject(error);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
} catch(error) {
|
|
480
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$l([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
481
|
+
setTimeout(()=>{
|
|
482
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
483
|
+
.then(resolve)
|
|
484
|
+
.catch(reject);
|
|
485
|
+
}, 500);
|
|
486
|
+
} else {
|
|
487
|
+
reject(error);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
};
|
|
492
|
+
|
|
462
493
|
const submit$3 = ({ transaction, provider, signer }) => {
|
|
463
494
|
if(transaction.method) {
|
|
464
495
|
return submitContractInteraction$3({ transaction, signer, provider })
|
|
@@ -1143,7 +1174,6 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1143
1174
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
1144
1175
|
transaction.nonce = transactionCount;
|
|
1145
1176
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1146
|
-
console.log('tx', tx);
|
|
1147
1177
|
if (tx) {
|
|
1148
1178
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
1149
1179
|
transaction.id = tx;
|
|
@@ -1182,9 +1212,21 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1182
1212
|
|
|
1183
1213
|
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
1184
1214
|
return new Promise((resolve, reject)=>{
|
|
1215
|
+
try {
|
|
1185
1216
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1217
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1218
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1219
|
+
setTimeout(()=>{
|
|
1220
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
1221
|
+
.then(resolve)
|
|
1222
|
+
.catch(reject);
|
|
1223
|
+
}, 500);
|
|
1224
|
+
} else {
|
|
1225
|
+
reject(error);
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
} catch (error) {
|
|
1229
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1188
1230
|
setTimeout(()=>{
|
|
1189
1231
|
retrieveConfirmedTransaction$2(sentTransaction)
|
|
1190
1232
|
.then(resolve)
|
|
@@ -1193,7 +1235,7 @@ const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
|
1193
1235
|
} else {
|
|
1194
1236
|
reject(error);
|
|
1195
1237
|
}
|
|
1196
|
-
}
|
|
1238
|
+
}
|
|
1197
1239
|
})
|
|
1198
1240
|
};
|
|
1199
1241
|
|
|
@@ -1229,7 +1271,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
1229
1271
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
1230
1272
|
const provider = await getProvider(transaction.blockchain);
|
|
1231
1273
|
let gasPrice = await provider.getGasPrice();
|
|
1232
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1274
|
+
if(_optionalChain$5([wallet, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.peerMeta, 'optionalAccess', _7 => _7.name]) === 'Uniswap Wallet') {
|
|
1233
1275
|
gasPrice = undefined;
|
|
1234
1276
|
} else {
|
|
1235
1277
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1253,7 +1295,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
1253
1295
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1254
1296
|
const provider = await getProvider(transaction.blockchain);
|
|
1255
1297
|
let gasPrice = await provider.getGasPrice();
|
|
1256
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1298
|
+
if(_optionalChain$5([wallet, 'access', _8 => _8.session, 'optionalAccess', _9 => _9.peerMeta, 'optionalAccess', _10 => _10.name]) === 'Uniswap Wallet') {
|
|
1257
1299
|
gasPrice = undefined;
|
|
1258
1300
|
} else {
|
|
1259
1301
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1580,7 +1622,6 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1580
1622
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1581
1623
|
if(!sentTransaction) {
|
|
1582
1624
|
transaction._failed = true;
|
|
1583
|
-
console.log('Error retrieving transaction');
|
|
1584
1625
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1585
1626
|
} else {
|
|
1586
1627
|
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
@@ -1612,35 +1653,60 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1612
1653
|
|
|
1613
1654
|
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1614
1655
|
return new Promise((resolve, reject)=>{
|
|
1656
|
+
try {
|
|
1657
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1658
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1659
|
+
setTimeout(()=>{
|
|
1660
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1661
|
+
.then(resolve)
|
|
1662
|
+
.catch(reject);
|
|
1663
|
+
}, 500);
|
|
1664
|
+
} else {
|
|
1665
|
+
reject(error);
|
|
1666
|
+
}
|
|
1667
|
+
});
|
|
1668
|
+
} catch (error) {
|
|
1669
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1670
|
+
setTimeout(()=>{
|
|
1671
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1672
|
+
.then(resolve)
|
|
1673
|
+
.catch(reject);
|
|
1674
|
+
}, 500);
|
|
1675
|
+
} else {
|
|
1676
|
+
reject(error);
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
})
|
|
1680
|
+
};
|
|
1615
1681
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1682
|
+
const retrieveTransaction = (tx, blockchain)=>{
|
|
1683
|
+
return new Promise(async(resolve, reject)=>{
|
|
1684
|
+
try {
|
|
1685
|
+
let sentTransaction;
|
|
1686
|
+
const provider = await getProvider(blockchain);
|
|
1687
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1688
|
+
const maxRetries = 120;
|
|
1689
|
+
let attempt = 1;
|
|
1690
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1691
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1692
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1693
|
+
attempt++;
|
|
1694
|
+
}
|
|
1695
|
+
resolve(sentTransaction);
|
|
1696
|
+
} catch (error) {
|
|
1697
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]))) {
|
|
1618
1698
|
setTimeout(()=>{
|
|
1619
|
-
|
|
1699
|
+
retrieveTransaction(tx, blockchain)
|
|
1620
1700
|
.then(resolve)
|
|
1621
1701
|
.catch(reject);
|
|
1622
1702
|
}, 500);
|
|
1623
1703
|
} else {
|
|
1624
1704
|
reject(error);
|
|
1625
1705
|
}
|
|
1626
|
-
}
|
|
1706
|
+
}
|
|
1627
1707
|
})
|
|
1628
1708
|
};
|
|
1629
1709
|
|
|
1630
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1631
|
-
let sentTransaction;
|
|
1632
|
-
const provider = await getProvider(blockchain);
|
|
1633
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1634
|
-
const maxRetries = 120;
|
|
1635
|
-
let attempt = 1;
|
|
1636
|
-
while (attempt <= maxRetries && !sentTransaction) {
|
|
1637
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1638
|
-
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1639
|
-
attempt++;
|
|
1640
|
-
}
|
|
1641
|
-
return sentTransaction
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
1710
|
const submit$1 = ({ transaction, wallet }) => {
|
|
1645
1711
|
if(transaction.method) {
|
|
1646
1712
|
return submitContractInteraction$1({ transaction, wallet })
|
|
@@ -2124,9 +2190,21 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
2124
2190
|
|
|
2125
2191
|
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
2126
2192
|
return new Promise((resolve, reject)=>{
|
|
2193
|
+
try {
|
|
2127
2194
|
|
|
2128
|
-
|
|
2129
|
-
|
|
2195
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
2196
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
2197
|
+
setTimeout(()=>{
|
|
2198
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
2199
|
+
.then(resolve)
|
|
2200
|
+
.catch(reject);
|
|
2201
|
+
}, 500);
|
|
2202
|
+
} else {
|
|
2203
|
+
reject(error);
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
} catch(error) {
|
|
2207
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
2130
2208
|
setTimeout(()=>{
|
|
2131
2209
|
retrieveConfirmedTransaction(sentTransaction)
|
|
2132
2210
|
.then(resolve)
|
|
@@ -2135,7 +2213,7 @@ const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
|
2135
2213
|
} else {
|
|
2136
2214
|
reject(error);
|
|
2137
2215
|
}
|
|
2138
|
-
}
|
|
2216
|
+
}
|
|
2139
2217
|
})
|
|
2140
2218
|
};
|
|
2141
2219
|
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
13
13
|
supported$1.solana = [];
|
|
14
14
|
|
|
15
|
-
function _optionalChain$
|
|
15
|
+
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; }
|
|
16
16
|
class Transaction {
|
|
17
17
|
|
|
18
18
|
constructor({
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
|
|
38
38
|
|
|
39
39
|
// optional
|
|
40
|
-
this.value = _optionalChain$
|
|
40
|
+
this.value = _optionalChain$j([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
41
41
|
this.api = api;
|
|
42
42
|
this.method = method;
|
|
43
43
|
this.params = params;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
getParamType(param) {
|
|
80
|
-
if(_optionalChain$
|
|
80
|
+
if(_optionalChain$j([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
81
81
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
82
82
|
} else {
|
|
83
83
|
return param.type
|
|
@@ -150,6 +150,8 @@
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
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; }
|
|
154
|
+
|
|
153
155
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
154
156
|
transaction = new Transaction(transaction);
|
|
155
157
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -169,7 +171,7 @@
|
|
|
169
171
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
170
172
|
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
171
173
|
if (transaction.sent) transaction.sent(transaction);
|
|
172
|
-
sentTransaction
|
|
174
|
+
retrieveConfirmedTransaction$3(sentTransaction).then(() => {
|
|
173
175
|
transaction._succeeded = true;
|
|
174
176
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
175
177
|
}).catch((error)=>{
|
|
@@ -197,6 +199,35 @@
|
|
|
197
199
|
return transaction
|
|
198
200
|
};
|
|
199
201
|
|
|
202
|
+
const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
|
|
203
|
+
return new Promise((resolve, reject)=>{
|
|
204
|
+
try {
|
|
205
|
+
|
|
206
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
207
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$i([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
208
|
+
setTimeout(()=>{
|
|
209
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
210
|
+
.then(resolve)
|
|
211
|
+
.catch(reject);
|
|
212
|
+
}, 500);
|
|
213
|
+
} else {
|
|
214
|
+
reject(error);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
} catch(error) {
|
|
218
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$i([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
219
|
+
setTimeout(()=>{
|
|
220
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
221
|
+
.then(resolve)
|
|
222
|
+
.catch(reject);
|
|
223
|
+
}, 500);
|
|
224
|
+
} else {
|
|
225
|
+
reject(error);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
};
|
|
230
|
+
|
|
200
231
|
const submit$3 = ({ transaction, provider, signer }) => {
|
|
201
232
|
if(transaction.method) {
|
|
202
233
|
return submitContractInteraction$3({ transaction, signer, provider })
|
|
@@ -674,7 +705,6 @@
|
|
|
674
705
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
675
706
|
transaction.nonce = transactionCount;
|
|
676
707
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
677
|
-
console.log('tx', tx);
|
|
678
708
|
if (tx) {
|
|
679
709
|
let blockchain = Blockchains__default['default'].findByName(transaction.blockchain);
|
|
680
710
|
transaction.id = tx;
|
|
@@ -713,9 +743,21 @@
|
|
|
713
743
|
|
|
714
744
|
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
715
745
|
return new Promise((resolve, reject)=>{
|
|
746
|
+
try {
|
|
716
747
|
|
|
717
|
-
|
|
718
|
-
|
|
748
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
749
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
750
|
+
setTimeout(()=>{
|
|
751
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
752
|
+
.then(resolve)
|
|
753
|
+
.catch(reject);
|
|
754
|
+
}, 500);
|
|
755
|
+
} else {
|
|
756
|
+
reject(error);
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
} catch (error) {
|
|
760
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
719
761
|
setTimeout(()=>{
|
|
720
762
|
retrieveConfirmedTransaction$2(sentTransaction)
|
|
721
763
|
.then(resolve)
|
|
@@ -724,7 +766,7 @@
|
|
|
724
766
|
} else {
|
|
725
767
|
reject(error);
|
|
726
768
|
}
|
|
727
|
-
}
|
|
769
|
+
}
|
|
728
770
|
})
|
|
729
771
|
};
|
|
730
772
|
|
|
@@ -760,7 +802,7 @@
|
|
|
760
802
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
761
803
|
const provider = await web3ClientEvm.getProvider(transaction.blockchain);
|
|
762
804
|
let gasPrice = await provider.getGasPrice();
|
|
763
|
-
if(_optionalChain$5([wallet, 'access',
|
|
805
|
+
if(_optionalChain$5([wallet, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.peerMeta, 'optionalAccess', _7 => _7.name]) === 'Uniswap Wallet') {
|
|
764
806
|
gasPrice = undefined;
|
|
765
807
|
} else {
|
|
766
808
|
gasPrice = gasPrice.toHexString();
|
|
@@ -784,7 +826,7 @@
|
|
|
784
826
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
785
827
|
const provider = await web3ClientEvm.getProvider(transaction.blockchain);
|
|
786
828
|
let gasPrice = await provider.getGasPrice();
|
|
787
|
-
if(_optionalChain$5([wallet, 'access',
|
|
829
|
+
if(_optionalChain$5([wallet, 'access', _8 => _8.session, 'optionalAccess', _9 => _9.peerMeta, 'optionalAccess', _10 => _10.name]) === 'Uniswap Wallet') {
|
|
788
830
|
gasPrice = undefined;
|
|
789
831
|
} else {
|
|
790
832
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1111,7 +1153,6 @@
|
|
|
1111
1153
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1112
1154
|
if(!sentTransaction) {
|
|
1113
1155
|
transaction._failed = true;
|
|
1114
|
-
console.log('Error retrieving transaction');
|
|
1115
1156
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1116
1157
|
} else {
|
|
1117
1158
|
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
@@ -1143,35 +1184,60 @@
|
|
|
1143
1184
|
|
|
1144
1185
|
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1145
1186
|
return new Promise((resolve, reject)=>{
|
|
1187
|
+
try {
|
|
1188
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1189
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1190
|
+
setTimeout(()=>{
|
|
1191
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1192
|
+
.then(resolve)
|
|
1193
|
+
.catch(reject);
|
|
1194
|
+
}, 500);
|
|
1195
|
+
} else {
|
|
1196
|
+
reject(error);
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
} catch (error) {
|
|
1200
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1201
|
+
setTimeout(()=>{
|
|
1202
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1203
|
+
.then(resolve)
|
|
1204
|
+
.catch(reject);
|
|
1205
|
+
}, 500);
|
|
1206
|
+
} else {
|
|
1207
|
+
reject(error);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
})
|
|
1211
|
+
};
|
|
1146
1212
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1213
|
+
const retrieveTransaction = (tx, blockchain)=>{
|
|
1214
|
+
return new Promise(async(resolve, reject)=>{
|
|
1215
|
+
try {
|
|
1216
|
+
let sentTransaction;
|
|
1217
|
+
const provider = await web3ClientEvm.getProvider(blockchain);
|
|
1218
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1219
|
+
const maxRetries = 120;
|
|
1220
|
+
let attempt = 1;
|
|
1221
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1222
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1223
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1224
|
+
attempt++;
|
|
1225
|
+
}
|
|
1226
|
+
resolve(sentTransaction);
|
|
1227
|
+
} catch (error) {
|
|
1228
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]))) {
|
|
1149
1229
|
setTimeout(()=>{
|
|
1150
|
-
|
|
1230
|
+
retrieveTransaction(tx, blockchain)
|
|
1151
1231
|
.then(resolve)
|
|
1152
1232
|
.catch(reject);
|
|
1153
1233
|
}, 500);
|
|
1154
1234
|
} else {
|
|
1155
1235
|
reject(error);
|
|
1156
1236
|
}
|
|
1157
|
-
}
|
|
1237
|
+
}
|
|
1158
1238
|
})
|
|
1159
1239
|
};
|
|
1160
1240
|
|
|
1161
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1162
|
-
let sentTransaction;
|
|
1163
|
-
const provider = await web3ClientEvm.getProvider(blockchain);
|
|
1164
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1165
|
-
const maxRetries = 120;
|
|
1166
|
-
let attempt = 1;
|
|
1167
|
-
while (attempt <= maxRetries && !sentTransaction) {
|
|
1168
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1169
|
-
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1170
|
-
attempt++;
|
|
1171
|
-
}
|
|
1172
|
-
return sentTransaction
|
|
1173
|
-
};
|
|
1174
|
-
|
|
1175
1241
|
const submit$1 = ({ transaction, wallet }) => {
|
|
1176
1242
|
if(transaction.method) {
|
|
1177
1243
|
return submitContractInteraction$1({ transaction, wallet })
|
|
@@ -1655,9 +1721,21 @@
|
|
|
1655
1721
|
|
|
1656
1722
|
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
1657
1723
|
return new Promise((resolve, reject)=>{
|
|
1724
|
+
try {
|
|
1658
1725
|
|
|
1659
|
-
|
|
1660
|
-
|
|
1726
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1727
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1728
|
+
setTimeout(()=>{
|
|
1729
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
1730
|
+
.then(resolve)
|
|
1731
|
+
.catch(reject);
|
|
1732
|
+
}, 500);
|
|
1733
|
+
} else {
|
|
1734
|
+
reject(error);
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
} catch(error) {
|
|
1738
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1661
1739
|
setTimeout(()=>{
|
|
1662
1740
|
retrieveConfirmedTransaction(sentTransaction)
|
|
1663
1741
|
.then(resolve)
|
|
@@ -1666,7 +1744,7 @@
|
|
|
1666
1744
|
} else {
|
|
1667
1745
|
reject(error);
|
|
1668
1746
|
}
|
|
1669
|
-
}
|
|
1747
|
+
}
|
|
1670
1748
|
})
|
|
1671
1749
|
};
|
|
1672
1750
|
|
package/dist/umd/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
var Blockchains__default = /*#__PURE__*/_interopDefaultLegacy(Blockchains);
|
|
10
10
|
|
|
11
|
-
function _optionalChain$
|
|
11
|
+
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; }
|
|
12
12
|
class Transaction {
|
|
13
13
|
|
|
14
14
|
constructor({
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
|
|
34
34
|
|
|
35
35
|
// optional
|
|
36
|
-
this.value = _optionalChain$
|
|
36
|
+
this.value = _optionalChain$p([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
37
37
|
this.api = api;
|
|
38
38
|
this.method = method;
|
|
39
39
|
this.params = params;
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
getParamType(param) {
|
|
76
|
-
if(_optionalChain$
|
|
76
|
+
if(_optionalChain$p([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
77
77
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
78
78
|
} else {
|
|
79
79
|
return param.type
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
function _optionalChain$
|
|
149
|
+
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; }
|
|
150
150
|
|
|
151
151
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
152
152
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -167,14 +167,14 @@
|
|
|
167
167
|
|
|
168
168
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
169
169
|
const { value } = await provider.getSignatureStatus(signature);
|
|
170
|
-
const confirmationStatus = _optionalChain$
|
|
170
|
+
const confirmationStatus = _optionalChain$o([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
171
171
|
if(confirmationStatus) {
|
|
172
172
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
173
173
|
if (hasReachedSufficientCommitment) {
|
|
174
174
|
if(value.err) {
|
|
175
175
|
transaction._failed = true;
|
|
176
176
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
177
|
-
const failedReason = _optionalChain$
|
|
177
|
+
const failedReason = _optionalChain$o([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
178
178
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
179
179
|
} else {
|
|
180
180
|
transaction._succeeded = true;
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
266
266
|
supported$1.solana = ['solana'];
|
|
267
267
|
|
|
268
|
-
function _optionalChain$
|
|
268
|
+
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; }
|
|
269
269
|
class WindowSolana {
|
|
270
270
|
|
|
271
271
|
static __initStatic() {this.info = {
|
|
@@ -276,13 +276,13 @@
|
|
|
276
276
|
|
|
277
277
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
278
278
|
return (
|
|
279
|
-
_optionalChain$
|
|
279
|
+
_optionalChain$n([window, 'optionalAccess', _5 => _5.solana]) &&
|
|
280
280
|
// not Phantom
|
|
281
281
|
!(window.phantom && !window.glow && !window.solana.isGlow && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
282
282
|
// not Coin98
|
|
283
283
|
!window.coin98 &&
|
|
284
284
|
// not BitKeep
|
|
285
|
-
!(_optionalChain$
|
|
285
|
+
!(_optionalChain$n([window, 'optionalAccess', _6 => _6.solana]) && _optionalChain$n([window, 'optionalAccess', _7 => _7.solana, 'access', _8 => _8.isBitKeep])) &&
|
|
286
286
|
// not Glow
|
|
287
287
|
!window.solana.isGlow
|
|
288
288
|
)
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
let internalCallback;
|
|
332
332
|
switch (event) {
|
|
333
333
|
case 'account':
|
|
334
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
334
|
+
internalCallback = (publicKey) => callback(_optionalChain$n([publicKey, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]));
|
|
335
335
|
this.getProvider().on('accountChanged', internalCallback);
|
|
336
336
|
break
|
|
337
337
|
}
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
}
|
|
385
385
|
} WindowSolana.__initStatic(); WindowSolana.__initStatic2();
|
|
386
386
|
|
|
387
|
-
function _optionalChain$
|
|
387
|
+
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; }
|
|
388
388
|
|
|
389
389
|
class Backpack extends WindowSolana {
|
|
390
390
|
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
|
|
397
397
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
398
398
|
return (
|
|
399
|
-
_optionalChain$
|
|
399
|
+
_optionalChain$m([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
400
400
|
window.backpack.isBackpack
|
|
401
401
|
)
|
|
402
402
|
};}
|
|
@@ -414,6 +414,8 @@
|
|
|
414
414
|
}
|
|
415
415
|
} Backpack.__initStatic(); Backpack.__initStatic2();
|
|
416
416
|
|
|
417
|
+
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; }
|
|
418
|
+
|
|
417
419
|
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
418
420
|
transaction = new Transaction(transaction);
|
|
419
421
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -433,7 +435,7 @@
|
|
|
433
435
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
434
436
|
transaction.url = Blockchains__default['default'].findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
435
437
|
if (transaction.sent) transaction.sent(transaction);
|
|
436
|
-
sentTransaction
|
|
438
|
+
retrieveConfirmedTransaction$3(sentTransaction).then(() => {
|
|
437
439
|
transaction._succeeded = true;
|
|
438
440
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
439
441
|
}).catch((error)=>{
|
|
@@ -461,6 +463,35 @@
|
|
|
461
463
|
return transaction
|
|
462
464
|
};
|
|
463
465
|
|
|
466
|
+
const retrieveConfirmedTransaction$3 = (sentTransaction)=>{
|
|
467
|
+
return new Promise((resolve, reject)=>{
|
|
468
|
+
try {
|
|
469
|
+
|
|
470
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
471
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$l([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
472
|
+
setTimeout(()=>{
|
|
473
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
474
|
+
.then(resolve)
|
|
475
|
+
.catch(reject);
|
|
476
|
+
}, 500);
|
|
477
|
+
} else {
|
|
478
|
+
reject(error);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
} catch(error) {
|
|
482
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$l([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
483
|
+
setTimeout(()=>{
|
|
484
|
+
retrieveConfirmedTransaction$3(sentTransaction)
|
|
485
|
+
.then(resolve)
|
|
486
|
+
.catch(reject);
|
|
487
|
+
}, 500);
|
|
488
|
+
} else {
|
|
489
|
+
reject(error);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
})
|
|
493
|
+
};
|
|
494
|
+
|
|
464
495
|
const submit$3 = ({ transaction, provider, signer }) => {
|
|
465
496
|
if(transaction.method) {
|
|
466
497
|
return submitContractInteraction$3({ transaction, signer, provider })
|
|
@@ -1145,7 +1176,6 @@
|
|
|
1145
1176
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
1146
1177
|
transaction.nonce = transactionCount;
|
|
1147
1178
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1148
|
-
console.log('tx', tx);
|
|
1149
1179
|
if (tx) {
|
|
1150
1180
|
let blockchain = Blockchains__default['default'].findByName(transaction.blockchain);
|
|
1151
1181
|
transaction.id = tx;
|
|
@@ -1184,9 +1214,21 @@
|
|
|
1184
1214
|
|
|
1185
1215
|
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
1186
1216
|
return new Promise((resolve, reject)=>{
|
|
1217
|
+
try {
|
|
1187
1218
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1219
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1220
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1221
|
+
setTimeout(()=>{
|
|
1222
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
1223
|
+
.then(resolve)
|
|
1224
|
+
.catch(reject);
|
|
1225
|
+
}, 500);
|
|
1226
|
+
} else {
|
|
1227
|
+
reject(error);
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
} catch (error) {
|
|
1231
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$5([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1190
1232
|
setTimeout(()=>{
|
|
1191
1233
|
retrieveConfirmedTransaction$2(sentTransaction)
|
|
1192
1234
|
.then(resolve)
|
|
@@ -1195,7 +1237,7 @@
|
|
|
1195
1237
|
} else {
|
|
1196
1238
|
reject(error);
|
|
1197
1239
|
}
|
|
1198
|
-
}
|
|
1240
|
+
}
|
|
1199
1241
|
})
|
|
1200
1242
|
};
|
|
1201
1243
|
|
|
@@ -1231,7 +1273,7 @@
|
|
|
1231
1273
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
1232
1274
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
1233
1275
|
let gasPrice = await provider.getGasPrice();
|
|
1234
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1276
|
+
if(_optionalChain$5([wallet, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.peerMeta, 'optionalAccess', _7 => _7.name]) === 'Uniswap Wallet') {
|
|
1235
1277
|
gasPrice = undefined;
|
|
1236
1278
|
} else {
|
|
1237
1279
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1255,7 +1297,7 @@
|
|
|
1255
1297
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1256
1298
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
1257
1299
|
let gasPrice = await provider.getGasPrice();
|
|
1258
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1300
|
+
if(_optionalChain$5([wallet, 'access', _8 => _8.session, 'optionalAccess', _9 => _9.peerMeta, 'optionalAccess', _10 => _10.name]) === 'Uniswap Wallet') {
|
|
1259
1301
|
gasPrice = undefined;
|
|
1260
1302
|
} else {
|
|
1261
1303
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1582,7 +1624,6 @@
|
|
|
1582
1624
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1583
1625
|
if(!sentTransaction) {
|
|
1584
1626
|
transaction._failed = true;
|
|
1585
|
-
console.log('Error retrieving transaction');
|
|
1586
1627
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1587
1628
|
} else {
|
|
1588
1629
|
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
@@ -1614,35 +1655,60 @@
|
|
|
1614
1655
|
|
|
1615
1656
|
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1616
1657
|
return new Promise((resolve, reject)=>{
|
|
1658
|
+
try {
|
|
1659
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1660
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
1661
|
+
setTimeout(()=>{
|
|
1662
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1663
|
+
.then(resolve)
|
|
1664
|
+
.catch(reject);
|
|
1665
|
+
}, 500);
|
|
1666
|
+
} else {
|
|
1667
|
+
reject(error);
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
} catch (error) {
|
|
1671
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
1672
|
+
setTimeout(()=>{
|
|
1673
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1674
|
+
.then(resolve)
|
|
1675
|
+
.catch(reject);
|
|
1676
|
+
}, 500);
|
|
1677
|
+
} else {
|
|
1678
|
+
reject(error);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
})
|
|
1682
|
+
};
|
|
1617
1683
|
|
|
1618
|
-
|
|
1619
|
-
|
|
1684
|
+
const retrieveTransaction = (tx, blockchain)=>{
|
|
1685
|
+
return new Promise(async(resolve, reject)=>{
|
|
1686
|
+
try {
|
|
1687
|
+
let sentTransaction;
|
|
1688
|
+
const provider = await web3Client.getProvider(blockchain);
|
|
1689
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1690
|
+
const maxRetries = 120;
|
|
1691
|
+
let attempt = 1;
|
|
1692
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1693
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1694
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1695
|
+
attempt++;
|
|
1696
|
+
}
|
|
1697
|
+
resolve(sentTransaction);
|
|
1698
|
+
} catch (error) {
|
|
1699
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$3([error, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]))) {
|
|
1620
1700
|
setTimeout(()=>{
|
|
1621
|
-
|
|
1701
|
+
retrieveTransaction(tx, blockchain)
|
|
1622
1702
|
.then(resolve)
|
|
1623
1703
|
.catch(reject);
|
|
1624
1704
|
}, 500);
|
|
1625
1705
|
} else {
|
|
1626
1706
|
reject(error);
|
|
1627
1707
|
}
|
|
1628
|
-
}
|
|
1708
|
+
}
|
|
1629
1709
|
})
|
|
1630
1710
|
};
|
|
1631
1711
|
|
|
1632
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1633
|
-
let sentTransaction;
|
|
1634
|
-
const provider = await web3Client.getProvider(blockchain);
|
|
1635
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1636
|
-
const maxRetries = 120;
|
|
1637
|
-
let attempt = 1;
|
|
1638
|
-
while (attempt <= maxRetries && !sentTransaction) {
|
|
1639
|
-
sentTransaction = await provider.getTransaction(tx);
|
|
1640
|
-
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1641
|
-
attempt++;
|
|
1642
|
-
}
|
|
1643
|
-
return sentTransaction
|
|
1644
|
-
};
|
|
1645
|
-
|
|
1646
1712
|
const submit$1 = ({ transaction, wallet }) => {
|
|
1647
1713
|
if(transaction.method) {
|
|
1648
1714
|
return submitContractInteraction$1({ transaction, wallet })
|
|
@@ -2126,9 +2192,21 @@
|
|
|
2126
2192
|
|
|
2127
2193
|
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
2128
2194
|
return new Promise((resolve, reject)=>{
|
|
2195
|
+
try {
|
|
2129
2196
|
|
|
2130
|
-
|
|
2131
|
-
|
|
2197
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
2198
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]))) {
|
|
2199
|
+
setTimeout(()=>{
|
|
2200
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
2201
|
+
.then(resolve)
|
|
2202
|
+
.catch(reject);
|
|
2203
|
+
}, 500);
|
|
2204
|
+
} else {
|
|
2205
|
+
reject(error);
|
|
2206
|
+
}
|
|
2207
|
+
});
|
|
2208
|
+
} catch(error) {
|
|
2209
|
+
if(["TypeError: undefined is not an object (evaluating 'error.message')", "TypeError: Cannot read properties of undefined (reading 'message')"].includes(_optionalChain$1([error, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]))) {
|
|
2132
2210
|
setTimeout(()=>{
|
|
2133
2211
|
retrieveConfirmedTransaction(sentTransaction)
|
|
2134
2212
|
.then(resolve)
|
|
@@ -2137,7 +2215,7 @@
|
|
|
2137
2215
|
} else {
|
|
2138
2216
|
reject(error);
|
|
2139
2217
|
}
|
|
2140
|
-
}
|
|
2218
|
+
}
|
|
2141
2219
|
})
|
|
2142
2220
|
};
|
|
2143
2221
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "16.2.
|
|
4
|
+
"version": "16.2.12",
|
|
5
5
|
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
|
|
6
6
|
"main": "dist/umd/index.evm.js",
|
|
7
7
|
"module": "dist/esm/index.evm.js",
|