@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/dist/index.d.cts CHANGED
@@ -289,6 +289,38 @@ interface SignTypedDataParams {
289
289
  * ```
290
290
  */
291
291
  declare function signTypedData(session: AccountSession$1, params: SignTypedDataParams): Promise<`0x${string}`>;
292
+ /**
293
+ * Deploy smart account contract if not already deployed.
294
+ *
295
+ * This sends a minimal UserOperation (to 0x0, value 0, data 0x) which triggers
296
+ * account deployment via factory without requiring user consent.
297
+ *
298
+ * By default, checks if account is already deployed to avoid unnecessary gas costs.
299
+ * If already deployed, returns null without sending a transaction.
300
+ *
301
+ * @param session - Account session with signing credentials
302
+ * @param feeType - Fee type: 'economy', 'standard', or 'fast' (default: 'economy')
303
+ * @param options - Deployment options
304
+ * @param options.force - If true, sends transaction even if already deployed (default: false)
305
+ * @returns UserOperation hash if deployed, null if already deployed (when force=false)
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * // Deploy account immediately after DKG (skips if already deployed)
310
+ * const userOpHash = await deployAccount(session, 'economy');
311
+ * if (userOpHash) {
312
+ * console.log('Account deployed:', userOpHash);
313
+ * } else {
314
+ * console.log('Account already deployed');
315
+ * }
316
+ *
317
+ * // Force deployment even if already deployed (not recommended)
318
+ * const hash = await deployAccount(session, 'economy', { force: true });
319
+ * ```
320
+ */
321
+ declare function deployAccount(session: AccountSession$1, feeType?: 'economy' | 'standard' | 'fast', options?: {
322
+ force?: boolean;
323
+ }): Promise<`0x${string}` | null>;
292
324
 
293
325
  type AccountSession = AccountSession$1;
294
326
  interface SessionState {
@@ -961,4 +993,4 @@ interface WalletReadyStatus {
961
993
  timestamp: number;
962
994
  }
963
995
 
964
- export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
996
+ export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
package/dist/index.d.ts CHANGED
@@ -289,6 +289,38 @@ interface SignTypedDataParams {
289
289
  * ```
290
290
  */
291
291
  declare function signTypedData(session: AccountSession$1, params: SignTypedDataParams): Promise<`0x${string}`>;
292
+ /**
293
+ * Deploy smart account contract if not already deployed.
294
+ *
295
+ * This sends a minimal UserOperation (to 0x0, value 0, data 0x) which triggers
296
+ * account deployment via factory without requiring user consent.
297
+ *
298
+ * By default, checks if account is already deployed to avoid unnecessary gas costs.
299
+ * If already deployed, returns null without sending a transaction.
300
+ *
301
+ * @param session - Account session with signing credentials
302
+ * @param feeType - Fee type: 'economy', 'standard', or 'fast' (default: 'economy')
303
+ * @param options - Deployment options
304
+ * @param options.force - If true, sends transaction even if already deployed (default: false)
305
+ * @returns UserOperation hash if deployed, null if already deployed (when force=false)
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * // Deploy account immediately after DKG (skips if already deployed)
310
+ * const userOpHash = await deployAccount(session, 'economy');
311
+ * if (userOpHash) {
312
+ * console.log('Account deployed:', userOpHash);
313
+ * } else {
314
+ * console.log('Account already deployed');
315
+ * }
316
+ *
317
+ * // Force deployment even if already deployed (not recommended)
318
+ * const hash = await deployAccount(session, 'economy', { force: true });
319
+ * ```
320
+ */
321
+ declare function deployAccount(session: AccountSession$1, feeType?: 'economy' | 'standard' | 'fast', options?: {
322
+ force?: boolean;
323
+ }): Promise<`0x${string}` | null>;
292
324
 
293
325
  type AccountSession = AccountSession$1;
294
326
  interface SessionState {
@@ -961,4 +993,4 @@ interface WalletReadyStatus {
961
993
  timestamp: number;
962
994
  }
963
995
 
964
- export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
996
+ export { type AccountSession$1 as AccountSession, Address, type AddressProps, type Asset, ConnectWalletButton, type ConnectWalletButtonProps, Hash, type HashProps, KeyshareBackup, LUMIA_EXPLORER_URL, LumiaLogo, type LumiaPassportCallbacks, type LumiaPassportConfig, LumiaPassportProvider, type LumiaPassportProviderProps, LumiaPassportSessionProvider, type LumiaPassportSessionProviderProps, LumiaRainbowKitProvider, type LumiaRainbowKitProviderProps, LumiaSessionProvider, type LumiaSessionProviderProps, LumiaWagmiProvider, type ProviderDetail, type SendTransactionParams, type SendTransactionResult, type SignTypedDataParams, type Theme, ThemeToggle, type TokenBalance, type Transaction, TransactionsList, type TypedDataDomain, type TypedDataField, type UpdateProfileRequest, type UseSendTransactionReturn, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UserOpMempool, type UserOpReceipt, type SendTransactionParams$1 as UserOpSendTransactionParams, type UserOpState, UserOpStatus, type UserOpStatusProps, type UserOperation, type UserProfile, type WalletReadyStatus, deployAccount, getUserProfile, lumiaBeam, prepareUserOperation, queryClient, sendUserOperation, signTypedData, updateUserProfile, useAssets, useLumiaPassportConfig, useLumiaPassportLinkedProfiles, useLumiaPassportSession, useLumiaSession, useSendTransaction, useSmartAccountTransactions, useTheme, useTokenBalance, useTokenInfo, useTransactions, useUserOpStatus, wagmiConfig };
package/dist/index.js CHANGED
@@ -1305,7 +1305,7 @@ async function getShareVaultToken(scopes) {
1305
1305
  async function getShareRecoveryStats() {
1306
1306
  try {
1307
1307
  const token = await getShareVaultToken(["share:get"]);
1308
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1308
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1309
1309
  if (response.status === 404) return null;
1310
1310
  if (!response.ok) return null;
1311
1311
  return await response.json();
@@ -1315,26 +1315,26 @@ async function getShareRecoveryStats() {
1315
1315
  }
1316
1316
  async function getShare() {
1317
1317
  const token = await getShareVaultToken(["share:get"]);
1318
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1318
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1319
1319
  if (response.status === 404) return null;
1320
1320
  if (!response.ok) throw new Error(`Failed to fetch share: ${response.status} ${response.statusText}`);
1321
1321
  return await response.json();
1322
1322
  }
1323
1323
  async function uploadShare(share, idempotencyKey) {
1324
1324
  const token = await getShareVaultToken(["share:put"]);
1325
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(share) });
1325
+ 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) });
1326
1326
  if (!response.ok) throw new Error(`Failed to upload share: ${response.status} ${response.statusText}`);
1327
1327
  return await response.json();
1328
1328
  }
1329
1329
  async function rewrapShare(payload, idempotencyKey) {
1330
1330
  const token = await getShareVaultToken(["share:rewrap"]);
1331
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/rewrap`, { method: "POST", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(payload) });
1331
+ 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) });
1332
1332
  if (!response.ok) throw new Error(`Failed to rewrap share: ${response.status} ${response.statusText}`);
1333
1333
  return await response.json();
1334
1334
  }
1335
1335
  async function deleteShare() {
1336
1336
  const token = await getShareVaultToken(["share:delete"]);
1337
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` }, credentials: "include" });
1337
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "DELETE", headers: { Authorization: `Bearer ${token.token}` } });
1338
1338
  if (!response.ok && response.status !== 404) throw new Error(`Failed to delete share: ${response.status} ${response.statusText}`);
