@embarkai/ui-kit 0.4.25 → 0.4.27

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.
@@ -1,78 +0,0 @@
1
- import {
2
- COMPAT_CREATE_ABI,
3
- FUNDER_PK,
4
- MAX_BUNDLER_VERIFICATION_GAS,
5
- PAYMASTER_POSTOP_GAS,
6
- PAYMASTER_POSTOP_GAS_LIMIT,
7
- PAYMASTER_VERIFICATION_GAS,
8
- PAYMASTER_VERIFICATION_GAS_LIMIT,
9
- SALT_ZERO,
10
- SALT_ZERO_UINT256,
11
- changeNickname,
12
- checkNicknameAvailability,
13
- createAccountSession,
14
- deployAccount,
15
- depositForSmartAccount,
16
- entryPointDepositAbi,
17
- executeAbi,
18
- executeBatchAbi,
19
- getAllSmartAccounts,
20
- getBundlerClient,
21
- getDashboardApiUrl,
22
- getEntryPointDeposit,
23
- getExplorerUrl,
24
- getNicknameInfo,
25
- getShareVaultUrl,
26
- getSmartAccountForChain,
27
- getTssUrl,
28
- lumiaBeamTestnet,
29
- lumiaPrisma,
30
- prepareBatchUserOperation,
31
- prepareUserOperation,
32
- registerSmartAccountAddress,
33
- resolveNickname,
34
- sendBatchUserOperation,
35
- sendUserOperation,
36
- signTypedData
37
- } from "./chunk-YW3BCDPE.js";
38
- import "./chunk-7G3OIJGJ.js";
39
- import "./chunk-MLUPZCC3.js";
40
- import "./chunk-DBFKMKYT.js";
41
- export {
42
- COMPAT_CREATE_ABI,
43
- FUNDER_PK,
44
- MAX_BUNDLER_VERIFICATION_GAS,
45
- PAYMASTER_POSTOP_GAS,
46
- PAYMASTER_POSTOP_GAS_LIMIT,
47
- PAYMASTER_VERIFICATION_GAS,
48
- PAYMASTER_VERIFICATION_GAS_LIMIT,
49
- SALT_ZERO,
50
- SALT_ZERO_UINT256,
51
- changeNickname,
52
- checkNicknameAvailability,
53
- createAccountSession,
54
- deployAccount,
55
- depositForSmartAccount,
56
- entryPointDepositAbi,
57
- executeAbi,
58
- executeBatchAbi,
59
- getAllSmartAccounts,
60
- getBundlerClient,
61
- getDashboardApiUrl,
62
- getEntryPointDeposit,
63
- getExplorerUrl,
64
- getNicknameInfo,
65
- getShareVaultUrl,
66
- getSmartAccountForChain,
67
- getTssUrl,
68
- lumiaBeamTestnet,
69
- lumiaPrisma,
70
- prepareBatchUserOperation,
71
- prepareUserOperation,
72
- registerSmartAccountAddress,
73
- resolveNickname,
74
- sendBatchUserOperation,
75
- sendUserOperation,
76
- signTypedData
77
- };
78
- //# sourceMappingURL=clients-IMZKL3HS.js.map
@@ -1,78 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
- var _chunkYVHXT2JXcjs = require('./chunk-YVHXT2JX.cjs');
38
- require('./chunk-NES46LXF.cjs');
39
- require('./chunk-B254FLAW.cjs');
40
- require('./chunk-DACL62OU.cjs');
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
- exports.COMPAT_CREATE_ABI = _chunkYVHXT2JXcjs.COMPAT_CREATE_ABI; exports.FUNDER_PK = _chunkYVHXT2JXcjs.FUNDER_PK; exports.MAX_BUNDLER_VERIFICATION_GAS = _chunkYVHXT2JXcjs.MAX_BUNDLER_VERIFICATION_GAS; exports.PAYMASTER_POSTOP_GAS = _chunkYVHXT2JXcjs.PAYMASTER_POSTOP_GAS; exports.PAYMASTER_POSTOP_GAS_LIMIT = _chunkYVHXT2JXcjs.PAYMASTER_POSTOP_GAS_LIMIT; exports.PAYMASTER_VERIFICATION_GAS = _chunkYVHXT2JXcjs.PAYMASTER_VERIFICATION_GAS; exports.PAYMASTER_VERIFICATION_GAS_LIMIT = _chunkYVHXT2JXcjs.PAYMASTER_VERIFICATION_GAS_LIMIT; exports.SALT_ZERO = _chunkYVHXT2JXcjs.SALT_ZERO; exports.SALT_ZERO_UINT256 = _chunkYVHXT2JXcjs.SALT_ZERO_UINT256; exports.changeNickname = _chunkYVHXT2JXcjs.changeNickname; exports.checkNicknameAvailability = _chunkYVHXT2JXcjs.checkNicknameAvailability; exports.createAccountSession = _chunkYVHXT2JXcjs.createAccountSession; exports.deployAccount = _chunkYVHXT2JXcjs.deployAccount; exports.depositForSmartAccount = _chunkYVHXT2JXcjs.depositForSmartAccount; exports.entryPointDepositAbi = _chunkYVHXT2JXcjs.entryPointDepositAbi; exports.executeAbi = _chunkYVHXT2JXcjs.executeAbi; exports.executeBatchAbi = _chunkYVHXT2JXcjs.executeBatchAbi; exports.getAllSmartAccounts = _chunkYVHXT2JXcjs.getAllSmartAccounts; exports.getBundlerClient = _chunkYVHXT2JXcjs.getBundlerClient; exports.getDashboardApiUrl = _chunkYVHXT2JXcjs.getDashboardApiUrl; exports.getEntryPointDeposit = _chunkYVHXT2JXcjs.getEntryPointDeposit; exports.getExplorerUrl = _chunkYVHXT2JXcjs.getExplorerUrl; exports.getNicknameInfo = _chunkYVHXT2JXcjs.getNicknameInfo; exports.getShareVaultUrl = _chunkYVHXT2JXcjs.getShareVaultUrl; exports.getSmartAccountForChain = _chunkYVHXT2JXcjs.getSmartAccountForChain; exports.getTssUrl = _chunkYVHXT2JXcjs.getTssUrl; exports.lumiaBeamTestnet = _chunkYVHXT2JXcjs.lumiaBeamTestnet; exports.lumiaPrisma = _chunkYVHXT2JXcjs.lumiaPrisma; exports.prepareBatchUserOperation = _chunkYVHXT2JXcjs.prepareBatchUserOperation; exports.prepareUserOperation = _chunkYVHXT2JXcjs.prepareUserOperation; exports.registerSmartAccountAddress = _chunkYVHXT2JXcjs.registerSmartAccountAddress; exports.resolveNickname = _chunkYVHXT2JXcjs.resolveNickname; exports.sendBatchUserOperation = _chunkYVHXT2JXcjs.sendBatchUserOperation; exports.sendUserOperation = _chunkYVHXT2JXcjs.sendUserOperation; exports.signTypedData = _chunkYVHXT2JXcjs.signTypedData;
78
- //# sourceMappingURL=clients-MCQWHPWS.cjs.map
@@ -1,207 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-DACL62OU.cjs');
2
-
3
- // src/internal/cloudStorage.ts
4
- var GoogleDriveProvider = class {
5
- constructor() {
6
- this.name = "Google Drive";
7
- this.id = "google-drive";
8
- this.icon = "\u{1F4C1}";
9
- // Can be replaced with proper icon
10
- this.accessToken = null;
11
- this.CLIENT_ID = "41560291859-hjqblt3jb80e268i0nafeu4m89eomhg3.apps.googleusercontent.com";
12
- this.DISCOVERY_DOC = "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest";
13
- this.SCOPES = "https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata";
14
- this.gapiInitialized = false;
15
- this.gisInitialized = false;
16
- this.initializeAPIs();
17
- }
18
- async initializeAPIs() {
19
- if (!window.gapi) {
20
- await this.loadScript("https://apis.google.com/js/api.js");
21
- }
22
- if (!_optionalChain([window, 'access', _ => _.google, 'optionalAccess', _2 => _2.accounts])) {
23
- await this.loadScript("https://accounts.google.com/gsi/client");
24
- }
25
- if (!this.gapiInitialized) {
26
- await new Promise((resolve) => {
27
- window.gapi.load("client", resolve);
28
- });
29
- await window.gapi.client.init({
30
- discoveryDocs: [this.DISCOVERY_DOC]
31
- });
32
- this.gapiInitialized = true;
33
- }
34
- if (!this.gisInitialized) {
35
- this.gisInitialized = true;
36
- }
37
- }
38
- loadScript(src) {
39
- return new Promise((resolve, reject) => {
40
- if (document.querySelector(`script[src="${src}"]`)) {
41
- resolve();
42
- return;
43
- }
44
- const script = document.createElement("script");
45
- script.src = src;
46
- script.onload = () => resolve();
47
- script.onerror = () => reject(new Error(`Failed to load ${src}`));
48
- document.head.appendChild(script);
49
- });
50
- }
51
- isAvailable() {
52
- return !!this.CLIENT_ID && typeof window !== "undefined";
53
- }
54
- async authenticate() {
55
- if (!this.isAvailable()) {
56
- throw new Error(
57
- "Google Drive integration is not available in this environment"
58
- );
59
- }
60
- await this.initializeAPIs();
61
- return new Promise((resolve, reject) => {
62
- try {
63
- const tokenClient = window.google.accounts.oauth2.initTokenClient({
64
- client_id: this.CLIENT_ID,
65
- scope: this.SCOPES,
66
- callback: (response) => {
67
- if (response.error) {
68
- console.error("[GoogleDrive] Authentication error:", response.error);
69
- reject(new Error(`Google Drive authentication failed: ${response.error}`));
70
- return;
71
- }
72
- this.accessToken = response.access_token;
73
- window.gapi.client.setToken({ access_token: this.accessToken });
74
- resolve(true);
75
- }
76
- });
77
- tokenClient.requestAccessToken({ prompt: "consent" });
78
- } catch (error) {
79
- console.error("[GoogleDrive] Authentication initialization failed:", error);
80
- reject(new Error(`Google Drive authentication setup failed: ${error}`));
81
- }
82
- });
83
- }
84
- isAuthenticated() {
85
- return !!this.accessToken;
86
- }
87
- async signOut() {
88
- if (this.accessToken) {
89
- _optionalChain([window, 'access', _3 => _3.google, 'optionalAccess', _4 => _4.accounts, 'access', _5 => _5.oauth2, 'access', _6 => _6.revoke, 'call', _7 => _7(this.accessToken)]);
90
- this.accessToken = null;
91
- _optionalChain([window, 'access', _8 => _8.gapi, 'optionalAccess', _9 => _9.client, 'access', _10 => _10.setToken, 'call', _11 => _11(null)]);
92
- }
93
- }
94
- async upload(fileName, content, usePrivateStorage = true) {
95
- if (!this.isAuthenticated()) {
96
- throw new Error("Not authenticated with Google Drive");
97
- }
98
- await this.initializeAPIs();
99
- if (usePrivateStorage) {
100
- try {
101
- const fileId = await this.uploadToAppDataFolder(fileName, content);
102
- return fileId;
103
- } catch (error) {
104
- console.warn("[GoogleDrive] AppDataFolder upload failed, trying fallback to regular folder:", error);
105
- const fileId = await this.uploadToAppFolder(fileName, content);
106
- return fileId;
107
- }
108
- } else {
109
- try {
110
- const fileId = await this.uploadToAppFolder(fileName, content);
111
- return fileId;
112
- } catch (error) {
113
- console.error("[GoogleDrive] Upload failed:", error);
114
- throw new Error(
115
- `Failed to upload to Google Drive: ${error instanceof Error ? error.message : String(error)}`
116
- );
117
- }
118
- }
119
- }
120
- async uploadToAppDataFolder(fileName, content) {
121
- const metadata = {
122
- name: fileName,
123
- parents: ["appDataFolder"]
124
- // Store in app-specific folder for privacy
125
- };
126
- return this.performUpload(metadata, content);
127
- }
128
- async uploadToAppFolder(fileName, content) {
129
- const folderName = "EmbarkAI Wallet Backups";
130
- const folderId = await this.findOrCreateFolder(folderName);
131
- const metadata = {
132
- name: fileName,
133
- parents: [folderId]
134
- };
135
- return this.performUpload(metadata, content);
136
- }
137
- async findOrCreateFolder(folderName) {
138
- const searchResponse = await fetch(
139
- `https://www.googleapis.com/drive/v3/files?q=name='${folderName}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,
140
- {
141
- headers: { Authorization: `Bearer ${this.accessToken}` },
142
- credentials: "include"
143
- }
144
- );
145
- if (!searchResponse.ok) {
146
- throw new Error(`Failed to search for folder: ${searchResponse.status}`);
147
- }
148
- const searchResult = await searchResponse.json();
149
- if (searchResult.files && searchResult.files.length > 0) {
150
- return searchResult.files[0].id;
151
- }
152
- const createResponse = await fetch("https://www.googleapis.com/drive/v3/files", {
153
- method: "POST",
154
- headers: {
155
- Authorization: `Bearer ${this.accessToken}`,
156
- "Content-Type": "application/json"
157
- },
158
- credentials: "include",
159
- body: JSON.stringify({
160
- name: folderName,
161
- mimeType: "application/vnd.google-apps.folder"
162
- })
163
- });
164
- if (!createResponse.ok) {
165
- throw new Error(`Failed to create folder: ${createResponse.status}`);
166
- }
167
- const createResult = await createResponse.json();
168
- return createResult.id;
169
- }
170
- async performUpload(metadata, content) {
171
- const form = new FormData();
172
- form.append("metadata", new Blob([JSON.stringify(metadata)], { type: "application/json" }));
173
- form.append("file", new Blob([content], { type: "application/json" }));
174
- const response = await fetch(
175
- "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",
176
- {
177
- method: "POST",
178
- headers: {
179
- Authorization: `Bearer ${this.accessToken}`
180
- },
181
- credentials: "include",
182
- body: form
183
- }
184
- );
185
- if (!response.ok) {
186
- const errorText = await response.text();
187
- throw new Error(
188
- `Google Drive upload failed: ${response.status} ${response.statusText} - ${errorText}`
189
- );
190
- }
191
- const result = await response.json();
192
- return result.id;
193
- }
194
- };
195
- function getAvailableCloudProviders() {
196
- const providers = [];
197
- const googleDrive = new GoogleDriveProvider();
198
- if (googleDrive.isAvailable()) {
199
- providers.push(googleDrive);
200
- }
201
- return providers;
202
- }
203
-
204
-
205
-
206
- exports.GoogleDriveProvider = GoogleDriveProvider; exports.getAvailableCloudProviders = getAvailableCloudProviders;
207
- //# sourceMappingURL=cloudStorage-SXE7HVID.cjs.map
@@ -1,207 +0,0 @@
1
- import "./chunk-DBFKMKYT.js";
2
-
3
- // src/internal/cloudStorage.ts
4
- var GoogleDriveProvider = class {
5
- constructor() {
6
- this.name = "Google Drive";
7
- this.id = "google-drive";
8
- this.icon = "\u{1F4C1}";
9
- // Can be replaced with proper icon
10
- this.accessToken = null;
11
- this.CLIENT_ID = "41560291859-hjqblt3jb80e268i0nafeu4m89eomhg3.apps.googleusercontent.com";
12
- this.DISCOVERY_DOC = "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest";
13
- this.SCOPES = "https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata";
14
- this.gapiInitialized = false;
15
- this.gisInitialized = false;
16
- this.initializeAPIs();
17
- }
18
- async initializeAPIs() {
19
- if (!window.gapi) {
20
- await this.loadScript("https://apis.google.com/js/api.js");
21
- }
22
- if (!window.google?.accounts) {
23
- await this.loadScript("https://accounts.google.com/gsi/client");
24
- }
25
- if (!this.gapiInitialized) {
26
- await new Promise((resolve) => {
27
- window.gapi.load("client", resolve);
28
- });
29
- await window.gapi.client.init({
30
- discoveryDocs: [this.DISCOVERY_DOC]
31
- });
32
- this.gapiInitialized = true;
33
- }
34
- if (!this.gisInitialized) {
35
- this.gisInitialized = true;
36
- }
37
- }
38
- loadScript(src) {
39
- return new Promise((resolve, reject) => {
40
- if (document.querySelector(`script[src="${src}"]`)) {
41
- resolve();
42
- return;
43
- }
44
- const script = document.createElement("script");
45
- script.src = src;
46
- script.onload = () => resolve();
47
- script.onerror = () => reject(new Error(`Failed to load ${src}`));
48
- document.head.appendChild(script);
49
- });
50
- }
51
- isAvailable() {
52
- return !!this.CLIENT_ID && typeof window !== "undefined";
53
- }
54
- async authenticate() {
55
- if (!this.isAvailable()) {
56
- throw new Error(
57
- "Google Drive integration is not available in this environment"
58
- );
59
- }
60
- await this.initializeAPIs();
61
- return new Promise((resolve, reject) => {
62
- try {
63
- const tokenClient = window.google.accounts.oauth2.initTokenClient({
64
- client_id: this.CLIENT_ID,
65
- scope: this.SCOPES,
66
- callback: (response) => {
67
- if (response.error) {
68
- console.error("[GoogleDrive] Authentication error:", response.error);
69
- reject(new Error(`Google Drive authentication failed: ${response.error}`));
70
- return;
71
- }
72
- this.accessToken = response.access_token;
73
- window.gapi.client.setToken({ access_token: this.accessToken });
74
- resolve(true);
75
- }
76
- });
77
- tokenClient.requestAccessToken({ prompt: "consent" });
78
- } catch (error) {
79
- console.error("[GoogleDrive] Authentication initialization failed:", error);
80
- reject(new Error(`Google Drive authentication setup failed: ${error}`));
81
- }
82
- });
83
- }
84
- isAuthenticated() {
85
- return !!this.accessToken;
86
- }
87
- async signOut() {
88
- if (this.accessToken) {
89
- window.google?.accounts.oauth2.revoke(this.accessToken);
90
- this.accessToken = null;
91
- window.gapi?.client.setToken(null);
92
- }
93
- }
94
- async upload(fileName, content, usePrivateStorage = true) {
95
- if (!this.isAuthenticated()) {
96
- throw new Error("Not authenticated with Google Drive");
97
- }
98
- await this.initializeAPIs();
99
- if (usePrivateStorage) {
100
- try {
101
- const fileId = await this.uploadToAppDataFolder(fileName, content);
102
- return fileId;
103
- } catch (error) {
104
- console.warn("[GoogleDrive] AppDataFolder upload failed, trying fallback to regular folder:", error);
105
- const fileId = await this.uploadToAppFolder(fileName, content);
106
- return fileId;
107
- }
108
- } else {
109
- try {
110
- const fileId = await this.uploadToAppFolder(fileName, content);
111
- return fileId;
112
- } catch (error) {
113
- console.error("[GoogleDrive] Upload failed:", error);
114
- throw new Error(
115
- `Failed to upload to Google Drive: ${error instanceof Error ? error.message : String(error)}`
116
- );
117
- }
118
- }
119
- }
120
- async uploadToAppDataFolder(fileName, content) {
121
- const metadata = {
122
- name: fileName,
123
- parents: ["appDataFolder"]
124
- // Store in app-specific folder for privacy
125
- };
126
- return this.performUpload(metadata, content);
127
- }
128
- async uploadToAppFolder(fileName, content) {
129
- const folderName = "EmbarkAI Wallet Backups";
130
- const folderId = await this.findOrCreateFolder(folderName);
131
- const metadata = {
132
- name: fileName,
133
- parents: [folderId]
134
- };
135
- return this.performUpload(metadata, content);
136
- }
137
- async findOrCreateFolder(folderName) {
138
- const searchResponse = await fetch(
139
- `https://www.googleapis.com/drive/v3/files?q=name='${folderName}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,
140
- {
141
- headers: { Authorization: `Bearer ${this.accessToken}` },
142
- credentials: "include"
143
- }
144
- );
145
- if (!searchResponse.ok) {
146
- throw new Error(`Failed to search for folder: ${searchResponse.status}`);
147
- }
148
- const searchResult = await searchResponse.json();
149
- if (searchResult.files && searchResult.files.length > 0) {
150
- return searchResult.files[0].id;
151
- }
152
- const createResponse = await fetch("https://www.googleapis.com/drive/v3/files", {
153
- method: "POST",
154
- headers: {
155
- Authorization: `Bearer ${this.accessToken}`,
156
- "Content-Type": "application/json"
157
- },
158
- credentials: "include",
159
- body: JSON.stringify({
160
- name: folderName,
161
- mimeType: "application/vnd.google-apps.folder"
162
- })
163
- });
164
- if (!createResponse.ok) {
165
- throw new Error(`Failed to create folder: ${createResponse.status}`);
166
- }
167
- const createResult = await createResponse.json();
168
- return createResult.id;
169
- }
170
- async performUpload(metadata, content) {
171
- const form = new FormData();
172
- form.append("metadata", new Blob([JSON.stringify(metadata)], { type: "application/json" }));
173
- form.append("file", new Blob([content], { type: "application/json" }));
174
- const response = await fetch(
175
- "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",
176
- {
177
- method: "POST",
178
- headers: {
179
- Authorization: `Bearer ${this.accessToken}`
180
- },
181
- credentials: "include",
182
- body: form
183
- }
184
- );
185
- if (!response.ok) {
186
- const errorText = await response.text();
187
- throw new Error(
188
- `Google Drive upload failed: ${response.status} ${response.statusText} - ${errorText}`
189
- );
190
- }
191
- const result = await response.json();
192
- return result.id;
193
- }
194
- };
195
- function getAvailableCloudProviders() {
196
- const providers = [];
197
- const googleDrive = new GoogleDriveProvider();
198
- if (googleDrive.isAvailable()) {
199
- providers.push(googleDrive);
200
- }
201
- return providers;
202
- }
203
- export {
204
- GoogleDriveProvider,
205
- getAvailableCloudProviders
206
- };
207
- //# sourceMappingURL=cloudStorage-WASWQ4KL.js.map