@depay/web3-wallets-evm 16.3.5 → 16.3.6
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 +38 -16
- package/dist/esm/index.js +37 -15
- package/dist/umd/index.evm.js +37 -15
- package/dist/umd/index.js +37 -15
- package/package.json +1 -1
package/dist/esm/index.evm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { request,
|
|
1
|
+
import { request, estimate, getProvider } 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';
|
|
@@ -239,17 +239,24 @@ const submit$3 = ({ transaction, provider, signer }) => {
|
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
242
|
+
const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
|
|
243
243
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
244
244
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
245
245
|
let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
|
|
246
|
+
let gas;
|
|
247
|
+
try {
|
|
248
|
+
gas = await estimate(transaction);
|
|
249
|
+
gas = gas.add(gas.div(10));
|
|
250
|
+
} catch (e) {}
|
|
246
251
|
if(contractArguments) {
|
|
247
|
-
return method(...contractArguments, {
|
|
248
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
252
|
+
return await method(...contractArguments, {
|
|
253
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
254
|
+
gasLimit: _optionalChain$j([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
249
255
|
})
|
|
250
256
|
} else {
|
|
251
|
-
return method({
|
|
252
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
257
|
+
return await method({
|
|
258
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
259
|
+
gasLimit: _optionalChain$j([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
253
260
|
})
|
|
254
261
|
}
|
|
255
262
|
};
|
|
@@ -871,17 +878,20 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
871
878
|
} else {
|
|
872
879
|
gasPrice = gasPrice.toHexString();
|
|
873
880
|
}
|
|
874
|
-
let gas
|
|
881
|
+
let gas;
|
|
882
|
+
try {
|
|
883
|
+
gas = await estimate(transaction);
|
|
884
|
+
gas = gas.add(gas.div(10));
|
|
885
|
+
} catch (e2) {}
|
|
875
886
|
const data = await transaction.getData();
|
|
876
887
|
const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
|
|
877
888
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
878
|
-
gas = gas.add(gas.div(10));
|
|
879
889
|
return wallet.connector.sendTransaction({
|
|
880
890
|
from: transaction.from,
|
|
881
891
|
to: transaction.to,
|
|
882
892
|
value,
|
|
883
893
|
data,
|
|
884
|
-
gas: gas.toHexString(),
|
|
894
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
885
895
|
gasPrice,
|
|
886
896
|
nonce,
|
|
887
897
|
})
|
|
@@ -890,12 +900,16 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
890
900
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
891
901
|
const provider = await getProvider(transaction.blockchain);
|
|
892
902
|
let gasPrice = await provider.getGasPrice();
|
|
893
|
-
if(_optionalChain$5([wallet, 'access',
|
|
903
|
+
if(_optionalChain$5([wallet, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.peerMeta, 'optionalAccess', _14 => _14.name]) === 'Uniswap Wallet') {
|
|
894
904
|
gasPrice = undefined;
|
|
895
905
|
} else {
|
|
896
906
|
gasPrice = gasPrice.toHexString();
|
|
897
907
|
}
|
|
898
|
-
|
|
908
|
+
let gas;
|
|
909
|
+
try {
|
|
910
|
+
gas = await estimate(transaction);
|
|
911
|
+
gas = gas.add(gas.div(10));
|
|
912
|
+
} catch (e3) {}
|
|
899
913
|
const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
|
|
900
914
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
901
915
|
return wallet.connector.sendTransaction({
|
|
@@ -903,7 +917,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
903
917
|
to: transaction.to,
|
|
904
918
|
value,
|
|
905
919
|
data: '0x',
|
|
906
|
-
gas: gas.toHexString(),
|
|
920
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _15 => _15.toHexString, 'call', _16 => _16()]),
|
|
907
921
|
gasPrice,
|
|
908
922
|
nonce,
|
|
909
923
|
})
|
|
@@ -1322,7 +1336,11 @@ const submit$1 = ({ transaction, wallet }) => {
|
|
|
1322
1336
|
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
1323
1337
|
const provider = await getProvider(transaction.blockchain);
|
|
1324
1338
|
const blockchain = Blockchains[transaction.blockchain];
|
|
1325
|
-
|
|
1339
|
+
let gas;
|
|
1340
|
+
try {
|
|
1341
|
+
gas = await estimate(transaction);
|
|
1342
|
+
gas = gas.add(gas.div(10));
|
|
1343
|
+
} catch (e2) {}
|
|
1326
1344
|
const gasPrice = await provider.getGasPrice();
|
|
1327
1345
|
return wallet.signClient.request({
|
|
1328
1346
|
topic: wallet.session.topic,
|
|
@@ -1334,7 +1352,7 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1334
1352
|
to: transaction.to,
|
|
1335
1353
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1336
1354
|
data: await transaction.getData(),
|
|
1337
|
-
gas: gas.toHexString(),
|
|
1355
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1338
1356
|
gasPrice: gasPrice.toHexString(),
|
|
1339
1357
|
nonce: transaction.nonce,
|
|
1340
1358
|
}]
|
|
@@ -1345,7 +1363,11 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1345
1363
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
1346
1364
|
const provider = await getProvider(transaction.blockchain);
|
|
1347
1365
|
let blockchain = Blockchains[transaction.blockchain];
|
|
1348
|
-
|
|
1366
|
+
let gas;
|
|
1367
|
+
try {
|
|
1368
|
+
gas = await estimate(transaction);
|
|
1369
|
+
gas = gas.add(gas.div(10));
|
|
1370
|
+
} catch (e3) {}
|
|
1349
1371
|
const gasPrice = await provider.getGasPrice();
|
|
1350
1372
|
return wallet.signClient.request({
|
|
1351
1373
|
topic: wallet.session.topic,
|
|
@@ -1356,7 +1378,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1356
1378
|
from: transaction.from,
|
|
1357
1379
|
to: transaction.to,
|
|
1358
1380
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1359
|
-
gas: gas.toHexString(),
|
|
1381
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1360
1382
|
gasPrice: gasPrice.toHexString(),
|
|
1361
1383
|
nonce: transaction.nonce
|
|
1362
1384
|
}]
|
package/dist/esm/index.js
CHANGED
|
@@ -506,17 +506,24 @@ const submit$3 = ({ transaction, provider, signer }) => {
|
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
508
|
|
|
509
|
-
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
509
|
+
const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
|
|
510
510
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
511
511
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
512
512
|
let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
|
|
513
|
+
let gas;
|
|
514
|
+
try {
|
|
515
|
+
gas = await estimate(transaction);
|
|
516
|
+
gas = gas.add(gas.div(10));
|
|
517
|
+
} catch (e) {}
|
|
513
518
|
if(contractArguments) {
|
|
514
|
-
return method(...contractArguments, {
|
|
515
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
519
|
+
return await method(...contractArguments, {
|
|
520
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
521
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
516
522
|
})
|
|
517
523
|
} else {
|
|
518
|
-
return method({
|
|
519
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
524
|
+
return await method({
|
|
525
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
526
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
520
527
|
})
|
|
521
528
|
}
|
|
522
529
|
};
|
|
@@ -1409,17 +1416,20 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
1409
1416
|
} else {
|
|
1410
1417
|
gasPrice = gasPrice.toHexString();
|
|
1411
1418
|
}
|
|
1412
|
-
let gas
|
|
1419
|
+
let gas;
|
|
1420
|
+
try {
|
|
1421
|
+
gas = await estimate(transaction);
|
|
1422
|
+
gas = gas.add(gas.div(10));
|
|
1423
|
+
} catch (e2) {}
|
|
1413
1424
|
const data = await transaction.getData();
|
|
1414
1425
|
const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
|
|
1415
1426
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
1416
|
-
gas = gas.add(gas.div(10));
|
|
1417
1427
|
return wallet.connector.sendTransaction({
|
|
1418
1428
|
from: transaction.from,
|
|
1419
1429
|
to: transaction.to,
|
|
1420
1430
|
value,
|
|
1421
1431
|
data,
|
|
1422
|
-
gas: gas.toHexString(),
|
|
1432
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1423
1433
|
gasPrice,
|
|
1424
1434
|
nonce,
|
|
1425
1435
|
})
|
|
@@ -1428,12 +1438,16 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
1428
1438
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1429
1439
|
const provider = await getProvider(transaction.blockchain);
|
|
1430
1440
|
let gasPrice = await provider.getGasPrice();
|
|
1431
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1441
|
+
if(_optionalChain$5([wallet, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.peerMeta, 'optionalAccess', _14 => _14.name]) === 'Uniswap Wallet') {
|
|
1432
1442
|
gasPrice = undefined;
|
|
1433
1443
|
} else {
|
|
1434
1444
|
gasPrice = gasPrice.toHexString();
|
|
1435
1445
|
}
|
|
1436
|
-
|
|
1446
|
+
let gas;
|
|
1447
|
+
try {
|
|
1448
|
+
gas = await estimate(transaction);
|
|
1449
|
+
gas = gas.add(gas.div(10));
|
|
1450
|
+
} catch (e3) {}
|
|
1437
1451
|
const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
|
|
1438
1452
|
const nonce = ethers.utils.hexlify(transaction.nonce);
|
|
1439
1453
|
return wallet.connector.sendTransaction({
|
|
@@ -1441,7 +1455,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
1441
1455
|
to: transaction.to,
|
|
1442
1456
|
value,
|
|
1443
1457
|
data: '0x',
|
|
1444
|
-
gas: gas.toHexString(),
|
|
1458
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _15 => _15.toHexString, 'call', _16 => _16()]),
|
|
1445
1459
|
gasPrice,
|
|
1446
1460
|
nonce,
|
|
1447
1461
|
})
|
|
@@ -1860,7 +1874,11 @@ const submit$1 = ({ transaction, wallet }) => {
|
|
|
1860
1874
|
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
1861
1875
|
const provider = await getProvider(transaction.blockchain);
|
|
1862
1876
|
const blockchain = Blockchains[transaction.blockchain];
|
|
1863
|
-
|
|
1877
|
+
let gas;
|
|
1878
|
+
try {
|
|
1879
|
+
gas = await estimate(transaction);
|
|
1880
|
+
gas = gas.add(gas.div(10));
|
|
1881
|
+
} catch (e2) {}
|
|
1864
1882
|
const gasPrice = await provider.getGasPrice();
|
|
1865
1883
|
return wallet.signClient.request({
|
|
1866
1884
|
topic: wallet.session.topic,
|
|
@@ -1872,7 +1890,7 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1872
1890
|
to: transaction.to,
|
|
1873
1891
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1874
1892
|
data: await transaction.getData(),
|
|
1875
|
-
gas: gas.toHexString(),
|
|
1893
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1876
1894
|
gasPrice: gasPrice.toHexString(),
|
|
1877
1895
|
nonce: transaction.nonce,
|
|
1878
1896
|
}]
|
|
@@ -1883,7 +1901,11 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1883
1901
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
1884
1902
|
const provider = await getProvider(transaction.blockchain);
|
|
1885
1903
|
let blockchain = Blockchains[transaction.blockchain];
|
|
1886
|
-
|
|
1904
|
+
let gas;
|
|
1905
|
+
try {
|
|
1906
|
+
gas = await estimate(transaction);
|
|
1907
|
+
gas = gas.add(gas.div(10));
|
|
1908
|
+
} catch (e3) {}
|
|
1887
1909
|
const gasPrice = await provider.getGasPrice();
|
|
1888
1910
|
return wallet.signClient.request({
|
|
1889
1911
|
topic: wallet.session.topic,
|
|
@@ -1894,7 +1916,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1894
1916
|
from: transaction.from,
|
|
1895
1917
|
to: transaction.to,
|
|
1896
1918
|
value: transaction.value ? ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1897
|
-
gas: gas.toHexString(),
|
|
1919
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1898
1920
|
gasPrice: gasPrice.toHexString(),
|
|
1899
1921
|
nonce: transaction.nonce
|
|
1900
1922
|
}]
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -242,17 +242,24 @@
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
-
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
245
|
+
const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
|
|
246
246
|
let contract = new ethers.ethers.Contract(transaction.to, transaction.api, provider);
|
|
247
247
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
248
248
|
let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
|
|
249
|
+
let gas;
|
|
250
|
+
try {
|
|
251
|
+
gas = await web3ClientEvm.estimate(transaction);
|
|
252
|
+
gas = gas.add(gas.div(10));
|
|
253
|
+
} catch (e) {}
|
|
249
254
|
if(contractArguments) {
|
|
250
|
-
return method(...contractArguments, {
|
|
251
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
255
|
+
return await method(...contractArguments, {
|
|
256
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
257
|
+
gasLimit: _optionalChain$j([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
252
258
|
})
|
|
253
259
|
} else {
|
|
254
|
-
return method({
|
|
255
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
260
|
+
return await method({
|
|
261
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
262
|
+
gasLimit: _optionalChain$j([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
256
263
|
})
|
|
257
264
|
}
|
|
258
265
|
};
|
|
@@ -874,17 +881,20 @@
|
|
|
874
881
|
} else {
|
|
875
882
|
gasPrice = gasPrice.toHexString();
|
|
876
883
|
}
|
|
877
|
-
let gas
|
|
884
|
+
let gas;
|
|
885
|
+
try {
|
|
886
|
+
gas = await web3ClientEvm.estimate(transaction);
|
|
887
|
+
gas = gas.add(gas.div(10));
|
|
888
|
+
} catch (e2) {}
|
|
878
889
|
const data = await transaction.getData();
|
|
879
890
|
const value = transaction.value ? ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value)) : undefined;
|
|
880
891
|
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
881
|
-
gas = gas.add(gas.div(10));
|
|
882
892
|
return wallet.connector.sendTransaction({
|
|
883
893
|
from: transaction.from,
|
|
884
894
|
to: transaction.to,
|
|
885
895
|
value,
|
|
886
896
|
data,
|
|
887
|
-
gas: gas.toHexString(),
|
|
897
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
888
898
|
gasPrice,
|
|
889
899
|
nonce,
|
|
890
900
|
})
|
|
@@ -893,12 +903,16 @@
|
|
|
893
903
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
894
904
|
const provider = await web3ClientEvm.getProvider(transaction.blockchain);
|
|
895
905
|
let gasPrice = await provider.getGasPrice();
|
|
896
|
-
if(_optionalChain$5([wallet, 'access',
|
|
906
|
+
if(_optionalChain$5([wallet, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.peerMeta, 'optionalAccess', _14 => _14.name]) === 'Uniswap Wallet') {
|
|
897
907
|
gasPrice = undefined;
|
|
898
908
|
} else {
|
|
899
909
|
gasPrice = gasPrice.toHexString();
|
|
900
910
|
}
|
|
901
|
-
|
|
911
|
+
let gas;
|
|
912
|
+
try {
|
|
913
|
+
gas = await web3ClientEvm.estimate(transaction);
|
|
914
|
+
gas = gas.add(gas.div(10));
|
|
915
|
+
} catch (e3) {}
|
|
902
916
|
const value = ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value));
|
|
903
917
|
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
904
918
|
return wallet.connector.sendTransaction({
|
|
@@ -906,7 +920,7 @@
|
|
|
906
920
|
to: transaction.to,
|
|
907
921
|
value,
|
|
908
922
|
data: '0x',
|
|
909
|
-
gas: gas.toHexString(),
|
|
923
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _15 => _15.toHexString, 'call', _16 => _16()]),
|
|
910
924
|
gasPrice,
|
|
911
925
|
nonce,
|
|
912
926
|
})
|
|
@@ -1325,7 +1339,11 @@
|
|
|
1325
1339
|
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
1326
1340
|
const provider = await web3ClientEvm.getProvider(transaction.blockchain);
|
|
1327
1341
|
const blockchain = Blockchains__default['default'][transaction.blockchain];
|
|
1328
|
-
|
|
1342
|
+
let gas;
|
|
1343
|
+
try {
|
|
1344
|
+
gas = await web3ClientEvm.estimate(transaction);
|
|
1345
|
+
gas = gas.add(gas.div(10));
|
|
1346
|
+
} catch (e2) {}
|
|
1329
1347
|
const gasPrice = await provider.getGasPrice();
|
|
1330
1348
|
return wallet.signClient.request({
|
|
1331
1349
|
topic: wallet.session.topic,
|
|
@@ -1337,7 +1355,7 @@
|
|
|
1337
1355
|
to: transaction.to,
|
|
1338
1356
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1339
1357
|
data: await transaction.getData(),
|
|
1340
|
-
gas: gas.toHexString(),
|
|
1358
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1341
1359
|
gasPrice: gasPrice.toHexString(),
|
|
1342
1360
|
nonce: transaction.nonce,
|
|
1343
1361
|
}]
|
|
@@ -1348,7 +1366,11 @@
|
|
|
1348
1366
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
1349
1367
|
const provider = await web3ClientEvm.getProvider(transaction.blockchain);
|
|
1350
1368
|
let blockchain = Blockchains__default['default'][transaction.blockchain];
|
|
1351
|
-
|
|
1369
|
+
let gas;
|
|
1370
|
+
try {
|
|
1371
|
+
gas = await web3ClientEvm.estimate(transaction);
|
|
1372
|
+
gas = gas.add(gas.div(10));
|
|
1373
|
+
} catch (e3) {}
|
|
1352
1374
|
const gasPrice = await provider.getGasPrice();
|
|
1353
1375
|
return wallet.signClient.request({
|
|
1354
1376
|
topic: wallet.session.topic,
|
|
@@ -1359,7 +1381,7 @@
|
|
|
1359
1381
|
from: transaction.from,
|
|
1360
1382
|
to: transaction.to,
|
|
1361
1383
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1362
|
-
gas: gas.toHexString(),
|
|
1384
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1363
1385
|
gasPrice: gasPrice.toHexString(),
|
|
1364
1386
|
nonce: transaction.nonce
|
|
1365
1387
|
}]
|
package/dist/umd/index.js
CHANGED
|
@@ -508,17 +508,24 @@
|
|
|
508
508
|
}
|
|
509
509
|
};
|
|
510
510
|
|
|
511
|
-
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
511
|
+
const submitContractInteraction$3 = async ({ transaction, signer, provider })=>{
|
|
512
512
|
let contract = new ethers.ethers.Contract(transaction.to, transaction.api, provider);
|
|
513
513
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
514
514
|
let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
|
|
515
|
+
let gas;
|
|
516
|
+
try {
|
|
517
|
+
gas = await web3Client.estimate(transaction);
|
|
518
|
+
gas = gas.add(gas.div(10));
|
|
519
|
+
} catch (e) {}
|
|
515
520
|
if(contractArguments) {
|
|
516
|
-
return method(...contractArguments, {
|
|
517
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
521
|
+
return await method(...contractArguments, {
|
|
522
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
523
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _7 => _7.toHexString, 'call', _8 => _8()])
|
|
518
524
|
})
|
|
519
525
|
} else {
|
|
520
|
-
return method({
|
|
521
|
-
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
526
|
+
return await method({
|
|
527
|
+
value: Transaction.bigNumberify(transaction.value, transaction.blockchain),
|
|
528
|
+
gasLimit: _optionalChain$p([gas, 'optionalAccess', _9 => _9.toHexString, 'call', _10 => _10()])
|
|
522
529
|
})
|
|
523
530
|
}
|
|
524
531
|
};
|
|
@@ -1411,17 +1418,20 @@
|
|
|
1411
1418
|
} else {
|
|
1412
1419
|
gasPrice = gasPrice.toHexString();
|
|
1413
1420
|
}
|
|
1414
|
-
let gas
|
|
1421
|
+
let gas;
|
|
1422
|
+
try {
|
|
1423
|
+
gas = await web3Client.estimate(transaction);
|
|
1424
|
+
gas = gas.add(gas.div(10));
|
|
1425
|
+
} catch (e2) {}
|
|
1415
1426
|
const data = await transaction.getData();
|
|
1416
1427
|
const value = transaction.value ? ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value)) : undefined;
|
|
1417
1428
|
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
1418
|
-
gas = gas.add(gas.div(10));
|
|
1419
1429
|
return wallet.connector.sendTransaction({
|
|
1420
1430
|
from: transaction.from,
|
|
1421
1431
|
to: transaction.to,
|
|
1422
1432
|
value,
|
|
1423
1433
|
data,
|
|
1424
|
-
gas: gas.toHexString(),
|
|
1434
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1425
1435
|
gasPrice,
|
|
1426
1436
|
nonce,
|
|
1427
1437
|
})
|
|
@@ -1430,12 +1440,16 @@
|
|
|
1430
1440
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1431
1441
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
1432
1442
|
let gasPrice = await provider.getGasPrice();
|
|
1433
|
-
if(_optionalChain$5([wallet, 'access',
|
|
1443
|
+
if(_optionalChain$5([wallet, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.peerMeta, 'optionalAccess', _14 => _14.name]) === 'Uniswap Wallet') {
|
|
1434
1444
|
gasPrice = undefined;
|
|
1435
1445
|
} else {
|
|
1436
1446
|
gasPrice = gasPrice.toHexString();
|
|
1437
1447
|
}
|
|
1438
|
-
|
|
1448
|
+
let gas;
|
|
1449
|
+
try {
|
|
1450
|
+
gas = await web3Client.estimate(transaction);
|
|
1451
|
+
gas = gas.add(gas.div(10));
|
|
1452
|
+
} catch (e3) {}
|
|
1439
1453
|
const value = ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value));
|
|
1440
1454
|
const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
|
|
1441
1455
|
return wallet.connector.sendTransaction({
|
|
@@ -1443,7 +1457,7 @@
|
|
|
1443
1457
|
to: transaction.to,
|
|
1444
1458
|
value,
|
|
1445
1459
|
data: '0x',
|
|
1446
|
-
gas: gas.toHexString(),
|
|
1460
|
+
gas: _optionalChain$5([gas, 'optionalAccess', _15 => _15.toHexString, 'call', _16 => _16()]),
|
|
1447
1461
|
gasPrice,
|
|
1448
1462
|
nonce,
|
|
1449
1463
|
})
|
|
@@ -1862,7 +1876,11 @@
|
|
|
1862
1876
|
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
1863
1877
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
1864
1878
|
const blockchain = Blockchains__default['default'][transaction.blockchain];
|
|
1865
|
-
|
|
1879
|
+
let gas;
|
|
1880
|
+
try {
|
|
1881
|
+
gas = await web3Client.estimate(transaction);
|
|
1882
|
+
gas = gas.add(gas.div(10));
|
|
1883
|
+
} catch (e2) {}
|
|
1866
1884
|
const gasPrice = await provider.getGasPrice();
|
|
1867
1885
|
return wallet.signClient.request({
|
|
1868
1886
|
topic: wallet.session.topic,
|
|
@@ -1874,7 +1892,7 @@
|
|
|
1874
1892
|
to: transaction.to,
|
|
1875
1893
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1876
1894
|
data: await transaction.getData(),
|
|
1877
|
-
gas: gas.toHexString(),
|
|
1895
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _10 => _10.toHexString, 'call', _11 => _11()]),
|
|
1878
1896
|
gasPrice: gasPrice.toHexString(),
|
|
1879
1897
|
nonce: transaction.nonce,
|
|
1880
1898
|
}]
|
|
@@ -1885,7 +1903,11 @@
|
|
|
1885
1903
|
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
1886
1904
|
const provider = await web3Client.getProvider(transaction.blockchain);
|
|
1887
1905
|
let blockchain = Blockchains__default['default'][transaction.blockchain];
|
|
1888
|
-
|
|
1906
|
+
let gas;
|
|
1907
|
+
try {
|
|
1908
|
+
gas = await web3Client.estimate(transaction);
|
|
1909
|
+
gas = gas.add(gas.div(10));
|
|
1910
|
+
} catch (e3) {}
|
|
1889
1911
|
const gasPrice = await provider.getGasPrice();
|
|
1890
1912
|
return wallet.signClient.request({
|
|
1891
1913
|
topic: wallet.session.topic,
|
|
@@ -1896,7 +1918,7 @@
|
|
|
1896
1918
|
from: transaction.from,
|
|
1897
1919
|
to: transaction.to,
|
|
1898
1920
|
value: transaction.value ? ethers.ethers.BigNumber.from(transaction.value.toString()).toHexString() : undefined,
|
|
1899
|
-
gas: gas.toHexString(),
|
|
1921
|
+
gas: _optionalChain$3([gas, 'optionalAccess', _12 => _12.toHexString, 'call', _13 => _13()]),
|
|
1900
1922
|
gasPrice: gasPrice.toHexString(),
|
|
1901
1923
|
nonce: transaction.nonce
|
|
1902
1924
|
}]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "16.3.
|
|
4
|
+
"version": "16.3.6",
|
|
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",
|