1339
1339
  }
1340
1340
  async function deriveKEKFromPasskey(userId, requiredCredentialId) {
@@ -1511,7 +1511,7 @@ function clearBackupStatus(userId) {
1511
1511
  async function checkServerBackupAvailability() {
1512
1512
  try {
1513
1513
  const token = await getShareVaultToken(["share:get"]);
1514
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" }, credentials: "include" });
1514
+ const response = await fetch(`${getShareVaultUrl()}/v1/shares/me/recovery/stats`, { method: "GET", headers: { Authorization: `Bearer ${token.token}`, "Content-Type": "application/json" } });
1515
1515
  if (response.status === 404) return { hasBackup: false, serviceAvailable: true };
1516
1516
  if (!response.ok) return { hasBackup: false, serviceAvailable: false };
1517
1517
  return { hasBackup: true, serviceAvailable: true };
@@ -1521,14 +1521,14 @@ async function checkServerBackupAvailability() {
1521
1521
  }
1522
1522
  async function uploadShareToVault(envelope, token) {
1523
1523
  const idempotencyKey = crypto.randomUUID ? crypto.randomUUID() : `backup-${Date.now()}`;
1524
- const response = await fetch(`${getShareVaultUrl()}/v1/shares/me`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, "Idempotency-Key": idempotencyKey }, credentials: "include", body: JSON.stringify(envelope) });
1524
+ 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) });
1525
1525
  if (!response.ok) {
1526
1526
  const errorText = await response.text();
1527
1527
  throw new Error(`Failed to upload share: ${response.status} ${response.statusText} - ${errorText}`);
1528
1528
  }
