@imtbl/checkout-sdk 2.4.10 → 2.4.11-alpha.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/browser/index.js +85 -83
- package/dist/node/index.cjs +167 -165
- package/dist/node/index.js +171 -169
- package/dist/types/widgets/definitions/events/commerce.d.ts +15 -4
- package/package.json +9 -9
package/dist/node/index.cjs
CHANGED
|
@@ -113,45 +113,47 @@ var un = /* @__PURE__ */ ((i) => {
|
|
|
113
113
|
i["USER_ACTION"] = "USER_ACTION";
|
|
114
114
|
return i;
|
|
115
115
|
})(un || {});
|
|
116
|
-
var mn = /* @__PURE__ */ ((
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
var mn = /* @__PURE__ */ ((l) => {
|
|
117
|
+
l["SWAP_SUCCESS"] = "SWAP_SUCCESS";
|
|
118
|
+
l["ONRAMP_SUCCESS"] = "ONRAMP_SUCCESS";
|
|
119
|
+
l["CONNECT_SUCCESS"] = "CONNECT_SUCCESS";
|
|
120
|
+
l["SALE_SUCCESS"] = "SALE_SUCCESS";
|
|
121
|
+
l["SALE_TRANSACTION_SUCCESS"] = "SALE_TRANSACTION_SUCCESS";
|
|
122
|
+
l["BRIDGE_SUCCESS"] = "BRIDGE_SUCCESS";
|
|
123
|
+
l["BRIDGE_CLAIM_WITHDRAWAL_SUCCESS"] = "BRIDGE_CLAIM_WITHDRAWAL_SUCCESS";
|
|
124
|
+
l["ADD_TOKENS_SUCCESS"] = "ADD_TOKENS_SUCCESS";
|
|
125
|
+
l["ADD_TOKENS_CONNECT_SUCCESS"] = "ADD_TOKENS_CONNECT_SUCCESS";
|
|
126
|
+
l["TRANSFER_SUCCESS"] = "TRANSFER_SUCCESS";
|
|
127
|
+
return l;
|
|
127
128
|
})(mn || {});
|
|
128
|
-
var fn = /* @__PURE__ */ ((
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
var fn = /* @__PURE__ */ ((d) => {
|
|
130
|
+
d["BRIDGE_FAILED"] = "BRIDGE_FAILED";
|
|
131
|
+
d["BRIDGE_CLAIM_WITHDRAWAL_FAILED"] = "BRIDGE_CLAIM_WITHDRAWAL_FAILED";
|
|
132
|
+
d["SWAP_FAILED"] = "SWAP_FAILED";
|
|
133
|
+
d["SWAP_REJECTED"] = "SWAP_REJECTED";
|
|
134
|
+
d["CONNECT_FAILED"] = "CONNECT_FAILED";
|
|
135
|
+
d["SALE_FAILED"] = "SALE_FAILED";
|
|
136
|
+
d["ONRAMP_FAILED"] = "ONRAMP_FAILED";
|
|
137
|
+
d["ADD_TOKENS_FAILED"] = "ADD_TOKENS_FAILED";
|
|
138
|
+
d["TRANSFER_FAILED"] = "TRANSFER_FAILED";
|
|
139
|
+
return d;
|
|
138
140
|
})(fn || {});
|
|
139
|
-
var
|
|
141
|
+
var En = /* @__PURE__ */ ((n) => {
|
|
140
142
|
n["PAYMENT_METHOD_SELECTED"] = "PAYMENT_METHOD_SELECTED";
|
|
141
143
|
n["PAYMENT_TOKEN_SELECTED"] = "PAYMENT_TOKEN_SELECTED";
|
|
142
144
|
n["NETWORK_SWITCH"] = "NETWORK_SWITCH";
|
|
143
145
|
return n;
|
|
144
|
-
})(
|
|
146
|
+
})(En || {});
|
|
145
147
|
|
|
146
148
|
// src/widgets/definitions/events/addTokens.ts
|
|
147
|
-
var
|
|
149
|
+
var gn = /* @__PURE__ */ ((a) => {
|
|
148
150
|
a["CLOSE_WIDGET"] = "close-widget";
|
|
149
151
|
a["LANGUAGE_CHANGED"] = "language-changed";
|
|
150
152
|
a["CONNECT_SUCCESS"] = "connect-success";
|
|
151
153
|
a["SUCCESS"] = "success";
|
|
152
154
|
a["FAILURE"] = "failure";
|
|
153
155
|
return a;
|
|
154
|
-
})(
|
|
156
|
+
})(gn || {});
|
|
155
157
|
|
|
156
158
|
// src/widgets/definitions/events/purchase.ts
|
|
157
159
|
var Rn = /* @__PURE__ */ ((o) => {
|
|
@@ -801,7 +803,7 @@ var ot = {
|
|
|
801
803
|
};
|
|
802
804
|
|
|
803
805
|
// src/env/env.ts
|
|
804
|
-
var vn = "2.4.
|
|
806
|
+
var vn = "2.4.11-alpha.0";
|
|
805
807
|
var pe = () => vn;
|
|
806
808
|
|
|
807
809
|
// src/availability/availability.ts
|
|
@@ -913,16 +915,16 @@ var B = /* @__PURE__ */ ((o) => {
|
|
|
913
915
|
o["ERC1155"] = "ERC1155";
|
|
914
916
|
return o;
|
|
915
917
|
})(B || {});
|
|
916
|
-
var
|
|
918
|
+
var Ee = /* @__PURE__ */ ((t) => {
|
|
917
919
|
t["TRANSACTION"] = "TRANSACTION";
|
|
918
920
|
t["GAS"] = "GAS";
|
|
919
921
|
return t;
|
|
920
|
-
})(
|
|
921
|
-
var
|
|
922
|
+
})(Ee || {});
|
|
923
|
+
var ge = /* @__PURE__ */ ((t) => {
|
|
922
924
|
t["NATIVE"] = "NATIVE";
|
|
923
925
|
t["ERC20"] = "ERC20";
|
|
924
926
|
return t;
|
|
925
|
-
})(
|
|
927
|
+
})(ge || {});
|
|
926
928
|
var st = /* @__PURE__ */ ((n) => {
|
|
927
929
|
n["ROUTES_FOUND"] = "ROUTES_FOUND";
|
|
928
930
|
n["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
|
|
@@ -1641,7 +1643,7 @@ async function ft(r, e, t) {
|
|
|
1641
1643
|
);
|
|
1642
1644
|
}
|
|
1643
1645
|
var pt = /* @__PURE__ */ new Map();
|
|
1644
|
-
var
|
|
1646
|
+
var Et = () => pt.clear();
|
|
1645
1647
|
var zn = async (r, e, t, n) => {
|
|
1646
1648
|
const o = n !== void 0;
|
|
1647
1649
|
const a = Object.assign(
|
|
@@ -1657,37 +1659,37 @@ var zn = async (r, e, t, n) => {
|
|
|
1657
1659
|
const i = [];
|
|
1658
1660
|
const c = "ERC-20";
|
|
1659
1661
|
const d = async (m) => {
|
|
1660
|
-
let
|
|
1662
|
+
let E;
|
|
1661
1663
|
try {
|
|
1662
1664
|
do {
|
|
1663
|
-
|
|
1665
|
+
E = await m.getTokensByWalletAddress({
|
|
1664
1666
|
walletAddress: e,
|
|
1665
1667
|
tokenType: c,
|
|
1666
|
-
nextPage: _optionalChain([
|
|
1668
|
+
nextPage: _optionalChain([E, 'optionalAccess', _74 => _74.next_page_params])
|
|
1667
1669
|
});
|
|
1668
|
-
i.push(...
|
|
1669
|
-
} while (
|
|
1670
|
-
} catch (
|
|
1671
|
-
if (_optionalChain([
|
|
1670
|
+
i.push(...E.items);
|
|
1671
|
+
} while (E.next_page_params);
|
|
1672
|
+
} catch (g) {
|
|
1673
|
+
if (_optionalChain([g, 'optionalAccess', _75 => _75.code]) !== _axios.HttpStatusCode.NotFound) {
|
|
1672
1674
|
throw new p(
|
|
1673
|
-
|
|
1675
|
+
g.message || "InternalServerError | getTokensByWalletAddress",
|
|
1674
1676
|
"GET_INDEXER_BALANCE_ERROR",
|
|
1675
|
-
{ error:
|
|
1677
|
+
{ error: g }
|
|
1676
1678
|
);
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
1681
|
};
|
|
1680
1682
|
const l = async (m) => {
|
|
1681
1683
|
try {
|
|
1682
|
-
const
|
|
1683
|
-
|
|
1684
|
-
i.push(
|
|
1685
|
-
} catch (
|
|
1686
|
-
if (_optionalChain([
|
|
1684
|
+
const E = await m.getNativeTokenByWalletAddress({ walletAddress: e });
|
|
1685
|
+
E.token.address ||= _;
|
|
1686
|
+
i.push(E);
|
|
1687
|
+
} catch (E) {
|
|
1688
|
+
if (_optionalChain([E, 'optionalAccess', _76 => _76.code]) !== _axios.HttpStatusCode.NotFound) {
|
|
1687
1689
|
throw new p(
|
|
1688
|
-
|
|
1690
|
+
E.message || "InternalServerError | getNativeTokenByWalletAddress",
|
|
1689
1691
|
"GET_INDEXER_BALANCE_ERROR",
|
|
1690
|
-
{ error:
|
|
1692
|
+
{ error: E }
|
|
1691
1693
|
);
|
|
1692
1694
|
}
|
|
1693
1695
|
}
|
|
@@ -1698,16 +1700,16 @@ var zn = async (r, e, t, n) => {
|
|
|
1698
1700
|
]);
|
|
1699
1701
|
const u = [];
|
|
1700
1702
|
i.forEach((m) => {
|
|
1701
|
-
const
|
|
1702
|
-
if (o && !
|
|
1703
|
-
const
|
|
1703
|
+
const E = a[m.token.address.toLowerCase()];
|
|
1704
|
+
if (o && !E) return;
|
|
1705
|
+
const g = m.token || {};
|
|
1704
1706
|
if (m.value == null) return;
|
|
1705
1707
|
const f = BigInt(m.value);
|
|
1706
|
-
let R = parseInt(
|
|
1708
|
+
let R = parseInt(g.decimals, 10);
|
|
1707
1709
|
if (Number.isNaN(R)) R = G;
|
|
1708
|
-
const I = _nullishCoalesce(
|
|
1710
|
+
const I = _nullishCoalesce(g.icon_url, () => ( E.icon));
|
|
1709
1711
|
const C = {
|
|
1710
|
-
...
|
|
1712
|
+
...g,
|
|
1711
1713
|
decimals: R,
|
|
1712
1714
|
icon: I
|
|
1713
1715
|
};
|
|
@@ -1776,7 +1778,7 @@ var q = async (r, e, t, n, o = false) => {
|
|
|
1776
1778
|
}
|
|
1777
1779
|
);
|
|
1778
1780
|
if (o) {
|
|
1779
|
-
|
|
1781
|
+
Et();
|
|
1780
1782
|
}
|
|
1781
1783
|
if (he.isChainSupported(n)) {
|
|
1782
1784
|
const s = await _asyncNullishCoalesce(t, async () => ( await await _asyncOptionalChain([(await _optionalChain([e, 'optionalAccess', _77 => _77.getSigner, 'call', _78 => _78()])), 'optionalAccess', async _79 => _79.getAddress, 'call', async _80 => _80()])));
|
|
@@ -2122,7 +2124,7 @@ async function ar(r, e, t) {
|
|
|
2122
2124
|
|
|
2123
2125
|
// src/gasEstimate/gasPriceInWei.ts
|
|
2124
2126
|
var lo = (r) => !!r.maxFeePerGas && !!r.maxPriorityFeePerGas;
|
|
2125
|
-
var
|
|
2127
|
+
var gt = (r) => {
|
|
2126
2128
|
if (lo(r)) {
|
|
2127
2129
|
const { maxFeePerGas: e, maxPriorityFeePerGas: t } = r;
|
|
2128
2130
|
if (e === null || t === null) return null;
|
|
@@ -2266,7 +2268,7 @@ var mo = (r) => ({
|
|
|
2266
2268
|
});
|
|
2267
2269
|
|
|
2268
2270
|
// src/provider/provider.ts
|
|
2269
|
-
async function
|
|
2271
|
+
async function Eo() {
|
|
2270
2272
|
const r = await x(
|
|
2271
2273
|
async () => await _detectprovider2.default.call(void 0, ),
|
|
2272
2274
|
{ type: "METAMASK_PROVIDER_ERROR" }
|
|
@@ -2305,7 +2307,7 @@ async function sr(r, e) {
|
|
|
2305
2307
|
case "metamask": {
|
|
2306
2308
|
n = D.getInstance().findProvider({ rdns: be.rdns });
|
|
2307
2309
|
if (!n) {
|
|
2308
|
-
t = await
|
|
2310
|
+
t = await Eo();
|
|
2309
2311
|
}
|
|
2310
2312
|
break;
|
|
2311
2313
|
}
|
|
@@ -2564,39 +2566,39 @@ var lr = async (r, e, t) => {
|
|
|
2564
2566
|
const s = /* @__PURE__ */ new Map();
|
|
2565
2567
|
const i = /* @__PURE__ */ new Map();
|
|
2566
2568
|
const c = /* @__PURE__ */ new Map();
|
|
2567
|
-
for (const
|
|
2568
|
-
if (
|
|
2569
|
-
const { tokenAddress:
|
|
2570
|
-
const R = `${
|
|
2571
|
-
a.set(R,
|
|
2569
|
+
for (const E of t) {
|
|
2570
|
+
if (E.type !== "ERC20") continue;
|
|
2571
|
+
const { tokenAddress: g, spenderAddress: f } = E;
|
|
2572
|
+
const R = `${g}${f}`;
|
|
2573
|
+
a.set(R, E);
|
|
2572
2574
|
s.set(
|
|
2573
2575
|
R,
|
|
2574
|
-
Ao(r, e,
|
|
2576
|
+
Ao(r, e, g, f)
|
|
2575
2577
|
);
|
|
2576
2578
|
}
|
|
2577
2579
|
const d = await Promise.all(s.values());
|
|
2578
2580
|
const l = Array.from(s.keys());
|
|
2579
|
-
for (let
|
|
2580
|
-
const
|
|
2581
|
-
if (!
|
|
2582
|
-
if (d[
|
|
2581
|
+
for (let E = 0; E < d.length; E++) {
|
|
2582
|
+
const g = a.get(l[E]);
|
|
2583
|
+
if (!g || g.type !== "ERC20") continue;
|
|
2584
|
+
if (d[E] >= g.amount) {
|
|
2583
2585
|
o.push({
|
|
2584
2586
|
sufficient: true,
|
|
2585
|
-
itemRequirement:
|
|
2587
|
+
itemRequirement: g
|
|
2586
2588
|
});
|
|
2587
2589
|
continue;
|
|
2588
2590
|
}
|
|
2589
2591
|
n = false;
|
|
2590
|
-
const { tokenAddress: f, spenderAddress: R } =
|
|
2592
|
+
const { tokenAddress: f, spenderAddress: R } = g;
|
|
2591
2593
|
const I = `${f}${R}`;
|
|
2592
|
-
const C =
|
|
2594
|
+
const C = g.amount - d[E];
|
|
2593
2595
|
i.set(
|
|
2594
2596
|
I,
|
|
2595
2597
|
{
|
|
2596
2598
|
type: "ERC20",
|
|
2597
2599
|
sufficient: false,
|
|
2598
2600
|
delta: C,
|
|
2599
|
-
itemRequirement:
|
|
2601
|
+
itemRequirement: g,
|
|
2600
2602
|
approvalTransaction: void 0
|
|
2601
2603
|
}
|
|
2602
2604
|
);
|
|
@@ -2613,11 +2615,11 @@ var lr = async (r, e, t) => {
|
|
|
2613
2615
|
}
|
|
2614
2616
|
const u = await Promise.all(c.values());
|
|
2615
2617
|
const m = Array.from(c.keys());
|
|
2616
|
-
u.forEach((
|
|
2617
|
-
const f = i.get(m[
|
|
2618
|
+
u.forEach((E, g) => {
|
|
2619
|
+
const f = i.get(m[g]);
|
|
2618
2620
|
if (!f) return;
|
|
2619
2621
|
if (f.sufficient) return;
|
|
2620
|
-
f.approvalTransaction =
|
|
2622
|
+
f.approvalTransaction = E;
|
|
2621
2623
|
});
|
|
2622
2624
|
return { sufficient: n, allowances: o.concat(Array.from(i.values())) };
|
|
2623
2625
|
};
|
|
@@ -2742,21 +2744,21 @@ var ur = async (r, e, t) => {
|
|
|
2742
2744
|
t,
|
|
2743
2745
|
e
|
|
2744
2746
|
);
|
|
2745
|
-
for (const
|
|
2746
|
-
if (
|
|
2747
|
-
const { contractAddress: f, id: R, spenderAddress: I } =
|
|
2747
|
+
for (const g of t) {
|
|
2748
|
+
if (g.type !== "ERC721") continue;
|
|
2749
|
+
const { contractAddress: f, id: R, spenderAddress: I } = g;
|
|
2748
2750
|
const C = `${f}-${I}`;
|
|
2749
2751
|
const y = d.get(C);
|
|
2750
2752
|
if (y) {
|
|
2751
2753
|
o.push({
|
|
2752
2754
|
sufficient: true,
|
|
2753
|
-
itemRequirement:
|
|
2755
|
+
itemRequirement: g
|
|
2754
2756
|
});
|
|
2755
2757
|
continue;
|
|
2756
2758
|
}
|
|
2757
2759
|
const P = `${f}-${R}`;
|
|
2758
2760
|
const N = pr(R, f);
|
|
2759
|
-
a.set(P,
|
|
2761
|
+
a.set(P, g);
|
|
2760
2762
|
s.set(
|
|
2761
2763
|
P,
|
|
2762
2764
|
Po(r, f, N)
|
|
@@ -2764,10 +2766,10 @@ var ur = async (r, e, t) => {
|
|
|
2764
2766
|
}
|
|
2765
2767
|
const l = await Promise.all(s.values());
|
|
2766
2768
|
const u = Array.from(s.keys());
|
|
2767
|
-
for (let
|
|
2768
|
-
const f = a.get(u[
|
|
2769
|
+
for (let g = 0; g < l.length; g++) {
|
|
2770
|
+
const f = a.get(u[g]);
|
|
2769
2771
|
if (!f || f.type !== "ERC721") continue;
|
|
2770
|
-
if (l[
|
|
2772
|
+
if (l[g] === f.spenderAddress) {
|
|
2771
2773
|
o.push({
|
|
2772
2774
|
sufficient: true,
|
|
2773
2775
|
itemRequirement: f
|
|
@@ -2799,12 +2801,12 @@ var ur = async (r, e, t) => {
|
|
|
2799
2801
|
);
|
|
2800
2802
|
}
|
|
2801
2803
|
const m = await Promise.all(c.values());
|
|
2802
|
-
const
|
|
2803
|
-
m.forEach((
|
|
2804
|
-
const R = i.get(
|
|
2804
|
+
const E = Array.from(c.keys());
|
|
2805
|
+
m.forEach((g, f) => {
|
|
2806
|
+
const R = i.get(E[f]);
|
|
2805
2807
|
if (!R) return;
|
|
2806
2808
|
if (R.sufficient) return;
|
|
2807
|
-
R.approvalTransaction =
|
|
2809
|
+
R.approvalTransaction = g;
|
|
2808
2810
|
});
|
|
2809
2811
|
return { sufficient: n, allowances: o.concat(Array.from(i.values())) };
|
|
2810
2812
|
};
|
|
@@ -2952,11 +2954,11 @@ var Bo = (r) => {
|
|
|
2952
2954
|
});
|
|
2953
2955
|
return t.concat(Array.from(e.values()));
|
|
2954
2956
|
};
|
|
2955
|
-
var
|
|
2957
|
+
var Er = (r) => Bo(Oo(_o(r)));
|
|
2956
2958
|
|
|
2957
2959
|
// src/smartCheckout/balanceCheck/balanceRequirement.ts
|
|
2958
2960
|
|
|
2959
|
-
var
|
|
2961
|
+
var gr = (r) => r.map((e) => {
|
|
2960
2962
|
switch (e.type) {
|
|
2961
2963
|
case "ERC20":
|
|
2962
2964
|
return {
|
|
@@ -3046,13 +3048,13 @@ var Tr = async (r, e, t) => {
|
|
|
3046
3048
|
JSON.stringify(L),
|
|
3047
3049
|
t
|
|
3048
3050
|
);
|
|
3049
|
-
const [u, m,
|
|
3051
|
+
const [u, m, E] = await Promise.all([
|
|
3050
3052
|
l.name(),
|
|
3051
3053
|
l.symbol(),
|
|
3052
3054
|
l.decimals()
|
|
3053
3055
|
]);
|
|
3054
3056
|
s = o.tokenAddress;
|
|
3055
|
-
d =
|
|
3057
|
+
d = E;
|
|
3056
3058
|
i = u;
|
|
3057
3059
|
c = m;
|
|
3058
3060
|
} catch (l) {
|
|
@@ -3140,7 +3142,7 @@ var Ir = (r, e, t) => {
|
|
|
3140
3142
|
var Lo = async (r, e, t, n, o = false) => {
|
|
3141
3143
|
try {
|
|
3142
3144
|
const a = /* @__PURE__ */ new Map();
|
|
3143
|
-
|
|
3145
|
+
gr(n).forEach(
|
|
3144
3146
|
(i) => {
|
|
3145
3147
|
if (!i.address) return;
|
|
3146
3148
|
a.set(i.address.toLocaleLowerCase(), i);
|
|
@@ -3199,7 +3201,7 @@ var Do = async (r, e, t) => {
|
|
|
3199
3201
|
return n;
|
|
3200
3202
|
};
|
|
3201
3203
|
var hr = async (r, e, t, n, o = false) => {
|
|
3202
|
-
const a =
|
|
3204
|
+
const a = Er(n);
|
|
3203
3205
|
const s = [];
|
|
3204
3206
|
const i = [];
|
|
3205
3207
|
a.forEach((m) => {
|
|
@@ -3232,22 +3234,22 @@ var hr = async (r, e, t, n, o = false) => {
|
|
|
3232
3234
|
const l = [];
|
|
3233
3235
|
if (s.length > 0) {
|
|
3234
3236
|
const m = _nullishCoalesce(d.shift(), () => ( []));
|
|
3235
|
-
const
|
|
3237
|
+
const E = new Map(m.map((f) => {
|
|
3236
3238
|
const R = f.type === "NATIVE" ? _ : _optionalChain([f, 'access', _130 => _130.token, 'access', _131 => _131.address, 'optionalAccess', _132 => _132.toLowerCase, 'call', _133 => _133()]);
|
|
3237
3239
|
return [R, f];
|
|
3238
3240
|
}));
|
|
3239
|
-
const
|
|
3241
|
+
const g = await Tr(s, m, e);
|
|
3240
3242
|
s.forEach((f) => {
|
|
3241
3243
|
const R = (_nullishCoalesce(f.tokenAddress, () => ( _))).toLowerCase();
|
|
3242
|
-
const I =
|
|
3243
|
-
const C =
|
|
3244
|
-
const y = Ir(f, [...
|
|
3244
|
+
const I = g[R];
|
|
3245
|
+
const C = E.get(R);
|
|
3246
|
+
const y = Ir(f, [...E.values()], I);
|
|
3245
3247
|
l.push(y);
|
|
3246
3248
|
if (!C) {
|
|
3247
3249
|
return;
|
|
3248
3250
|
}
|
|
3249
3251
|
const P = C.balance - y.required.balance;
|
|
3250
|
-
|
|
3252
|
+
E.set(R, {
|
|
3251
3253
|
...C,
|
|
3252
3254
|
balance: P,
|
|
3253
3255
|
formattedBalance: _ethers.formatUnits.call(void 0, P, y.required.token.decimals)
|
|
@@ -3256,8 +3258,8 @@ var hr = async (r, e, t, n, o = false) => {
|
|
|
3256
3258
|
}
|
|
3257
3259
|
if (i.length > 0) {
|
|
3258
3260
|
const m = _nullishCoalesce(d.shift(), () => ( []));
|
|
3259
|
-
i.forEach((
|
|
3260
|
-
l.push(Rr(
|
|
3261
|
+
i.forEach((E) => {
|
|
3262
|
+
l.push(Rr(E, m));
|
|
3261
3263
|
});
|
|
3262
3264
|
}
|
|
3263
3265
|
const u = l.find((m) => !m.sufficient) === void 0;
|
|
@@ -3306,7 +3308,7 @@ var yr = async (r, e, t) => {
|
|
|
3306
3308
|
n.push(Ar(r, t.transaction));
|
|
3307
3309
|
} else {
|
|
3308
3310
|
const s = await r.getFeeData();
|
|
3309
|
-
const i =
|
|
3311
|
+
const i = gt(s);
|
|
3310
3312
|
if (i !== null) {
|
|
3311
3313
|
const c = i * t.gasToken.limit;
|
|
3312
3314
|
if (c) o += c;
|
|
@@ -3457,8 +3459,8 @@ var We = async (r, e, t, n, o) => {
|
|
|
3457
3459
|
);
|
|
3458
3460
|
l.forEach((u, m) => {
|
|
3459
3461
|
if (u.status === "rejected") return;
|
|
3460
|
-
const
|
|
3461
|
-
a.set(
|
|
3462
|
+
const E = d[m];
|
|
3463
|
+
a.set(E, {
|
|
3462
3464
|
quote: u.value.quote,
|
|
3463
3465
|
approval: _nullishCoalesce(_optionalChain([u, 'access', _136 => _136.value, 'access', _137 => _137.approval, 'optionalAccess', _138 => _138.gasFeeEstimate]), () => ( null)),
|
|
3464
3466
|
swap: u.value.swap.gasFeeEstimate
|
|
@@ -3690,12 +3692,12 @@ var Ge = async (r, e, t, n, o, a, s) => {
|
|
|
3690
3692
|
c,
|
|
3691
3693
|
a
|
|
3692
3694
|
);
|
|
3693
|
-
const
|
|
3694
|
-
for (const
|
|
3695
|
-
const f = m.get(
|
|
3695
|
+
const E = Array.from(m.keys());
|
|
3696
|
+
for (const g of E) {
|
|
3697
|
+
const f = m.get(g);
|
|
3696
3698
|
if (!f) continue;
|
|
3697
3699
|
const R = u.find(
|
|
3698
|
-
(P) => T(P.token.address,
|
|
3700
|
+
(P) => T(P.token.address, g)
|
|
3699
3701
|
);
|
|
3700
3702
|
if (!R) continue;
|
|
3701
3703
|
const I = f.quote.amountWithMaxSlippage;
|
|
@@ -3709,13 +3711,13 @@ var Ge = async (r, e, t, n, o, a, s) => {
|
|
|
3709
3711
|
f.quote.fees,
|
|
3710
3712
|
{
|
|
3711
3713
|
amount: I.value,
|
|
3712
|
-
address:
|
|
3714
|
+
address: g
|
|
3713
3715
|
}
|
|
3714
3716
|
)) continue;
|
|
3715
3717
|
if (!Ho(
|
|
3716
3718
|
R.balance,
|
|
3717
3719
|
s,
|
|
3718
|
-
|
|
3720
|
+
g,
|
|
3719
3721
|
I.value,
|
|
3720
3722
|
C,
|
|
3721
3723
|
f.quote.fees
|
|
@@ -3954,25 +3956,25 @@ var Ve = async (r, e, t, n, o) => {
|
|
|
3954
3956
|
} else if (!l.find((P) => T(P.address, m))) {
|
|
3955
3957
|
return void 0;
|
|
3956
3958
|
}
|
|
3957
|
-
const
|
|
3959
|
+
const E = await Or(
|
|
3958
3960
|
r,
|
|
3959
3961
|
e,
|
|
3960
3962
|
a,
|
|
3961
3963
|
s
|
|
3962
3964
|
);
|
|
3963
3965
|
const {
|
|
3964
|
-
sourceChainGas:
|
|
3966
|
+
sourceChainGas: g,
|
|
3965
3967
|
approvalGas: f,
|
|
3966
3968
|
bridgeFee: R,
|
|
3967
3969
|
imtblFee: I,
|
|
3968
3970
|
totalFees: C
|
|
3969
|
-
} =
|
|
3971
|
+
} = E;
|
|
3970
3972
|
if (!Yo(c, C)) return void 0;
|
|
3971
3973
|
if (O(m)) {
|
|
3972
3974
|
const P = c.balances.find((N) => O(N.token.address));
|
|
3973
3975
|
if (P && P.balance >= n.amount + C) {
|
|
3974
3976
|
const N = Br(
|
|
3975
|
-
|
|
3977
|
+
g,
|
|
3976
3978
|
R,
|
|
3977
3979
|
I,
|
|
3978
3980
|
f,
|
|
@@ -3987,7 +3989,7 @@ var Ve = async (r, e, t, n, o) => {
|
|
|
3987
3989
|
);
|
|
3988
3990
|
if (y && y.balance >= n.amount) {
|
|
3989
3991
|
const P = Br(
|
|
3990
|
-
|
|
3992
|
+
g,
|
|
3991
3993
|
R,
|
|
3992
3994
|
I,
|
|
3993
3995
|
f,
|
|
@@ -4071,9 +4073,9 @@ var br = (r, e, t, n, o) => {
|
|
|
4071
4073
|
return T(C.token.address, l);
|
|
4072
4074
|
});
|
|
4073
4075
|
if (!m) continue;
|
|
4074
|
-
const
|
|
4075
|
-
const
|
|
4076
|
-
const f =
|
|
4076
|
+
const E = i.quote.amountWithMaxSlippage.value;
|
|
4077
|
+
const g = $o(i, s);
|
|
4078
|
+
const f = E + g;
|
|
4077
4079
|
const R = Xo(
|
|
4078
4080
|
o,
|
|
4079
4081
|
s
|
|
@@ -4166,15 +4168,15 @@ var oa = (r, e, t, n, o) => {
|
|
|
4166
4168
|
let u = BigInt(0);
|
|
4167
4169
|
const m = s.get(l);
|
|
4168
4170
|
if (m) u = m.balance;
|
|
4169
|
-
const
|
|
4170
|
-
const
|
|
4171
|
+
const E = u + d;
|
|
4172
|
+
const g = o.find((f) => T(f.address, l));
|
|
4171
4173
|
s.set(l, {
|
|
4172
|
-
balance:
|
|
4174
|
+
balance: E,
|
|
4173
4175
|
formattedBalance: _ethers.formatUnits.call(void 0,
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
+
E,
|
|
4177
|
+
g.decimals
|
|
4176
4178
|
),
|
|
4177
|
-
token:
|
|
4179
|
+
token: g
|
|
4178
4180
|
});
|
|
4179
4181
|
}
|
|
4180
4182
|
const i = Array.from(s.values());
|
|
@@ -4248,22 +4250,22 @@ var Fr = async (r, e, t, n, o, a, s, i, c) => {
|
|
|
4248
4250
|
u
|
|
4249
4251
|
)) return [];
|
|
4250
4252
|
const m = await Lr(r, i);
|
|
4251
|
-
const
|
|
4253
|
+
const E = na(
|
|
4252
4254
|
u,
|
|
4253
4255
|
s,
|
|
4254
4256
|
i,
|
|
4255
4257
|
m
|
|
4256
4258
|
);
|
|
4257
|
-
if (
|
|
4258
|
-
const
|
|
4259
|
+
if (E.length === 0) return [];
|
|
4260
|
+
const g = await Dr(
|
|
4259
4261
|
r,
|
|
4260
4262
|
o,
|
|
4261
4263
|
u,
|
|
4262
4264
|
n,
|
|
4263
|
-
|
|
4265
|
+
E
|
|
4264
4266
|
);
|
|
4265
4267
|
const f = br(
|
|
4266
|
-
|
|
4268
|
+
g,
|
|
4267
4269
|
d,
|
|
4268
4270
|
l,
|
|
4269
4271
|
m,
|
|
@@ -4434,15 +4436,15 @@ var pa = async (r, e, t, n, o, a, s, i) => {
|
|
|
4434
4436
|
if (!d) return [];
|
|
4435
4437
|
if (d.error !== void 0 || !d.success) return [];
|
|
4436
4438
|
const l = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _145 => _145.bridge]), () => ( []));
|
|
4437
|
-
const u = l.map((
|
|
4438
|
-
if (
|
|
4439
|
-
return
|
|
4439
|
+
const u = l.map((g) => {
|
|
4440
|
+
if (g.address === void 0) return J;
|
|
4441
|
+
return g.address;
|
|
4440
4442
|
});
|
|
4441
4443
|
const m = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _146 => _146.swap]), () => ( []));
|
|
4442
4444
|
if (n.type !== "NATIVE" && n.type !== "ERC20") {
|
|
4443
4445
|
return [];
|
|
4444
4446
|
}
|
|
4445
|
-
const
|
|
4447
|
+
const E = await Fr(
|
|
4446
4448
|
r,
|
|
4447
4449
|
e,
|
|
4448
4450
|
t,
|
|
@@ -4453,7 +4455,7 @@ var pa = async (r, e, t, n, o, a, s, i) => {
|
|
|
4453
4455
|
m,
|
|
4454
4456
|
i
|
|
4455
4457
|
);
|
|
4456
|
-
return
|
|
4458
|
+
return E;
|
|
4457
4459
|
};
|
|
4458
4460
|
var ua = async (r, e, t) => {
|
|
4459
4461
|
if (!e.onRamp) return void 0;
|
|
@@ -4677,22 +4679,22 @@ var ce = async (r, e, t, n, o, a, s, i = false) => {
|
|
|
4677
4679
|
c,
|
|
4678
4680
|
d
|
|
4679
4681
|
);
|
|
4680
|
-
const
|
|
4682
|
+
const E = await S(
|
|
4681
4683
|
r,
|
|
4682
4684
|
"Time to calculate token allowances",
|
|
4683
4685
|
Promise.all([l, u, m])
|
|
4684
4686
|
);
|
|
4685
|
-
const
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4687
|
+
const g = cr(
|
|
4688
|
+
E[0],
|
|
4689
|
+
E[1],
|
|
4690
|
+
E[2]
|
|
4689
4691
|
);
|
|
4690
4692
|
let f = null;
|
|
4691
4693
|
if (n) {
|
|
4692
4694
|
f = await S(
|
|
4693
4695
|
r,
|
|
4694
4696
|
"Time to run gas calculator",
|
|
4695
|
-
yr(e,
|
|
4697
|
+
yr(e, g, n)
|
|
4696
4698
|
);
|
|
4697
4699
|
if (f !== null) {
|
|
4698
4700
|
d.push(f);
|
|
@@ -4769,15 +4771,15 @@ var _metrics = require('@imtbl/metrics');
|
|
|
4769
4771
|
function wt(r) {
|
|
4770
4772
|
return _optionalChain([r, 'optionalAccess', _152 => _152.ethereumProvider, 'optionalAccess', _153 => _153.isPassport]) === true;
|
|
4771
4773
|
}
|
|
4772
|
-
function
|
|
4774
|
+
function Ea(r) {
|
|
4773
4775
|
return wt(r);
|
|
4774
4776
|
}
|
|
4775
|
-
var
|
|
4777
|
+
var ga = async (r, e) => {
|
|
4776
4778
|
const t = e;
|
|
4777
4779
|
const { chainId: n } = await r.getNetwork();
|
|
4778
4780
|
if (!Kt(Number(n))) return t;
|
|
4779
4781
|
if (typeof t.gasPrice !== "undefined") return t;
|
|
4780
|
-
if (
|
|
4782
|
+
if (Ea(r)) {
|
|
4781
4783
|
t.gasPrice = BigInt(0);
|
|
4782
4784
|
} else {
|
|
4783
4785
|
t.maxFeePerGas = ot.maxFeePerGas;
|
|
@@ -4809,7 +4811,7 @@ var St = (r) => {
|
|
|
4809
4811
|
var F = async (r, e) => {
|
|
4810
4812
|
try {
|
|
4811
4813
|
const t = await r.getSigner();
|
|
4812
|
-
const n = await
|
|
4814
|
+
const n = await ga(r, e);
|
|
4813
4815
|
const o = await t.sendTransaction(n);
|
|
4814
4816
|
return {
|
|
4815
4817
|
transactionResponse: o
|
|
@@ -5072,11 +5074,11 @@ var Kr = async (r, e, t, n = {
|
|
|
5072
5074
|
"Time to get the address from the provider",
|
|
5073
5075
|
(await e.getSigner()).getAddress()
|
|
5074
5076
|
);
|
|
5075
|
-
|
|
5077
|
+
Et();
|
|
5076
5078
|
q(r, e, l, v(r));
|
|
5077
5079
|
q(r, e, l, A(r));
|
|
5078
|
-
const { id: u, takerFees: m, fillAmount:
|
|
5079
|
-
let
|
|
5080
|
+
const { id: u, takerFees: m, fillAmount: E } = t[0];
|
|
5081
|
+
let g;
|
|
5080
5082
|
try {
|
|
5081
5083
|
o = await S(
|
|
5082
5084
|
r,
|
|
@@ -5084,7 +5086,7 @@ var Kr = async (r, e, t, n = {
|
|
|
5084
5086
|
c.getListing(u)
|
|
5085
5087
|
);
|
|
5086
5088
|
const { seaportContractAddress: k, chainName: X } = c.config();
|
|
5087
|
-
|
|
5089
|
+
g = X;
|
|
5088
5090
|
a = k;
|
|
5089
5091
|
} catch (k) {
|
|
5090
5092
|
throw new p(
|
|
@@ -5111,7 +5113,7 @@ var Kr = async (r, e, t, n = {
|
|
|
5111
5113
|
const k = await S(
|
|
5112
5114
|
r,
|
|
5113
5115
|
"Time to get decimals of token contract for the buy token",
|
|
5114
|
-
d.getToken({ contractAddress: f.contractAddress, chainName:
|
|
5116
|
+
d.getToken({ contractAddress: f.contractAddress, chainName: g })
|
|
5115
5117
|
);
|
|
5116
5118
|
if (k.result.decimals) s = k.result.decimals;
|
|
5117
5119
|
}
|
|
@@ -5128,7 +5130,7 @@ var Kr = async (r, e, t, n = {
|
|
|
5128
5130
|
const { actions: k } = await S(
|
|
5129
5131
|
r,
|
|
5130
5132
|
"Time to call fulfillOrder from the orderbook",
|
|
5131
|
-
c.fulfillOrder(u, l, R,
|
|
5133
|
+
c.fulfillOrder(u, l, R, E)
|
|
5132
5134
|
);
|
|
5133
5135
|
y = k;
|
|
5134
5136
|
I = await S(
|
|
@@ -5193,8 +5195,8 @@ var Kr = async (r, e, t, n = {
|
|
|
5193
5195
|
W.forEach((k) => {
|
|
5194
5196
|
N += BigInt(k.amount);
|
|
5195
5197
|
});
|
|
5196
|
-
if (o.result.sell[0].type === "ERC1155" &&
|
|
5197
|
-
N = N * BigInt(
|
|
5198
|
+
if (o.result.sell[0].type === "ERC1155" && E) {
|
|
5199
|
+
N = N * BigInt(E) / BigInt(o.result.sell[0].amount);
|
|
5198
5200
|
}
|
|
5199
5201
|
const et = [
|
|
5200
5202
|
Sa(z, de, N, a)
|
|
@@ -5540,7 +5542,7 @@ var Jr = async (r, e, t) => {
|
|
|
5540
5542
|
}
|
|
5541
5543
|
);
|
|
5542
5544
|
}
|
|
5543
|
-
const
|
|
5545
|
+
const E = [];
|
|
5544
5546
|
if (m && i.type === "ERC1155") {
|
|
5545
5547
|
const f = La(
|
|
5546
5548
|
i.id,
|
|
@@ -5548,20 +5550,20 @@ var Jr = async (r, e, t) => {
|
|
|
5548
5550
|
a,
|
|
5549
5551
|
i.amount
|
|
5550
5552
|
);
|
|
5551
|
-
|
|
5553
|
+
E.push(f);
|
|
5552
5554
|
} else {
|
|
5553
5555
|
const f = ba(i.id, i.collectionAddress, a);
|
|
5554
|
-
|
|
5556
|
+
E.push(f);
|
|
5555
5557
|
}
|
|
5556
|
-
let
|
|
5558
|
+
let g;
|
|
5557
5559
|
if (!ht(e)) {
|
|
5558
|
-
|
|
5560
|
+
g = await S(
|
|
5559
5561
|
r,
|
|
5560
5562
|
"Total time running smart checkout",
|
|
5561
5563
|
ce(
|
|
5562
5564
|
r,
|
|
5563
5565
|
e,
|
|
5564
|
-
|
|
5566
|
+
E,
|
|
5565
5567
|
{
|
|
5566
5568
|
type: "GAS",
|
|
5567
5569
|
gasToken: {
|
|
@@ -5572,9 +5574,9 @@ var Jr = async (r, e, t) => {
|
|
|
5572
5574
|
)
|
|
5573
5575
|
);
|
|
5574
5576
|
} else {
|
|
5575
|
-
|
|
5577
|
+
g = { sufficient: true, transactionRequirements: [] };
|
|
5576
5578
|
}
|
|
5577
|
-
if (
|
|
5579
|
+
if (g.sufficient) {
|
|
5578
5580
|
const f = await jr(o.actions);
|
|
5579
5581
|
const R = await Ke(e, f.approvalTransactions);
|
|
5580
5582
|
if (R.type === "FAILED") {
|
|
@@ -5582,7 +5584,7 @@ var Jr = async (r, e, t) => {
|
|
|
5582
5584
|
status: "FAILED",
|
|
5583
5585
|
transactionHash: R.transactionHash,
|
|
5584
5586
|
reason: R.reason,
|
|
5585
|
-
smartCheckoutResult:
|
|
5587
|
+
smartCheckoutResult: g
|
|
5586
5588
|
};
|
|
5587
5589
|
}
|
|
5588
5590
|
const I = Hr(
|
|
@@ -5640,12 +5642,12 @@ var Jr = async (r, e, t) => {
|
|
|
5640
5642
|
return {
|
|
5641
5643
|
status: "SUCCESS",
|
|
5642
5644
|
orderIds: [y],
|
|
5643
|
-
smartCheckoutResult:
|
|
5645
|
+
smartCheckoutResult: g
|
|
5644
5646
|
};
|
|
5645
5647
|
}
|
|
5646
5648
|
return {
|
|
5647
5649
|
status: "INSUFFICIENT_FUNDS",
|
|
5648
|
-
smartCheckoutResult:
|
|
5650
|
+
smartCheckoutResult: g
|
|
5649
5651
|
};
|
|
5650
5652
|
};
|
|
5651
5653
|
|
|
@@ -5714,8 +5716,8 @@ var Xr = async (r, e, t, n, o, a, s, i, c) => {
|
|
|
5714
5716
|
);
|
|
5715
5717
|
if (d.approval) {
|
|
5716
5718
|
const m = await F(e, d.approval.transaction);
|
|
5717
|
-
const
|
|
5718
|
-
if (_optionalChain([
|
|
5719
|
+
const E = await m.transactionResponse.wait();
|
|
5720
|
+
if (_optionalChain([E, 'optionalAccess', _156 => _156.status]) === 0) {
|
|
5719
5721
|
throw new p(
|
|
5720
5722
|
"Approval transaction failed and was reverted",
|
|
5721
5723
|
"APPROVAL_TRANSACTION_FAILED"
|
|
@@ -6407,4 +6409,4 @@ var Xe = class {
|
|
|
6407
6409
|
|
|
6408
6410
|
|
|
6409
6411
|
|
|
6410
|
-
exports.AddTokensEventType =
|
|
6412
|
+
exports.AddTokensEventType = gn; exports.BlockExplorerService = Xe; exports.BridgeEventType = dn; exports.ChainId = Q; exports.ChainName = rt; exports.ChainSlug = Ae; exports.Checkout = Ot; exports.CheckoutConfiguration = Ie; exports.CheckoutError = p; exports.CheckoutErrorType = w; exports.CheckoutStatus = fe; exports.CommerceEventType = un; exports.CommerceFailureEventType = fn; exports.CommerceFlowType = An; exports.CommerceSuccessEventType = mn; exports.CommerceUserActionEventType = En; exports.ConnectEventType = nn; exports.ConnectTargetLayer = In; exports.ExchangeType = qt; exports.FeeType = ve; exports.FundingStepType = Re; exports.GasEstimateType = at; exports.GasTokenType = ge; exports.IMMUTABLE_API_BASE_URL = U; exports.IMTBLWidgetEvents = tn; exports.ItemType = B; exports.NetworkFilterTypes = ue; exports.OnRampEventType = pn; exports.OrchestrationEventType = ln; exports.ProviderEventType = rn; exports.PurchaseEventType = Rn; exports.RoutingOutcomeType = st; exports.SaleEventType = sn; exports.SalePaymentTypes = cn; exports.SwapDirection = hn; exports.SwapEventType = an; exports.TokenFilterTypes = ne; exports.TransactionOrGasType = Ee; exports.TransferEventType = Cn; exports.WalletEventType = on; exports.WalletFilterTypes = Wt; exports.WalletProviderName = me; exports.WalletProviderRdns = Ut; exports.WidgetTheme = yn; exports.WidgetType = Tn; exports.WrappedBrowserProvider = b; exports.fetchRiskAssessment = Nt; exports.getGasPriceInWei = gt; exports.getMetaMaskProviderDetail = mo; exports.getPassportProviderDetail = uo; exports.getUnderlyingChainId = Ce; exports.isAddressSanctioned = _t; exports.metaMaskProviderInfo = be; exports.passportProviderInfo = Le; exports.validateProvider = M;
|