@lumiapassport/ui-kit 1.14.16 → 1.14.19
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/iframe/index.html +1 -1
- package/dist/iframe/main.js +35 -8
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +94 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -82
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/iframe/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
16
16
|
<meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
|
|
17
17
|
|
|
18
|
-
<title>Lumia Passport Secure Wallet - iframe version 1.14.
|
|
18
|
+
<title>Lumia Passport Secure Wallet - iframe version 1.14.19</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -1408,6 +1408,7 @@ function buildSignTxTemplateData(project, origin, typedData, metadata, userProfi
|
|
|
1408
1408
|
|
|
1409
1409
|
// src/iframe/templates/data/confirm-tx-template-data.ts
|
|
1410
1410
|
var ERC20_APPROVE_SELECTOR = "0x095ea7b3";
|
|
1411
|
+
var EXECUTE_SELECTOR = "0xb61d27f6";
|
|
1411
1412
|
var DEFAULT_EXPLORER_URL = "https://beam-explorer.lumia.org";
|
|
1412
1413
|
function formatAddress(address) {
|
|
1413
1414
|
if (address.length < 10) return address;
|
|
@@ -1418,14 +1419,33 @@ function getAddressExplorerUrl(address, explorerUrl) {
|
|
|
1418
1419
|
const baseUrl = explorerUrl.replace(/\/$/, "");
|
|
1419
1420
|
return `${baseUrl}/address/${address}`;
|
|
1420
1421
|
}
|
|
1421
|
-
function
|
|
1422
|
+
function extractInnerCallData(callData) {
|
|
1422
1423
|
if (!callData || callData.length < 10) return null;
|
|
1423
1424
|
const selector = callData.slice(0, 10).toLowerCase();
|
|
1425
|
+
if (selector !== EXECUTE_SELECTOR) return null;
|
|
1426
|
+
try {
|
|
1427
|
+
const lengthHex = callData.slice(202, 266);
|
|
1428
|
+
const length = parseInt(lengthHex, 16);
|
|
1429
|
+
if (length === 0) return "0x";
|
|
1430
|
+
const innerData = "0x" + callData.slice(266, 266 + length * 2);
|
|
1431
|
+
return innerData;
|
|
1432
|
+
} catch {
|
|
1433
|
+
return null;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function parseERC20Approve(callData) {
|
|
1437
|
+
if (!callData || callData.length < 10) return null;
|
|
1438
|
+
let dataToCheck = callData;
|
|
1439
|
+
const innerData = extractInnerCallData(callData);
|
|
1440
|
+
if (innerData) {
|
|
1441
|
+
dataToCheck = innerData;
|
|
1442
|
+
}
|
|
1443
|
+
const selector = dataToCheck.slice(0, 10).toLowerCase();
|
|
1424
1444
|
if (selector !== ERC20_APPROVE_SELECTOR) return null;
|
|
1425
|
-
if (
|
|
1445
|
+
if (dataToCheck.length < 138) return null;
|
|
1426
1446
|
try {
|
|
1427
|
-
const spender = "0x" +
|
|
1428
|
-
const amountHex =
|
|
1447
|
+
const spender = "0x" + dataToCheck.slice(34, 74);
|
|
1448
|
+
const amountHex = dataToCheck.slice(74, 138);
|
|
1429
1449
|
const amount = BigInt("0x" + amountHex);
|
|
1430
1450
|
return { spender, amount };
|
|
1431
1451
|
} catch {
|
|
@@ -1486,13 +1506,20 @@ function buildConfirmTxTemplateData(project, origin, transaction, risk, metadata
|
|
|
1486
1506
|
const formattedValue = formatValue(transactionValue);
|
|
1487
1507
|
const hasValue = BigInt(transactionValue) > 0n;
|
|
1488
1508
|
const callData = transaction.userOpDetails?.callData || transaction.data || "";
|
|
1489
|
-
const
|
|
1509
|
+
const innerCallData = extractInnerCallData(callData);
|
|
1510
|
+
const effectiveCallData = innerCallData || callData;
|
|
1511
|
+
const hasContractCall = !!effectiveCallData && effectiveCallData !== "0x" && effectiveCallData.length > 2;
|
|
1512
|
+
const showContractInteraction = isUserOp ? hasContractCall : !!callData && callData !== "0x";
|
|
1490
1513
|
let actionDescription = "Contract Interaction";
|
|
1491
1514
|
if (showContractInteraction) {
|
|
1492
1515
|
const approveData = parseERC20Approve(callData);
|
|
1493
1516
|
if (approveData) {
|
|
1494
|
-
|
|
1495
|
-
|
|
1517
|
+
if (approveData.amount === 0n) {
|
|
1518
|
+
actionDescription = "Revoke token approval";
|
|
1519
|
+
} else {
|
|
1520
|
+
const formattedAmount = formatApproveAmount(approveData.amount);
|
|
1521
|
+
actionDescription = `Approve ${formattedAmount} tokens`;
|
|
1522
|
+
}
|
|
1496
1523
|
}
|
|
1497
1524
|
}
|
|
1498
1525
|
const isSponsored = isUserOp && !!transaction.userOpDetails?.paymaster;
|
|
@@ -4288,7 +4315,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
4288
4315
|
};
|
|
4289
4316
|
|
|
4290
4317
|
// src/iframe/main.ts
|
|
4291
|
-
var IFRAME_VERSION = "1.14.
|
|
4318
|
+
var IFRAME_VERSION = "1.14.19";
|
|
4292
4319
|
var IframeWallet = class {
|
|
4293
4320
|
constructor() {
|
|
4294
4321
|
console.log("=".repeat(60));
|