@depay/widgets 6.20.1 → 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 +33 -25
- package/dist/umd/index.bundle.js +33 -25
- package/package.json +3 -3
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
|
}
|
|
@@ -66370,7 +66370,7 @@ var bn = createCommonjsModule(function (module) {
|
|
|
66370
66370
|
})(module, commonjsGlobal);
|
|
66371
66371
|
});
|
|
66372
66372
|
|
|
66373
|
-
const version$3 = "logger/5.
|
|
66373
|
+
const version$3 = "logger/5.5.0";
|
|
66374
66374
|
|
|
66375
66375
|
let _permanentCensorErrors = false;
|
|
66376
66376
|
let _censorErrors = false;
|
|
@@ -66467,7 +66467,7 @@ var ErrorCode;
|
|
|
66467
66467
|
// - errorArgs?: The EIP848 error parameters
|
|
66468
66468
|
// - reason: The reason (only for EIP848 "Error(string)")
|
|
66469
66469
|
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
|
66470
|
-
//
|
|
66470
|
+
// Insufficient funds (< value + gasLimit * gasPrice)
|
|
66471
66471
|
// - transaction: the transaction attempted
|
|
66472
66472
|
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
66473
66473
|
// Nonce has already been used
|
|
@@ -66682,7 +66682,7 @@ class Logger {
|
|
|
66682
66682
|
Logger.errors = ErrorCode;
|
|
66683
66683
|
Logger.levels = LogLevel;
|
|
66684
66684
|
|
|
66685
|
-
const version$2 = "bytes/5.
|
|
66685
|
+
const version$2 = "bytes/5.5.0";
|
|
66686
66686
|
|
|
66687
66687
|
const logger$3 = new Logger(version$2);
|
|
66688
66688
|
///////////////////////////////
|
|
@@ -66699,6 +66699,9 @@ function addSlice(array) {
|
|
|
66699
66699
|
};
|
|
66700
66700
|
return array;
|
|
66701
66701
|
}
|
|
66702
|
+
function isInteger(value) {
|
|
66703
|
+
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
66704
|
+
}
|
|
66702
66705
|
function isBytes(value) {
|
|
66703
66706
|
if (value == null) {
|
|
66704
66707
|
return false;
|
|
@@ -66709,12 +66712,12 @@ function isBytes(value) {
|
|
|
66709
66712
|
if (typeof (value) === "string") {
|
|
66710
66713
|
return false;
|
|
66711
66714
|
}
|
|
66712
|
-
if (value.length
|
|
66715
|
+
if (!isInteger(value.length) || value.length < 0) {
|
|
66713
66716
|
return false;
|
|
66714
66717
|
}
|
|
66715
66718
|
for (let i = 0; i < value.length; i++) {
|
|
66716
66719
|
const v = value[i];
|
|
66717
|
-
if (
|
|
66720
|
+
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
66718
66721
|
return false;
|
|
66719
66722
|
}
|
|
66720
66723
|
}
|
|
@@ -66848,7 +66851,7 @@ function hexZeroPad(value, length) {
|
|
|
66848
66851
|
return value;
|
|
66849
66852
|
}
|
|
66850
66853
|
|
|
66851
|
-
const version$1 = "bignumber/5.
|
|
66854
|
+
const version$1 = "bignumber/5.5.0";
|
|
66852
66855
|
|
|
66853
66856
|
var BN = bn.BN;
|
|
66854
66857
|
const logger$2 = new Logger(version$1);
|
|
@@ -67050,7 +67053,7 @@ class BigNumber {
|
|
|
67050
67053
|
return BigNumber.from(hexlify(anyValue));
|
|
67051
67054
|
}
|
|
67052
67055
|
if (anyValue) {
|
|
67053
|
-
// Hexable interface (takes
|
|
67056
|
+
// Hexable interface (takes priority)
|
|
67054
67057
|
if (anyValue.toHexString) {
|
|
67055
67058
|
const hex = anyValue.toHexString();
|
|
67056
67059
|
if (typeof (hex) === "string") {
|
|
@@ -67087,7 +67090,7 @@ function toHex(value) {
|
|
|
67087
67090
|
if (value[0] === "-") {
|
|
67088
67091
|
// Strip off the negative sign
|
|
67089
67092
|
value = value.substring(1);
|
|
67090
|
-
// Cannot have
|
|
67093
|
+
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
67091
67094
|
if (value[0] === "-") {
|
|
67092
67095
|
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
67093
67096
|
}
|
|
@@ -67199,7 +67202,7 @@ function parseFixed(value, decimals) {
|
|
|
67199
67202
|
decimals = 0;
|
|
67200
67203
|
}
|
|
67201
67204
|
const multiplier = getMultiplier(decimals);
|
|
67202
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9
|
|
67205
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
67203
67206
|
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67204
67207
|
}
|
|
67205
67208
|
// Is it negative?
|
|
@@ -67222,12 +67225,17 @@ function parseFixed(value, decimals) {
|
|
|
67222
67225
|
if (!fraction) {
|
|
67223
67226
|
fraction = "0";
|
|
67224
67227
|
}
|
|
67225
|
-
//
|
|
67226
|
-
{
|
|
67227
|
-
|
|
67228
|
-
|
|
67229
|
-
|
|
67230
|
-
|
|
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";
|
|
67231
67239
|
}
|
|
67232
67240
|
// Fully pad the string with zeros to get to wei
|
|
67233
67241
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -67486,7 +67494,7 @@ class FixedNumber {
|
|
|
67486
67494
|
const ONE = FixedNumber.from(1);
|
|
67487
67495
|
const BUMP = FixedNumber.from("0.5");
|
|
67488
67496
|
|
|
67489
|
-
const version = "units/5.
|
|
67497
|
+
const version = "units/5.5.0";
|
|
67490
67498
|
|
|
67491
67499
|
const logger = new Logger(version);
|
|
67492
67500
|
const names = [
|
|
@@ -67721,7 +67729,7 @@ class PaymentRoute {
|
|
|
67721
67729
|
}
|
|
67722
67730
|
}
|
|
67723
67731
|
|
|
67724
|
-
async function getAllAssetsFromAggregator({ accept
|
|
67732
|
+
async function getAllAssetsFromAggregator({ accept }) {
|
|
67725
67733
|
|
|
67726
67734
|
let routes = [
|
|
67727
67735
|
...new Set(
|
|
@@ -67735,7 +67743,7 @@ async function getAllAssetsFromAggregator({ accept, apiKey }) {
|
|
|
67735
67743
|
routes.map(
|
|
67736
67744
|
async (route)=> {
|
|
67737
67745
|
route = JSON.parse(route);
|
|
67738
|
-
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress
|
|
67746
|
+
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress })
|
|
67739
67747
|
}
|
|
67740
67748
|
)
|
|
67741
67749
|
).then((assets)=>{
|
|
@@ -67756,10 +67764,10 @@ async function onlyGetWhitelistedAssets({ whitelist }) {
|
|
|
67756
67764
|
return assets
|
|
67757
67765
|
}
|
|
67758
67766
|
|
|
67759
|
-
async function getAllAssets({ accept,
|
|
67767
|
+
async function getAllAssets({ accept, whitelist }) {
|
|
67760
67768
|
|
|
67761
67769
|
if(whitelist == undefined) {
|
|
67762
|
-
return getAllAssetsFromAggregator({ accept
|
|
67770
|
+
return getAllAssetsFromAggregator({ accept })
|
|
67763
67771
|
} else {
|
|
67764
67772
|
return onlyGetWhitelistedAssets({ whitelist })
|
|
67765
67773
|
}
|
|
@@ -67810,8 +67818,8 @@ function convertToRoutes({ tokens, accept }) {
|
|
|
67810
67818
|
})).then((routes)=> routes.flat().filter(el => el))
|
|
67811
67819
|
}
|
|
67812
67820
|
|
|
67813
|
-
async function route({ accept, whitelist, blacklist,
|
|
67814
|
-
let paymentRoutes = getAllAssets({ accept, whitelist
|
|
67821
|
+
async function route({ accept, whitelist, blacklist, event, fee }) {
|
|
67822
|
+
let paymentRoutes = getAllAssets({ accept, whitelist })
|
|
67815
67823
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67816
67824
|
.then(assetsToTokens)
|
|
67817
67825
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
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
|
}
|
|
@@ -66376,7 +66376,7 @@
|
|
|
66376
66376
|
})(module, commonjsGlobal);
|
|
66377
66377
|
});
|
|
66378
66378
|
|
|
66379
|
-
const version$3 = "logger/5.
|
|
66379
|
+
const version$3 = "logger/5.5.0";
|
|
66380
66380
|
|
|
66381
66381
|
let _permanentCensorErrors = false;
|
|
66382
66382
|
let _censorErrors = false;
|
|
@@ -66473,7 +66473,7 @@
|
|
|
66473
66473
|
// - errorArgs?: The EIP848 error parameters
|
|
66474
66474
|
// - reason: The reason (only for EIP848 "Error(string)")
|
|
66475
66475
|
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
|
66476
|
-
//
|
|
66476
|
+
// Insufficient funds (< value + gasLimit * gasPrice)
|
|
66477
66477
|
// - transaction: the transaction attempted
|
|
66478
66478
|
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
66479
66479
|
// Nonce has already been used
|
|
@@ -66688,7 +66688,7 @@
|
|
|
66688
66688
|
Logger.errors = ErrorCode;
|
|
66689
66689
|
Logger.levels = LogLevel;
|
|
66690
66690
|
|
|
66691
|
-
const version$2 = "bytes/5.
|
|
66691
|
+
const version$2 = "bytes/5.5.0";
|
|
66692
66692
|
|
|
66693
66693
|
const logger$3 = new Logger(version$2);
|
|
66694
66694
|
///////////////////////////////
|
|
@@ -66705,6 +66705,9 @@
|
|
|
66705
66705
|
};
|
|
66706
66706
|
return array;
|
|
66707
66707
|
}
|
|
66708
|
+
function isInteger(value) {
|
|
66709
|
+
return (typeof (value) === "number" && value == value && (value % 1) === 0);
|
|
66710
|
+
}
|
|
66708
66711
|
function isBytes(value) {
|
|
66709
66712
|
if (value == null) {
|
|
66710
66713
|
return false;
|
|
@@ -66715,12 +66718,12 @@
|
|
|
66715
66718
|
if (typeof (value) === "string") {
|
|
66716
66719
|
return false;
|
|
66717
66720
|
}
|
|
66718
|
-
if (value.length
|
|
66721
|
+
if (!isInteger(value.length) || value.length < 0) {
|
|
66719
66722
|
return false;
|
|
66720
66723
|
}
|
|
66721
66724
|
for (let i = 0; i < value.length; i++) {
|
|
66722
66725
|
const v = value[i];
|
|
66723
|
-
if (
|
|
66726
|
+
if (!isInteger(v) || v < 0 || v >= 256) {
|
|
66724
66727
|
return false;
|
|
66725
66728
|
}
|
|
66726
66729
|
}
|
|
@@ -66854,7 +66857,7 @@
|
|
|
66854
66857
|
return value;
|
|
66855
66858
|
}
|
|
66856
66859
|
|
|
66857
|
-
const version$1 = "bignumber/5.
|
|
66860
|
+
const version$1 = "bignumber/5.5.0";
|
|
66858
66861
|
|
|
66859
66862
|
var BN = bn.BN;
|
|
66860
66863
|
const logger$2 = new Logger(version$1);
|
|
@@ -67056,7 +67059,7 @@
|
|
|
67056
67059
|
return BigNumber.from(hexlify(anyValue));
|
|
67057
67060
|
}
|
|
67058
67061
|
if (anyValue) {
|
|
67059
|
-
// Hexable interface (takes
|
|
67062
|
+
// Hexable interface (takes priority)
|
|
67060
67063
|
if (anyValue.toHexString) {
|
|
67061
67064
|
const hex = anyValue.toHexString();
|
|
67062
67065
|
if (typeof (hex) === "string") {
|
|
@@ -67093,7 +67096,7 @@
|
|
|
67093
67096
|
if (value[0] === "-") {
|
|
67094
67097
|
// Strip off the negative sign
|
|
67095
67098
|
value = value.substring(1);
|
|
67096
|
-
// Cannot have
|
|
67099
|
+
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
67097
67100
|
if (value[0] === "-") {
|
|
67098
67101
|
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
67099
67102
|
}
|
|
@@ -67205,7 +67208,7 @@
|
|
|
67205
67208
|
decimals = 0;
|
|
67206
67209
|
}
|
|
67207
67210
|
const multiplier = getMultiplier(decimals);
|
|
67208
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9
|
|
67211
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
67209
67212
|
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67210
67213
|
}
|
|
67211
67214
|
// Is it negative?
|
|
@@ -67228,12 +67231,17 @@
|
|
|
67228
67231
|
if (!fraction) {
|
|
67229
67232
|
fraction = "0";
|
|
67230
67233
|
}
|
|
67231
|
-
//
|
|
67232
|
-
{
|
|
67233
|
-
|
|
67234
|
-
|
|
67235
|
-
|
|
67236
|
-
|
|
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";
|
|
67237
67245
|
}
|
|
67238
67246
|
// Fully pad the string with zeros to get to wei
|
|
67239
67247
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -67492,7 +67500,7 @@
|
|
|
67492
67500
|
const ONE = FixedNumber.from(1);
|
|
67493
67501
|
const BUMP = FixedNumber.from("0.5");
|
|
67494
67502
|
|
|
67495
|
-
const version = "units/5.
|
|
67503
|
+
const version = "units/5.5.0";
|
|
67496
67504
|
|
|
67497
67505
|
const logger = new Logger(version);
|
|
67498
67506
|
const names = [
|
|
@@ -67727,7 +67735,7 @@
|
|
|
67727
67735
|
}
|
|
67728
67736
|
}
|
|
67729
67737
|
|
|
67730
|
-
async function getAllAssetsFromAggregator({ accept
|
|
67738
|
+
async function getAllAssetsFromAggregator({ accept }) {
|
|
67731
67739
|
|
|
67732
67740
|
let routes = [
|
|
67733
67741
|
...new Set(
|
|
@@ -67741,7 +67749,7 @@
|
|
|
67741
67749
|
routes.map(
|
|
67742
67750
|
async (route)=> {
|
|
67743
67751
|
route = JSON.parse(route);
|
|
67744
|
-
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress
|
|
67752
|
+
return await getAssets({ blockchain: route.blockchain, account: route.fromAddress })
|
|
67745
67753
|
}
|
|
67746
67754
|
)
|
|
67747
67755
|
).then((assets)=>{
|
|
@@ -67762,10 +67770,10 @@
|
|
|
67762
67770
|
return assets
|
|
67763
67771
|
}
|
|
67764
67772
|
|
|
67765
|
-
async function getAllAssets({ accept,
|
|
67773
|
+
async function getAllAssets({ accept, whitelist }) {
|
|
67766
67774
|
|
|
67767
67775
|
if(whitelist == undefined) {
|
|
67768
|
-
return getAllAssetsFromAggregator({ accept
|
|
67776
|
+
return getAllAssetsFromAggregator({ accept })
|
|
67769
67777
|
} else {
|
|
67770
67778
|
return onlyGetWhitelistedAssets({ whitelist })
|
|
67771
67779
|
}
|
|
@@ -67816,8 +67824,8 @@
|
|
|
67816
67824
|
})).then((routes)=> routes.flat().filter(el => el))
|
|
67817
67825
|
}
|
|
67818
67826
|
|
|
67819
|
-
async function route({ accept, whitelist, blacklist,
|
|
67820
|
-
let paymentRoutes = getAllAssets({ accept, whitelist
|
|
67827
|
+
async function route({ accept, whitelist, blacklist, event, fee }) {
|
|
67828
|
+
let paymentRoutes = getAllAssets({ accept, whitelist })
|
|
67821
67829
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67822
67830
|
.then(assetsToTokens)
|
|
67823
67831
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
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",
|
|
@@ -38,12 +38,12 @@
|
|
|
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.3.
|
|
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",
|