@depay/widgets 6.19.1 → 6.20.1
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 +29 -36
- package/dist/esm/index.js +21 -26
- package/dist/umd/index.bundle.js +29 -36
- package/dist/umd/index.js +21 -26
- package/package.json +3 -3
package/dist/esm/index.bundle.js
CHANGED
|
@@ -49441,7 +49441,7 @@ var ErrorProvider = (function (props) {
|
|
|
49441
49441
|
}, /*#__PURE__*/react.createElement("div", {
|
|
49442
49442
|
className: "PaddingTopS PaddingLeftS PaddingRightS"
|
|
49443
49443
|
})), /*#__PURE__*/react.createElement("div", {
|
|
49444
|
-
className: "DialogBody"
|
|
49444
|
+
className: "DialogBody TextCenter"
|
|
49445
49445
|
}, /*#__PURE__*/react.createElement("div", {
|
|
49446
49446
|
className: "GraphicWrapper PaddingTopS"
|
|
49447
49447
|
}, /*#__PURE__*/react.createElement("img", {
|
|
@@ -62347,13 +62347,15 @@ class Currency {
|
|
|
62347
62347
|
return timezoneToCurrency[timeZone || Currency.timeZone()] || 'USD'
|
|
62348
62348
|
}
|
|
62349
62349
|
|
|
62350
|
-
static async fromUSD({ amount, code, timeZone
|
|
62350
|
+
static async fromUSD({ amount, code, timeZone }) {
|
|
62351
62351
|
let currency = new Currency({ amount, code, timeZone });
|
|
62352
|
-
let rate = await fetch('https://
|
|
62353
|
-
headers: { 'X-Api-Key': apiKey },
|
|
62354
|
-
})
|
|
62352
|
+
let rate = await fetch('https://public.depay.fi/currencies/' + currency.code)
|
|
62355
62353
|
.then((response) => response.json())
|
|
62356
|
-
.then((data) => parseFloat(data))
|
|
62354
|
+
.then((data) => parseFloat(data))
|
|
62355
|
+
.catch(()=>{
|
|
62356
|
+
currency.code = "USD";
|
|
62357
|
+
return 1
|
|
62358
|
+
});
|
|
62357
62359
|
currency.amount = currency.amount * rate;
|
|
62358
62360
|
return currency
|
|
62359
62361
|
}
|
|
@@ -62388,11 +62390,9 @@ var ConfigurationProvider = (function (props) {
|
|
|
62388
62390
|
}, props.children);
|
|
62389
62391
|
});
|
|
62390
62392
|
|
|
62391
|
-
var apiKey = 'M5dZeHFfIp3J7h9H9fs4i4wmkUo1HjAF3EmMy32c';
|
|
62392
|
-
|
|
62393
62393
|
var ConversionRateProvider = (function (props) {
|
|
62394
|
-
var _useContext = react.useContext(ErrorContext)
|
|
62395
|
-
|
|
62394
|
+
var _useContext = react.useContext(ErrorContext);
|
|
62395
|
+
_useContext.setError;
|
|
62396
62396
|
|
|
62397
62397
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
62398
62398
|
currency = _useContext2.currency;
|
|
@@ -62405,11 +62405,10 @@ var ConversionRateProvider = (function (props) {
|
|
|
62405
62405
|
react.useEffect(function () {
|
|
62406
62406
|
Currency.fromUSD({
|
|
62407
62407
|
amount: 1,
|
|
62408
|
-
code: currency
|
|
62409
|
-
apiKey: apiKey
|
|
62408
|
+
code: currency
|
|
62410
62409
|
}).then(function (conversion) {
|
|
62411
62410
|
return setConversionRate(conversion.amount);
|
|
62412
|
-
})["catch"](
|
|
62411
|
+
})["catch"](setConversionRate(1));
|
|
62413
62412
|
}, []);
|
|
62414
62413
|
return /*#__PURE__*/react.createElement(ConversionRateContext.Provider, {
|
|
62415
62414
|
value: {
|
|
@@ -62788,14 +62787,10 @@ const getAssets = async (options) => {
|
|
|
62788
62787
|
}
|
|
62789
62788
|
if (!account) { return }
|
|
62790
62789
|
|
|
62791
|
-
if(options.apiKey == undefined) { throw 'Web3Wallets: Please pass an apiKey. See documentation.' }
|
|
62792
|
-
|
|
62793
62790
|
let assets = Promise.all(
|
|
62794
62791
|
(options.blockchain ? [options.blockchain] : wallet.blockchains).map((blockchain) =>{
|
|
62795
62792
|
|
|
62796
|
-
return fetch(`https://
|
|
62797
|
-
headers: { 'x-api-key': options.apiKey }
|
|
62798
|
-
})
|
|
62793
|
+
return fetch(`https://public.depay.fi/accounts/${blockchain}/${account}/assets`)
|
|
62799
62794
|
.then((response) => response.json())
|
|
62800
62795
|
.then(async (assets) => {
|
|
62801
62796
|
return await ensureNativeTokenAsset({
|
|
@@ -68102,8 +68097,7 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
68102
68097
|
whitelist: props.whitelist,
|
|
68103
68098
|
blacklist: props.blacklist,
|
|
68104
68099
|
event: props.event,
|
|
68105
|
-
fee: props.fee
|
|
68106
|
-
apiKey: apiKey
|
|
68100
|
+
fee: props.fee
|
|
68107
68101
|
}).then(function (routes) {
|
|
68108
68102
|
if (routes.length == 0) {
|
|
68109
68103
|
setAllRoutes([]);
|
|
@@ -68318,9 +68312,8 @@ var PaymentValueProvider = (function (props) {
|
|
|
68318
68312
|
var toTokenUSDValue = formatUnits(toTokenUSDAmount, USDDecimals);
|
|
68319
68313
|
Currency.fromUSD({
|
|
68320
68314
|
amount: toTokenUSDValue,
|
|
68321
|
-
code: currency
|
|
68322
|
-
|
|
68323
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
68315
|
+
code: currency
|
|
68316
|
+
}).then(setPaymentValue);
|
|
68324
68317
|
})["catch"](setError);
|
|
68325
68318
|
};
|
|
68326
68319
|
|
|
@@ -70935,7 +70928,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
70935
70928
|
|
|
70936
70929
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
70937
70930
|
track = _useContext2.track,
|
|
70938
|
-
integration = _useContext2.integration
|
|
70931
|
+
integration = _useContext2.integration,
|
|
70932
|
+
type = _useContext2.type;
|
|
70939
70933
|
|
|
70940
70934
|
var _useState = react.useState(),
|
|
70941
70935
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71135,12 +71129,11 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
71135
71129
|
return;
|
|
71136
71130
|
}
|
|
71137
71131
|
|
|
71138
|
-
fetch('https://
|
|
71139
|
-
method: 'POST',
|
|
71132
|
+
fetch('https://public.depay.fi/payments', {
|
|
71140
71133
|
headers: {
|
|
71141
|
-
'X-Api-Key': apiKey,
|
|
71142
71134
|
'Content-Type': 'application/json'
|
|
71143
71135
|
},
|
|
71136
|
+
method: 'POST',
|
|
71144
71137
|
body: JSON.stringify({
|
|
71145
71138
|
blockchain: transaction.blockchain,
|
|
71146
71139
|
transaction: transaction.id,
|
|
@@ -71156,7 +71149,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
71156
71149
|
sender_id: transaction.from.toLowerCase(),
|
|
71157
71150
|
sender_token_id: paymentRoute.fromToken.address,
|
|
71158
71151
|
sender_amount: formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
71159
|
-
integration: integration
|
|
71152
|
+
integration: integration,
|
|
71153
|
+
type: type
|
|
71160
71154
|
},
|
|
71161
71155
|
fee_amount: paymentRoute.fee ? formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
71162
71156
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -71224,7 +71218,7 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
71224
71218
|
react.useEffect(function () {
|
|
71225
71219
|
if (polling) {
|
|
71226
71220
|
var poll = function poll() {
|
|
71227
|
-
fetch("https://
|
|
71221
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
71228
71222
|
if (response.status == 200) {
|
|
71229
71223
|
response.json().then(function (data) {
|
|
71230
71224
|
if (data.status != 'pending') {
|
|
@@ -71253,10 +71247,9 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
71253
71247
|
return;
|
|
71254
71248
|
}
|
|
71255
71249
|
|
|
71256
|
-
fetch('https://
|
|
71250
|
+
fetch('https://public.depay.fi/transactions', {
|
|
71257
71251
|
method: 'POST',
|
|
71258
71252
|
headers: {
|
|
71259
|
-
'X-Api-Key': apiKey,
|
|
71260
71253
|
'Content-Type': 'application/json'
|
|
71261
71254
|
},
|
|
71262
71255
|
body: JSON.stringify({
|
|
@@ -71473,6 +71466,7 @@ var Donation = /*#__PURE__*/function () {
|
|
|
71473
71466
|
unmount: unmount
|
|
71474
71467
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71475
71468
|
configuration: {
|
|
71469
|
+
type: 'donation',
|
|
71476
71470
|
amount: amount,
|
|
71477
71471
|
accept: accept,
|
|
71478
71472
|
currency: currency,
|
|
@@ -71971,6 +71965,7 @@ var Payment = /*#__PURE__*/function () {
|
|
|
71971
71965
|
unmount: unmount
|
|
71972
71966
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71973
71967
|
configuration: {
|
|
71968
|
+
type: 'payment',
|
|
71974
71969
|
amount: amount,
|
|
71975
71970
|
accept: accept,
|
|
71976
71971
|
currency: currency,
|
|
@@ -72385,6 +72380,7 @@ var Sale = /*#__PURE__*/function () {
|
|
|
72385
72380
|
unmount: unmount
|
|
72386
72381
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
72387
72382
|
configuration: {
|
|
72383
|
+
type: 'sale',
|
|
72388
72384
|
tokenImage: tokenImage,
|
|
72389
72385
|
amount: amount,
|
|
72390
72386
|
sell: sell,
|
|
@@ -72770,11 +72766,8 @@ var SelectTokenDialog = (function (props) {
|
|
|
72770
72766
|
});
|
|
72771
72767
|
} else if (term && term.length) {
|
|
72772
72768
|
setTokens([]);
|
|
72773
|
-
fetch("https://
|
|
72774
|
-
signal: signal
|
|
72775
|
-
headers: {
|
|
72776
|
-
'X-Api-Key': apiKey
|
|
72777
|
-
}
|
|
72769
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
72770
|
+
signal: signal
|
|
72778
72771
|
}).then(function (response) {
|
|
72779
72772
|
if (response.status == 200) {
|
|
72780
72773
|
response.json().then(function (tokens) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1627,7 +1627,7 @@ var ErrorProvider = (function (props) {
|
|
|
1627
1627
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1628
1628
|
className: "PaddingTopS PaddingLeftS PaddingRightS"
|
|
1629
1629
|
})), /*#__PURE__*/React.createElement("div", {
|
|
1630
|
-
className: "DialogBody"
|
|
1630
|
+
className: "DialogBody TextCenter"
|
|
1631
1631
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1632
1632
|
className: "GraphicWrapper PaddingTopS"
|
|
1633
1633
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -2212,11 +2212,9 @@ var ConfigurationProvider = (function (props) {
|
|
|
2212
2212
|
}, props.children);
|
|
2213
2213
|
});
|
|
2214
2214
|
|
|
2215
|
-
var apiKey = 'M5dZeHFfIp3J7h9H9fs4i4wmkUo1HjAF3EmMy32c';
|
|
2216
|
-
|
|
2217
2215
|
var ConversionRateProvider = (function (props) {
|
|
2218
|
-
var _useContext = useContext(ErrorContext)
|
|
2219
|
-
|
|
2216
|
+
var _useContext = useContext(ErrorContext);
|
|
2217
|
+
_useContext.setError;
|
|
2220
2218
|
|
|
2221
2219
|
var _useContext2 = useContext(ConfigurationContext),
|
|
2222
2220
|
currency = _useContext2.currency;
|
|
@@ -2229,11 +2227,10 @@ var ConversionRateProvider = (function (props) {
|
|
|
2229
2227
|
useEffect(function () {
|
|
2230
2228
|
Currency.fromUSD({
|
|
2231
2229
|
amount: 1,
|
|
2232
|
-
code: currency
|
|
2233
|
-
apiKey: apiKey
|
|
2230
|
+
code: currency
|
|
2234
2231
|
}).then(function (conversion) {
|
|
2235
2232
|
return setConversionRate(conversion.amount);
|
|
2236
|
-
})["catch"](
|
|
2233
|
+
})["catch"](setConversionRate(1));
|
|
2237
2234
|
}, []);
|
|
2238
2235
|
return /*#__PURE__*/React.createElement(ConversionRateContext.Provider, {
|
|
2239
2236
|
value: {
|
|
@@ -2627,8 +2624,7 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
2627
2624
|
whitelist: props.whitelist,
|
|
2628
2625
|
blacklist: props.blacklist,
|
|
2629
2626
|
event: props.event,
|
|
2630
|
-
fee: props.fee
|
|
2631
|
-
apiKey: apiKey
|
|
2627
|
+
fee: props.fee
|
|
2632
2628
|
}).then(function (routes) {
|
|
2633
2629
|
if (routes.length == 0) {
|
|
2634
2630
|
setAllRoutes([]);
|
|
@@ -2843,9 +2839,8 @@ var PaymentValueProvider = (function (props) {
|
|
|
2843
2839
|
var toTokenUSDValue = ethers.utils.formatUnits(toTokenUSDAmount, USDDecimals);
|
|
2844
2840
|
Currency.fromUSD({
|
|
2845
2841
|
amount: toTokenUSDValue,
|
|
2846
|
-
code: currency
|
|
2847
|
-
|
|
2848
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
2842
|
+
code: currency
|
|
2843
|
+
}).then(setPaymentValue);
|
|
2849
2844
|
})["catch"](setError);
|
|
2850
2845
|
};
|
|
2851
2846
|
|
|
@@ -3745,7 +3740,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
3745
3740
|
|
|
3746
3741
|
var _useContext2 = useContext(ConfigurationContext),
|
|
3747
3742
|
track = _useContext2.track,
|
|
3748
|
-
integration = _useContext2.integration
|
|
3743
|
+
integration = _useContext2.integration,
|
|
3744
|
+
type = _useContext2.type;
|
|
3749
3745
|
|
|
3750
3746
|
var _useState = useState(),
|
|
3751
3747
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -3945,12 +3941,11 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
3945
3941
|
return;
|
|
3946
3942
|
}
|
|
3947
3943
|
|
|
3948
|
-
fetch('https://
|
|
3949
|
-
method: 'POST',
|
|
3944
|
+
fetch('https://public.depay.fi/payments', {
|
|
3950
3945
|
headers: {
|
|
3951
|
-
'X-Api-Key': apiKey,
|
|
3952
3946
|
'Content-Type': 'application/json'
|
|
3953
3947
|
},
|
|
3948
|
+
method: 'POST',
|
|
3954
3949
|
body: JSON.stringify({
|
|
3955
3950
|
blockchain: transaction.blockchain,
|
|
3956
3951
|
transaction: transaction.id,
|
|
@@ -3966,7 +3961,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
3966
3961
|
sender_id: transaction.from.toLowerCase(),
|
|
3967
3962
|
sender_token_id: paymentRoute.fromToken.address,
|
|
3968
3963
|
sender_amount: ethers.utils.formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
3969
|
-
integration: integration
|
|
3964
|
+
integration: integration,
|
|
3965
|
+
type: type
|
|
3970
3966
|
},
|
|
3971
3967
|
fee_amount: paymentRoute.fee ? ethers.utils.formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
3972
3968
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -4034,7 +4030,7 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
4034
4030
|
useEffect(function () {
|
|
4035
4031
|
if (polling) {
|
|
4036
4032
|
var poll = function poll() {
|
|
4037
|
-
fetch("https://
|
|
4033
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
4038
4034
|
if (response.status == 200) {
|
|
4039
4035
|
response.json().then(function (data) {
|
|
4040
4036
|
if (data.status != 'pending') {
|
|
@@ -4063,10 +4059,9 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
4063
4059
|
return;
|
|
4064
4060
|
}
|
|
4065
4061
|
|
|
4066
|
-
fetch('https://
|
|
4062
|
+
fetch('https://public.depay.fi/transactions', {
|
|
4067
4063
|
method: 'POST',
|
|
4068
4064
|
headers: {
|
|
4069
|
-
'X-Api-Key': apiKey,
|
|
4070
4065
|
'Content-Type': 'application/json'
|
|
4071
4066
|
},
|
|
4072
4067
|
body: JSON.stringify({
|
|
@@ -4283,6 +4278,7 @@ var Donation = /*#__PURE__*/function () {
|
|
|
4283
4278
|
unmount: unmount
|
|
4284
4279
|
}, /*#__PURE__*/React.createElement(ConfigurationProvider, {
|
|
4285
4280
|
configuration: {
|
|
4281
|
+
type: 'donation',
|
|
4286
4282
|
amount: amount,
|
|
4287
4283
|
accept: accept,
|
|
4288
4284
|
currency: currency,
|
|
@@ -4781,6 +4777,7 @@ var Payment = /*#__PURE__*/function () {
|
|
|
4781
4777
|
unmount: unmount
|
|
4782
4778
|
}, /*#__PURE__*/React.createElement(ConfigurationProvider, {
|
|
4783
4779
|
configuration: {
|
|
4780
|
+
type: 'payment',
|
|
4784
4781
|
amount: amount,
|
|
4785
4782
|
accept: accept,
|
|
4786
4783
|
currency: currency,
|
|
@@ -5195,6 +5192,7 @@ var Sale = /*#__PURE__*/function () {
|
|
|
5195
5192
|
unmount: unmount
|
|
5196
5193
|
}, /*#__PURE__*/React.createElement(ConfigurationProvider, {
|
|
5197
5194
|
configuration: {
|
|
5195
|
+
type: 'sale',
|
|
5198
5196
|
tokenImage: tokenImage,
|
|
5199
5197
|
amount: amount,
|
|
5200
5198
|
sell: sell,
|
|
@@ -5580,11 +5578,8 @@ var SelectTokenDialog = (function (props) {
|
|
|
5580
5578
|
});
|
|
5581
5579
|
} else if (term && term.length) {
|
|
5582
5580
|
setTokens([]);
|
|
5583
|
-
fetch("https://
|
|
5584
|
-
signal: signal
|
|
5585
|
-
headers: {
|
|
5586
|
-
'X-Api-Key': apiKey
|
|
5587
|
-
}
|
|
5581
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
5582
|
+
signal: signal
|
|
5588
5583
|
}).then(function (response) {
|
|
5589
5584
|
if (response.status == 200) {
|
|
5590
5585
|
response.json().then(function (tokens) {
|
package/dist/umd/index.bundle.js
CHANGED
|
@@ -49447,7 +49447,7 @@
|
|
|
49447
49447
|
}, /*#__PURE__*/react.createElement("div", {
|
|
49448
49448
|
className: "PaddingTopS PaddingLeftS PaddingRightS"
|
|
49449
49449
|
})), /*#__PURE__*/react.createElement("div", {
|
|
49450
|
-
className: "DialogBody"
|
|
49450
|
+
className: "DialogBody TextCenter"
|
|
49451
49451
|
}, /*#__PURE__*/react.createElement("div", {
|
|
49452
49452
|
className: "GraphicWrapper PaddingTopS"
|
|
49453
49453
|
}, /*#__PURE__*/react.createElement("img", {
|
|
@@ -62353,13 +62353,15 @@
|
|
|
62353
62353
|
return timezoneToCurrency[timeZone || Currency.timeZone()] || 'USD'
|
|
62354
62354
|
}
|
|
62355
62355
|
|
|
62356
|
-
static async fromUSD({ amount, code, timeZone
|
|
62356
|
+
static async fromUSD({ amount, code, timeZone }) {
|
|
62357
62357
|
let currency = new Currency({ amount, code, timeZone });
|
|
62358
|
-
let rate = await fetch('https://
|
|
62359
|
-
headers: { 'X-Api-Key': apiKey },
|
|
62360
|
-
})
|
|
62358
|
+
let rate = await fetch('https://public.depay.fi/currencies/' + currency.code)
|
|
62361
62359
|
.then((response) => response.json())
|
|
62362
|
-
.then((data) => parseFloat(data))
|
|
62360
|
+
.then((data) => parseFloat(data))
|
|
62361
|
+
.catch(()=>{
|
|
62362
|
+
currency.code = "USD";
|
|
62363
|
+
return 1
|
|
62364
|
+
});
|
|
62363
62365
|
currency.amount = currency.amount * rate;
|
|
62364
62366
|
return currency
|
|
62365
62367
|
}
|
|
@@ -62394,11 +62396,9 @@
|
|
|
62394
62396
|
}, props.children);
|
|
62395
62397
|
});
|
|
62396
62398
|
|
|
62397
|
-
var apiKey = 'M5dZeHFfIp3J7h9H9fs4i4wmkUo1HjAF3EmMy32c';
|
|
62398
|
-
|
|
62399
62399
|
var ConversionRateProvider = (function (props) {
|
|
62400
|
-
var _useContext = react.useContext(ErrorContext)
|
|
62401
|
-
|
|
62400
|
+
var _useContext = react.useContext(ErrorContext);
|
|
62401
|
+
_useContext.setError;
|
|
62402
62402
|
|
|
62403
62403
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
62404
62404
|
currency = _useContext2.currency;
|
|
@@ -62411,11 +62411,10 @@
|
|
|
62411
62411
|
react.useEffect(function () {
|
|
62412
62412
|
Currency.fromUSD({
|
|
62413
62413
|
amount: 1,
|
|
62414
|
-
code: currency
|
|
62415
|
-
apiKey: apiKey
|
|
62414
|
+
code: currency
|
|
62416
62415
|
}).then(function (conversion) {
|
|
62417
62416
|
return setConversionRate(conversion.amount);
|
|
62418
|
-
})["catch"](
|
|
62417
|
+
})["catch"](setConversionRate(1));
|
|
62419
62418
|
}, []);
|
|
62420
62419
|
return /*#__PURE__*/react.createElement(ConversionRateContext.Provider, {
|
|
62421
62420
|
value: {
|
|
@@ -62794,14 +62793,10 @@
|
|
|
62794
62793
|
}
|
|
62795
62794
|
if (!account) { return }
|
|
62796
62795
|
|
|
62797
|
-
if(options.apiKey == undefined) { throw 'Web3Wallets: Please pass an apiKey. See documentation.' }
|
|
62798
|
-
|
|
62799
62796
|
let assets = Promise.all(
|
|
62800
62797
|
(options.blockchain ? [options.blockchain] : wallet.blockchains).map((blockchain) =>{
|
|
62801
62798
|
|
|
62802
|
-
return fetch(`https://
|
|
62803
|
-
headers: { 'x-api-key': options.apiKey }
|
|
62804
|
-
})
|
|
62799
|
+
return fetch(`https://public.depay.fi/accounts/${blockchain}/${account}/assets`)
|
|
62805
62800
|
.then((response) => response.json())
|
|
62806
62801
|
.then(async (assets) => {
|
|
62807
62802
|
return await ensureNativeTokenAsset({
|
|
@@ -68108,8 +68103,7 @@
|
|
|
68108
68103
|
whitelist: props.whitelist,
|
|
68109
68104
|
blacklist: props.blacklist,
|
|
68110
68105
|
event: props.event,
|
|
68111
|
-
fee: props.fee
|
|
68112
|
-
apiKey: apiKey
|
|
68106
|
+
fee: props.fee
|
|
68113
68107
|
}).then(function (routes) {
|
|
68114
68108
|
if (routes.length == 0) {
|
|
68115
68109
|
setAllRoutes([]);
|
|
@@ -68324,9 +68318,8 @@
|
|
|
68324
68318
|
var toTokenUSDValue = formatUnits(toTokenUSDAmount, USDDecimals);
|
|
68325
68319
|
Currency.fromUSD({
|
|
68326
68320
|
amount: toTokenUSDValue,
|
|
68327
|
-
code: currency
|
|
68328
|
-
|
|
68329
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
68321
|
+
code: currency
|
|
68322
|
+
}).then(setPaymentValue);
|
|
68330
68323
|
})["catch"](setError);
|
|
68331
68324
|
};
|
|
68332
68325
|
|
|
@@ -70941,7 +70934,8 @@
|
|
|
70941
70934
|
|
|
70942
70935
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
70943
70936
|
track = _useContext2.track,
|
|
70944
|
-
integration = _useContext2.integration
|
|
70937
|
+
integration = _useContext2.integration,
|
|
70938
|
+
type = _useContext2.type;
|
|
70945
70939
|
|
|
70946
70940
|
var _useState = react.useState(),
|
|
70947
70941
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71141,12 +71135,11 @@
|
|
|
71141
71135
|
return;
|
|
71142
71136
|
}
|
|
71143
71137
|
|
|
71144
|
-
fetch('https://
|
|
71145
|
-
method: 'POST',
|
|
71138
|
+
fetch('https://public.depay.fi/payments', {
|
|
71146
71139
|
headers: {
|
|
71147
|
-
'X-Api-Key': apiKey,
|
|
71148
71140
|
'Content-Type': 'application/json'
|
|
71149
71141
|
},
|
|
71142
|
+
method: 'POST',
|
|
71150
71143
|
body: JSON.stringify({
|
|
71151
71144
|
blockchain: transaction.blockchain,
|
|
71152
71145
|
transaction: transaction.id,
|
|
@@ -71162,7 +71155,8 @@
|
|
|
71162
71155
|
sender_id: transaction.from.toLowerCase(),
|
|
71163
71156
|
sender_token_id: paymentRoute.fromToken.address,
|
|
71164
71157
|
sender_amount: formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
71165
|
-
integration: integration
|
|
71158
|
+
integration: integration,
|
|
71159
|
+
type: type
|
|
71166
71160
|
},
|
|
71167
71161
|
fee_amount: paymentRoute.fee ? formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
71168
71162
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -71230,7 +71224,7 @@
|
|
|
71230
71224
|
react.useEffect(function () {
|
|
71231
71225
|
if (polling) {
|
|
71232
71226
|
var poll = function poll() {
|
|
71233
|
-
fetch("https://
|
|
71227
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
71234
71228
|
if (response.status == 200) {
|
|
71235
71229
|
response.json().then(function (data) {
|
|
71236
71230
|
if (data.status != 'pending') {
|
|
@@ -71259,10 +71253,9 @@
|
|
|
71259
71253
|
return;
|
|
71260
71254
|
}
|
|
71261
71255
|
|
|
71262
|
-
fetch('https://
|
|
71256
|
+
fetch('https://public.depay.fi/transactions', {
|
|
71263
71257
|
method: 'POST',
|
|
71264
71258
|
headers: {
|
|
71265
|
-
'X-Api-Key': apiKey,
|
|
71266
71259
|
'Content-Type': 'application/json'
|
|
71267
71260
|
},
|
|
71268
71261
|
body: JSON.stringify({
|
|
@@ -71479,6 +71472,7 @@
|
|
|
71479
71472
|
unmount: unmount
|
|
71480
71473
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71481
71474
|
configuration: {
|
|
71475
|
+
type: 'donation',
|
|
71482
71476
|
amount: amount,
|
|
71483
71477
|
accept: accept,
|
|
71484
71478
|
currency: currency,
|
|
@@ -71977,6 +71971,7 @@
|
|
|
71977
71971
|
unmount: unmount
|
|
71978
71972
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71979
71973
|
configuration: {
|
|
71974
|
+
type: 'payment',
|
|
71980
71975
|
amount: amount,
|
|
71981
71976
|
accept: accept,
|
|
71982
71977
|
currency: currency,
|
|
@@ -72391,6 +72386,7 @@
|
|
|
72391
72386
|
unmount: unmount
|
|
72392
72387
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
72393
72388
|
configuration: {
|
|
72389
|
+
type: 'sale',
|
|
72394
72390
|
tokenImage: tokenImage,
|
|
72395
72391
|
amount: amount,
|
|
72396
72392
|
sell: sell,
|
|
@@ -72776,11 +72772,8 @@
|
|
|
72776
72772
|
});
|
|
72777
72773
|
} else if (term && term.length) {
|
|
72778
72774
|
setTokens([]);
|
|
72779
|
-
fetch("https://
|
|
72780
|
-
signal: signal
|
|
72781
|
-
headers: {
|
|
72782
|
-
'X-Api-Key': apiKey
|
|
72783
|
-
}
|
|
72775
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
72776
|
+
signal: signal
|
|
72784
72777
|
}).then(function (response) {
|
|
72785
72778
|
if (response.status == 200) {
|
|
72786
72779
|
response.json().then(function (tokens) {
|
package/dist/umd/index.js
CHANGED
|
@@ -1622,7 +1622,7 @@
|
|
|
1622
1622
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1623
1623
|
className: "PaddingTopS PaddingLeftS PaddingRightS"
|
|
1624
1624
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1625
|
-
className: "DialogBody"
|
|
1625
|
+
className: "DialogBody TextCenter"
|
|
1626
1626
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1627
1627
|
className: "GraphicWrapper PaddingTopS"
|
|
1628
1628
|
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
@@ -2207,11 +2207,9 @@
|
|
|
2207
2207
|
}, props.children);
|
|
2208
2208
|
});
|
|
2209
2209
|
|
|
2210
|
-
var apiKey = 'M5dZeHFfIp3J7h9H9fs4i4wmkUo1HjAF3EmMy32c';
|
|
2211
|
-
|
|
2212
2210
|
var ConversionRateProvider = (function (props) {
|
|
2213
|
-
var _useContext = React.useContext(ErrorContext)
|
|
2214
|
-
|
|
2211
|
+
var _useContext = React.useContext(ErrorContext);
|
|
2212
|
+
_useContext.setError;
|
|
2215
2213
|
|
|
2216
2214
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
2217
2215
|
currency = _useContext2.currency;
|
|
@@ -2224,11 +2222,10 @@
|
|
|
2224
2222
|
React.useEffect(function () {
|
|
2225
2223
|
localCurrency.Currency.fromUSD({
|
|
2226
2224
|
amount: 1,
|
|
2227
|
-
code: currency
|
|
2228
|
-
apiKey: apiKey
|
|
2225
|
+
code: currency
|
|
2229
2226
|
}).then(function (conversion) {
|
|
2230
2227
|
return setConversionRate(conversion.amount);
|
|
2231
|
-
})["catch"](
|
|
2228
|
+
})["catch"](setConversionRate(1));
|
|
2232
2229
|
}, []);
|
|
2233
2230
|
return /*#__PURE__*/React__default["default"].createElement(ConversionRateContext.Provider, {
|
|
2234
2231
|
value: {
|
|
@@ -2622,8 +2619,7 @@
|
|
|
2622
2619
|
whitelist: props.whitelist,
|
|
2623
2620
|
blacklist: props.blacklist,
|
|
2624
2621
|
event: props.event,
|
|
2625
|
-
fee: props.fee
|
|
2626
|
-
apiKey: apiKey
|
|
2622
|
+
fee: props.fee
|
|
2627
2623
|
}).then(function (routes) {
|
|
2628
2624
|
if (routes.length == 0) {
|
|
2629
2625
|
setAllRoutes([]);
|
|
@@ -2838,9 +2834,8 @@
|
|
|
2838
2834
|
var toTokenUSDValue = ethers.ethers.utils.formatUnits(toTokenUSDAmount, USDDecimals);
|
|
2839
2835
|
localCurrency.Currency.fromUSD({
|
|
2840
2836
|
amount: toTokenUSDValue,
|
|
2841
|
-
code: currency
|
|
2842
|
-
|
|
2843
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
2837
|
+
code: currency
|
|
2838
|
+
}).then(setPaymentValue);
|
|
2844
2839
|
})["catch"](setError);
|
|
2845
2840
|
};
|
|
2846
2841
|
|
|
@@ -3740,7 +3735,8 @@
|
|
|
3740
3735
|
|
|
3741
3736
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
3742
3737
|
track = _useContext2.track,
|
|
3743
|
-
integration = _useContext2.integration
|
|
3738
|
+
integration = _useContext2.integration,
|
|
3739
|
+
type = _useContext2.type;
|
|
3744
3740
|
|
|
3745
3741
|
var _useState = React.useState(),
|
|
3746
3742
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -3940,12 +3936,11 @@
|
|
|
3940
3936
|
return;
|
|
3941
3937
|
}
|
|
3942
3938
|
|
|
3943
|
-
fetch('https://
|
|
3944
|
-
method: 'POST',
|
|
3939
|
+
fetch('https://public.depay.fi/payments', {
|
|
3945
3940
|
headers: {
|
|
3946
|
-
'X-Api-Key': apiKey,
|
|
3947
3941
|
'Content-Type': 'application/json'
|
|
3948
3942
|
},
|
|
3943
|
+
method: 'POST',
|
|
3949
3944
|
body: JSON.stringify({
|
|
3950
3945
|
blockchain: transaction.blockchain,
|
|
3951
3946
|
transaction: transaction.id,
|
|
@@ -3961,7 +3956,8 @@
|
|
|
3961
3956
|
sender_id: transaction.from.toLowerCase(),
|
|
3962
3957
|
sender_token_id: paymentRoute.fromToken.address,
|
|
3963
3958
|
sender_amount: ethers.ethers.utils.formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
3964
|
-
integration: integration
|
|
3959
|
+
integration: integration,
|
|
3960
|
+
type: type
|
|
3965
3961
|
},
|
|
3966
3962
|
fee_amount: paymentRoute.fee ? ethers.ethers.utils.formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
3967
3963
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -4029,7 +4025,7 @@
|
|
|
4029
4025
|
React.useEffect(function () {
|
|
4030
4026
|
if (polling) {
|
|
4031
4027
|
var poll = function poll() {
|
|
4032
|
-
fetch("https://
|
|
4028
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
4033
4029
|
if (response.status == 200) {
|
|
4034
4030
|
response.json().then(function (data) {
|
|
4035
4031
|
if (data.status != 'pending') {
|
|
@@ -4058,10 +4054,9 @@
|
|
|
4058
4054
|
return;
|
|
4059
4055
|
}
|
|
4060
4056
|
|
|
4061
|
-
fetch('https://
|
|
4057
|
+
fetch('https://public.depay.fi/transactions', {
|
|
4062
4058
|
method: 'POST',
|
|
4063
4059
|
headers: {
|
|
4064
|
-
'X-Api-Key': apiKey,
|
|
4065
4060
|
'Content-Type': 'application/json'
|
|
4066
4061
|
},
|
|
4067
4062
|
body: JSON.stringify({
|
|
@@ -4278,6 +4273,7 @@
|
|
|
4278
4273
|
unmount: unmount
|
|
4279
4274
|
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
4280
4275
|
configuration: {
|
|
4276
|
+
type: 'donation',
|
|
4281
4277
|
amount: amount,
|
|
4282
4278
|
accept: accept,
|
|
4283
4279
|
currency: currency,
|
|
@@ -4776,6 +4772,7 @@
|
|
|
4776
4772
|
unmount: unmount
|
|
4777
4773
|
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
4778
4774
|
configuration: {
|
|
4775
|
+
type: 'payment',
|
|
4779
4776
|
amount: amount,
|
|
4780
4777
|
accept: accept,
|
|
4781
4778
|
currency: currency,
|
|
@@ -5190,6 +5187,7 @@
|
|
|
5190
5187
|
unmount: unmount
|
|
5191
5188
|
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
5192
5189
|
configuration: {
|
|
5190
|
+
type: 'sale',
|
|
5193
5191
|
tokenImage: tokenImage,
|
|
5194
5192
|
amount: amount,
|
|
5195
5193
|
sell: sell,
|
|
@@ -5575,11 +5573,8 @@
|
|
|
5575
5573
|
});
|
|
5576
5574
|
} else if (term && term.length) {
|
|
5577
5575
|
setTokens([]);
|
|
5578
|
-
fetch("https://
|
|
5579
|
-
signal: signal
|
|
5580
|
-
headers: {
|
|
5581
|
-
'X-Api-Key': apiKey
|
|
5582
|
-
}
|
|
5576
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
5577
|
+
signal: signal
|
|
5583
5578
|
}).then(function (response) {
|
|
5584
5579
|
if (response.status == 200) {
|
|
5585
5580
|
response.json().then(function (tokens) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.20.1",
|
|
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",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"test": "yarn test:jest && yarn test:cypress"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@depay/local-currency": "^3.
|
|
36
|
+
"@depay/local-currency": "^3.2.2",
|
|
37
37
|
"@depay/react-dialog-stack": "^5.0.1",
|
|
38
38
|
"@depay/react-shadow-dom": "^4.0.0",
|
|
39
39
|
"@depay/react-token-image": "^3.0.0",
|
|
40
40
|
"@depay/walletconnect-v1": "^1.1.0",
|
|
41
|
-
"@depay/web3-assets": "^5.
|
|
41
|
+
"@depay/web3-assets": "^5.3.1",
|
|
42
42
|
"@depay/web3-blockchains": "^4.2.0",
|
|
43
43
|
"@depay/web3-client": "^8.0.0",
|
|
44
44
|
"@depay/web3-constants": "^5.0.0",
|