@depay/widgets 6.16.0 → 6.16.4
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.bundle.js +22 -10
- package/dist/esm/index.js +1 -1
- package/dist/umd/index.bundle.js +22 -10
- package/dist/umd/index.js +1 -1
- package/package.json +2 -2
package/dist/esm/index.bundle.js
CHANGED
|
@@ -48841,7 +48841,13 @@ const submitSimpleTransfer = ({ transaction, wallet })=>{
|
|
|
48841
48841
|
};
|
|
48842
48842
|
|
|
48843
48843
|
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; }
|
|
48844
|
-
|
|
48844
|
+
const setConnectedInstance = (value)=>{
|
|
48845
|
+
window._connectedWalletConnectInstance = value;
|
|
48846
|
+
};
|
|
48847
|
+
|
|
48848
|
+
const getConnectedInstance = ()=>{
|
|
48849
|
+
return window._connectedWalletConnectInstance
|
|
48850
|
+
};
|
|
48845
48851
|
|
|
48846
48852
|
class WalletConnectWallet {
|
|
48847
48853
|
|
|
@@ -48891,12 +48897,12 @@ class WalletConnectWallet {
|
|
|
48891
48897
|
});
|
|
48892
48898
|
|
|
48893
48899
|
instance.on("disconnect", (error, payload) => {
|
|
48894
|
-
|
|
48900
|
+
setConnectedInstance(undefined);
|
|
48895
48901
|
if (error) { throw error }
|
|
48896
48902
|
});
|
|
48897
48903
|
|
|
48898
48904
|
instance.on("modal_closed", ()=>{
|
|
48899
|
-
|
|
48905
|
+
setConnectedInstance(undefined);
|
|
48900
48906
|
this.connector = undefined;
|
|
48901
48907
|
});
|
|
48902
48908
|
|
|
@@ -48915,23 +48921,28 @@ class WalletConnectWallet {
|
|
|
48915
48921
|
|
|
48916
48922
|
async connect(options) {
|
|
48917
48923
|
try {
|
|
48924
|
+
if(this.connector == undefined){
|
|
48925
|
+
this.connector = this.newWalletConnectInstance();
|
|
48926
|
+
}
|
|
48927
|
+
|
|
48918
48928
|
if(this.connector.connected) {
|
|
48919
48929
|
await this.connector.killSession();
|
|
48920
|
-
|
|
48930
|
+
setConnectedInstance(undefined);
|
|
48921
48931
|
this.connector = this.newWalletConnectInstance();
|
|
48922
48932
|
}
|
|
48923
48933
|
|
|
48924
48934
|
const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$6([options, 'optionalAccess', _ => _.chainId]) });
|
|
48925
48935
|
|
|
48926
48936
|
if(accounts instanceof Array && accounts.length) {
|
|
48927
|
-
|
|
48937
|
+
setConnectedInstance(this);
|
|
48928
48938
|
}
|
|
48929
48939
|
|
|
48930
48940
|
this.connectedAccounts = accounts;
|
|
48931
48941
|
this.connectedChainId = chainId;
|
|
48932
48942
|
|
|
48933
48943
|
return accounts
|
|
48934
|
-
} catch (
|
|
48944
|
+
} catch (error) {
|
|
48945
|
+
console.log('WALLETCONNECT ERROR', error);
|
|
48935
48946
|
return []
|
|
48936
48947
|
}
|
|
48937
48948
|
}
|
|
@@ -49025,7 +49036,7 @@ const wallets = {
|
|
|
49025
49036
|
const instances = {};
|
|
49026
49037
|
|
|
49027
49038
|
const getWalletClass = function(){
|
|
49028
|
-
if(
|
|
49039
|
+
if(getConnectedInstance()) {
|
|
49029
49040
|
return wallets.WalletConnect
|
|
49030
49041
|
} else if (typeof window.ethereum === 'object' && window.ethereum.isMetaMask) {
|
|
49031
49042
|
return wallets.MetaMask
|
|
@@ -49040,8 +49051,8 @@ const getWallet = function () {
|
|
|
49040
49051
|
const walletClass = getWalletClass();
|
|
49041
49052
|
const existingInstance = instances[walletClass];
|
|
49042
49053
|
|
|
49043
|
-
if(
|
|
49044
|
-
return
|
|
49054
|
+
if(getConnectedInstance()) {
|
|
49055
|
+
return getConnectedInstance()
|
|
49045
49056
|
} else if(existingInstance) {
|
|
49046
49057
|
return existingInstance
|
|
49047
49058
|
} else if(walletClass) {
|
|
@@ -68275,7 +68286,7 @@ var PaymentValueProvider = (function (props) {
|
|
|
68275
68286
|
var paymentAmountInBN = BigNumber$4.from(payment.route.fromAmount);
|
|
68276
68287
|
var divPercent = 100 - reverseAmountOutBN.mul(BigNumber$4.from('100')).div(paymentAmountInBN).abs().toString();
|
|
68277
68288
|
|
|
68278
|
-
if (divPercent
|
|
68289
|
+
if (divPercent > 5) {
|
|
68279
68290
|
setPaymentValueLoss(divPercent);
|
|
68280
68291
|
} else {
|
|
68281
68292
|
setPaymentValueLoss(null);
|
|
@@ -70070,6 +70081,7 @@ let TokenImage = function(props){
|
|
|
70070
70081
|
|
|
70071
70082
|
return(
|
|
70072
70083
|
react.createElement('img', {
|
|
70084
|
+
className: props.className ,
|
|
70073
70085
|
src: src ,
|
|
70074
70086
|
onError: handleLoadError , __self: this, __source: {fileName: _jsxFileName, lineNumber: 51}}
|
|
70075
70087
|
)
|
package/dist/esm/index.js
CHANGED
|
@@ -2818,7 +2818,7 @@ var PaymentValueProvider = (function (props) {
|
|
|
2818
2818
|
var paymentAmountInBN = ethers.BigNumber.from(payment.route.fromAmount);
|
|
2819
2819
|
var divPercent = 100 - reverseAmountOutBN.mul(ethers.BigNumber.from('100')).div(paymentAmountInBN).abs().toString();
|
|
2820
2820
|
|
|
2821
|
-
if (divPercent
|
|
2821
|
+
if (divPercent > 5) {
|
|
2822
2822
|
setPaymentValueLoss(divPercent);
|
|
2823
2823
|
} else {
|
|
2824
2824
|
setPaymentValueLoss(null);
|
package/dist/umd/index.bundle.js
CHANGED
|
@@ -48847,7 +48847,13 @@
|
|
|
48847
48847
|
};
|
|
48848
48848
|
|
|
48849
48849
|
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; }
|
|
48850
|
-
|
|
48850
|
+
const setConnectedInstance = (value)=>{
|
|
48851
|
+
window._connectedWalletConnectInstance = value;
|
|
48852
|
+
};
|
|
48853
|
+
|
|
48854
|
+
const getConnectedInstance = ()=>{
|
|
48855
|
+
return window._connectedWalletConnectInstance
|
|
48856
|
+
};
|
|
48851
48857
|
|
|
48852
48858
|
class WalletConnectWallet {
|
|
48853
48859
|
|
|
@@ -48897,12 +48903,12 @@
|
|
|
48897
48903
|
});
|
|
48898
48904
|
|
|
48899
48905
|
instance.on("disconnect", (error, payload) => {
|
|
48900
|
-
|
|
48906
|
+
setConnectedInstance(undefined);
|
|
48901
48907
|
if (error) { throw error }
|
|
48902
48908
|
});
|
|
48903
48909
|
|
|
48904
48910
|
instance.on("modal_closed", ()=>{
|
|
48905
|
-
|
|
48911
|
+
setConnectedInstance(undefined);
|
|
48906
48912
|
this.connector = undefined;
|
|
48907
48913
|
});
|
|
48908
48914
|
|
|
@@ -48921,23 +48927,28 @@
|
|
|
48921
48927
|
|
|
48922
48928
|
async connect(options) {
|
|
48923
48929
|
try {
|
|
48930
|
+
if(this.connector == undefined){
|
|
48931
|
+
this.connector = this.newWalletConnectInstance();
|
|
48932
|
+
}
|
|
48933
|
+
|
|
48924
48934
|
if(this.connector.connected) {
|
|
48925
48935
|
await this.connector.killSession();
|
|
48926
|
-
|
|
48936
|
+
setConnectedInstance(undefined);
|
|
48927
48937
|
this.connector = this.newWalletConnectInstance();
|
|
48928
48938
|
}
|
|
48929
48939
|
|
|
48930
48940
|
const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$6([options, 'optionalAccess', _ => _.chainId]) });
|
|
48931
48941
|
|
|
48932
48942
|
if(accounts instanceof Array && accounts.length) {
|
|
48933
|
-
|
|
48943
|
+
setConnectedInstance(this);
|
|
48934
48944
|
}
|
|
48935
48945
|
|
|
48936
48946
|
this.connectedAccounts = accounts;
|
|
48937
48947
|
this.connectedChainId = chainId;
|
|
48938
48948
|
|
|
48939
48949
|
return accounts
|
|
48940
|
-
} catch (
|
|
48950
|
+
} catch (error) {
|
|
48951
|
+
console.log('WALLETCONNECT ERROR', error);
|
|
48941
48952
|
return []
|
|
48942
48953
|
}
|
|
48943
48954
|
}
|
|
@@ -49031,7 +49042,7 @@
|
|
|
49031
49042
|
const instances = {};
|
|
49032
49043
|
|
|
49033
49044
|
const getWalletClass = function(){
|
|
49034
|
-
if(
|
|
49045
|
+
if(getConnectedInstance()) {
|
|
49035
49046
|
return wallets.WalletConnect
|
|
49036
49047
|
} else if (typeof window.ethereum === 'object' && window.ethereum.isMetaMask) {
|
|
49037
49048
|
return wallets.MetaMask
|
|
@@ -49046,8 +49057,8 @@
|
|
|
49046
49057
|
const walletClass = getWalletClass();
|
|
49047
49058
|
const existingInstance = instances[walletClass];
|
|
49048
49059
|
|
|
49049
|
-
if(
|
|
49050
|
-
return
|
|
49060
|
+
if(getConnectedInstance()) {
|
|
49061
|
+
return getConnectedInstance()
|
|
49051
49062
|
} else if(existingInstance) {
|
|
49052
49063
|
return existingInstance
|
|
49053
49064
|
} else if(walletClass) {
|
|
@@ -68281,7 +68292,7 @@
|
|
|
68281
68292
|
var paymentAmountInBN = BigNumber$4.from(payment.route.fromAmount);
|
|
68282
68293
|
var divPercent = 100 - reverseAmountOutBN.mul(BigNumber$4.from('100')).div(paymentAmountInBN).abs().toString();
|
|
68283
68294
|
|
|
68284
|
-
if (divPercent
|
|
68295
|
+
if (divPercent > 5) {
|
|
68285
68296
|
setPaymentValueLoss(divPercent);
|
|
68286
68297
|
} else {
|
|
68287
68298
|
setPaymentValueLoss(null);
|
|
@@ -70076,6 +70087,7 @@
|
|
|
70076
70087
|
|
|
70077
70088
|
return(
|
|
70078
70089
|
react.createElement('img', {
|
|
70090
|
+
className: props.className ,
|
|
70079
70091
|
src: src ,
|
|
70080
70092
|
onError: handleLoadError , __self: this, __source: {fileName: _jsxFileName, lineNumber: 51}}
|
|
70081
70093
|
)
|
package/dist/umd/index.js
CHANGED
|
@@ -2813,7 +2813,7 @@
|
|
|
2813
2813
|
var paymentAmountInBN = ethers.ethers.BigNumber.from(payment.route.fromAmount);
|
|
2814
2814
|
var divPercent = 100 - reverseAmountOutBN.mul(ethers.ethers.BigNumber.from('100')).div(paymentAmountInBN).abs().toString();
|
|
2815
2815
|
|
|
2816
|
-
if (divPercent
|
|
2816
|
+
if (divPercent > 5) {
|
|
2817
2817
|
setPaymentValueLoss(divPercent);
|
|
2818
2818
|
} else {
|
|
2819
2819
|
setPaymentValueLoss(null);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "6.16.
|
|
4
|
+
"version": "6.16.4",
|
|
5
5
|
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
|
|
6
6
|
"main": "./dist/umd/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@depay/web3-exchanges": "^8.1.0",
|
|
46
46
|
"@depay/web3-payments": "^9.3.3",
|
|
47
47
|
"@depay/web3-tokens": "^8.0.1",
|
|
48
|
-
"@depay/web3-wallets": "^9.0.
|
|
48
|
+
"@depay/web3-wallets": "^9.0.3",
|
|
49
49
|
"decimal.js": "^10.3.1",
|
|
50
50
|
"react-rangeslider": "^2.2.0"
|
|
51
51
|
},
|