1529
1529
  }
1530
1530
  async function downloadShareFromVault(token) {
1531
- 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" }, credentials: "include" });
1531
+ 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" } });
1532
1532
  if (!response.ok) {
1533
1533
  if (response.status === 404) throw new Error("No backup found on server for this user");
1534
1534
  const errorText = await response.text();
@@ -5633,6 +5633,34 @@ async function signTypedData(session, params) {
5633
5633
  }
5634
5634
  return signature;
5635
5635
  }
5636
+ async function deployAccount(session, feeType = "economy", options) {
5637
+ if (!options?.force) {
5638
+ try {
5639
+ const code = await publicClient.getCode({
5640
+ address: session.smartAccountAddress
5641
+ });
5642
+ const isDeployed = code && code !== "0x" && code.length > 2;
5643
+ if (isDeployed) {
5644
+ console.log("[deployAccount] Account already deployed, skipping deployment");
5645
+ return null;
5646
+ }
5647
+ console.log("[deployAccount] Account not deployed, initiating deployment");
5648
+ } catch (error) {
5649
+ console.warn("[deployAccount] Failed to check deployment status, proceeding with deployment:", error);
5650
+ }
5651
+ }
5652
+ return sendUserOperation(
5653
+ session,
5654
+ "0x0000000000000000000000000000000000000000",
5655
+ // to: burn address
5656
+ "0",
5657
+ // value: 0 (no funds)
5658
+ "0x",
5659
+ // data: empty (no contract call)
5660
+ feeType,
5661
+ "v0.7"
5662
+ );
5663
+ }
5636
5664
  var PAYMASTER_VERIFICATION_GAS_LIMIT, PAYMASTER_POSTOP_GAS_LIMIT, MAX_BUNDLER_VERIFICATION_GAS, PAYMASTER_VERIFICATION_GAS, executeAbi;
5637
5665
  var init_account = __esm({
5638
5666
  "src/internal/clients/account.ts"() {
@@ -5708,6 +5736,7 @@ __export(clients_exports, {
5708
5736
  createAccountSession: () => createAccountSession,
5709
5737
  createAkClient: () => createAkClient,
5710
5738
  createLumiaClient: () => createLumiaClient,
5739
+ deployAccount: () => deployAccount,
5711
5740
  depositForLumiaAccount: () => depositForLumiaAccount,
5712
5741
  depositForSmartAccount: () => depositForSmartAccount,
5713
5742
  getBundlerClient: () => getBundlerClient,
@@ -7879,7 +7908,6 @@ var UserOpStatus = ({
7879
7908
  const res = await fetch(getBundlerUrl(), {
7880
7909
  method: "POST",
7881
7910
  headers: { "content-type": "application/json" },
7882
- credentials: "include",
7883
7911
  body: JSON.stringify(body)
7884
7912
  });
7885
7913
  const json = await res.json();
@@ -8645,7 +8673,7 @@ function useLumiaPassportLinkedProfiles() {
8645
8673
  // package.json
8646
8674
  var package_default = {
8647
8675
  name: "@lumiapassport/ui-kit",
8648
- version: "1.8.0",
8676
+ version: "1.9.0",
8649
8677
  description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
8650
8678
  type: "module",
8651
8679
  main: "./dist/index.cjs",
@@ -9907,7 +9935,6 @@ function useUserOpStatus(options = {}) {
9907
9935
  const res = await fetch(getBundlerUrl(), {
9908
9936
  method: "POST",
9909
9937
  headers: { "content-type": "application/json" },
9910
- credentials: "include",
9911
9938
  body: JSON.stringify(body)
9912
9939
  });
9913
9940
  const json = await res.json();
@@ -10209,6 +10236,7 @@ export {
10209
10236
  ThemeToggle,
10210
10237
  TransactionsList,
10211
10238
  UserOpStatus,
10239
+ deployAccount,
10212
10240
  getUserProfile,
10213
10241
  lumiaBeam,
10214
10242
  prepareUserOperation,