@bounded-sh/client 0.0.13 → 0.0.15

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.
Files changed (28) hide show
  1. package/dist/auth/providers/offchain-auth-provider.d.ts +7 -13
  2. package/dist/index.js +226 -285
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +226 -285
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/{index.native-BYEVhmbt.mjs → index.native-CAygEkU7.mjs} +229 -288
  7. package/dist/index.native-CAygEkU7.mjs.map +1 -0
  8. package/dist/{index.native-CcBTbnBg.js → index.native-zD2ZzCLO.js} +229 -288
  9. package/dist/index.native-zD2ZzCLO.js.map +1 -0
  10. package/dist/index.native.js +1 -1
  11. package/dist/index.native.mjs +1 -1
  12. package/dist/{phantom-wallet-provider-D_AzfLq0.mjs → phantom-wallet-provider-DU4WPFPM.mjs} +2 -2
  13. package/dist/{phantom-wallet-provider-D_AzfLq0.mjs.map → phantom-wallet-provider-DU4WPFPM.mjs.map} +1 -1
  14. package/dist/{phantom-wallet-provider-Cn6MzUUo.js → phantom-wallet-provider-MW2H0SFY.js} +2 -2
  15. package/dist/{phantom-wallet-provider-Cn6MzUUo.js.map → phantom-wallet-provider-MW2H0SFY.js.map} +1 -1
  16. package/dist/{privy-wallet-provider-AC4xL6bN.mjs → privy-wallet-provider-D5Kdp3Qp.mjs} +3 -3
  17. package/dist/{privy-wallet-provider-AC4xL6bN.mjs.map → privy-wallet-provider-D5Kdp3Qp.mjs.map} +1 -1
  18. package/dist/{privy-wallet-provider-DtWAtbUl.js → privy-wallet-provider-dFxuvDf4.js} +3 -3
  19. package/dist/{privy-wallet-provider-DtWAtbUl.js.map → privy-wallet-provider-dFxuvDf4.js.map} +1 -1
  20. package/dist/{solana-mobile-wallet-provider-X6BM07gm.mjs → solana-mobile-wallet-provider-CLiflgPj.mjs} +3 -3
  21. package/dist/solana-mobile-wallet-provider-CLiflgPj.mjs.map +1 -0
  22. package/dist/{solana-mobile-wallet-provider-Cos9gu7k.js → solana-mobile-wallet-provider-DAR0BLTQ.js} +3 -3
  23. package/dist/solana-mobile-wallet-provider-DAR0BLTQ.js.map +1 -0
  24. package/package.json +2 -2
  25. package/dist/index.native-BYEVhmbt.mjs.map +0 -1
  26. package/dist/index.native-CcBTbnBg.js.map +0 -1
  27. package/dist/solana-mobile-wallet-provider-Cos9gu7k.js.map +0 -1
  28. package/dist/solana-mobile-wallet-provider-X6BM07gm.mjs.map +0 -1
@@ -10153,24 +10153,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
10153
10153
  /* ------------------------------------------------------------------ */
10154
10154
  /* ENV helpers */
10155
10155
  /* ------------------------------------------------------------------ */
