@lumiapassport/ui-kit 1.13.10 → 1.14.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 +15 -4
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +286 -59
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +447 -597
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +250 -401
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -267,15 +267,14 @@ That's it! The `ConnectWalletButton` provides a complete authentication UI with
|
|
|
267
267
|
|
|
268
268
|
## Using Hooks
|
|
269
269
|
|
|
270
|
-
> **Note:** The `useLumiaPassportSession` hook is based on pure Zustand store so if you already using hook consider 2 options: 1) refactor state extarction so it uses zustand state extraction feature. 2) consider using
|
|
271
|
-
|
|
272
|
-
### useLumiaPassportAccountSession, useLumiaPassportLoadingStatus, useLumiaPassportBalance, useLumiaPassportIFrameReady, useLumiaPassportAddress, useLumiaPassportError, useLumiaPassportLoadingStatus, useLumiaPassportRecoveryUserId, useLumiaPassportHasServerVault
|
|
270
|
+
> **Note:** The `useLumiaPassportSession` hook is based on pure Zustand store so if you're already using useLumiaPassportSession hook please consider 2 options: 1) refactor state extarction so it uses zustand state extraction feature. 2) consider using dedicated LumiaPassport shared store values hooks: `useLumiaPassportAccountSession`, `useLumiaPassportAddress` etc. Otherwise you might experience excessive re-rendering issues as LumiaPassport shares its internal store and might update some state values which should not affect app render.
|
|
273
271
|
|
|
274
272
|
```tsx
|
|
275
273
|
import { useLumiaPassportAccountSession, useLumiaPassportLoadingStatus } from '@lumiapassport/ui-kit'
|
|
276
274
|
|
|
277
275
|
function MyComponent() {
|
|
278
|
-
|
|
276
|
+
// const session = useLumiaPassportSession(s => s.session) - with prev hook & Zustand state extraction feature, please prefer this instead:
|
|
277
|
+
const session = useLumiaPassportAccountSession()
|
|
279
278
|
const { isSessionLoading } = useLumiaPassportLoadingStatus()
|
|
280
279
|
|
|
281
280
|
if (isSessionLoading) return <div>Loading...</div>
|
|
@@ -295,6 +294,18 @@ function MyComponent() {
|
|
|
295
294
|
}
|
|
296
295
|
```
|
|
297
296
|
|
|
297
|
+
### Lumia Passport shared store values hooks
|
|
298
|
+
|
|
299
|
+
- **useLumiaPassportIsMobileView** - Returns boolean indicating if UI is in mobile view mode
|
|
300
|
+
- **useLumiaPassportAccountSession** - Returns current user session object with userId, addresses, and auth info
|
|
301
|
+
- **useLumiaPassportLoadingStatus** - Returns `{ isSessionLoading, sessionStatus }` for tracking authentication state
|
|
302
|
+
- **useLumiaPassportBalance** - Returns wallet balance data: `{ walletBalance, fiatBalance, cryptoRate, fiatSymbol, cryptoSymbol }`
|
|
303
|
+
- **useLumiaPassportIFrameReady** - Returns boolean indicating if the MPC iframe is ready for operations
|
|
304
|
+
- **useLumiaPassportAddress** - Returns the current user's wallet address
|
|
305
|
+
- **useLumiaPassportError** - Returns any error that occurred during authentication or operations
|
|
306
|
+
- **useLumiaPassportRecoveryUserId** - Returns userId for account recovery flow
|
|
307
|
+
- **useLumiaPassportHasServerVault** - Returns boolean indicating if user has server-side keyshare backup
|
|
308
|
+
|
|
298
309
|
### useSendTransaction - Send Transactions
|
|
299
310
|
|
|
300
311
|
```tsx
|
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.
|
|
18
|
+
<title>Lumia Passport Secure Wallet - iframe version 1.14.0</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -2786,6 +2786,231 @@ var DKGManager = class extends TokenRefreshApiClient {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
};
|
|
2788
2788
|
|
|
2789
|
+
// src/iframe/lib/onramp/binance.ts
|
|
2790
|
+
var API_DOMAIN = "https://api.lumiapassport.com/on-ramp";
|
|
2791
|
+
var BinanceOnrampAPI = class {
|
|
2792
|
+
constructor(sendResponseFn) {
|
|
2793
|
+
this.sendResponseFn = sendResponseFn;
|
|
2794
|
+
}
|
|
2795
|
+
async checkIsLumaiAvailableQuery(accessToken) {
|
|
2796
|
+
const response = await fetch(`${API_DOMAIN}/api/binance/pairs`, {
|
|
2797
|
+
method: "POST",
|
|
2798
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
2799
|
+
});
|
|
2800
|
+
const data = await response.json();
|
|
2801
|
+
if (!data.success) {
|
|
2802
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2803
|
+
}
|
|
2804
|
+
if (!data.data?.cryptoCurrencies?.includes("LUMIA")) {
|
|
2805
|
+
console.error("Lumia is not available in Binance pairs API");
|
|
2806
|
+
throw new Error("Lumia is not available in API");
|
|
2807
|
+
}
|
|
2808
|
+
return !!data.data.cryptoCurrencies.includes("LUMIA");
|
|
2809
|
+
}
|
|
2810
|
+
async getLumiaNetworkQuery(accessToken) {
|
|
2811
|
+
const response = await fetch(`${API_DOMAIN}/api/binance/networks`, {
|
|
2812
|
+
method: "POST",
|
|
2813
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
2814
|
+
});
|
|
2815
|
+
const data = await response.json();
|
|
2816
|
+
if (!data?.success) {
|
|
2817
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2818
|
+
}
|
|
2819
|
+
const lumiaNetwork = data.data?.find((el) => el.cryptoCurrency === "LUMIA") || null;
|
|
2820
|
+
if (!lumiaNetwork) {
|
|
2821
|
+
console.error("Lumia is not available in Binance pairs API");
|
|
2822
|
+
throw new Error("Lumia is not available in API");
|
|
2823
|
+
}
|
|
2824
|
+
return lumiaNetwork;
|
|
2825
|
+
}
|
|
2826
|
+
async getPaymentMethodsQuery(payload, accessToken) {
|
|
2827
|
+
const response = await fetch(`${API_DOMAIN}/api/binance/modes`, {
|
|
2828
|
+
method: "POST",
|
|
2829
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2830
|
+
body: JSON.stringify(payload)
|
|
2831
|
+
});
|
|
2832
|
+
const data = await response.json();
|
|
2833
|
+
if (!data.success) {
|
|
2834
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2835
|
+
}
|
|
2836
|
+
if (!data.data.paymentMethods.length) {
|
|
2837
|
+
throw new Error("No payment methods available yet");
|
|
2838
|
+
}
|
|
2839
|
+
return data.data.paymentMethods;
|
|
2840
|
+
}
|
|
2841
|
+
async getQuoteQuery(payload, accessToken) {
|
|
2842
|
+
const response = await fetch(`${API_DOMAIN}/api/binance/quote`, {
|
|
2843
|
+
method: "POST",
|
|
2844
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2845
|
+
body: JSON.stringify(payload)
|
|
2846
|
+
});
|
|
2847
|
+
const data = await response.json();
|
|
2848
|
+
if (!data.success) {
|
|
2849
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2850
|
+
}
|
|
2851
|
+
return data.data;
|
|
2852
|
+
}
|
|
2853
|
+
async createPreorderMutation(payload, accessToken) {
|
|
2854
|
+
const response = await fetch(`${API_DOMAIN}/api/binance/pre-order`, {
|
|
2855
|
+
method: "POST",
|
|
2856
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2857
|
+
body: JSON.stringify(payload)
|
|
2858
|
+
});
|
|
2859
|
+
const data = await response.json();
|
|
2860
|
+
if (!data.success) {
|
|
2861
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2862
|
+
}
|
|
2863
|
+
return data.data;
|
|
2864
|
+
}
|
|
2865
|
+
async handleMessage(message, origin) {
|
|
2866
|
+
const { type, messageId, data } = message;
|
|
2867
|
+
const { accessToken } = message.data;
|
|
2868
|
+
console.log("[ BINANCE Received message ]", type, message);
|
|
2869
|
+
switch (type) {
|
|
2870
|
+
case "BINANCE_CHECK_IS_LUMIA_AVAILABLE_QUERY":
|
|
2871
|
+
const isLumiaAvalableRes = await this.checkIsLumaiAvailableQuery(accessToken);
|
|
2872
|
+
this.sendResponseFn(messageId, isLumiaAvalableRes, origin);
|
|
2873
|
+
break;
|
|
2874
|
+
case "BINANCE_GET_LUMIA_NETWORK_QUERY":
|
|
2875
|
+
const lumiaNetworkResponse = await this.getLumiaNetworkQuery(accessToken);
|
|
2876
|
+
this.sendResponseFn(messageId, lumiaNetworkResponse, origin);
|
|
2877
|
+
break;
|
|
2878
|
+
case "BINANCE_GET_PAYMENT_METHODS_QUERY":
|
|
2879
|
+
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
2880
|
+
this.ensurePayload(data, "methods"),
|
|
2881
|
+
accessToken
|
|
2882
|
+
);
|
|
2883
|
+
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
2884
|
+
break;
|
|
2885
|
+
case "BINANCE_GET_QUOTE_QUERY":
|
|
2886
|
+
const quoteResponse = await this.getQuoteQuery(this.ensurePayload(data, "quote"), accessToken);
|
|
2887
|
+
this.sendResponseFn(messageId, quoteResponse, origin);
|
|
2888
|
+
break;
|
|
2889
|
+
case "BINANCE_CREATE_PREORDER_MUTATION":
|
|
2890
|
+
const preorderResponse = await this.createPreorderMutation(this.ensurePayload(data, "preorder"), accessToken);
|
|
2891
|
+
this.sendResponseFn(messageId, preorderResponse, origin);
|
|
2892
|
+
break;
|
|
2893
|
+
default:
|
|
2894
|
+
throw new Error(`[ BINANCE ]: Unknown message type: ${type}`);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
ensurePayload(data, type) {
|
|
2898
|
+
if (!data || typeof data !== "object") {
|
|
2899
|
+
throw new Error(`Invalid payload: expected object, got ${typeof data}`);
|
|
2900
|
+
}
|
|
2901
|
+
const payload = data;
|
|
2902
|
+
switch (type) {
|
|
2903
|
+
case "methods":
|
|
2904
|
+
if (typeof payload.totalAmount !== "string") {
|
|
2905
|
+
throw new Error("Invalid payload: totalAmount must be a string");
|
|
2906
|
+
}
|
|
2907
|
+
return { totalAmount: payload.totalAmount };
|
|
2908
|
+
case "quote":
|
|
2909
|
+
if (typeof payload.network !== "string") {
|
|
2910
|
+
throw new Error("Invalid payload: network must be a string");
|
|
2911
|
+
}
|
|
2912
|
+
if (typeof payload.walletAddress !== "string") {
|
|
2913
|
+
throw new Error("Invalid payload: walletAddress must be a string");
|
|
2914
|
+
}
|
|
2915
|
+
if (typeof payload.requestedAmount !== "string") {
|
|
2916
|
+
throw new Error("Invalid payload: requestedAmount must be a string");
|
|
2917
|
+
}
|
|
2918
|
+
return {
|
|
2919
|
+
network: payload.network,
|
|
2920
|
+
walletAddress: payload.walletAddress,
|
|
2921
|
+
requestedAmount: payload.requestedAmount,
|
|
2922
|
+
...payload.payMethodCode && typeof payload.payMethodCode === "string" ? { payMethodCode: payload.payMethodCode } : {},
|
|
2923
|
+
...payload.payMethodSubCode && typeof payload.payMethodSubCode === "string" ? { payMethodSubCode: payload.payMethodSubCode } : {}
|
|
2924
|
+
};
|
|
2925
|
+
case "preorder":
|
|
2926
|
+
if (typeof payload.requestedAmount !== "string") {
|
|
2927
|
+
throw new Error("Invalid payload: requestedAmount must be a string");
|
|
2928
|
+
}
|
|
2929
|
+
if (typeof payload.address !== "string") {
|
|
2930
|
+
throw new Error("Invalid payload: address must be a string");
|
|
2931
|
+
}
|
|
2932
|
+
if (typeof payload.network !== "string") {
|
|
2933
|
+
throw new Error("Invalid payload: network must be a string");
|
|
2934
|
+
}
|
|
2935
|
+
return {
|
|
2936
|
+
requestedAmount: payload.requestedAmount,
|
|
2937
|
+
address: payload.address,
|
|
2938
|
+
network: payload.network,
|
|
2939
|
+
...payload.payMethodCode && typeof payload.payMethodCode === "string" ? { payMethodCode: payload.payMethodCode } : {},
|
|
2940
|
+
...payload.payMethodSubCode && typeof payload.payMethodSubCode === "string" ? { payMethodSubCode: payload.payMethodSubCode } : {},
|
|
2941
|
+
...payload.redirectUrl && typeof payload.redirectUrl === "string" ? { redirectUrl: payload.redirectUrl } : {},
|
|
2942
|
+
...payload.failRedirectUrl && typeof payload.failRedirectUrl === "string" ? { failRedirectUrl: payload.failRedirectUrl } : {}
|
|
2943
|
+
};
|
|
2944
|
+
default:
|
|
2945
|
+
throw new Error(`Unknown payload type: ${type}`);
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
};
|
|
2949
|
+
|
|
2950
|
+
// src/iframe/lib/onramp/rampnow.ts
|
|
2951
|
+
var API_DOMAIN2 = "https://api.lumiapassport.com/on-ramp";
|
|
2952
|
+
var RampnowOnrampAPI = class {
|
|
2953
|
+
constructor(sendResponseFn) {
|
|
2954
|
+
this.sendResponseFn = sendResponseFn;
|
|
2955
|
+
}
|
|
2956
|
+
async getRampnowConfigQuery(accessToken) {
|
|
2957
|
+
const response = await fetch(`${API_DOMAIN2}/api/rampnow/cfg`, {
|
|
2958
|
+
method: "GET",
|
|
2959
|
+
headers: { ...accessToken && { Authorization: accessToken } }
|
|
2960
|
+
});
|
|
2961
|
+
const data = await response.json();
|
|
2962
|
+
return data;
|
|
2963
|
+
}
|
|
2964
|
+
async getRampOrderQuoteQuery(payload, accessToken) {
|
|
2965
|
+
const response = await fetch(`${API_DOMAIN2}/api/rampnow/quote`, {
|
|
2966
|
+
method: "POST",
|
|
2967
|
+
headers: {
|
|
2968
|
+
"Content-Type": "application/json",
|
|
2969
|
+
...accessToken && { Authorization: accessToken }
|
|
2970
|
+
},
|
|
2971
|
+
body: JSON.stringify(payload)
|
|
2972
|
+
});
|
|
2973
|
+
const data = await response.json();
|
|
2974
|
+
if (!data.data) {
|
|
2975
|
+
throw new Error(`${data.code}: ${data.message}`);
|
|
2976
|
+
}
|
|
2977
|
+
return data;
|
|
2978
|
+
}
|
|
2979
|
+
ensureOrderQuotePayload(payload) {
|
|
2980
|
+
if (typeof payload !== "object" || payload === null || typeof payload?.paymentMode !== "string" || typeof payload?.srcAmount !== "number" || typeof payload?.walletAddress !== "string") {
|
|
2981
|
+
throw new Error("Invalid Ramp order quote payload");
|
|
2982
|
+
}
|
|
2983
|
+
return payload;
|
|
2984
|
+
}
|
|
2985
|
+
// UNUSED due to Rampnow APP redirect order flow
|
|
2986
|
+
// async ctreateChekoutOrderMutation(payload: CreateCheckoutOrderMutationPayload) {
|
|
2987
|
+
// const checkoutedOrderData = await axios
|
|
2988
|
+
// .post('/api/rampnow/order', payload)
|
|
2989
|
+
// .then((r) => r.data.data as CreateCheckoutOrderMutationResponse)
|
|
2990
|
+
// .catch((err) => {
|
|
2991
|
+
// throw new Error(err?.message || 'Ramp quote query failed')
|
|
2992
|
+
// })
|
|
2993
|
+
// return checkoutedOrderData
|
|
2994
|
+
// }
|
|
2995
|
+
async handleMessage(message, origin) {
|
|
2996
|
+
const { type, data, messageId } = message;
|
|
2997
|
+
const { accessToken } = message.data;
|
|
2998
|
+
console.log("[ RAMPNOW Received message ]", type, message);
|
|
2999
|
+
switch (type) {
|
|
3000
|
+
case "RAMPNOW_GET_CONFIG":
|
|
3001
|
+
const ramnowCfg = await this.getRampnowConfigQuery(accessToken);
|
|
3002
|
+
this.sendResponseFn(messageId, ramnowCfg, origin);
|
|
3003
|
+
break;
|
|
3004
|
+
case "RAMPNOW_GET_ORDER_QUOTE":
|
|
3005
|
+
const orderQuote = await this.getRampOrderQuoteQuery(this.ensureOrderQuotePayload(data), accessToken);
|
|
3006
|
+
this.sendResponseFn(messageId, orderQuote, origin);
|
|
3007
|
+
break;
|
|
3008
|
+
default:
|
|
3009
|
+
throw new Error(`[ RAMPNOW ]: Unknown message type: ${type}`);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
};
|
|
3013
|
+
|
|
2789
3014
|
// src/iframe/lib/secure-messenger.ts
|
|
2790
3015
|
var SecureMessenger = class {
|
|
2791
3016
|
constructor() {
|
|
@@ -2799,7 +3024,7 @@ var SecureMessenger = class {
|
|
|
2799
3024
|
this.NONCE_CLEANUP_INTERVAL = 5 * 60 * 1e3;
|
|
2800
3025
|
// 5 minutes
|
|
2801
3026
|
// Debug flag: set to true to log all filtered messages (for debugging only)
|
|
2802
|
-
this.DEBUG_FILTERED_MESSAGES =
|
|
3027
|
+
this.DEBUG_FILTERED_MESSAGES = true;
|
|
2803
3028
|
setInterval(() => this.cleanupOldNonces(), this.NONCE_CLEANUP_INTERVAL);
|
|
2804
3029
|
}
|
|
2805
3030
|
/**
|
|
@@ -2964,9 +3189,10 @@ var SecureMessenger = class {
|
|
|
2964
3189
|
"TRUSTED_APP_REMOVED",
|
|
2965
3190
|
"TOKEN_REFRESHED"
|
|
2966
3191
|
];
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
3192
|
+
const validTypeGroups = ["BINANCE_", "RAMPNOW_"];
|
|
3193
|
+
const isTypeValid = validTypes.includes(message.type);
|
|
3194
|
+
const isGroupTypeValid = validTypeGroups.some((prefix) => message.type.startsWith(prefix));
|
|
3195
|
+
if (!message.type || !isTypeValid && !isGroupTypeValid) return false;
|
|
2970
3196
|
return !!(message.messageId && message.timestamp);
|
|
2971
3197
|
}
|
|
2972
3198
|
/**
|
|
@@ -3006,13 +3232,7 @@ var SecureMessenger = class {
|
|
|
3006
3232
|
});
|
|
3007
3233
|
const data = encoder3.encode(payload);
|
|
3008
3234
|
const key = encoder3.encode(this.sessionToken);
|
|
3009
|
-
const cryptoKey = await crypto.subtle.importKey(
|
|
3010
|
-
"raw",
|
|
3011
|
-
key,
|
|
3012
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
3013
|
-
false,
|
|
3014
|
-
["sign"]
|
|
3015
|
-
);
|
|
3235
|
+
const cryptoKey = await crypto.subtle.importKey("raw", key, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
3016
3236
|
const signature = await crypto.subtle.sign("HMAC", cryptoKey, data);
|
|
3017
3237
|
return Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3018
3238
|
}
|
|
@@ -4010,13 +4230,12 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
4010
4230
|
};
|
|
4011
4231
|
|
|
4012
4232
|
// src/iframe/main.ts
|
|
4013
|
-
var IFRAME_VERSION = "1.
|
|
4233
|
+
var IFRAME_VERSION = "1.14.0";
|
|
4014
4234
|
var IframeWallet = class {
|
|
4015
4235
|
constructor() {
|
|
4016
4236
|
console.log("=".repeat(60));
|
|
4017
4237
|
console.log(` Lumia Passport Secure Wallet - iframe version ${IFRAME_VERSION}`);
|
|
4018
4238
|
console.log("=".repeat(60));
|
|
4019
|
-
this.applyThemeColors();
|
|
4020
4239
|
this.messenger = new SecureMessenger();
|
|
4021
4240
|
this.sessionManager = new SessionManager();
|
|
4022
4241
|
this.dkgManager = new DKGManager();
|
|
@@ -4025,35 +4244,37 @@ var IframeWallet = class {
|
|
|
4025
4244
|
this.storage = new StorageManager();
|
|
4026
4245
|
this.trustedApps = new TrustedAppsManager();
|
|
4027
4246
|
this.backupManager = new BackupManager();
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4247
|
+
this.binance = new BinanceOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
4248
|
+
this.rampnow = new RampnowOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
4249
|
+
}
|
|
4250
|
+
// private applyThemeColors(): void {
|
|
4251
|
+
// try {
|
|
4252
|
+
// const params = new URLSearchParams(window.location.search)
|
|
4253
|
+
// const bg = params.get('bg')
|
|
4254
|
+
// const text = params.get('text')
|
|
4255
|
+
// const textSec = params.get('textSec')
|
|
4256
|
+
// const border = params.get('border')
|
|
4257
|
+
// if (bg || text || textSec || border) {
|
|
4258
|
+
// const root = document.documentElement
|
|
4259
|
+
// if (bg) {
|
|
4260
|
+
// root.style.setProperty('--iframe-bg', bg)
|
|
4261
|
+
// root.style.setProperty('--iframe-modal-bg', bg)
|
|
4262
|
+
// }
|
|
4263
|
+
// if (text) {
|
|
4264
|
+
// root.style.setProperty('--iframe-text', text)
|
|
4265
|
+
// }
|
|
4266
|
+
// if (textSec) {
|
|
4267
|
+
// root.style.setProperty('--iframe-text-secondary', textSec)
|
|
4268
|
+
// }
|
|
4269
|
+
// if (border) {
|
|
4270
|
+
// root.style.setProperty('--iframe-border', border)
|
|
4271
|
+
// }
|
|
4272
|
+
// console.log('[IframeWallet] Applied theme colors:', { bg, text, textSec, border })
|
|
4273
|
+
// }
|
|
4274
|
+
// } catch (error) {
|
|
4275
|
+
// console.warn('[IframeWallet] Failed to apply theme colors:', error)
|
|
4276
|
+
// }
|
|
4277
|
+
// }
|
|
4057
4278
|
async initialize() {
|
|
4058
4279
|
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("lumiapassport.com")) {
|
|
4059
4280
|
console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin!");
|
|
@@ -4077,53 +4298,59 @@ var IframeWallet = class {
|
|
|
4077
4298
|
async handleMessage(message, origin) {
|
|
4078
4299
|
const { type, messageId, projectId } = message;
|
|
4079
4300
|
try {
|
|
4080
|
-
switch (
|
|
4081
|
-
case "
|
|
4301
|
+
switch (true) {
|
|
4302
|
+
case type.startsWith("BINANCE_"):
|
|
4303
|
+
await this.binance.handleMessage(message, origin);
|
|
4304
|
+
break;
|
|
4305
|
+
case type.startsWith("RAMPNOW_"):
|
|
4306
|
+
await this.rampnow.handleMessage(message, origin);
|
|
4307
|
+
break;
|
|
4308
|
+
case type === "SDK_AUTH":
|
|
4082
4309
|
await this.handleSDKAuth(message, origin);
|
|
4083
4310
|
break;
|
|
4084
|
-
case "AUTHENTICATE":
|
|
4311
|
+
case type === "AUTHENTICATE":
|
|
4085
4312
|
await this.handleAuthenticate(message, origin);
|
|
4086
4313
|
break;
|
|
4087
|
-
case "START_DKG":
|
|
4314
|
+
case type === "START_DKG":
|
|
4088
4315
|
await this.handleStartDKG(message, origin);
|
|
4089
4316
|
break;
|
|
4090
|
-
case "SIGN_TRANSACTION":
|
|
4317
|
+
case type === "SIGN_TRANSACTION":
|
|
4091
4318
|
await this.handleSignTransaction(message, origin);
|
|
4092
4319
|
break;
|
|
4093
|
-
case "SIGN_TYPED_DATA":
|
|
4320
|
+
case type === "SIGN_TYPED_DATA":
|
|
4094
4321
|
await this.handleSignTypedData(message, origin);
|
|
4095
4322
|
break;
|
|
4096
|
-
case "GET_ADDRESS":
|
|
4323
|
+
case type === "GET_ADDRESS":
|
|
4097
4324
|
await this.handleGetAddress(message, origin);
|
|
4098
4325
|
break;
|
|
4099
|
-
case "CHECK_KEYSHARE":
|
|
4326
|
+
case type === "CHECK_KEYSHARE":
|
|
4100
4327
|
await this.handleCheckKeyshare(message, origin);
|
|
4101
4328
|
break;
|
|
4102
|
-
case "GET_TRUSTED_APPS":
|
|
4329
|
+
case type === "GET_TRUSTED_APPS":
|
|
4103
4330
|
await this.handleGetTrustedApps(message, origin);
|
|
4104
4331
|
break;
|
|
4105
|
-
case "REMOVE_TRUSTED_APP":
|
|
4332
|
+
case type === "REMOVE_TRUSTED_APP":
|
|
4106
4333
|
await this.handleRemoveTrustedApp(message, origin);
|
|
4107
4334
|
break;
|
|
4108
|
-
case "CLEAR_AUTHORIZATIONS":
|
|
4335
|
+
case type === "CLEAR_AUTHORIZATIONS":
|
|
4109
4336
|
await this.handleClearAuthorizations(message, origin);
|
|
4110
4337
|
break;
|
|
4111
|
-
case "CREATE_BACKUP":
|
|
4338
|
+
case type === "CREATE_BACKUP":
|
|
4112
4339
|
await this.handleCreateBackup(message, origin);
|
|
4113
4340
|
break;
|
|
4114
|
-
case "GET_BACKUP_STATUS":
|
|
4341
|
+
case type === "GET_BACKUP_STATUS":
|
|
4115
4342
|
await this.handleGetBackupStatus(message, origin);
|
|
4116
4343
|
break;
|
|
4117
|
-
case "GET_CLOUD_PROVIDERS":
|
|
4344
|
+
case type === "GET_CLOUD_PROVIDERS":
|
|
4118
4345
|
await this.handleGetCloudProviders(message, origin);
|
|
4119
4346
|
break;
|
|
4120
|
-
case "RESTORE_BACKUP":
|
|
4347
|
+
case type === "RESTORE_BACKUP":
|
|
4121
4348
|
await this.handleRestoreBackup(message, origin);
|
|
4122
4349
|
break;
|
|
4123
|
-
case "RESTORE_FROM_FILE":
|
|
4350
|
+
case type === "RESTORE_FROM_FILE":
|
|
4124
4351
|
await this.handleRestoreFromFile(message, origin);
|
|
4125
4352
|
break;
|
|
4126
|
-
case "ENCRYPT_BACKUP_DATA":
|
|
4353
|
+
case type === "ENCRYPT_BACKUP_DATA":
|
|
4127
4354
|
await this.handleEncryptBackupData(message, origin);
|
|
4128
4355
|
break;
|
|
4129
4356
|
default:
|