@getpara/web-sdk 2.0.0-alpha.7 → 2.0.0-alpha.70

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 ADDED
@@ -0,0 +1,20 @@
1
+ https://www.npmjs.com/package/@getpara/web-sdk
2
+
3
+ The `@getpara/web-sdk` is Para's core Web SDK for browser environments. It provides direct access to Para's wallet infrastructure without React-specific components.
4
+
5
+ ###Key Features
6
+
7
+ - Authentication: Email, phone, and OAuth login methods
8
+ - Wallet Management: Create and manage EVM, Solana, and Cosmos wallets
9
+ - Transaction Signing: Sign messages and transactions across multiple chains
10
+ - Session Management: Handle user sessions and JWT tokens
11
+
12
+ ###Prerequisites
13
+
14
+ To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration.
15
+
16
+ Don't have an API key yet? Request access to the [Developer Portal](https://developer.getpara.com/) to create API keys, manage billing, teams, and more.
17
+
18
+ ###Learn more
19
+
20
+ For more information on Para’s Web SDK visit the [Para Docs](https://docs.getpara.com/v2/react/examples#para-web-examples)
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
2
+ import "./chunk-YJOFEY2L.js";
3
3
  class LocalStorage {
4
4
  constructor() {
5
5
  this.get = (key) => {
package/dist/ParaWeb.d.ts CHANGED
@@ -1,6 +1,19 @@
1
1
  import ParaCore, { ConstructorOpts, Environment } from '@getpara/core-sdk';
2
2
  import { WebUtils } from './WebUtils.js';
3
+ import { PortalRequest } from './types/onRamp.js';
3
4
  export declare class Para extends ParaCore {
4
- constructor(env: Environment, apiKey?: string, opts?: ConstructorOpts);
5
+ #private;
6
+ farcasterSdk: any;
7
+ isReady: boolean;
8
+ isFarcasterMiniApp: boolean;
9
+ private isFarcasterSetup;
10
+ constructor(env: Environment | undefined, apiKey: string, opts?: ConstructorOpts);
11
+ constructor(apiKey: string, opts?: ConstructorOpts);
12
+ ready(): Promise<void>;
13
+ protected portalEventListener: (event: MessageEvent<PortalRequest>) => Promise<void>;
14
+ protected get toStringAdditions(): {
15
+ isFarcasterMiniApp: boolean;
16
+ };
5
17
  protected getPlatformUtils(): WebUtils;
18
+ isPasskeySupported(): Promise<boolean>;
6
19
  }
package/dist/ParaWeb.js CHANGED
@@ -1,22 +1,179 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
3
- import * as Sentry from "@sentry/browser";
4
- import ParaCore, { Environment } from "@getpara/core-sdk";
2
+ import {
3
+ __async,
4
+ __privateAdd,
5
+ __privateGet,
6
+ __privateSet,
7
+ __spreadValues
8
+ } from "./chunk-YJOFEY2L.js";
9
+ var _isPasskeySupported;
10
+ import ParaCore, {
11
+ dispatchEvent,
12
+ getNetworkPrefix,
13
+ OnRampPurchaseStatus,
14
+ ParaEvent
15
+ } from "@getpara/core-sdk";
5
16
  import { WebUtils } from "./WebUtils.js";
17
+ import { isPasskeySupported } from "./utils/isPasskeySupported.js";
18
+ import { offRampSend } from "./utils/offrampSend.js";
6
19
  class Para extends ParaCore {
7
- constructor(env, apiKey, opts) {
8
- super(env, apiKey, opts);
9
- if (env !== Environment.PROD && env !== Environment.DEV) {
10
- Sentry.init({
11
- environment: env.toLowerCase(),
12
- dsn: "https://38f27d4836da617ab9e95cf66b9611d9@o4504568036720640.ingest.us.sentry.io/4508850812944384"
13
- });
20
+ constructor(envOrApiKey, apiKeyOrOpts, opts) {
21
+ super(envOrApiKey, apiKeyOrOpts, opts);
22
+ this.farcasterSdk = void 0;
23
+ this.isReady = false;
24
+ this.isFarcasterMiniApp = false;
25
+ this.isFarcasterSetup = false;
26
+ this.portalEventListener = (event) => __async(this, null, function* () {
27
+ var _a, _b, _c, _d, _e, _f;
28
+ if (!event.data.isPara || event.origin !== (yield this.getPortalURL()) || this.isPortal()) {
29
+ return;
30
+ }
31
+ const messagePort = event.ports[0];
32
+ let payload, status = "SUCCESS";
33
+ try {
34
+ switch (event.data.type) {
35
+ case "ONRAMPS__INIT":
36
+ {
37
+ const onRampConfig = yield this.ctx.client.getOnRampConfig();
38
+ payload = { onRampPurchase: (_a = this.onRampPopup) == null ? void 0 : _a.onRampPurchase, onRampConfig };
39
+ }
40
+ break;
41
+ case "ONRAMPS__UPDATE_PURCHASE":
42
+ {
43
+ const { updates, depositRequest } = event.data.payload;
44
+ if ((_b = this.onRampPopup) == null ? void 0 : _b.onRampPurchase) {
45
+ this.onRampPopup.onRampPurchase = __spreadValues(__spreadValues({}, (_c = this.onRampPopup) == null ? void 0 : _c.onRampPurchase), updates);
46
+ const onRampPurchase = this.onRampPopup.onRampPurchase;
47
+ if (onRampPurchase.status === OnRampPurchaseStatus.FINISHED) {
48
+ const wallet = this.findWallet((_d = onRampPurchase.externalWalletAddress) != null ? _d : onRampPurchase.walletId);
49
+ if (wallet) {
50
+ const { asset, assetQuantity, network, address } = onRampPurchase;
51
+ if (depositRequest) {
52
+ const { chainId, contractAddress, destinationAddress } = depositRequest;
53
+ dispatchEvent(ParaEvent.ASSET_TRANSFERRED, {
54
+ wallet,
55
+ type: "OUTBOUND",
56
+ asset,
57
+ network,
58
+ quantity: assetQuantity,
59
+ chainId,
60
+ contractAddress,
61
+ sourceAddress: address,
62
+ destinationAddress
63
+ });
64
+ }
65
+ dispatchEvent(ParaEvent.ONRAMP_TRANSACTION_COMPLETE, onRampPurchase);
66
+ }
67
+ }
68
+ payload = { onRampPurchase };
69
+ }
70
+ }
71
+ break;
72
+ case "ONRAMPS__SIGN_MOONPAY_URL":
73
+ {
74
+ const userId = this.assertUserId();
75
+ const { url } = event.data.payload;
76
+ const onRampPurchase = (_e = this.onRampPopup) == null ? void 0 : _e.onRampPurchase;
77
+ const res = yield this.ctx.client.signMoonPayUrl(userId, {
78
+ url,
79
+ type: onRampPurchase.walletType,
80
+ cosmosPrefix: getNetworkPrefix(onRampPurchase.network),
81
+ testMode: onRampPurchase.testMode,
82
+ walletId: onRampPurchase.walletId,
83
+ externalWalletAddress: onRampPurchase.externalWalletAddress
84
+ });
85
+ payload = { signature: res.data.signature };
86
+ }
87
+ break;
88
+ case "ONRAMPS__SIGN_DEPOSIT_TX":
89
+ {
90
+ const { depositRequest } = event.data.payload;
91
+ const onRampPurchase = (_f = this.onRampPopup) == null ? void 0 : _f.onRampPurchase;
92
+ try {
93
+ const { txHash, updatedOnRampPurchase } = yield offRampSend(this, onRampPurchase, depositRequest);
94
+ payload = { onRampPurchase: updatedOnRampPurchase, txHash };
95
+ } catch (e) {
96
+ throw e;
97
+ }
98
+ }
99
+ break;
100
+ case "SYNC_WALLETS":
101
+ {
102
+ payload = {
103
+ wallets: this.wallets,
104
+ currentWalletIds: this.currentWalletIds
105
+ };
106
+ }
107
+ break;
108
+ }
109
+ } catch (e) {
110
+ status = "ERROR";
111
+ payload = { error: e.message };
112
+ }
113
+ if (messagePort) {
114
+ messagePort.postMessage({
115
+ id: event.data.id,
116
+ type: event.data.type,
117
+ isPara: true,
118
+ status,
119
+ payload
120
+ });
121
+ messagePort.close();
122
+ }
123
+ });
124
+ __privateAdd(this, _isPasskeySupported);
125
+ if (typeof window !== "undefined") {
126
+ window.addEventListener("message", this.portalEventListener);
14
127
  }
15
128
  }
129
+ ready() {
130
+ return __async(this, null, function* () {
131
+ var _a, _b, _c, _d;
132
+ if (!this.isReady) {
133
+ if (!this.isFarcasterSetup) {
134
+ try {
135
+ this.farcasterSdk = (_b = (_a = yield import("@farcaster/miniapp-sdk")) == null ? void 0 : _a.sdk) != null ? _b : void 0;
136
+ if (!((_c = this.farcasterSdk) == null ? void 0 : _c.isInMiniApp)) {
137
+ throw new Error("Farcaster SDK not detected or failed to load");
138
+ }
139
+ this.devLog("Farcaster SDK detected and loaded successfully.", this.farcasterSdk);
140
+ } catch (e) {
141
+ this.devLog(e);
142
+ }
143
+ if (!!((_d = this.farcasterSdk) == null ? void 0 : _d.isInMiniApp)) {
144
+ this.devLog("Initializing Farcaster SDK...");
145
+ this.isFarcasterMiniApp = yield this.farcasterSdk.isInMiniApp();
146
+ if (this.isFarcasterMiniApp) {
147
+ this.externalWalletConnectionOnly = true;
148
+ }
149
+ }
150
+ this.isFarcasterSetup = true;
151
+ }
152
+ if (!this.isPortal() && Object.values(this.wallets).length > 0 && Object.values(this.wallets).every((wallet) => !wallet.partner)) {
153
+ yield this.populateWalletAddresses();
154
+ }
155
+ this.isReady = true;
156
+ }
157
+ });
158
+ }
159
+ get toStringAdditions() {
160
+ return {
161
+ isFarcasterMiniApp: this.isFarcasterMiniApp
162
+ };
163
+ }
16
164
  getPlatformUtils() {
17
165
  return new WebUtils();
18
166
  }
167
+ isPasskeySupported() {
168
+ return __async(this, null, function* () {
169
+ if (__privateGet(this, _isPasskeySupported) === void 0) {
170
+ __privateSet(this, _isPasskeySupported, yield isPasskeySupported());
171
+ }
172
+ return __privateGet(this, _isPasskeySupported);
173
+ });
174
+ }
19
175
  }
176
+ _isPasskeySupported = new WeakMap();
20
177
  export {
21
178
  Para
22
179
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
2
+ import "./chunk-YJOFEY2L.js";
3
3
  class SessionStorage {
4
4
  constructor() {
5
5
  this.get = (key) => {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Ctx, PlatformUtils, SignatureRes, PopupType } from '@getpara/core-sdk';
3
2
  import { LocalStorage } from './LocalStorage.js';
4
3
  import { SessionStorage } from './SessionStorage.js';
@@ -44,5 +43,6 @@ export declare class WebUtils implements PlatformUtils {
44
43
  disableProviderModal: boolean;
45
44
  openPopup(popupUrl: string, opts?: {
46
45
  type: PopupType;
47
- }): Window;
46
+ }): Promise<Window>;
47
+ initializeWorker(ctx: Ctx): Promise<void>;
48
48
  }
package/dist/WebUtils.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
2
+ import {
3
+ __async
4
+ } from "./chunk-YJOFEY2L.js";
3
5
  import { PopupType } from "@getpara/core-sdk";
4
6
  import { LocalStorage } from "./LocalStorage.js";
5
7
  import { SessionStorage } from "./SessionStorage.js";
6
- import { keygen, preKeygen, ed25519Keygen, ed25519PreKeygen, refresh } from "./wallet/keygen.js";
8
+ import { keygen, preKeygen, ed25519Keygen, ed25519PreKeygen, refresh, initializeWorker } from "./wallet/keygen.js";
7
9
  import { signMessage, sendTransaction, signTransaction, ed25519Sign } from "./wallet/signing.js";
8
10
  import { getPrivateKey } from "./wallet/privateKey.js";
9
11
  class WebUtils {
@@ -49,60 +51,71 @@ class WebUtils {
49
51
  return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
50
52
  }
51
53
  openPopup(popupUrl, opts) {
52
- if (typeof window === "undefined") {
53
- return;
54
- }
55
- if (opts) {
56
- const { type } = opts;
57
- const popUpWidth = 550;
58
- let popUpHeight;
59
- switch (type) {
60
- case PopupType.LOGIN_PASSKEY: {
61
- popUpHeight = 798;
62
- break;
63
- }
64
- case PopupType.CREATE_PASSKEY: {
65
- popUpHeight = 464;
66
- break;
67
- }
68
- case PopupType.SIGN_MESSAGE_REVIEW: {
69
- popUpHeight = 585;
70
- break;
54
+ return __async(this, null, function* () {
55
+ if (typeof window === "undefined") {
56
+ return;
57
+ }
58
+ let popupWindow = null;
59
+ if (opts) {
60
+ const { type } = opts;
61
+ const popUpWidth = 550;
62
+ let popUpHeight;
63
+ switch (type) {
64
+ case PopupType.LOGIN_PASSKEY: {
65
+ popUpHeight = 798;
66
+ break;
67
+ }
68
+ case PopupType.CREATE_PASSKEY: {
69
+ popUpHeight = 464;
70
+ break;
71
+ }
72
+ case PopupType.SIGN_MESSAGE_REVIEW:
73
+ case PopupType.EXPORT_PRIVATE_KEY: {
74
+ popUpHeight = 585;
75
+ break;
76
+ }
77
+ case PopupType.SIGN_TRANSACTION_REVIEW: {
78
+ popUpHeight = 750;
79
+ break;
80
+ }
81
+ case PopupType.OAUTH:
82
+ default: {
83
+ popUpHeight = 768;
84
+ break;
85
+ }
71
86
  }
72
- case PopupType.SIGN_TRANSACTION_REVIEW: {
73
- popUpHeight = 750;
74
- break;
87
+ const dualScreenLeft = window.screenLeft !== void 0 ? window.screenLeft : window.screenX;
88
+ const dualScreenTop = window.screenTop !== void 0 ? window.screenTop : window.screenY;
89
+ const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
90
+ const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
91
+ const left = (width - popUpWidth) / 2 + dualScreenLeft;
92
+ const top = (height - popUpHeight) / 2 + dualScreenTop;
93
+ const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
94
+ height=${popUpHeight}, top=${top}, left=${left}`;
95
+ popupWindow = window.open(popupUrl, type.toString(), windowFeatures);
96
+ if (!popupWindow) {
97
+ setTimeout(() => {
98
+ popupWindow = window.open(popupUrl, "_blank");
99
+ }, 0);
75
100
  }
76
- case PopupType.OAUTH:
77
- default: {
78
- popUpHeight = 768;
79
- break;
101
+ } else {
102
+ popupWindow = window.open(popupUrl, "popup", "popup=true,width=400,height=500");
103
+ if (!popupWindow) {
104
+ setTimeout(() => {
105
+ popupWindow = window.open(popupUrl, "_blank");
106
+ }, 0);
80
107
  }
81
108
  }
82
- const dualScreenLeft = window.screenLeft !== void 0 ? window.screenLeft : window.screenX;
83
- const dualScreenTop = window.screenTop !== void 0 ? window.screenTop : window.screenY;
84
- const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
85
- const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
86
- const left = (width - popUpWidth) / 2 + dualScreenLeft;
87
- const top = (height - popUpHeight) / 2 + dualScreenTop;
88
- const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
89
- height=${popUpHeight}, top=${top}, left=${left}`;
90
- let popupWindow = window.open(popupUrl, type.toString(), windowFeatures);
91
- if (!popupWindow) {
92
- setTimeout(() => {
93
- popupWindow = window.open(popupUrl, "_blank");
94
- }, 0);
95
- }
96
- return popupWindow;
97
- } else {
98
- const popupWindow = window.open(popupUrl, "popup", "popup=true,width=400,height=500");
99
- if (!popupWindow) {
100
- setTimeout(() => {
101
- window.open(popupUrl, "_blank");
102
- }, 0);
109
+ while (!popupWindow) {
110
+ yield new Promise((resolve) => setTimeout(resolve, 100));
103
111
  }
104
112
  return popupWindow;
105
- }
113
+ });
114
+ }
115
+ initializeWorker(ctx) {
116
+ return __async(this, null, function* () {
117
+ return initializeWorker(ctx);
118
+ });
106
119
  }
107
120
  }
108
121
  export {
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __typeError = (msg) => {
7
+ throw TypeError(msg);
8
+ };
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
22
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
23
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
24
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
25
+ var __async = (__this, __arguments, generator) => {
26
+ return new Promise((resolve, reject) => {
27
+ var fulfilled = (value) => {
28
+ try {
29
+ step(generator.next(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var rejected = (value) => {
35
+ try {
36
+ step(generator.throw(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
42
+ step((generator = generator.apply(__this, __arguments)).next());
43
+ });
44
+ };
45
+
46
+ export {
47
+ __spreadValues,
48
+ __privateGet,
49
+ __privateAdd,
50
+ __privateSet,
51
+ __async
52
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  __async
4
- } from "../chunk-M66XENHI.js";
4
+ } from "../chunk-YJOFEY2L.js";
5
5
  import base64url from "base64url";
6
6
  import * as cbor from "cbor-web";
7
7
  import forge from "node-forge";
package/dist/errors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
2
+ import "./chunk-YJOFEY2L.js";
3
3
  class TransactionReviewError extends Error {
4
4
  constructor(transactionReviewUrl) {
5
5
  super("transaction review error");
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export * from '@getpara/core-sdk';
2
2
  import { Para as ParaWeb } from './ParaWeb.js';
3
3
  import ParaCore from '@getpara/core-sdk';
4
- export { type StorageUtils, type ConstructorOpts, Environment, type OnRampConfig, type OnRampAllowedAssets, } from '@getpara/core-sdk';
4
+ export { type StorageUtils, type ConstructorOpts, Environment, type OnRampConfig, type OnRampAssets, } from '@getpara/core-sdk';
5
5
  export { createCredential, generateSignature, parseCredentialCreationRes } from './cryptography/webAuth.js';
6
- export { truncateEthAddress } from './utils/truncateEthAddress.js';
7
- export { isPasskeySupported } from './utils/isPasskeySupported.js';
6
+ export { truncateEthAddress, isPasskeySupported, offRampSend } from './utils/index.js';
8
7
  export * from './utils/isMobile.js';
8
+ export * from './types/index.js';
9
9
  export { ParaWeb, ParaCore };
10
10
  export default ParaWeb;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "./chunk-M66XENHI.js";
2
+ import "./chunk-YJOFEY2L.js";
3
3
  export * from "@getpara/core-sdk";
4
4
  import { Para as ParaWeb } from "./ParaWeb.js";
5
5
  import ParaCore from "@getpara/core-sdk";
@@ -7,9 +7,9 @@ import {
7
7
  Environment
8
8
  } from "@getpara/core-sdk";
9
9
  import { createCredential, generateSignature, parseCredentialCreationRes } from "./cryptography/webAuth.js";
10
- import { truncateEthAddress } from "./utils/truncateEthAddress.js";
11
- import { isPasskeySupported } from "./utils/isPasskeySupported.js";
10
+ import { truncateEthAddress, isPasskeySupported, offRampSend } from "./utils/index.js";
12
11
  export * from "./utils/isMobile.js";
12
+ export * from "./types/index.js";
13
13
  var src_default = ParaWeb;
14
14
  export {
15
15
  Environment,
@@ -19,6 +19,7 @@ export {
19
19
  src_default as default,
20
20
  generateSignature,
21
21
  isPasskeySupported,
22
+ offRampSend,
22
23
  parseCredentialCreationRes,
23
24
  truncateEthAddress
24
25
  };
@@ -0,0 +1 @@
1
+ export * from './onRamp.js';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export * from "./onRamp.js";
@@ -0,0 +1,87 @@
1
+ import { CurrentWalletIds, OnRampConfig, OnRampPurchase, OnRampPurchaseUpdateParams } from '@getpara/user-management-client';
2
+ import { OfframpDepositRequest, Wallet } from '@getpara/core-sdk';
3
+ export type PortalMessageType = 'ONRAMPS__INIT' | 'ONRAMPS__UPDATE_PURCHASE' | 'ONRAMPS__SIGN_MOONPAY_URL' | 'ONRAMPS__SIGN_DEPOSIT_TX' | 'WALLET_SWITCH_COMPLETED' | 'SYNC_WALLETS';
4
+ export type PortalMessageStatus = 'ERROR' | 'SUCCESS';
5
+ export type PortalRequestPayload<T extends PortalMessageType> = T extends 'ONRAMPS__UPDATE_PURCHASE' ? {
6
+ updates: OnRampPurchaseUpdateParams;
7
+ depositRequest?: OfframpDepositRequest;
8
+ } : T extends 'ONRAMPS__SIGN_MOONPAY_URL' ? {
9
+ url: string;
10
+ } : T extends 'ONRAMPS__SIGN_DEPOSIT_TX' ? {
11
+ depositRequest: OfframpDepositRequest;
12
+ } : T extends 'WALLET_SWITCH_COMPLETED' ? {
13
+ walletIds?: CurrentWalletIds;
14
+ } : T extends 'SYNC_WALLETS' ? undefined : never;
15
+ export type PortalRequest = {
16
+ isPara: boolean;
17
+ id: string;
18
+ status?: undefined;
19
+ } & ({
20
+ type: 'ONRAMPS__INIT';
21
+ payload?: undefined;
22
+ } | {
23
+ type: 'ONRAMPS__UPDATE_PURCHASE';
24
+ payload: PortalRequestPayload<'ONRAMPS__UPDATE_PURCHASE'>;
25
+ } | {
26
+ type: 'ONRAMPS__SIGN_MOONPAY_URL';
27
+ payload: PortalRequestPayload<'ONRAMPS__SIGN_MOONPAY_URL'>;
28
+ } | {
29
+ type: 'ONRAMPS__SIGN_DEPOSIT_TX';
30
+ payload: PortalRequestPayload<'ONRAMPS__SIGN_DEPOSIT_TX'>;
31
+ } | {
32
+ type: 'WALLET_SWITCH_COMPLETED';
33
+ payload: PortalRequestPayload<'WALLET_SWITCH_COMPLETED'>;
34
+ } | {
35
+ type: 'SYNC_WALLETS';
36
+ payload?: undefined;
37
+ });
38
+ export type PortalResponsePayload<T extends PortalMessageType> = T extends 'ONRAMPS__INIT' ? {
39
+ onRampPurchase: OnRampPurchase;
40
+ onRampConfig: OnRampConfig;
41
+ } : T extends 'ONRAMPS__UPDATE_PURCHASE' ? {
42
+ onRampPurchase: OnRampPurchase;
43
+ } : T extends 'ONRAMPS__SIGN_MOONPAY_URL' ? {
44
+ signature: string;
45
+ } : T extends 'ONRAMPS__SIGN_DEPOSIT_TX' ? {
46
+ txHash: string;
47
+ onRampPurchase: OnRampPurchase;
48
+ } : T extends 'WALLET_SWITCH_COMPLETED' ? {
49
+ walletIds?: CurrentWalletIds;
50
+ } : T extends 'SYNC_WALLETS' ? {
51
+ wallets: Record<string, Wallet>;
52
+ currentWalletIds?: CurrentWalletIds;
53
+ } : never;
54
+ export type PortalResponse = {
55
+ id: string;
56
+ status: PortalMessageStatus;
57
+ type: PortalMessageType;
58
+ } & ({
59
+ status: 'ERROR';
60
+ payload: {
61
+ error: string;
62
+ };
63
+ } | {
64
+ status: 'SUCCESS';
65
+ type: 'ONRAMPS__INIT';
66
+ payload: PortalResponsePayload<'ONRAMPS__INIT'>;
67
+ } | {
68
+ status: 'SUCCESS';
69
+ type: 'ONRAMPS__UPDATE_PURCHASE';
70
+ payload: PortalResponsePayload<'ONRAMPS__UPDATE_PURCHASE'>;
71
+ } | {
72
+ status: 'SUCCESS';
73
+ type: 'ONRAMPS__SIGN_MOONPAY_URL';
74
+ payload: PortalResponsePayload<'ONRAMPS__SIGN_MOONPAY_URL'>;
75
+ } | {
76
+ status: 'SUCCESS';
77
+ type: 'ONRAMPS__SIGN_DEPOSIT_TX';
78
+ payload: PortalResponsePayload<'ONRAMPS__SIGN_DEPOSIT_TX'>;
79
+ } | {
80
+ status: 'SUCCESS';
81
+ type: 'WALLET_SWITCH_COMPLETED';
82
+ payload: PortalResponsePayload<'WALLET_SWITCH_COMPLETED'>;
83
+ } | {
84
+ status: 'SUCCESS';
85
+ type: 'SYNC_WALLETS';
86
+ payload: PortalResponsePayload<'SYNC_WALLETS'>;
87
+ });
@@ -0,0 +1 @@
1
+ "use client";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "../chunk-M66XENHI.js";
2
+ import "../chunk-YJOFEY2L.js";
3
3
  function getMailtoLink(email, recoveryShare) {
4
4
  const emailBody = `Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${recoveryShare}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;
5
5
  const mailText = `mailto:${email}?subject=Para%20Recovery%20Secret&body=${emailBody}`;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "../chunk-M66XENHI.js";
2
+ import "../chunk-YJOFEY2L.js";
3
3
  function hexStringToBase64(hexString) {
4
4
  if (hexString.substring(0, 2) === "0x") {
5
5
  hexString = hexString.substring(2);
@@ -0,0 +1,5 @@
1
+ export * from './emailUtils.js';
2
+ export * from './formattingUtils.js';
3
+ export * from './isPasskeySupported.js';
4
+ export * from './offrampSend.js';
5
+ export * from './truncateEthAddress.js';
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ export * from "./emailUtils.js";
3
+ export * from "./formattingUtils.js";
4
+ export * from "./isPasskeySupported.js";
5
+ export * from "./offrampSend.js";
6
+ export * from "./truncateEthAddress.js";