@lumiapassport/ui-kit 1.8.0 → 1.9.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/README.md +56 -0
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +36 -11
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +40 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +39 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1316,7 +1316,7 @@ async function getShareVaultToken(scopes) {
|
|
|
1316
1316
|
async function getShareRecoveryStats() {
|
|
1317
1317
|
try {
|
|
1318
1318
|
const token = await getShareVaultToken(["share:get"]);
|
|
1319
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }
|
|
1319
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
|
|
1320
1320
|
if (response.status === 404) return null;
|
|
1321
1321
|
if (!response.ok) return null;
|
|
1322
1322
|
return await response.json();
|
|
@@ -1326,26 +1326,26 @@ async function getShareRecoveryStats() {
|
|
|
1326
1326
|
}
|
|
1327
1327
|
async function getShare() {
|
|
1328
1328
|
const token = await getShareVaultToken(["share:get"]);
|
|
1329
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }
|
|
1329
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
|
|
1330
1330
|
if (response.status === 404) return null;
|
|
1331
1331
|
if (!response.ok) throw new Error(`Failed to fetch share: ${response.status} ${response.statusText}`);
|
|
1332
1332
|
return await response.json();
|
|
1333
1333
|
}
|
|
1334
1334
|
async function uploadShare(share, idempotencyKey) {
|
|
1335
1335
|
const token = await getShareVaultToken(["share:put"]);
|
|
1336
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey },
|
|
1336
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, body: JSON.stringify(share) });
|
|
1337
1337
|
if (!response.ok) throw new Error(`Failed to upload share: ${response.status} ${response.statusText}`);
|
|
1338
1338
|
return await response.json();
|
|
1339
1339
|
}
|
|
1340
1340
|
async function rewrapShare(payload, idempotencyKey) {
|
|
1341
1341
|
const token = await getShareVaultToken(["share:rewrap"]);
|
|
1342
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/rewrap`, { method: "POST", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey },
|
|
1342
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/rewrap`, { method: "POST", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, body: JSON.stringify(payload) });
|
|
1343
1343
|
if (!response.ok) throw new Error(`Failed to rewrap share: ${response.status} ${response.statusText}`);
|
|
1344
1344
|
return await response.json();
|
|
1345
1345
|
}
|
|
1346
1346
|
async function deleteShare() {
|
|
1347
1347
|
const token = await getShareVaultToken(["share:delete"]);
|
|
1348
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` }
|
|
1348
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` } });
|
|
1349
1349
|
if (!response.ok && response.status !== 404) throw new Error(`Failed to delete share: ${response.status} ${response.statusText}`);
|
|
1350
1350
|
}
|
|
1351
1351
|
async function deriveKEKFromPasskey(userId, requiredCredentialId) {
|
|
@@ -1522,7 +1522,7 @@ function clearBackupStatus(userId) {
|
|
|
1522
1522
|
async function checkServerBackupAvailability() {
|
|
1523
1523
|
try {
|
|
1524
1524
|
const token = await getShareVaultToken(["share:get"]);
|
|
1525
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }
|
|
1525
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
|
|
1526
1526
|
if (response.status === 404) return { hasBackup: false, serviceAvailable: true };
|
|
1527
1527
|
if (!response.ok) return { hasBackup: false, serviceAvailable: false };
|
|
1528
1528
|
return { hasBackup: true, serviceAvailable: true };
|
|
@@ -1532,14 +1532,14 @@ async function checkServerBackupAvailability() {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
async function uploadShareToVault(envelope, token) {
|
|
1534
1534
|
const idempotencyKey = crypto.randomUUID ? crypto.randomUUID() : `backup-${Date.now()}`;
|
|
1535
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, "Idempotency-Key": idempotencyKey },
|
|
1535
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, "Idempotency-Key": idempotencyKey }, body: JSON.stringify(envelope) });
|
|
1536
1536
|
if (!response.ok) {
|
|
1537
1537
|
const errorText = await response.text();
|
|
1538
1538
|
throw new Error(`Failed to upload share: ${response.status} ${response.statusText} - ${errorText}`);
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
async function downloadShareFromVault(token) {
|
|
1542
|
-
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token}`, "X-Client-Device-Id": "lumia-ui-kit", "X-Client-Device-Name": "Lumia UI Kit" }
|
|
1542
|
+
const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token}`, "X-Client-Device-Id": "lumia-ui-kit", "X-Client-Device-Name": "Lumia UI Kit" } });
|
|
1543
1543
|
if (!response.ok) {
|
|
1544
1544
|
if (response.status === 404) throw new Error("No backup found on server for this user");
|
|
1545
1545
|
const errorText = await response.text();
|
|
@@ -5626,6 +5626,34 @@ async function signTypedData(session, params) {
|
|
|
5626
5626
|
}
|
|
5627
5627
|
return signature;
|
|
5628
5628
|
}
|
|
5629
|
+
async function deployAccount(session, feeType = "economy", options) {
|
|
5630
|
+
if (!options?.force) {
|
|
5631
|
+
try {
|
|
5632
|
+
const code = await publicClient.getCode({
|
|
5633
|
+
address: session.smartAccountAddress
|
|
5634
|
+
});
|
|
5635
|
+
const isDeployed = code && code !== "0x" && code.length > 2;
|
|
5636
|
+
if (isDeployed) {
|
|
5637
|
+
console.log("[deployAccount] Account already deployed, skipping deployment");
|
|
5638
|
+
return null;
|
|
5639
|
+
}
|
|
5640
|
+
console.log("[deployAccount] Account not deployed, initiating deployment");
|
|
5641
|
+
} catch (error) {
|
|
5642
|
+
console.warn("[deployAccount] Failed to check deployment status, proceeding with deployment:", error);
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
return sendUserOperation(
|
|
5646
|
+
session,
|
|
5647
|
+
"0x0000000000000000000000000000000000000000",
|
|
5648
|
+
// to: burn address
|
|
5649
|
+
"0",
|
|
5650
|
+
// value: 0 (no funds)
|
|
5651
|
+
"0x",
|
|
5652
|
+
// data: empty (no contract call)
|
|
5653
|
+
feeType,
|
|
5654
|
+
"v0.7"
|
|
5655
|
+
);
|
|
5656
|
+
}
|
|
5629
5657
|
var import_viem3, import_account_abstraction2, import_accounts, import_bundler, import_meta, PAYMASTER_VERIFICATION_GAS_LIMIT, PAYMASTER_POSTOP_GAS_LIMIT, MAX_BUNDLER_VERIFICATION_GAS, PAYMASTER_VERIFICATION_GAS, executeAbi;
|
|
5630
5658
|
var init_account = __esm({
|
|
5631
5659
|
"src/internal/clients/account.ts"() {
|
|
@@ -5706,6 +5734,7 @@ __export(clients_exports, {
|
|
|
5706
5734
|
createAccountSession: () => createAccountSession,
|
|
5707
5735
|
createAkClient: () => createAkClient,
|
|
5708
5736
|
createLumiaClient: () => createLumiaClient,
|
|
5737
|
+
deployAccount: () => deployAccount,
|
|
5709
5738
|
depositForLumiaAccount: () => depositForLumiaAccount,
|
|
5710
5739
|
depositForSmartAccount: () => depositForSmartAccount,
|
|
5711
5740
|
getBundlerClient: () => getBundlerClient,
|
|
@@ -5751,6 +5780,7 @@ __export(index_exports, {
|
|
|
5751
5780
|
ThemeToggle: () => ThemeToggle,
|
|
5752
5781
|
TransactionsList: () => TransactionsList,
|
|
5753
5782
|
UserOpStatus: () => UserOpStatus,
|
|
5783
|
+
deployAccount: () => deployAccount,
|
|
5754
5784
|
getUserProfile: () => getUserProfile,
|
|
5755
5785
|
lumiaBeam: () => lumiaBeam,
|
|
5756
5786
|
prepareUserOperation: () => prepareUserOperation,
|
|
@@ -7908,7 +7938,6 @@ var UserOpStatus = ({
|
|
|
7908
7938
|
const res = await fetch(getBundlerUrl(), {
|
|
7909
7939
|
method: "POST",
|
|
7910
7940
|
headers: { "content-type": "application/json" },
|
|
7911
|
-
credentials: "include",
|
|
7912
7941
|
body: JSON.stringify(body)
|
|
7913
7942
|
});
|
|
7914
7943
|
const json = await res.json();
|
|
@@ -8674,7 +8703,7 @@ function useLumiaPassportLinkedProfiles() {
|
|
|
8674
8703
|
// package.json
|
|
8675
8704
|
var package_default = {
|
|
8676
8705
|
name: "@lumiapassport/ui-kit",
|
|
8677
|
-
version: "1.
|
|
8706
|
+
version: "1.9.0",
|
|
8678
8707
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
8679
8708
|
type: "module",
|
|
8680
8709
|
main: "./dist/index.cjs",
|
|
@@ -9936,7 +9965,6 @@ function useUserOpStatus(options = {}) {
|
|
|
9936
9965
|
const res = await fetch(getBundlerUrl(), {
|
|
9937
9966
|
method: "POST",
|
|
9938
9967
|
headers: { "content-type": "application/json" },
|
|
9939
|
-
credentials: "include",
|
|
9940
9968
|
body: JSON.stringify(body)
|
|
9941
9969
|
});
|
|
9942
9970
|
const json = await res.json();
|
|
@@ -10239,6 +10267,7 @@ function useSmartAccountTransactions() {
|
|
|
10239
10267
|
ThemeToggle,
|
|
10240
10268
|
TransactionsList,
|
|
10241
10269
|
UserOpStatus,
|
|
10270
|
+
deployAccount,
|
|
10242
10271
|
getUserProfile,
|
|
10243
10272
|
lumiaBeam,
|
|
10244
10273
|
prepareUserOperation,
|