10156
- // Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI); legacy
10157
- // `BOUNDED_SOLANA_KEYPAIR` still honored. Only consulted when no explicit
10158
- // keypair was provided (createWalletClient passes one).
10159
- const ENV_KEYPAIRS = ["BOUNDED_PRIVATE_KEY", "BOUNDED_SOLANA_KEYPAIR"];
10156
+ // Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI). Only consulted when no
10157
+ // explicit keypair was provided (createWalletClient passes one).
10158
+ const ENV_KEYPAIR = "BOUNDED_PRIVATE_KEY";
10159
+ const LEGACY_ENV_KEYPAIR = "BOUNDED_SOLANA_KEYPAIR";
10160
10160
  function loadKeypairFromEnv() {
10161
- let secret;
10162
- let found;
10163
- for (const name of ENV_KEYPAIRS) {
10164
- const v = process.env[name];
10165
- if (v) {
10166
- secret = v;
10167
- found = name;
10168
- break;
10169
- }
10161
+ if (process.env[LEGACY_ENV_KEYPAIR]) {
10162
+ throw new Error(`${LEGACY_ENV_KEYPAIR} is no longer supported. Set ${ENV_KEYPAIR} instead, ` +
10163
+ `or pass an explicit keypair via createWalletClient({ keypair }).`);
10170
10164
  }
10165
+ const secret = process.env[ENV_KEYPAIR];
10171
10166
  if (!secret) {
10172
10167
  throw new Error(`No server keypair for this top-level call. The top-level get/set/subscribe/etc. use an ` +
10173
- `AMBIENT session — set ${ENV_KEYPAIRS[0]} to a base-58 secret key (or JSON array) to provide one. ` +
10168
+ `AMBIENT session — set ${ENV_KEYPAIR} to a base-58 secret key (or JSON array) to provide one. ` +
10174
10169
  `If you already created a wallet with createWalletClient({ keypair }), call ITS methods instead ` +
10175
10170
  `(client.subscribe / client.set / client.get): that client is self-contained and deliberately does ` +
10176
10171
  `not set the ambient session, so the top-level functions can't see it.`);
@@ -10182,7 +10177,7 @@ function loadKeypairFromEnv() {
10182
10177
  return Keypair.fromSecretKey(secretKey);
10183
10178
  }
10184
10179
  catch (err) {
10185
- throw new Error(`Unable to parse ${found}. Ensure it is valid base-58 or JSON.`);
10180
+ throw new Error(`Unable to parse ${ENV_KEYPAIR}. Ensure it is valid base-58 or JSON.`);
10186
10181
  }
10187
10182
  }
10188
10183
  /* ------------------------------------------------------------------ */
@@ -10249,7 +10244,7 @@ class ServerSessionManager {
10249
10244
  this.session = session;
10250
10245
  }
10251
10246
  /* ---------------------------------------------- *
10252
- * CLEAR (e.g. after logout or 401 retry)
10247
+ * CLEAR (e.g. after explicit logout)
10253
10248
  * ---------------------------------------------- */
10254
10249
  clearSession() {
10255
10250
  this.session = null;
@@ -10273,11 +10268,6 @@ class ServerSessionManager {
10273
10268
  /* The default singleton instance (reads keypair from env) */
10274
10269
  ServerSessionManager.instance = new ServerSessionManager();
10275
10270
 
10276
- var serverSessionManager = /*#__PURE__*/Object.freeze({
10277
- __proto__: null,
10278
- ServerSessionManager: ServerSessionManager
10279
- });
10280
-
10281
10271
  /**
10282
10272
  * Safe base64 helpers for bounded-core.
10283
10273
  *
@@ -10502,13 +10492,6 @@ async function refreshAuthSessionOnce(appId, isServer) {
10502
10492
  async function makeApiRequest(method, urlPath, data, _overrides) {
10503
10493
  var _a, _b, _c, _d, _e, _f, _g, _h;
10504
10494
  const config = await getConfig();
10505
- let hasRetriedAfterServerSessionReset = false;
10506
- const clearServerSession = async () => {
10507
- if (!config.isServer)
10508
- return;
10509
- const { ServerSessionManager } = await Promise.resolve().then(function () { return serverSessionManager; });
10510
- ServerSessionManager.instance.clearSession();
10511
- };
10512
10495
  async function executeRequest() {
10513
10496
  var _a;
10514
10497
  // When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
@@ -10558,13 +10541,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
10558
10541
  }
10559
10542
  return await executeRequest();
10560
10543
  }
10561
- catch (_refreshError) {
10562
- // Server-side fallback: clear global session and retry once
10563
- if (config.isServer && !hasRetriedAfterServerSessionReset) {
10564
- hasRetriedAfterServerSessionReset = true;
10565
- await clearServerSession();
10566
- return await executeRequest();
10567
- }
10544
+ catch (_j) {
10568
10545
  throw error;
10569
10546
  }
10570
10547
  }
@@ -11124,39 +11101,8 @@ async function get(path, opts = {}) {
11124
11101
  }
11125
11102
  // Create a new request promise and store it
11126
11103
  const requestPromise = (async () => {
11127
- var _a;
11128
11104
  try {
11129
- // For realtime chains, prefer WebSocket reads (lower latency, already connected)
11130
- const config = await getConfig();
11131
11105
  const pathIsDocument = normalizedPath.split("/").length % 2 === 0;
11132
- if (((_a = config.chain) === null || _a === void 0 ? void 0 : _a.startsWith('realtime_')) && !config.isServer && !opts.prompt && !opts.shape && !opts.cursor && !opts.includeSubPaths && !opts.filter && !opts.sort) {
11133
- try {
11134
- const { wsGet, wsQuery, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
11135
- if (hasActiveConnection()) {
11136
- if (pathIsDocument) {
11137
- const wsResult = await wsGet(normalizedPath);
11138
- const responseData = normalizeReadResult(wsResult, true);
11139
- if (!opts.bypassCache) {
11140
- getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
11141
- }
11142
- return responseData;
11143
- }
11144
- else if (!opts.limit) {
11145
- const wsResult = await wsQuery(normalizedPath, {
11146
- filter: undefined,
11147
- sort: undefined,
11148
- includeSubPaths: opts.includeSubPaths,
11149
- });
11150
- const responseData = normalizeReadResult(wsResult, false);
11151
- if (!opts.bypassCache) {
11152
- getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
11153
- }
11154
- return responseData;
11155
- }
11156
- }
11157
- }
11158
- catch ( /* fall through to HTTP */_b) { /* fall through to HTTP */ }
11159
- }
11160
11106
  // Cache miss or bypass - proceed with HTTP API request
11161
11107
  let response;
11162
11108
  // Build common query params
@@ -11409,7 +11355,7 @@ async function set(path, document, options) {
11409
11355
  return result;
11410
11356
  }
11411
11357
  async function setMany(many, options) {
11412
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11358
+ var _a, _b, _c, _d, _e, _f, _g;
11413
11359
  // Returns the data that was set, or undefined if the document was already set.
11414
11360
  try {
11415
11361
  const config = await getConfig();
@@ -11446,40 +11392,13 @@ async function setMany(many, options) {
11446
11392
  }
11447
11393
  let setResponse;
11448
11394
  try {
11449
- // For realtime chains, prefer WebSocket if a connection is active (lower latency)
11450
- const useWs = ((_c = config.chain) === null || _c === void 0 ? void 0 : _c.startsWith('realtime_')) && !config.isServer;
11451
- if (useWs) {
11452
- try {
11453
- const { wsSet, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
11454
- if (hasActiveConnection()) {
11455
- // Connection is active — send via WS. If this throws, the write
11456
- // may have been applied server-side (ack lost). Do NOT fall through
11457
- // to HTTP, as that would double-apply non-idempotent ops (Increment).
11458
- const wsResult = await wsSet(documents);
11459
- setResponse = { data: wsResult, status: 200 };
11460
- }
11461
- }
11462
- catch (wsError) {
11463
- // Only fall through to HTTP if the request was never sent (connection not available).
11464
- // If the request was sent and ack was lost (timeout), the server may have
11465
- // applied it — re-sending via HTTP risks double-write for non-idempotent ops.
11466
- const msg = (_d = wsError === null || wsError === void 0 ? void 0 : wsError.message) !== null && _d !== void 0 ? _d : '';
11467
- const neverSent = msg.includes('not available') || msg.includes('connection timeout');
11468
- if (!neverSent) {
11469
- throw wsError;
11470
- }
11471
- // Safe to retry via HTTP — request was never sent
11472
- }
11473
- }
11474
- if (!setResponse) {
11475
- setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
11476
- }
11395
+ setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
11477
11396
  }
11478
11397
  catch (error) {
11479
11398
  if ((error === null || error === void 0 ? void 0 : error.statusCode) === 402 && (error === null || error === void 0 ? void 0 : error.error) === 'INSUFFICIENT_BALANCE') {
11480
- const deficitLamports = Number((_e = error.deficitLamports) !== null && _e !== void 0 ? _e : 0);
11481
- const deficitSol = Number((_f = error.deficitSol) !== null && _f !== void 0 ? _f : deficitLamports / 1000000000);
11482
- throw new InsufficientBalanceError(String((_g = error.address) !== null && _g !== void 0 ? _g : ''), Number((_h = error.balanceLamports) !== null && _h !== void 0 ? _h : 0), Number((_j = error.estimatedCostLamports) !== null && _j !== void 0 ? _j : 0), deficitLamports, deficitSol);
11399
+ const deficitLamports = Number((_c = error.deficitLamports) !== null && _c !== void 0 ? _c : 0);
11400
+ const deficitSol = Number((_d = error.deficitSol) !== null && _d !== void 0 ? _d : deficitLamports / 1000000000);
11401
+ throw new InsufficientBalanceError(String((_e = error.address) !== null && _e !== void 0 ? _e : ''), Number((_f = error.balanceLamports) !== null && _f !== void 0 ? _f : 0), Number((_g = error.estimatedCostLamports) !== null && _g !== void 0 ? _g : 0), deficitLamports, deficitSol);
11483
11402
  }
11484
11403
  throw error;
11485
11404
  }
@@ -11526,7 +11445,7 @@ async function setMany(many, options) {
11526
11445
  else if (setResponse.data &&
11527
11446
  typeof setResponse.data === 'object' &&
11528
11447
  setResponse.data.success === true) {
11529
- const _k = setResponse.data, { success: _success } = _k, rest = __rest$1(_k, ["success"]);
11448
+ const _h = setResponse.data, { success: _success } = _h, rest = __rest$1(_h, ["success"]);
11530
11449
  return Object.assign(Object.assign(Object.assign({}, documents.map(d => d.document)), rest), { transactionId: null });
11531
11450
  }
11532
11451
  else {
@@ -13054,23 +12973,6 @@ async function wsGetMany(paths) {
13054
12973
  }));
13055
12974
  }
13056
12975
 
13057
- var subscriptionV2 = /*#__PURE__*/Object.freeze({
13058
- __proto__: null,
13059
- clearCacheV2: clearCacheV2,
13060
- closeAllSubscriptionsV2: closeAllSubscriptionsV2,
13061
- getCachedDataV2: getCachedDataV2,
13062
- hasActiveConnection: hasActiveConnection,
13063
- reconnectWithNewAuthV2: reconnectWithNewAuthV2,
13064
- subscribeV2: subscribeV2,
13065
- wsDelete: wsDelete,
13066
- wsGet: wsGet,
13067
- wsGetMany: wsGetMany,
13068
- wsIntent: wsIntent,
13069
- wsIntentReliable: wsIntentReliable,
13070
- wsQuery: wsQuery,
13071
- wsSet: wsSet
13072
- });
13073
-
13074
12976
  /**
13075
12977
  * WebSocket Subscription Module
13076
12978
  *
@@ -14881,7 +14783,7 @@ class OffchainAuthProvider {
14881
14783
  // Create modal container
14882
14784
  this.modalContainer = document.createElement("div");
14883
14785
  this.modalContainer.id = "poofnet-unsupported-modal";
14884
- this.modalContainer.innerHTML = this.getUnsupportedModalHTML();
14786
+ this.modalContainer.appendChild(this.buildUnsupportedModalContent());
14885
14787
  document.body.appendChild(this.modalContainer);
14886
14788
  // Add styles
14887
14789
  const style = document.createElement("style");
@@ -14937,38 +14839,6 @@ class OffchainAuthProvider {
14937
14839
  document.addEventListener("keydown", escHandler);
14938
14840
  });
14939
14841
  }
14940
- getUnsupportedModalHTML() {
14941
- return `
14942
- <div class="poofnet-modal-overlay">
14943
- <div class="poofnet-modal-content">
14944
- <button id="poofnet-close-btn" class="poofnet-close-btn" aria-label="Close">
14945
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
14946
- <path d="M1 1L13 13M1 13L13 1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
14947
- </svg>
14948
- </button>
14949
- <div class="poofnet-modal-header">
14950
- <div class="poofnet-modal-icon">⚠️</div>
14951
- <h2 class="poofnet-modal-title">Transaction Not Supported</h2>
14952
- <p class="poofnet-modal-subtitle">Poofnet Simulated Blockchain</p>
14953
- </div>
14954
-
14955
- <div class="poofnet-modal-body">
14956
- <div class="poofnet-info-box" style="background: #fef3c7;">
14957
- <span class="poofnet-info-icon">ℹ️</span>
14958
- <span class="poofnet-info-text" style="color: #92400e;">
14959
- Poofnet is a simulated blockchain and does not support real Solana transactions.
14960
- Deploy your project to mainnet to test real transactions.
14961
- </span>
14962
- </div>
14963
- </div>
14964
-
14965
- <div class="poofnet-modal-footer">
14966
- <button id="poofnet-cancel-btn" class="poofnet-btn poofnet-btn-cancel" style="flex: 1;">Close</button>
14967
- </div>
14968
- </div>
14969
- </div>
14970
- `;
14971
- }
14972
14842
  async showTransactionModal(message) {
14973
14843
  return new Promise((resolve) => {
14974
14844
  // Parse the transaction message for display
@@ -14982,7 +14852,7 @@ class OffchainAuthProvider {
14982
14852
  // Create modal container
14983
14853
  this.modalContainer = document.createElement("div");
14984
14854
  this.modalContainer.id = "poofnet-tx-modal";
14985
- this.modalContainer.innerHTML = this.getModalHTML(parsed, message);
14855
+ this.modalContainer.appendChild(this.buildTransactionModalContent(parsed, message));
14986
14856
  document.body.appendChild(this.modalContainer);
14987
14857
  // Add styles
14988
14858
  const style = document.createElement("style");
@@ -15065,24 +14935,59 @@ class OffchainAuthProvider {
15065
14935
  }, 200);
15066
14936
  }
15067
14937
  }
15068
- /**
15069
- * Escape a value for safe interpolation into an HTML string.
15070
- *
15071
- * Transaction messages are attacker-influenceable (they originate from
15072
- * server responses / app-supplied data), so every value derived from them
15073
- * MUST be escaped before being placed into innerHTML. Without this, a field
15074
- * key/value, path segment, document id, or raw message containing markup
15075
- * such as `<img src=x onerror=...>` would execute in the dApp origin and
15076
- * could exfiltrate the stored session (idToken/refreshToken).
15077
- */
15078
- escapeHtml(value) {
15079
- const str = value === null || value === undefined ? "" : String(value);
15080
- return str
15081
- .replace(/&/g, "&amp;")
15082
- .replace(/</g, "&lt;")
15083
- .replace(/>/g, "&gt;")
15084
- .replace(/"/g, "&quot;")
15085
- .replace(/'/g, "&#39;");
14938
+ createElement(tag, className, text) {
14939
+ const el = document.createElement(tag);
14940
+ if (className)
14941
+ el.className = className;
14942
+ if (text !== undefined)
14943
+ el.textContent = text;
14944
+ return el;
14945
+ }
14946
+ appendTextElement(parent, tag, className, text) {
14947
+ const el = this.createElement(tag, className, text);
14948
+ parent.appendChild(el);
14949
+ return el;
14950
+ }
14951
+ buildModalShell(icon, title) {
14952
+ const overlay = this.createElement("div", "poofnet-modal-overlay");
14953
+ const content = this.createElement("div", "poofnet-modal-content");
14954
+ overlay.appendChild(content);
14955
+ const close = this.createElement("button", "poofnet-close-btn", "×");
14956
+ close.id = "poofnet-close-btn";
14957
+ close.setAttribute("aria-label", "Close");
14958
+ close.type = "button";
14959
+ content.appendChild(close);
14960
+ const header = this.createElement("div", "poofnet-modal-header");
14961
+ this.appendTextElement(header, "div", "poofnet-modal-icon", icon);
14962
+ this.appendTextElement(header, "h2", "poofnet-modal-title", title);
14963
+ this.appendTextElement(header, "p", "poofnet-modal-subtitle", "Poofnet Simulated Blockchain");
14964
+ content.appendChild(header);
14965
+ const body = this.createElement("div", "poofnet-modal-body");
14966
+ content.appendChild(body);
14967
+ const footer = this.createElement("div", "poofnet-modal-footer");
14968
+ content.appendChild(footer);
14969
+ return { overlay, body, footer };
14970
+ }
14971
+ buildInfoBox(text, warning = false) {
14972
+ const info = this.createElement("div", "poofnet-info-box");
14973
+ if (warning)
14974
+ info.style.background = "#fef3c7";
14975
+ this.appendTextElement(info, "span", "poofnet-info-icon", "ℹ️");
14976
+ const infoText = this.createElement("span", "poofnet-info-text", text);
14977
+ if (warning)
14978
+ infoText.style.color = "#92400e";
14979
+ info.appendChild(infoText);
14980
+ return info;
14981
+ }
14982
+ buildUnsupportedModalContent() {
14983
+ const { overlay, body, footer } = this.buildModalShell("⚠️", "Transaction Not Supported");
14984
+ body.appendChild(this.buildInfoBox("Poofnet is a simulated blockchain and does not support real Solana transactions. Deploy your project to mainnet to test real transactions.", true));
14985
+ const close = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Close");
14986
+ close.id = "poofnet-cancel-btn";
14987
+ close.type = "button";
14988
+ close.style.flex = "1";
14989
+ footer.appendChild(close);
14990
+ return overlay;
15086
14991
  }
15087
14992
  formatPath(path) {
15088
14993
  const parts = path.split("/").filter(Boolean);
@@ -15115,59 +15020,11 @@ class OffchainAuthProvider {
15115
15020
  return `Delete from ${collection}`;
15116
15021
  return isNew ? `Create in ${collection}` : `Update ${collection}`;
15117
15022
  }
15118
- getModalHTML(parsed, rawMessage) {
15023
+ buildTransactionModalContent(parsed, rawMessage) {
15119
15024
  const instructions = parsed.instructions || [];
15120
15025
  // Group instructions by type for summary
15121
15026
  const sets = instructions.filter((i) => i.type === "set");
15122
15027
  const deletes = instructions.filter((i) => i.type === "delete");
15123
- const instructionsList = instructions
15124
- .map((inst) => {
15125
- const { collection, documentId } = this.formatPath(inst.path);
15126
- const isDelete = inst.type === "delete";
15127
- const icon = isDelete ? "🗑️" : "✏️";
15128
- const actionClass = isDelete
15129
- ? "poofnet-action-delete"
15130
- : "poofnet-action-set";
15131
- // Format data fields for display
15132
- let fieldsHtml = "";
15133
- if (inst.data && !isDelete) {
15134
- const fields = Object.entries(inst.data)
15135
- .filter(([key]) => !key.startsWith("_")) // Hide internal fields
15136
- .slice(0, 4);
15137
- if (fields.length > 0) {
15138
- fieldsHtml = `
15139
- <div class="poofnet-fields">
15140
- ${fields
15141
- .map(([key, value]) => `
15142
- <div class="poofnet-field">
15143
- <span class="poofnet-field-key">${this.escapeHtml(key)}:</span>
15144
- <span class="poofnet-field-value">${this.escapeHtml(this.formatFieldValue(value))}</span>
15145
- </div>
15146
- `)
15147
- .join("")}
15148
- ${Object.keys(inst.data).filter((k) => !k.startsWith("_"))
15149
- .length > 4
15150
- ? `<div class="poofnet-field-more">+${Object.keys(inst.data).filter((k) => !k.startsWith("_")).length - 4} more fields</div>`
15151
- : ""}
15152
- </div>
15153
- `;
15154
- }
15155
- }
15156
- return `
15157
- <div class="poofnet-instruction ${actionClass}">
15158
- <div class="poofnet-instruction-header">
15159
- <span class="poofnet-instruction-icon">${icon}</span>
15160
- <span class="poofnet-instruction-action">${isDelete ? "Delete" : "Save"}</span>
15161
- <span class="poofnet-instruction-collection">${this.escapeHtml(collection)}</span>
15162
- </div>
15163
- ${documentId
15164
- ? `<div class="poofnet-instruction-id">ID: ${this.escapeHtml(documentId)}</div>`
15165
- : ""}
15166
- ${fieldsHtml}
15167
- </div>
15168
- `;
15169
- })
15170
- .join("");
15171
15028
  // Create summary text
15172
15029
  let summaryText = "";
15173
15030
  if (sets.length > 0 && deletes.length > 0) {
@@ -15179,50 +15036,65 @@ class OffchainAuthProvider {
15179
15036
  else if (deletes.length > 0) {
15180
15037
  summaryText = `${deletes.length} delete${deletes.length > 1 ? "s" : ""}`;
15181
15038
  }
15182
- return `
15183
- <div class="poofnet-modal-overlay">
15184
- <div class="poofnet-modal-content">
15185
- <button id="poofnet-close-btn" class="poofnet-close-btn" aria-label="Close">
15186
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
15187
- <path d="M1 1L13 13M1 13L13 1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
15188
- </svg>
15189
- </button>
15190
- <div class="poofnet-modal-header">
15191
- <div class="poofnet-modal-icon">🔐</div>
15192
- <h2 class="poofnet-modal-title">Confirm Transaction</h2>
15193
- <p class="poofnet-modal-subtitle">Poofnet Simulated Blockchain</p>
15194
- </div>
15195
-
15196
- <div class="poofnet-modal-body">
15197
- ${instructions.length > 0
15198
- ? `
15199
- ${summaryText
15200
- ? `<div class="poofnet-summary">${summaryText}</div>`
15201
- : ""}
15202
- <div class="poofnet-instructions-list">
15203
- ${instructionsList}
15204
- </div>
15205
- `
15206
- : `
15207
- <div class="poofnet-section">
15208
- <h3 class="poofnet-section-title">Message</h3>
15209
- <pre class="poofnet-raw-message">${this.escapeHtml(rawMessage.slice(0, 200))}${rawMessage.length > 200 ? "..." : ""}</pre>
15210
- </div>
15211
- `}
15212
-
15213
- <div class="poofnet-info-box">
15214
- <span class="poofnet-info-icon">ℹ️</span>
15215
- <span class="poofnet-info-text">This is a simulated transaction. No real fees will be charged.</span>
15216
- </div>
15217
- </div>
15218
-
15219
- <div class="poofnet-modal-footer">
15220
- <button id="poofnet-cancel-btn" class="poofnet-btn poofnet-btn-cancel">Cancel</button>
15221
- <button id="poofnet-confirm-btn" class="poofnet-btn poofnet-btn-confirm">Confirm</button>
15222
- </div>
15223
- </div>
15224
- </div>
15225
- `;
15039
+ const { overlay, body, footer } = this.buildModalShell("🔐", "Confirm Transaction");
15040
+ if (instructions.length > 0) {
15041
+ if (summaryText) {
15042
+ this.appendTextElement(body, "div", "poofnet-summary", summaryText);
15043
+ }
15044
+ const list = this.createElement("div", "poofnet-instructions-list");
15045
+ for (const inst of instructions) {
15046
+ list.appendChild(this.buildInstructionElement(inst));
15047
+ }
15048
+ body.appendChild(list);
15049
+ }
15050
+ else {
15051
+ const section = this.createElement("div", "poofnet-section");
15052
+ this.appendTextElement(section, "h3", "poofnet-section-title", "Message");
15053
+ const raw = this.createElement("pre", "poofnet-raw-message", rawMessage.slice(0, 200) + (rawMessage.length > 200 ? "..." : ""));
15054
+ section.appendChild(raw);
15055
+ body.appendChild(section);
15056
+ }
15057
+ body.appendChild(this.buildInfoBox("This is a simulated transaction. No real fees will be charged."));
15058
+ const cancel = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Cancel");
15059
+ cancel.id = "poofnet-cancel-btn";
15060
+ cancel.type = "button";
15061
+ footer.appendChild(cancel);
15062
+ const confirm = this.createElement("button", "poofnet-btn poofnet-btn-confirm", "Confirm");
15063
+ confirm.id = "poofnet-confirm-btn";
15064
+ confirm.type = "button";
15065
+ footer.appendChild(confirm);
15066
+ return overlay;
15067
+ }
15068
+ buildInstructionElement(inst) {
15069
+ const { collection, documentId } = this.formatPath(inst.path);
15070
+ const isDelete = inst.type === "delete";
15071
+ const card = this.createElement("div", `poofnet-instruction ${isDelete ? "poofnet-action-delete" : "poofnet-action-set"}`);
15072
+ const header = this.createElement("div", "poofnet-instruction-header");
15073
+ this.appendTextElement(header, "span", "poofnet-instruction-icon", isDelete ? "🗑️" : "✏️");
15074
+ this.appendTextElement(header, "span", "poofnet-instruction-action", isDelete ? "Delete" : "Save");
15075
+ this.appendTextElement(header, "span", "poofnet-instruction-collection", collection);
15076
+ card.appendChild(header);
15077
+ if (documentId) {
15078
+ this.appendTextElement(card, "div", "poofnet-instruction-id", `ID: ${documentId}`);
15079
+ }
15080
+ if (inst.data && !isDelete) {
15081
+ const fieldKeys = Object.keys(inst.data).filter((key) => !key.startsWith("_"));
15082
+ const visibleFields = fieldKeys.slice(0, 4);
15083
+ if (visibleFields.length > 0) {
15084
+ const fields = this.createElement("div", "poofnet-fields");
15085
+ for (const key of visibleFields) {
15086
+ const row = this.createElement("div", "poofnet-field");
15087
+ this.appendTextElement(row, "span", "poofnet-field-key", `${key}:`);
15088
+ this.appendTextElement(row, "span", "poofnet-field-value", this.formatFieldValue(inst.data[key]));
15089
+ fields.appendChild(row);
15090
+ }
15091
+ if (fieldKeys.length > 4) {
15092
+ this.appendTextElement(fields, "div", "poofnet-field-more", `+${fieldKeys.length - 4} more fields`);
15093
+ }
15094
+ card.appendChild(fields);
15095
+ }
15096
+ }
15097
+ return card;
15226
15098
  }
15227
15099
  getModalStyles() {
15228
15100
  return `
@@ -18558,9 +18430,7 @@ const emailProviderSingleton = new EmailAuthProvider();
18558
18430
  function openEmailModal() {
18559
18431
  return new Promise((resolve) => {
18560
18432
  var _a;
18561
- const root = document.createElement('div');
18562
- root.id = 'bounded-auth-modal';
18563
- root.innerHTML = MODAL_HTML;
18433
+ const root = createEmailModalTree();
18564
18434
  const style = document.createElement('style');
18565
18435
  style.textContent = MODAL_CSS;
18566
18436
  root.appendChild(style);
@@ -18648,26 +18518,97 @@ function openEmailModal() {
18648
18518
  });
18649
18519
  });
18650
18520
  }
18651
- const MODAL_HTML = `
18652
- <div class="ba-overlay">
18653
- <div class="ba-card" role="dialog" aria-modal="true" aria-label="Sign in">
18654
- <button id="ba-close" class="ba-x" aria-label="Close">&times;</button>
18655
- <div class="ba-brand"><span class="ba-dot"></span> Sign in</div>
18656
- <div id="ba-email-step">
18657
- <label class="ba-label" for="ba-email">Email</label>
18658
- <input id="ba-email" class="ba-input" type="email" inputmode="email" autocomplete="email" placeholder="you@example.com" />
18659
- <button id="ba-email-btn" class="ba-btn">Continue</button>
18660
- </div>
18661
- <div id="ba-otp-step" class="hidden">
18662
- <label class="ba-label" for="ba-otp">Enter the code sent to <span id="ba-sent-to" class="ba-em"></span></label>
18663
- <input id="ba-otp" class="ba-input ba-code" inputmode="numeric" autocomplete="one-time-code" maxlength="8" placeholder="······" />
18664
- <button id="ba-otp-btn" class="ba-btn">Verify &amp; continue</button>
18665
- <button id="ba-back" class="ba-link">Use a different email</button>
18666
- </div>
18667
- <div id="ba-msg" class="ba-msg"></div>
18668
- <div class="ba-foot">Secured by Bounded</div>
18669
- </div>
18670
- </div>`;
18521
+ function createEmailModalTree() {
18522
+ const root = document.createElement('div');
18523
+ root.id = 'bounded-auth-modal';
18524
+ const overlay = document.createElement('div');
18525
+ overlay.className = 'ba-overlay';
18526
+ root.appendChild(overlay);
18527
+ const card = document.createElement('div');
18528
+ card.className = 'ba-card';
18529
+ card.setAttribute('role', 'dialog');
18530
+ card.setAttribute('aria-modal', 'true');
18531
+ card.setAttribute('aria-label', 'Sign in');
18532
+ overlay.appendChild(card);
18533
+ const close = document.createElement('button');
18534
+ close.id = 'ba-close';
18535
+ close.className = 'ba-x';
18536
+ close.setAttribute('aria-label', 'Close');
18537
+ close.type = 'button';
18538
+ close.textContent = '×';
18539
+ card.appendChild(close);
18540
+ const brand = document.createElement('div');
18541
+ brand.className = 'ba-brand';
18542
+ const dot = document.createElement('span');
18543
+ dot.className = 'ba-dot';
18544
+ brand.appendChild(dot);
18545
+ brand.appendChild(document.createTextNode(' Sign in'));
18546
+ card.appendChild(brand);
18547
+ const emailStep = document.createElement('div');
18548
+ emailStep.id = 'ba-email-step';
18549
+ card.appendChild(emailStep);
18550
+ const emailLabel = document.createElement('label');
18551
+ emailLabel.className = 'ba-label';
18552
+ emailLabel.htmlFor = 'ba-email';
18553
+ emailLabel.textContent = 'Email';
18554
+ emailStep.appendChild(emailLabel);
18555
+ const emailInput = document.createElement('input');
18556
+ emailInput.id = 'ba-email';
18557
+ emailInput.className = 'ba-input';
18558
+ emailInput.type = 'email';
18559
+ emailInput.inputMode = 'email';
18560
+ emailInput.autocomplete = 'email';
18561
+ emailInput.placeholder = 'you@example.com';
18562
+ emailStep.appendChild(emailInput);
18563
+ const emailButton = document.createElement('button');
18564
+ emailButton.id = 'ba-email-btn';
18565
+ emailButton.className = 'ba-btn';
18566
+ emailButton.type = 'button';
18567
+ emailButton.textContent = 'Continue';
18568
+ emailStep.appendChild(emailButton);
18569
+ const otpStep = document.createElement('div');
18570
+ otpStep.id = 'ba-otp-step';
18571
+ otpStep.className = 'hidden';
18572
+ card.appendChild(otpStep);
18573
+ const otpLabel = document.createElement('label');
18574
+ otpLabel.className = 'ba-label';
18575
+ otpLabel.htmlFor = 'ba-otp';
18576
+ otpLabel.appendChild(document.createTextNode('Enter the code sent to '));
18577
+ const sentTo = document.createElement('span');
18578
+ sentTo.id = 'ba-sent-to';
18579
+ sentTo.className = 'ba-em';
18580
+ otpLabel.appendChild(sentTo);
18581
+ otpStep.appendChild(otpLabel);
18582
+ const otpInput = document.createElement('input');
18583
+ otpInput.id = 'ba-otp';
18584
+ otpInput.className = 'ba-input ba-code';
18585
+ otpInput.inputMode = 'numeric';
18586
+ otpInput.autocomplete = 'one-time-code';
18587
+ otpInput.maxLength = 8;
18588
+ otpInput.placeholder = '······';
18589
+ otpStep.appendChild(otpInput);
18590
+ const otpButton = document.createElement('button');
18591
+ otpButton.id = 'ba-otp-btn';
18592
+ otpButton.className = 'ba-btn';
18593
+ otpButton.type = 'button';
18594
+ otpButton.textContent = 'Verify & continue';
18595
+ otpStep.appendChild(otpButton);
18596
+ const backButton = document.createElement('button');
18597
+ backButton.id = 'ba-back';
18598
+ backButton.className = 'ba-link';
18599
+ backButton.type = 'button';
18600
+ backButton.textContent = 'Use a different email';
18601
+ otpStep.appendChild(backButton);
18602
+ const msg = document.createElement('div');
18603
+ msg.id = 'ba-msg';
18604
+ msg.className = 'ba-msg';
18605
+ card.appendChild(msg);
18606
+ const foot = document.createElement('div');
18607
+ foot.className = 'ba-foot';
18608
+ foot.textContent = 'Secured by Bounded';
18609
+ card.appendChild(foot);
18610
+ return root;
18611
+ }
18671
18612
  const MODAL_CSS = `
18672
18613
  #bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(8,10,18,.62);backdrop-filter:blur(4px);
18673
18614
  display:flex;align-items:center;justify-content:center;z-index:2147483000;opacity:1;transition:opacity .16s ease;
@@ -19055,17 +18996,17 @@ function clearIncompatibleSession() {
19055
18996
  // Lazy loaders for web-only providers.
19056
18997
  // Using dynamic import() ensures Metro (RN) never resolves these modules.
19057
18998
  async function loadPhantomWalletProvider() {
19058
- const mod = await import('./phantom-wallet-provider-D_AzfLq0.mjs');
18999
+ const mod = await import('./phantom-wallet-provider-DU4WPFPM.mjs');
19059
19000
  return { PhantomWalletProvider: mod.PhantomWalletProvider };
19060
19001
  }
19061
19002
  // Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
19062
19003
  // never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
19063
19004
  async function loadPrivyWalletProvider() {
19064
- const mod = await import('./privy-wallet-provider-AC4xL6bN.mjs');
19005
+ const mod = await import('./privy-wallet-provider-D5Kdp3Qp.mjs');
19065
19006
  return mod.PrivyWalletProvider;
19066
19007
  }
19067
19008
  async function loadSolanaMobileWalletProvider() {
19068
- const mod = await import('./solana-mobile-wallet-provider-X6BM07gm.mjs');
19009
+ const mod = await import('./solana-mobile-wallet-provider-CLiflgPj.mjs');
19069
19010
  return mod.SolanaMobileWalletProvider;
19070
19011
  }
19071
19012
  async function hotSwapToMWAProvider(config) {
@@ -20068,4 +20009,4 @@ class PrivyExpoProvider {
20068
20009
  }
20069
20010
 
20070
20011
  export { signTransaction as $, sendEmailOtp as A, sendTextOtp as B, verifyEmailOtp as C, verifyTextOtp as D, linkEmail as E, loginWithPrivy as F, loginWithRedirect as G, linkWithRedirect as H, completeLoginFromRedirect as I, loginWithPopup as J, completeLoginInPopup as K, get as L, getMany as M, docId as N, set as O, setMany as P, setFile as Q, getFiles as R, SOLANA_DEVNET_RPC_URL as S, search as T, queryAggregate as U, runQuery as V, WebSessionManager as W, runQueryMany as X, runExpression as Y, runExpressionMany as Z, signMessage as _, buildSetDocumentsTransaction as a, signAndSubmitTransaction as a0, count as a1, aggregate as a2, subscribe as a3, useAuth as a4, deserializeTransaction as a5, getIdToken as a6, setPlatform as a7, MockAuthProvider as a8, DEFAULT_TEST_ADDRESS as a9, refreshSession as aA, resetRealtimeStore as aB, revokeSession as aC, serverTimestamp as aD, signSessionCreateMessage as aE, subscribeView as aF, toMillis as aG, toSeconds as aH, withEffects as aI, wsDelete as aJ, wsGet as aK, wsGetMany as aL, wsQuery as aM, wsSet as aN, index as aO, OffchainAuthProvider as aa, PrivyExpoProvider as ab, EFFECT_INTENT_ADDRESS as ac, FunctionInvokeError as ad, InsufficientBalanceError as ae, LiveIntentError as af, ReactNativeSessionManager as ag, RealtimeStore as ah, ServerSessionManager as ai, clearCache as aj, closeAllSubscriptions as ak, defineLiveModule as al, deriveUserIdentityFromIdToken as am, functions as an, getCachedData as ao, getRealtimeStore as ap, getWebhookKeysUrl as aq, hasActiveConnection as ar, increment as as, invoke as at, isEffectResult as au, live as av, intent as aw, status as ax, now as ay, reconnectWithNewAuth as az, bufferExports as b, convertRemainingAccounts as c, confirmAndCheckTransaction as d, SOLANA_MAINNET_RPC_URL as e, SURFNET_RPC_URL$1 as f, detectMobile as g, detectAndroid as h, getPlatform as i, setAuthLoading as j, genAuthNonce as k, genSolanaMessage as l, createSessionWithSignature as m, getActiveSessionManager as n, bs58 as o, init as p, getCurrentUser as q, onAuthStateChanged as r, setCurrentUser as s, onAuthLoadingChanged as t, getAuthLoading as u, login as v, logout as w, getConfig as x, getAuthProvider as y, signInAnonymously as z };
20071
- //# sourceMappingURL=index.native-BYEVhmbt.mjs.map
20012
+ //# sourceMappingURL=index.native-CAygEkU7.mjs.map