@depay/widgets 6.19.2 → 6.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.bundle.js +61 -60
- package/dist/esm/index.js +20 -25
- package/dist/umd/index.bundle.js +61 -60
- package/dist/umd/index.js +20 -25
- package/package.json +4 -4
package/dist/esm/index.bundle.js
CHANGED
|
@@ -10845,7 +10845,7 @@ function addSlice$4(array) {
|
|
|
10845
10845
|
function isBytesLike$2(value) {
|
|
10846
10846
|
return ((isHexString$4(value) && !(value.length % 2)) || isBytes$4(value));
|
|
10847
10847
|
}
|
|
10848
|
-
function isInteger(value) {
|
|
10848
|
+
function isInteger$1(value) {
|
|
10849
10849
|
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
10850
10850
|
}
|
|
10851
10851
|
function isBytes$4(value) {
|
|
@@ -10858,12 +10858,12 @@ function isBytes$4(value) {
|
|
|
10858
10858
|
if (typeof (value) === "string") {
|
|
10859
10859
|
return false;
|
|
10860
10860
|
}
|
|
10861
|
-
if (!isInteger(value.length) || value.length < 0) {
|
|
10861
|
+
if (!isInteger$1(value.length) || value.length < 0) {
|
|
10862
10862
|
return false;
|
|
10863
10863
|
}
|
|
10864
10864
|
for (let i = 0; i < value.length; i++) {
|
|
10865
10865
|
const v = value[i];
|
|
10866
|
-
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
10866
|
+
if (!isInteger$1(v) || v < 0 || v >= 256) {
|
|
10867
10867
|
return false;
|
|
10868
10868
|
}
|
|
10869
10869
|
}
|
|
@@ -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({
|
|
@@ -66375,7 +66370,7 @@ var bn = createCommonjsModule(function (module) {
|
|
|
66375
66370
|
})(module, commonjsGlobal);
|
|
66376
66371
|
});
|
|
66377
66372
|
|
|
66378
|
-
const version$3 = "logger/5.
|
|
66373
|
+
const version$3 = "logger/5.5.0";
|
|
66379
66374
|
|
|
66380
66375
|
let _permanentCensorErrors = false;
|
|
66381
66376
|
let _censorErrors = false;
|
|
@@ -66472,7 +66467,7 @@ var ErrorCode;
|
|
|
66472
66467
|
// - errorArgs?: The EIP848 error parameters
|
|
66473
66468
|
// - reason: The reason (only for EIP848 "Error(string)")
|
|
66474
66469
|
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
|
66475
|
-
//
|
|
66470
|
+
// Insufficient funds (< value + gasLimit * gasPrice)
|
|
66476
66471
|
// - transaction: the transaction attempted
|
|
66477
66472
|
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
66478
66473
|
// Nonce has already been used
|
|
@@ -66687,7 +66682,7 @@ class Logger {
|
|
|
66687
66682
|
Logger.errors = ErrorCode;
|
|
66688
66683
|
Logger.levels = LogLevel;
|
|
66689
66684
|
|
|
66690
|
-
const version$2 = "bytes/5.
|
|
66685
|
+
const version$2 = "bytes/5.5.0";
|
|
66691
66686
|
|
|
66692
66687
|
const logger$3 = new Logger(version$2);
|
|
66693
66688
|
///////////////////////////////
|
|
@@ -66704,6 +66699,9 @@ function addSlice(array) {
|
|
|
66704
66699
|
};
|
|
66705
66700
|
return array;
|
|
66706
66701
|
}
|
|
66702
|
+
function isInteger(value) {
|
|
66703
|
+
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
66704
|
+
}
|
|
66707
66705
|
function isBytes(value) {
|
|
66708
66706
|
if (value == null) {
|
|
66709
66707
|
return false;
|
|
@@ -66714,12 +66712,12 @@ function isBytes(value) {
|
|
|
66714
66712
|
if (typeof (value) === "string") {
|
|
66715
66713
|
return false;
|
|
66716
66714
|
}
|
|
66717
|
-
if (value.length
|
|
66715
|
+
if (!isInteger(value.length) || value.length < 0) {
|
|
66718
66716
|
return false;
|
|
66719
66717
|
}
|
|
66720
66718
|
for (let i = 0; i < value.length; i++) {
|
|
66721
66719
|
const v = value[i];
|
|
66722
|
-
if (
|
|
66720
|
+
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
66723
66721
|
return false;
|
|
66724
66722
|
}
|
|
66725
66723
|
}
|
|
@@ -66853,7 +66851,7 @@ function hexZeroPad(value, length) {
|
|
|
66853
66851
|
return value;
|
|
66854
66852
|
}
|
|
66855
66853
|
|
|
66856
|
-
const version$1 = "bignumber/5.
|
|
66854
|
+
const version$1 = "bignumber/5.5.0";
|
|
66857
66855
|
|
|
66858
66856
|
var BN = bn.BN;
|
|
66859
66857
|
const logger$2 = new Logger(version$1);
|
|
@@ -67055,7 +67053,7 @@ class BigNumber {
|
|
|
67055
67053
|
return BigNumber.from(hexlify(anyValue));
|
|
67056
67054
|
}
|
|
67057
67055
|
if (anyValue) {
|
|
67058
|
-
// Hexable interface (takes
|
|
67056
|
+
// Hexable interface (takes priority)
|
|
67059
67057
|
if (anyValue.toHexString) {
|
|
67060
67058
|
const hex = anyValue.toHexString();
|
|
67061
67059
|
if (typeof (hex) === "string") {
|
|
@@ -67092,7 +67090,7 @@ function toHex(value) {
|
|
|
67092
67090
|
if (value[0] === "-") {
|
|
67093
67091
|
// Strip off the negative sign
|
|
67094
67092
|
value = value.substring(1);
|
|
67095
|
-
// Cannot have
|
|
67093
|
+
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
67096
67094
|
if (value[0] === "-") {
|
|
67097
67095
|
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
67098
67096
|
}
|
|
@@ -67204,7 +67202,7 @@ function parseFixed(value, decimals) {
|
|
|
67204
67202
|
decimals = 0;
|
|
67205
67203
|
}
|
|
67206
67204
|
const multiplier = getMultiplier(decimals);
|
|
67207
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9
|
|
67205
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
67208
67206
|
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67209
67207
|
}
|
|
67210
67208
|
// Is it negative?
|
|
@@ -67227,12 +67225,17 @@ function parseFixed(value, decimals) {
|
|
|
67227
67225
|
if (!fraction) {
|
|
67228
67226
|
fraction = "0";
|
|
67229
67227
|
}
|
|
67230
|
-
//
|
|
67231
|
-
{
|
|
67232
|
-
|
|
67233
|
-
|
|
67234
|
-
|
|
67235
|
-
|
|
67228
|
+
// Trim trailing zeros
|
|
67229
|
+
while (fraction[fraction.length - 1] === "0") {
|
|
67230
|
+
fraction = fraction.substring(0, fraction.length - 1);
|
|
67231
|
+
}
|
|
67232
|
+
// Check the fraction doesn't exceed our decimals size
|
|
67233
|
+
if (fraction.length > multiplier.length - 1) {
|
|
67234
|
+
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
67235
|
+
}
|
|
67236
|
+
// If decimals is 0, we have an empty string for fraction
|
|
67237
|
+
if (fraction === "") {
|
|
67238
|
+
fraction = "0";
|
|
67236
67239
|
}
|
|
67237
67240
|
// Fully pad the string with zeros to get to wei
|
|
67238
67241
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -67491,7 +67494,7 @@ class FixedNumber {
|
|
|
67491
67494
|
const ONE = FixedNumber.from(1);
|
|
67492
67495
|
const BUMP = FixedNumber.from("0.5");
|
|
67493
67496
|
|
|
67494
|
-
const version = "units/5.
|
|
67497
|
+
const version = "units/5.5.0";
|
|
67495
67498
|
|
|
67496
67499
|
const logger = new Logger(version);
|
|
67497
67500
|
const names = [
|
|
@@ -67726,7 +67729,7 @@ class PaymentRoute {
|
|
|
67726
67729
|
}
|
|
67727
67730
|
}
|
|
67728
67731
|
|
|
67729
|
-
async function getAllAssetsFromAggregator({ accept
|
|
67732
|
+
async function getAllAssetsFromAggregator({ accept }) {
|
|
67730
67733
|
|
|
67731
67734
|
let routes = [
|
|
67732
67735
|
...new Set(
|
|
@@ -67740,7 +67743,7 @@ async function getAllAssetsFromAggregator({ accept, apiKey }) {
|
|
|
67740
67743
|
routes.map(
|
|
67741
67744
|
async (route)=> {
|
|
67742
67745
|
route = JSON.parse(route);
|
|
67743
|
-
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress
|
|
67746
|
+
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress })
|
|
67744
67747
|
}
|
|
67745
67748
|
)
|
|
67746
67749
|
).then((assets)=>{
|
|
@@ -67761,10 +67764,10 @@ async function onlyGetWhitelistedAssets({ whitelist }) {
|
|
|
67761
67764
|
return assets
|
|
67762
67765
|
}
|
|
67763
67766
|
|
|
67764
|
-
async function getAllAssets({ accept,
|
|
67767
|
+
async function getAllAssets({ accept, whitelist }) {
|
|
67765
67768
|
|
|
67766
67769
|
if(whitelist == undefined) {
|
|
67767
|
-
return getAllAssetsFromAggregator({ accept
|
|
67770
|
+
return getAllAssetsFromAggregator({ accept })
|
|
67768
67771
|
} else {
|
|
67769
67772
|
return onlyGetWhitelistedAssets({ whitelist })
|
|
67770
67773
|
}
|
|
@@ -67815,8 +67818,8 @@ function convertToRoutes({ tokens, accept }) {
|
|
|
67815
67818
|
})).then((routes)=> routes.flat().filter(el => el))
|
|
67816
67819
|
}
|
|
67817
67820
|
|
|
67818
|
-
async function route({ accept, whitelist, blacklist,
|
|
67819
|
-
let paymentRoutes = getAllAssets({ accept, whitelist
|
|
67821
|
+
async function route({ accept, whitelist, blacklist, event, fee }) {
|
|
67822
|
+
let paymentRoutes = getAllAssets({ accept, whitelist })
|
|
67820
67823
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67821
67824
|
.then(assetsToTokens)
|
|
67822
67825
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
|
@@ -68102,8 +68105,7 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
68102
68105
|
whitelist: props.whitelist,
|
|
68103
68106
|
blacklist: props.blacklist,
|
|
68104
68107
|
event: props.event,
|
|
68105
|
-
fee: props.fee
|
|
68106
|
-
apiKey: apiKey
|
|
68108
|
+
fee: props.fee
|
|
68107
68109
|
}).then(function (routes) {
|
|
68108
68110
|
if (routes.length == 0) {
|
|
68109
68111
|
setAllRoutes([]);
|
|
@@ -68318,9 +68320,8 @@ var PaymentValueProvider = (function (props) {
|
|
|
68318
68320
|
var toTokenUSDValue = formatUnits(toTokenUSDAmount, USDDecimals);
|
|
68319
68321
|
Currency.fromUSD({
|
|
68320
68322
|
amount: toTokenUSDValue,
|
|
68321
|
-
code: currency
|
|
68322
|
-
|
|
68323
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
68323
|
+
code: currency
|
|
68324
|
+
}).then(setPaymentValue);
|
|
68324
68325
|
})["catch"](setError);
|
|
68325
68326
|
};
|
|
68326
68327
|
|
|
@@ -70935,7 +70936,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
70935
70936
|
|
|
70936
70937
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
70937
70938
|
track = _useContext2.track,
|
|
70938
|
-
integration = _useContext2.integration
|
|
70939
|
+
integration = _useContext2.integration,
|
|
70940
|
+
type = _useContext2.type;
|
|
70939
70941
|
|
|
70940
70942
|
var _useState = react.useState(),
|
|
70941
70943
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71135,12 +71137,11 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
71135
71137
|
return;
|
|
71136
71138
|
}
|
|
71137
71139
|
|
|
71138
|
-
fetch('https://
|
|
71139
|
-
method: 'POST',
|
|
71140
|
+
fetch('https://public.depay.fi/payments', {
|
|
71140
71141
|
headers: {
|
|
71141
|
-
'X-Api-Key': apiKey,
|
|
71142
71142
|
'Content-Type': 'application/json'
|
|
71143
71143
|
},
|
|
71144
|
+
method: 'POST',
|
|
71144
71145
|
body: JSON.stringify({
|
|
71145
71146
|
blockchain: transaction.blockchain,
|
|
71146
71147
|
transaction: transaction.id,
|
|
@@ -71156,7 +71157,8 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
71156
71157
|
sender_id: transaction.from.toLowerCase(),
|
|
71157
71158
|
sender_token_id: paymentRoute.fromToken.address,
|
|
71158
71159
|
sender_amount: formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
71159
|
-
integration: integration
|
|
71160
|
+
integration: integration,
|
|
71161
|
+
type: type
|
|
71160
71162
|
},
|
|
71161
71163
|
fee_amount: paymentRoute.fee ? formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
71162
71164
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -71224,7 +71226,7 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
71224
71226
|
react.useEffect(function () {
|
|
71225
71227
|
if (polling) {
|
|
71226
71228
|
var poll = function poll() {
|
|
71227
|
-
fetch("https://
|
|
71229
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
71228
71230
|
if (response.status == 200) {
|
|
71229
71231
|
response.json().then(function (data) {
|
|
71230
71232
|
if (data.status != 'pending') {
|
|
@@ -71253,10 +71255,9 @@ var TransactionTrackingProvider = (function (props) {
|
|
|
71253
71255
|
return;
|
|
71254
71256
|
}
|
|
71255
71257
|
|
|
71256
|
-
fetch('https://
|
|
71258
|
+
fetch('https://public.depay.fi/transactions', {
|
|
71257
71259
|
method: 'POST',
|
|
71258
71260
|
headers: {
|
|
71259
|
-
'X-Api-Key': apiKey,
|
|
71260
71261
|
'Content-Type': 'application/json'
|
|
71261
71262
|
},
|
|
71262
71263
|
body: JSON.stringify({
|
|
@@ -71473,6 +71474,7 @@ var Donation = /*#__PURE__*/function () {
|
|
|
71473
71474
|
unmount: unmount
|
|
71474
71475
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71475
71476
|
configuration: {
|
|
71477
|
+
type: 'donation',
|
|
71476
71478
|
amount: amount,
|
|
71477
71479
|
accept: accept,
|
|
71478
71480
|
currency: currency,
|
|
@@ -71971,6 +71973,7 @@ var Payment = /*#__PURE__*/function () {
|
|
|
71971
71973
|
unmount: unmount
|
|
71972
71974
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71973
71975
|
configuration: {
|
|
71976
|
+
type: 'payment',
|
|
71974
71977
|
amount: amount,
|
|
71975
71978
|
accept: accept,
|
|
71976
71979
|
currency: currency,
|
|
@@ -72385,6 +72388,7 @@ var Sale = /*#__PURE__*/function () {
|
|
|
72385
72388
|
unmount: unmount
|
|
72386
72389
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
72387
72390
|
configuration: {
|
|
72391
|
+
type: 'sale',
|
|
72388
72392
|
tokenImage: tokenImage,
|
|
72389
72393
|
amount: amount,
|
|
72390
72394
|
sell: sell,
|
|
@@ -72770,11 +72774,8 @@ var SelectTokenDialog = (function (props) {
|
|
|
72770
72774
|
});
|
|
72771
72775
|
} else if (term && term.length) {
|
|
72772
72776
|
setTokens([]);
|
|
72773
|
-
fetch("https://
|
|
72774
|
-
signal: signal
|
|
72775
|
-
headers: {
|
|
72776
|
-
'X-Api-Key': apiKey
|
|
72777
|
-
}
|
|
72777
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
72778
|
+
signal: signal
|
|
72778
72779
|
}).then(function (response) {
|
|
72779
72780
|
if (response.status == 200) {
|
|
72780
72781
|
response.json().then(function (tokens) {
|
package/dist/esm/index.js
CHANGED
|
@@ -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
|
@@ -10851,7 +10851,7 @@
|
|
|
10851
10851
|
function isBytesLike$2(value) {
|
|
10852
10852
|
return ((isHexString$4(value) && !(value.length % 2)) || isBytes$4(value));
|
|
10853
10853
|
}
|
|
10854
|
-
function isInteger(value) {
|
|
10854
|
+
function isInteger$1(value) {
|
|
10855
10855
|
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
10856
10856
|
}
|
|
10857
10857
|
function isBytes$4(value) {
|
|
@@ -10864,12 +10864,12 @@
|
|
|
10864
10864
|
if (typeof (value) === "string") {
|
|
10865
10865
|
return false;
|
|
10866
10866
|
}
|
|
10867
|
-
if (!isInteger(value.length) || value.length < 0) {
|
|
10867
|
+
if (!isInteger$1(value.length) || value.length < 0) {
|
|
10868
10868
|
return false;
|
|
10869
10869
|
}
|
|
10870
10870
|
for (let i = 0; i < value.length; i++) {
|
|
10871
10871
|
const v = value[i];
|
|
10872
|
-
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
10872
|
+
if (!isInteger$1(v) || v < 0 || v >= 256) {
|
|
10873
10873
|
return false;
|
|
10874
10874
|
}
|
|
10875
10875
|
}
|
|
@@ -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({
|
|
@@ -66381,7 +66376,7 @@
|
|
|
66381
66376
|
})(module, commonjsGlobal);
|
|
66382
66377
|
});
|
|
66383
66378
|
|
|
66384
|
-
const version$3 = "logger/5.
|
|
66379
|
+
const version$3 = "logger/5.5.0";
|
|
66385
66380
|
|
|
66386
66381
|
let _permanentCensorErrors = false;
|
|
66387
66382
|
let _censorErrors = false;
|
|
@@ -66478,7 +66473,7 @@
|
|
|
66478
66473
|
// - errorArgs?: The EIP848 error parameters
|
|
66479
66474
|
// - reason: The reason (only for EIP848 "Error(string)")
|
|
66480
66475
|
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
|
66481
|
-
//
|
|
66476
|
+
// Insufficient funds (< value + gasLimit * gasPrice)
|
|
66482
66477
|
// - transaction: the transaction attempted
|
|
66483
66478
|
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
66484
66479
|
// Nonce has already been used
|
|
@@ -66693,7 +66688,7 @@
|
|
|
66693
66688
|
Logger.errors = ErrorCode;
|
|
66694
66689
|
Logger.levels = LogLevel;
|
|
66695
66690
|
|
|
66696
|
-
const version$2 = "bytes/5.
|
|
66691
|
+
const version$2 = "bytes/5.5.0";
|
|
66697
66692
|
|
|
66698
66693
|
const logger$3 = new Logger(version$2);
|
|
66699
66694
|
///////////////////////////////
|
|
@@ -66710,6 +66705,9 @@
|
|
|
66710
66705
|
};
|
|
66711
66706
|
return array;
|
|
66712
66707
|
}
|
|
66708
|
+
function isInteger(value) {
|
|
66709
|
+
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
66710
|
+
}
|
|
66713
66711
|
function isBytes(value) {
|
|
66714
66712
|
if (value == null) {
|
|
66715
66713
|
return false;
|
|
@@ -66720,12 +66718,12 @@
|
|
|
66720
66718
|
if (typeof (value) === "string") {
|
|
66721
66719
|
return false;
|
|
66722
66720
|
}
|
|
66723
|
-
if (value.length
|
|
66721
|
+
if (!isInteger(value.length) || value.length < 0) {
|
|
66724
66722
|
return false;
|
|
66725
66723
|
}
|
|
66726
66724
|
for (let i = 0; i < value.length; i++) {
|
|
66727
66725
|
const v = value[i];
|
|
66728
|
-
if (
|
|
66726
|
+
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
66729
66727
|
return false;
|
|
66730
66728
|
}
|
|
66731
66729
|
}
|
|
@@ -66859,7 +66857,7 @@
|
|
|
66859
66857
|
return value;
|
|
66860
66858
|
}
|
|
66861
66859
|
|
|
66862
|
-
const version$1 = "bignumber/5.
|
|
66860
|
+
const version$1 = "bignumber/5.5.0";
|
|
66863
66861
|
|
|
66864
66862
|
var BN = bn.BN;
|
|
66865
66863
|
const logger$2 = new Logger(version$1);
|
|
@@ -67061,7 +67059,7 @@
|
|
|
67061
67059
|
return BigNumber.from(hexlify(anyValue));
|
|
67062
67060
|
}
|
|
67063
67061
|
if (anyValue) {
|
|
67064
|
-
// Hexable interface (takes
|
|
67062
|
+
// Hexable interface (takes priority)
|
|
67065
67063
|
if (anyValue.toHexString) {
|
|
67066
67064
|
const hex = anyValue.toHexString();
|
|
67067
67065
|
if (typeof (hex) === "string") {
|
|
@@ -67098,7 +67096,7 @@
|
|
|
67098
67096
|
if (value[0] === "-") {
|
|
67099
67097
|
// Strip off the negative sign
|
|
67100
67098
|
value = value.substring(1);
|
|
67101
|
-
// Cannot have
|
|
67099
|
+
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
67102
67100
|
if (value[0] === "-") {
|
|
67103
67101
|
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
67104
67102
|
}
|
|
@@ -67210,7 +67208,7 @@
|
|
|
67210
67208
|
decimals = 0;
|
|
67211
67209
|
}
|
|
67212
67210
|
const multiplier = getMultiplier(decimals);
|
|
67213
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9
|
|
67211
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
67214
67212
|
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67215
67213
|
}
|
|
67216
67214
|
// Is it negative?
|
|
@@ -67233,12 +67231,17 @@
|
|
|
67233
67231
|
if (!fraction) {
|
|
67234
67232
|
fraction = "0";
|
|
67235
67233
|
}
|
|
67236
|
-
//
|
|
67237
|
-
{
|
|
67238
|
-
|
|
67239
|
-
|
|
67240
|
-
|
|
67241
|
-
|
|
67234
|
+
// Trim trailing zeros
|
|
67235
|
+
while (fraction[fraction.length - 1] === "0") {
|
|
67236
|
+
fraction = fraction.substring(0, fraction.length - 1);
|
|
67237
|
+
}
|
|
67238
|
+
// Check the fraction doesn't exceed our decimals size
|
|
67239
|
+
if (fraction.length > multiplier.length - 1) {
|
|
67240
|
+
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
67241
|
+
}
|
|
67242
|
+
// If decimals is 0, we have an empty string for fraction
|
|
67243
|
+
if (fraction === "") {
|
|
67244
|
+
fraction = "0";
|
|
67242
67245
|
}
|
|
67243
67246
|
// Fully pad the string with zeros to get to wei
|
|
67244
67247
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -67497,7 +67500,7 @@
|
|
|
67497
67500
|
const ONE = FixedNumber.from(1);
|
|
67498
67501
|
const BUMP = FixedNumber.from("0.5");
|
|
67499
67502
|
|
|
67500
|
-
const version = "units/5.
|
|
67503
|
+
const version = "units/5.5.0";
|
|
67501
67504
|
|
|
67502
67505
|
const logger = new Logger(version);
|
|
67503
67506
|
const names = [
|
|
@@ -67732,7 +67735,7 @@
|
|
|
67732
67735
|
}
|
|
67733
67736
|
}
|
|
67734
67737
|
|
|
67735
|
-
async function getAllAssetsFromAggregator({ accept
|
|
67738
|
+
async function getAllAssetsFromAggregator({ accept }) {
|
|
67736
67739
|
|
|
67737
67740
|
let routes = [
|
|
67738
67741
|
...new Set(
|
|
@@ -67746,7 +67749,7 @@
|
|
|
67746
67749
|
routes.map(
|
|
67747
67750
|
async (route)=> {
|
|
67748
67751
|
route = JSON.parse(route);
|
|
67749
|
-
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress
|
|
67752
|
+
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress })
|
|
67750
67753
|
}
|
|
67751
67754
|
)
|
|
67752
67755
|
).then((assets)=>{
|
|
@@ -67767,10 +67770,10 @@
|
|
|
67767
67770
|
return assets
|
|
67768
67771
|
}
|
|
67769
67772
|
|
|
67770
|
-
async function getAllAssets({ accept,
|
|
67773
|
+
async function getAllAssets({ accept, whitelist }) {
|
|
67771
67774
|
|
|
67772
67775
|
if(whitelist == undefined) {
|
|
67773
|
-
return getAllAssetsFromAggregator({ accept
|
|
67776
|
+
return getAllAssetsFromAggregator({ accept })
|
|
67774
67777
|
} else {
|
|
67775
67778
|
return onlyGetWhitelistedAssets({ whitelist })
|
|
67776
67779
|
}
|
|
@@ -67821,8 +67824,8 @@
|
|
|
67821
67824
|
})).then((routes)=> routes.flat().filter(el => el))
|
|
67822
67825
|
}
|
|
67823
67826
|
|
|
67824
|
-
async function route({ accept, whitelist, blacklist,
|
|
67825
|
-
let paymentRoutes = getAllAssets({ accept, whitelist
|
|
67827
|
+
async function route({ accept, whitelist, blacklist, event, fee }) {
|
|
67828
|
+
let paymentRoutes = getAllAssets({ accept, whitelist })
|
|
67826
67829
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67827
67830
|
.then(assetsToTokens)
|
|
67828
67831
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
|
@@ -68108,8 +68111,7 @@
|
|
|
68108
68111
|
whitelist: props.whitelist,
|
|
68109
68112
|
blacklist: props.blacklist,
|
|
68110
68113
|
event: props.event,
|
|
68111
|
-
fee: props.fee
|
|
68112
|
-
apiKey: apiKey
|
|
68114
|
+
fee: props.fee
|
|
68113
68115
|
}).then(function (routes) {
|
|
68114
68116
|
if (routes.length == 0) {
|
|
68115
68117
|
setAllRoutes([]);
|
|
@@ -68324,9 +68326,8 @@
|
|
|
68324
68326
|
var toTokenUSDValue = formatUnits(toTokenUSDAmount, USDDecimals);
|
|
68325
68327
|
Currency.fromUSD({
|
|
68326
68328
|
amount: toTokenUSDValue,
|
|
68327
|
-
code: currency
|
|
68328
|
-
|
|
68329
|
-
}).then(setPaymentValue)["catch"](setError);
|
|
68329
|
+
code: currency
|
|
68330
|
+
}).then(setPaymentValue);
|
|
68330
68331
|
})["catch"](setError);
|
|
68331
68332
|
};
|
|
68332
68333
|
|
|
@@ -70941,7 +70942,8 @@
|
|
|
70941
70942
|
|
|
70942
70943
|
var _useContext2 = react.useContext(ConfigurationContext),
|
|
70943
70944
|
track = _useContext2.track,
|
|
70944
|
-
integration = _useContext2.integration
|
|
70945
|
+
integration = _useContext2.integration,
|
|
70946
|
+
type = _useContext2.type;
|
|
70945
70947
|
|
|
70946
70948
|
var _useState = react.useState(),
|
|
70947
70949
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71141,12 +71143,11 @@
|
|
|
71141
71143
|
return;
|
|
71142
71144
|
}
|
|
71143
71145
|
|
|
71144
|
-
fetch('https://
|
|
71145
|
-
method: 'POST',
|
|
71146
|
+
fetch('https://public.depay.fi/payments', {
|
|
71146
71147
|
headers: {
|
|
71147
|
-
'X-Api-Key': apiKey,
|
|
71148
71148
|
'Content-Type': 'application/json'
|
|
71149
71149
|
},
|
|
71150
|
+
method: 'POST',
|
|
71150
71151
|
body: JSON.stringify({
|
|
71151
71152
|
blockchain: transaction.blockchain,
|
|
71152
71153
|
transaction: transaction.id,
|
|
@@ -71162,7 +71163,8 @@
|
|
|
71162
71163
|
sender_id: transaction.from.toLowerCase(),
|
|
71163
71164
|
sender_token_id: paymentRoute.fromToken.address,
|
|
71164
71165
|
sender_amount: formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
71165
|
-
integration: integration
|
|
71166
|
+
integration: integration,
|
|
71167
|
+
type: type
|
|
71166
71168
|
},
|
|
71167
71169
|
fee_amount: paymentRoute.fee ? formatUnits(paymentRoute.transaction.params.amounts[4], paymentRoute.toDecimals) : null,
|
|
71168
71170
|
fee_receiver: paymentRoute.fee ? paymentRoute.transaction.params.addresses[1] : null
|
|
@@ -71230,7 +71232,7 @@
|
|
|
71230
71232
|
react.useEffect(function () {
|
|
71231
71233
|
if (polling) {
|
|
71232
71234
|
var poll = function poll() {
|
|
71233
|
-
fetch("https://
|
|
71235
|
+
fetch("https://public.depay.fi/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
71234
71236
|
if (response.status == 200) {
|
|
71235
71237
|
response.json().then(function (data) {
|
|
71236
71238
|
if (data.status != 'pending') {
|
|
@@ -71259,10 +71261,9 @@
|
|
|
71259
71261
|
return;
|
|
71260
71262
|
}
|
|
71261
71263
|
|
|
71262
|
-
fetch('https://
|
|
71264
|
+
fetch('https://public.depay.fi/transactions', {
|
|
71263
71265
|
method: 'POST',
|
|
71264
71266
|
headers: {
|
|
71265
|
-
'X-Api-Key': apiKey,
|
|
71266
71267
|
'Content-Type': 'application/json'
|
|
71267
71268
|
},
|
|
71268
71269
|
body: JSON.stringify({
|
|
@@ -71479,6 +71480,7 @@
|
|
|
71479
71480
|
unmount: unmount
|
|
71480
71481
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71481
71482
|
configuration: {
|
|
71483
|
+
type: 'donation',
|
|
71482
71484
|
amount: amount,
|
|
71483
71485
|
accept: accept,
|
|
71484
71486
|
currency: currency,
|
|
@@ -71977,6 +71979,7 @@
|
|
|
71977
71979
|
unmount: unmount
|
|
71978
71980
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
71979
71981
|
configuration: {
|
|
71982
|
+
type: 'payment',
|
|
71980
71983
|
amount: amount,
|
|
71981
71984
|
accept: accept,
|
|
71982
71985
|
currency: currency,
|
|
@@ -72391,6 +72394,7 @@
|
|
|
72391
72394
|
unmount: unmount
|
|
72392
72395
|
}, /*#__PURE__*/react.createElement(ConfigurationProvider, {
|
|
72393
72396
|
configuration: {
|
|
72397
|
+
type: 'sale',
|
|
72394
72398
|
tokenImage: tokenImage,
|
|
72395
72399
|
amount: amount,
|
|
72396
72400
|
sell: sell,
|
|
@@ -72776,11 +72780,8 @@
|
|
|
72776
72780
|
});
|
|
72777
72781
|
} else if (term && term.length) {
|
|
72778
72782
|
setTokens([]);
|
|
72779
|
-
fetch("https://
|
|
72780
|
-
signal: signal
|
|
72781
|
-
headers: {
|
|
72782
|
-
'X-Api-Key': apiKey
|
|
72783
|
-
}
|
|
72783
|
+
fetch("https://public.depay.fi/tokens/search?blockchain=".concat(blockchain.name, "&term=").concat(term), {
|
|
72784
|
+
signal: signal
|
|
72784
72785
|
}).then(function (response) {
|
|
72785
72786
|
if (response.status == 200) {
|
|
72786
72787
|
response.json().then(function (tokens) {
|
package/dist/umd/index.js
CHANGED
|
@@ -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.21.0",
|
|
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,17 +33,17 @@
|
|
|
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.2
|
|
41
|
+
"@depay/web3-assets": "^5.3.2",
|
|
42
42
|
"@depay/web3-blockchains": "^4.2.0",
|
|
43
43
|
"@depay/web3-client": "^8.0.0",
|
|
44
44
|
"@depay/web3-constants": "^5.0.0",
|
|
45
45
|
"@depay/web3-exchanges": "^8.1.0",
|
|
46
|
-
"@depay/web3-payments": "^9.
|
|
46
|
+
"@depay/web3-payments": "^9.4.1",
|
|
47
47
|
"@depay/web3-tokens": "^8.0.1",
|
|
48
48
|
"@depay/web3-wallets": "^9.1.0",
|
|
49
49
|
"decimal.js": "^10.3.1",
|