@lumiapassport/ui-kit 1.14.26 → 1.15.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/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +47 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3750,6 +3750,11 @@ async function createAccountSession(params = {}) {
|
|
|
3750
3750
|
}
|
|
3751
3751
|
const saltZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
3752
3752
|
const smartAccountAddress = await predictCompatAddress(ownerAddress, factoryAddress, saltZero);
|
|
3753
|
+
if (mpcUserId) {
|
|
3754
|
+
registerSmartAccountAddress(smartAccountAddress).catch((error) => {
|
|
3755
|
+
console.warn("[Account] Background Smart Account registration failed:", error);
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3753
3758
|
return { ownerAddress, smartAccountAddress, factoryAddress, ownerPrivateKey, mpcUserId: privateKey ? void 0 : mpcUserId, usePaymaster, kind: "lumia", address: smartAccountAddress };
|
|
3754
3759
|
}
|
|
3755
3760
|
async function predictCompatAddress(owner, factory, salt) {
|
|
@@ -3761,6 +3766,47 @@ async function predictCompatAddress(owner, factory, salt) {
|
|
|
3761
3766
|
throw new Error(`Failed to predict account address: ${error}`);
|
|
3762
3767
|
}
|
|
3763
3768
|
}
|
|
3769
|
+
async function registerSmartAccountAddress(smartAccountAddress) {
|
|
3770
|
+
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
3771
|
+
const accessToken = jwtTokenManager4.getAccessToken();
|
|
3772
|
+
if (!accessToken) {
|
|
3773
|
+
console.warn("[Account] No access token available for Smart Account registration");
|
|
3774
|
+
return { success: true, smartAccountAddress, alreadySet: false };
|
|
3775
|
+
}
|
|
3776
|
+
const tssUrl = getTssUrl2();
|
|
3777
|
+
try {
|
|
3778
|
+
const response = await fetch(`${tssUrl}/api/tss/wallet/smart-account`, {
|
|
3779
|
+
method: "POST",
|
|
3780
|
+
headers: {
|
|
3781
|
+
"Authorization": `Bearer ${accessToken}`,
|
|
3782
|
+
"Content-Type": "application/json"
|
|
3783
|
+
},
|
|
3784
|
+
body: JSON.stringify({ smartAccountAddress })
|
|
3785
|
+
});
|
|
3786
|
+
if (!response.ok) {
|
|
3787
|
+
const errorData = await response.json().catch(() => ({}));
|
|
3788
|
+
if (response.status === 409) {
|
|
3789
|
+
console.warn("[Account] Smart Account address conflict:", errorData.error);
|
|
3790
|
+
return { success: true, smartAccountAddress, alreadySet: true };
|
|
3791
|
+
}
|
|
3792
|
+
if (response.status === 404) {
|
|
3793
|
+
console.warn("[Account] DKG not completed on server:", errorData.error);
|
|
3794
|
+
return { success: false, smartAccountAddress, alreadySet: false };
|
|
3795
|
+
}
|
|
3796
|
+
console.warn("[Account] Failed to register Smart Account:", errorData.error || response.statusText);
|
|
3797
|
+
return { success: false, smartAccountAddress, alreadySet: false };
|
|
3798
|
+
}
|
|
3799
|
+
const result = await response.json();
|
|
3800
|
+
console.log("[Account] Smart Account registered:", {
|
|
3801
|
+
address: result.smartAccountAddress,
|
|
3802
|
+
alreadySet: result.alreadySet
|
|
3803
|
+
});
|
|
3804
|
+
return result;
|
|
3805
|
+
} catch (error) {
|
|
3806
|
+
console.warn("[Account] Error registering Smart Account address:", error);
|
|
3807
|
+
return { success: false, smartAccountAddress, alreadySet: false };
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3764
3810
|
async function sendUserOperation(session, callTarget, amountWei, innerData = "0x", feeType = "standard", entryPointVersion = "v0.7") {
|
|
3765
3811
|
const entryPointAddress = entryPointVersion === "v0.6" ? ENTRYPOINT_V06 : ENTRYPOINT_V07;
|
|
3766
3812
|
const amountWeiBigInt = BigInt(amountWei);
|
|
@@ -5459,7 +5505,7 @@ function Header() {
|
|
|
5459
5505
|
// package.json
|
|
5460
5506
|
var package_default = {
|
|
5461
5507
|
name: "@lumiapassport/ui-kit",
|
|
5462
|
-
version: "1.
|
|
5508
|
+
version: "1.15.0",
|
|
5463
5509
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
5464
5510
|
type: "module",
|
|
5465
5511
|
main: "./dist/index.cjs",
|