@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.
- package/dist/auth/providers/offchain-auth-provider.d.ts +7 -13
- package/dist/index.js +226 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -285
- package/dist/index.mjs.map +1 -1
- package/dist/{index.native-BYEVhmbt.mjs → index.native-CAygEkU7.mjs} +229 -288
- package/dist/index.native-CAygEkU7.mjs.map +1 -0
- package/dist/{index.native-CcBTbnBg.js → index.native-zD2ZzCLO.js} +229 -288
- package/dist/index.native-zD2ZzCLO.js.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{phantom-wallet-provider-D_AzfLq0.mjs → phantom-wallet-provider-DU4WPFPM.mjs} +2 -2
- package/dist/{phantom-wallet-provider-D_AzfLq0.mjs.map → phantom-wallet-provider-DU4WPFPM.mjs.map} +1 -1
- package/dist/{phantom-wallet-provider-Cn6MzUUo.js → phantom-wallet-provider-MW2H0SFY.js} +2 -2
- package/dist/{phantom-wallet-provider-Cn6MzUUo.js.map → phantom-wallet-provider-MW2H0SFY.js.map} +1 -1
- package/dist/{privy-wallet-provider-AC4xL6bN.mjs → privy-wallet-provider-D5Kdp3Qp.mjs} +3 -3
- package/dist/{privy-wallet-provider-AC4xL6bN.mjs.map → privy-wallet-provider-D5Kdp3Qp.mjs.map} +1 -1
- package/dist/{privy-wallet-provider-DtWAtbUl.js → privy-wallet-provider-dFxuvDf4.js} +3 -3
- package/dist/{privy-wallet-provider-DtWAtbUl.js.map → privy-wallet-provider-dFxuvDf4.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-X6BM07gm.mjs → solana-mobile-wallet-provider-CLiflgPj.mjs} +3 -3
- package/dist/solana-mobile-wallet-provider-CLiflgPj.mjs.map +1 -0
- package/dist/{solana-mobile-wallet-provider-Cos9gu7k.js → solana-mobile-wallet-provider-DAR0BLTQ.js} +3 -3
- package/dist/solana-mobile-wallet-provider-DAR0BLTQ.js.map +1 -0
- package/package.json +2 -2
- package/dist/index.native-BYEVhmbt.mjs.map +0 -1
- package/dist/index.native-CcBTbnBg.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-Cos9gu7k.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-X6BM07gm.mjs.map +0 -1
|
@@ -10174,24 +10174,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
10174
10174
|
/* ------------------------------------------------------------------ */
|
|
10175
10175
|
/* ENV helpers */
|
|
10176
10176
|
/* ------------------------------------------------------------------ */
|
|
10177
|
-
// Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI)
|
|
10178
|
-
//
|
|
10179
|
-
|
|
10180
|
-
const
|
|
10177
|
+
// Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI). Only consulted when no
|
|
10178
|
+
// explicit keypair was provided (createWalletClient passes one).
|
|
10179
|
+
const ENV_KEYPAIR = "BOUNDED_PRIVATE_KEY";
|
|
10180
|
+
const LEGACY_ENV_KEYPAIR = "BOUNDED_SOLANA_KEYPAIR";
|
|
10181
10181
|
function loadKeypairFromEnv() {
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
const v = process.env[name];
|
|
10186
|
-
if (v) {
|
|
10187
|
-
secret = v;
|
|
10188
|
-
found = name;
|
|
10189
|
-
break;
|
|
10190
|
-
}
|
|
10182
|
+
if (process.env[LEGACY_ENV_KEYPAIR]) {
|
|
10183
|
+
throw new Error(`${LEGACY_ENV_KEYPAIR} is no longer supported. Set ${ENV_KEYPAIR} instead, ` +
|
|
10184
|
+
`or pass an explicit keypair via createWalletClient({ keypair }).`);
|
|
10191
10185
|
}
|
|
10186
|
+
const secret = process.env[ENV_KEYPAIR];
|
|
10192
10187
|
if (!secret) {
|
|
10193
10188
|
throw new Error(`No server keypair for this top-level call. The top-level get/set/subscribe/etc. use an ` +
|
|
10194
|
-
`AMBIENT session — set ${
|
|
10189
|
+
`AMBIENT session — set ${ENV_KEYPAIR} to a base-58 secret key (or JSON array) to provide one. ` +
|
|
10195
10190
|
`If you already created a wallet with createWalletClient({ keypair }), call ITS methods instead ` +
|
|
10196
10191
|
`(client.subscribe / client.set / client.get): that client is self-contained and deliberately does ` +
|
|
10197
10192
|
`not set the ambient session, so the top-level functions can't see it.`);
|
|
@@ -10203,7 +10198,7 @@ function loadKeypairFromEnv() {
|
|
|
10203
10198
|
return web3_js.Keypair.fromSecretKey(secretKey);
|
|
10204
10199
|
}
|
|
10205
10200
|
catch (err) {
|
|
10206
|
-
throw new Error(`Unable to parse ${
|
|
10201
|
+
throw new Error(`Unable to parse ${ENV_KEYPAIR}. Ensure it is valid base-58 or JSON.`);
|
|
10207
10202
|
}
|
|
10208
10203
|
}
|
|
10209
10204
|
/* ------------------------------------------------------------------ */
|
|
@@ -10270,7 +10265,7 @@ class ServerSessionManager {
|
|
|
10270
10265
|
this.session = session;
|
|
10271
10266
|
}
|
|
10272
10267
|
/* ---------------------------------------------- *
|
|
10273
|
-
* CLEAR (e.g. after logout
|
|
10268
|
+
* CLEAR (e.g. after explicit logout)
|
|
10274
10269
|
* ---------------------------------------------- */
|
|
10275
10270
|
clearSession() {
|
|
10276
10271
|
this.session = null;
|
|
@@ -10294,11 +10289,6 @@ class ServerSessionManager {
|
|
|
10294
10289
|
/* The default singleton instance (reads keypair from env) */
|
|
10295
10290
|
ServerSessionManager.instance = new ServerSessionManager();
|
|
10296
10291
|
|
|
10297
|
-
var serverSessionManager = /*#__PURE__*/Object.freeze({
|
|
10298
|
-
__proto__: null,
|
|
10299
|
-
ServerSessionManager: ServerSessionManager
|
|
10300
|
-
});
|
|
10301
|
-
|
|
10302
10292
|
/**
|
|
10303
10293
|
* Safe base64 helpers for bounded-core.
|
|
10304
10294
|
*
|
|
@@ -10523,13 +10513,6 @@ async function refreshAuthSessionOnce(appId, isServer) {
|
|
|
10523
10513
|
async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
10524
10514
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10525
10515
|
const config = await getConfig();
|
|
10526
|
-
let hasRetriedAfterServerSessionReset = false;
|
|
10527
|
-
const clearServerSession = async () => {
|
|
10528
|
-
if (!config.isServer)
|
|
10529
|
-
return;
|
|
10530
|
-
const { ServerSessionManager } = await Promise.resolve().then(function () { return serverSessionManager; });
|
|
10531
|
-
ServerSessionManager.instance.clearSession();
|
|
10532
|
-
};
|
|
10533
10516
|
async function executeRequest() {
|
|
10534
10517
|
var _a;
|
|
10535
10518
|
// When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
|
|
@@ -10579,13 +10562,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
10579
10562
|
}
|
|
10580
10563
|
return await executeRequest();
|
|
10581
10564
|
}
|
|
10582
|
-
catch (
|
|
10583
|
-
// Server-side fallback: clear global session and retry once
|
|
10584
|
-
if (config.isServer && !hasRetriedAfterServerSessionReset) {
|
|
10585
|
-
hasRetriedAfterServerSessionReset = true;
|
|
10586
|
-
await clearServerSession();
|
|
10587
|
-
return await executeRequest();
|
|
10588
|
-
}
|
|
10565
|
+
catch (_j) {
|
|
10589
10566
|
throw error;
|
|
10590
10567
|
}
|
|
10591
10568
|
}
|
|
@@ -11145,39 +11122,8 @@ async function get(path, opts = {}) {
|
|
|
11145
11122
|
}
|
|
11146
11123
|
// Create a new request promise and store it
|
|
11147
11124
|
const requestPromise = (async () => {
|
|
11148
|
-
var _a;
|
|
11149
11125
|
try {
|
|
11150
|
-
// For realtime chains, prefer WebSocket reads (lower latency, already connected)
|
|
11151
|
-
const config = await getConfig();
|
|
11152
11126
|
const pathIsDocument = normalizedPath.split("/").length % 2 === 0;
|
|
11153
|
-
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) {
|
|
11154
|
-
try {
|
|
11155
|
-
const { wsGet, wsQuery, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
|
|
11156
|
-
if (hasActiveConnection()) {
|
|
11157
|
-
if (pathIsDocument) {
|
|
11158
|
-
const wsResult = await wsGet(normalizedPath);
|
|
11159
|
-
const responseData = normalizeReadResult(wsResult, true);
|
|
11160
|
-
if (!opts.bypassCache) {
|
|
11161
|
-
getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
|
|
11162
|
-
}
|
|
11163
|
-
return responseData;
|
|
11164
|
-
}
|
|
11165
|
-
else if (!opts.limit) {
|
|
11166
|
-
const wsResult = await wsQuery(normalizedPath, {
|
|
11167
|
-
filter: undefined,
|
|
11168
|
-
sort: undefined,
|
|
11169
|
-
includeSubPaths: opts.includeSubPaths,
|
|
11170
|
-
});
|
|
11171
|
-
const responseData = normalizeReadResult(wsResult, false);
|
|
11172
|
-
if (!opts.bypassCache) {
|
|
11173
|
-
getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
|
|
11174
|
-
}
|
|
11175
|
-
return responseData;
|
|
11176
|
-
}
|
|
11177
|
-
}
|
|
11178
|
-
}
|
|
11179
|
-
catch ( /* fall through to HTTP */_b) { /* fall through to HTTP */ }
|
|
11180
|
-
}
|
|
11181
11127
|
// Cache miss or bypass - proceed with HTTP API request
|
|
11182
11128
|
let response;
|
|
11183
11129
|
// Build common query params
|
|
@@ -11430,7 +11376,7 @@ async function set(path, document, options) {
|
|
|
11430
11376
|
return result;
|
|
11431
11377
|
}
|
|
11432
11378
|
async function setMany(many, options) {
|
|
11433
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
11379
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11434
11380
|
// Returns the data that was set, or undefined if the document was already set.
|
|
11435
11381
|
try {
|
|
11436
11382
|
const config = await getConfig();
|
|
@@ -11467,40 +11413,13 @@ async function setMany(many, options) {
|
|
|
11467
11413
|
}
|
|
11468
11414
|
let setResponse;
|
|
11469
11415
|
try {
|
|
11470
|
-
|
|
11471
|
-
const useWs = ((_c = config.chain) === null || _c === void 0 ? void 0 : _c.startsWith('realtime_')) && !config.isServer;
|
|
11472
|
-
if (useWs) {
|
|
11473
|
-
try {
|
|
11474
|
-
const { wsSet, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
|
|
11475
|
-
if (hasActiveConnection()) {
|
|
11476
|
-
// Connection is active — send via WS. If this throws, the write
|
|
11477
|
-
// may have been applied server-side (ack lost). Do NOT fall through
|
|
11478
|
-
// to HTTP, as that would double-apply non-idempotent ops (Increment).
|
|
11479
|
-
const wsResult = await wsSet(documents);
|
|
11480
|
-
setResponse = { data: wsResult, status: 200 };
|
|
11481
|
-
}
|
|
11482
|
-
}
|
|
11483
|
-
catch (wsError) {
|
|
11484
|
-
// Only fall through to HTTP if the request was never sent (connection not available).
|
|
11485
|
-
// If the request was sent and ack was lost (timeout), the server may have
|
|
11486
|
-
// applied it — re-sending via HTTP risks double-write for non-idempotent ops.
|
|
11487
|
-
const msg = (_d = wsError === null || wsError === void 0 ? void 0 : wsError.message) !== null && _d !== void 0 ? _d : '';
|
|
11488
|
-
const neverSent = msg.includes('not available') || msg.includes('connection timeout');
|
|
11489
|
-
if (!neverSent) {
|
|
11490
|
-
throw wsError;
|
|
11491
|
-
}
|
|
11492
|
-
// Safe to retry via HTTP — request was never sent
|
|
11493
|
-
}
|
|
11494
|
-
}
|
|
11495
|
-
if (!setResponse) {
|
|
11496
|
-
setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
|
|
11497
|
-
}
|
|
11416
|
+
setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
|
|
11498
11417
|
}
|
|
11499
11418
|
catch (error) {
|
|
11500
11419
|
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 402 && (error === null || error === void 0 ? void 0 : error.error) === 'INSUFFICIENT_BALANCE') {
|
|
11501
|
-
const deficitLamports = Number((
|
|
11502
|
-
const deficitSol = Number((
|
|
11503
|
-
throw new InsufficientBalanceError(String((
|
|
11420
|
+
const deficitLamports = Number((_c = error.deficitLamports) !== null && _c !== void 0 ? _c : 0);
|
|
11421
|
+
const deficitSol = Number((_d = error.deficitSol) !== null && _d !== void 0 ? _d : deficitLamports / 1000000000);
|
|
11422
|
+
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);
|
|
11504
11423
|
}
|
|
11505
11424
|
throw error;
|
|
11506
11425
|
}
|
|
@@ -11547,7 +11466,7 @@ async function setMany(many, options) {
|
|
|
11547
11466
|
else if (setResponse.data &&
|
|
11548
11467
|
typeof setResponse.data === 'object' &&
|
|
11549
11468
|
setResponse.data.success === true) {
|
|
11550
|
-
const
|
|
11469
|
+
const _h = setResponse.data, { success: _success } = _h, rest = __rest$1(_h, ["success"]);
|
|
11551
11470
|
return Object.assign(Object.assign(Object.assign({}, documents.map(d => d.document)), rest), { transactionId: null });
|
|
11552
11471
|
}
|
|
11553
11472
|
else {
|
|
@@ -13075,23 +12994,6 @@ async function wsGetMany(paths) {
|
|
|
13075
12994
|
}));
|
|
13076
12995
|
}
|
|
13077
12996
|
|
|
13078
|
-
var subscriptionV2 = /*#__PURE__*/Object.freeze({
|
|
13079
|
-
__proto__: null,
|
|
13080
|
-
clearCacheV2: clearCacheV2,
|
|
13081
|
-
closeAllSubscriptionsV2: closeAllSubscriptionsV2,
|
|
13082
|
-
getCachedDataV2: getCachedDataV2,
|
|
13083
|
-
hasActiveConnection: hasActiveConnection,
|
|
13084
|
-
reconnectWithNewAuthV2: reconnectWithNewAuthV2,
|
|
13085
|
-
subscribeV2: subscribeV2,
|
|
13086
|
-
wsDelete: wsDelete,
|
|
13087
|
-
wsGet: wsGet,
|
|
13088
|
-
wsGetMany: wsGetMany,
|
|
13089
|
-
wsIntent: wsIntent,
|
|
13090
|
-
wsIntentReliable: wsIntentReliable,
|
|
13091
|
-
wsQuery: wsQuery,
|
|
13092
|
-
wsSet: wsSet
|
|
13093
|
-
});
|
|
13094
|
-
|
|
13095
12997
|
/**
|
|
13096
12998
|
* WebSocket Subscription Module
|
|
13097
12999
|
*
|
|
@@ -14902,7 +14804,7 @@ class OffchainAuthProvider {
|
|
|
14902
14804
|
// Create modal container
|
|
14903
14805
|
this.modalContainer = document.createElement("div");
|
|
14904
14806
|
this.modalContainer.id = "poofnet-unsupported-modal";
|
|
14905
|
-
this.modalContainer.
|
|
14807
|
+
this.modalContainer.appendChild(this.buildUnsupportedModalContent());
|
|
14906
14808
|
document.body.appendChild(this.modalContainer);
|
|
14907
14809
|
// Add styles
|
|
14908
14810
|
const style = document.createElement("style");
|
|
@@ -14958,38 +14860,6 @@ class OffchainAuthProvider {
|
|
|
14958
14860
|
document.addEventListener("keydown", escHandler);
|
|
14959
14861
|
});
|
|
14960
14862
|
}
|
|
14961
|
-
getUnsupportedModalHTML() {
|
|
14962
|
-
return `
|
|
14963
|
-
<div class="poofnet-modal-overlay">
|
|
14964
|
-
<div class="poofnet-modal-content">
|
|
14965
|
-
<button id="poofnet-close-btn" class="poofnet-close-btn" aria-label="Close">
|
|
14966
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
14967
|
-
<path d="M1 1L13 13M1 13L13 1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
14968
|
-
</svg>
|
|
14969
|
-
</button>
|
|
14970
|
-
<div class="poofnet-modal-header">
|
|
14971
|
-
<div class="poofnet-modal-icon">⚠️</div>
|
|
14972
|
-
<h2 class="poofnet-modal-title">Transaction Not Supported</h2>
|
|
14973
|
-
<p class="poofnet-modal-subtitle">Poofnet Simulated Blockchain</p>
|
|
14974
|
-
</div>
|
|
14975
|
-
|
|
14976
|
-
<div class="poofnet-modal-body">
|
|
14977
|
-
<div class="poofnet-info-box" style="background: #fef3c7;">
|
|
14978
|
-
<span class="poofnet-info-icon">ℹ️</span>
|
|
14979
|
-
<span class="poofnet-info-text" style="color: #92400e;">
|
|
14980
|
-
Poofnet is a simulated blockchain and does not support real Solana transactions.
|
|
14981
|
-
Deploy your project to mainnet to test real transactions.
|
|
14982
|
-
</span>
|
|
14983
|
-
</div>
|
|
14984
|
-
</div>
|
|
14985
|
-
|
|
14986
|
-
<div class="poofnet-modal-footer">
|
|
14987
|
-
<button id="poofnet-cancel-btn" class="poofnet-btn poofnet-btn-cancel" style="flex: 1;">Close</button>
|
|
14988
|
-
</div>
|
|
14989
|
-
</div>
|
|
14990
|
-
</div>
|
|
14991
|
-
`;
|
|
14992
|
-
}
|
|
14993
14863
|
async showTransactionModal(message) {
|
|
14994
14864
|
return new Promise((resolve) => {
|
|
14995
14865
|
// Parse the transaction message for display
|
|
@@ -15003,7 +14873,7 @@ class OffchainAuthProvider {
|
|
|
15003
14873
|
// Create modal container
|
|
15004
14874
|
this.modalContainer = document.createElement("div");
|
|
15005
14875
|
this.modalContainer.id = "poofnet-tx-modal";
|
|
15006
|
-
this.modalContainer.
|
|
14876
|
+
this.modalContainer.appendChild(this.buildTransactionModalContent(parsed, message));
|
|
15007
14877
|
document.body.appendChild(this.modalContainer);
|
|
15008
14878
|
// Add styles
|
|
15009
14879
|
const style = document.createElement("style");
|
|
@@ -15086,24 +14956,59 @@ class OffchainAuthProvider {
|
|
|
15086
14956
|
}, 200);
|
|
15087
14957
|
}
|
|
15088
14958
|
}
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
14959
|
+
createElement(tag, className, text) {
|
|
14960
|
+
const el = document.createElement(tag);
|
|
14961
|
+
if (className)
|
|
14962
|
+
el.className = className;
|
|
14963
|
+
if (text !== undefined)
|
|
14964
|
+
el.textContent = text;
|
|
14965
|
+
return el;
|
|
14966
|
+
}
|
|
14967
|
+
appendTextElement(parent, tag, className, text) {
|
|
14968
|
+
const el = this.createElement(tag, className, text);
|
|
14969
|
+
parent.appendChild(el);
|
|
14970
|
+
return el;
|
|
14971
|
+
}
|
|
14972
|
+
buildModalShell(icon, title) {
|
|
14973
|
+
const overlay = this.createElement("div", "poofnet-modal-overlay");
|
|
14974
|
+
const content = this.createElement("div", "poofnet-modal-content");
|
|
14975
|
+
overlay.appendChild(content);
|
|
14976
|
+
const close = this.createElement("button", "poofnet-close-btn", "×");
|
|
14977
|
+
close.id = "poofnet-close-btn";
|
|
14978
|
+
close.setAttribute("aria-label", "Close");
|
|
14979
|
+
close.type = "button";
|
|
14980
|
+
content.appendChild(close);
|
|
14981
|
+
const header = this.createElement("div", "poofnet-modal-header");
|
|
14982
|
+
this.appendTextElement(header, "div", "poofnet-modal-icon", icon);
|
|
14983
|
+
this.appendTextElement(header, "h2", "poofnet-modal-title", title);
|
|
14984
|
+
this.appendTextElement(header, "p", "poofnet-modal-subtitle", "Poofnet Simulated Blockchain");
|
|
14985
|
+
content.appendChild(header);
|
|
14986
|
+
const body = this.createElement("div", "poofnet-modal-body");
|
|
14987
|
+
content.appendChild(body);
|
|
14988
|
+
const footer = this.createElement("div", "poofnet-modal-footer");
|
|
14989
|
+
content.appendChild(footer);
|
|
14990
|
+
return { overlay, body, footer };
|
|
14991
|
+
}
|
|
14992
|
+
buildInfoBox(text, warning = false) {
|
|
14993
|
+
const info = this.createElement("div", "poofnet-info-box");
|
|
14994
|
+
if (warning)
|
|
14995
|
+
info.style.background = "#fef3c7";
|
|
14996
|
+
this.appendTextElement(info, "span", "poofnet-info-icon", "ℹ️");
|
|
14997
|
+
const infoText = this.createElement("span", "poofnet-info-text", text);
|
|
14998
|
+
if (warning)
|
|
14999
|
+
infoText.style.color = "#92400e";
|
|
15000
|
+
info.appendChild(infoText);
|
|
15001
|
+
return info;
|
|
15002
|
+
}
|
|
15003
|
+
buildUnsupportedModalContent() {
|
|
15004
|
+
const { overlay, body, footer } = this.buildModalShell("⚠️", "Transaction Not Supported");
|
|
15005
|
+
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));
|
|
15006
|
+
const close = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Close");
|
|
15007
|
+
close.id = "poofnet-cancel-btn";
|
|
15008
|
+
close.type = "button";
|
|
15009
|
+
close.style.flex = "1";
|
|
15010
|
+
footer.appendChild(close);
|
|
15011
|
+
return overlay;
|
|
15107
15012
|
}
|
|
15108
15013
|
formatPath(path) {
|
|
15109
15014
|
const parts = path.split("/").filter(Boolean);
|
|
@@ -15136,59 +15041,11 @@ class OffchainAuthProvider {
|
|
|
15136
15041
|
return `Delete from ${collection}`;
|
|
15137
15042
|
return isNew ? `Create in ${collection}` : `Update ${collection}`;
|
|
15138
15043
|
}
|
|
15139
|
-
|
|
15044
|
+
buildTransactionModalContent(parsed, rawMessage) {
|
|
15140
15045
|
const instructions = parsed.instructions || [];
|
|
15141
15046
|
// Group instructions by type for summary
|
|
15142
15047
|
const sets = instructions.filter((i) => i.type === "set");
|
|
15143
15048
|
const deletes = instructions.filter((i) => i.type === "delete");
|
|
15144
|
-
const instructionsList = instructions
|
|
15145
|
-
.map((inst) => {
|
|
15146
|
-
const { collection, documentId } = this.formatPath(inst.path);
|
|
15147
|
-
const isDelete = inst.type === "delete";
|
|
15148
|
-
const icon = isDelete ? "🗑️" : "✏️";
|
|
15149
|
-
const actionClass = isDelete
|
|
15150
|
-
? "poofnet-action-delete"
|
|
15151
|
-
: "poofnet-action-set";
|
|
15152
|
-
// Format data fields for display
|
|
15153
|
-
let fieldsHtml = "";
|
|
15154
|
-
if (inst.data && !isDelete) {
|
|
15155
|
-
const fields = Object.entries(inst.data)
|
|
15156
|
-
.filter(([key]) => !key.startsWith("_")) // Hide internal fields
|
|
15157
|
-
.slice(0, 4);
|
|
15158
|
-
if (fields.length > 0) {
|
|
15159
|
-
fieldsHtml = `
|
|
15160
|
-
<div class="poofnet-fields">
|
|
15161
|
-
${fields
|
|
15162
|
-
.map(([key, value]) => `
|
|
15163
|
-
<div class="poofnet-field">
|
|
15164
|
-
<span class="poofnet-field-key">${this.escapeHtml(key)}:</span>
|
|
15165
|
-
<span class="poofnet-field-value">${this.escapeHtml(this.formatFieldValue(value))}</span>
|
|
15166
|
-
</div>
|
|
15167
|
-
`)
|
|
15168
|
-
.join("")}
|
|
15169
|
-
${Object.keys(inst.data).filter((k) => !k.startsWith("_"))
|
|
15170
|
-
.length > 4
|
|
15171
|
-
? `<div class="poofnet-field-more">+${Object.keys(inst.data).filter((k) => !k.startsWith("_")).length - 4} more fields</div>`
|
|
15172
|
-
: ""}
|
|
15173
|
-
</div>
|
|
15174
|
-
`;
|
|
15175
|
-
}
|
|
15176
|
-
}
|
|
15177
|
-
return `
|
|
15178
|
-
<div class="poofnet-instruction ${actionClass}">
|
|
15179
|
-
<div class="poofnet-instruction-header">
|
|
15180
|
-
<span class="poofnet-instruction-icon">${icon}</span>
|
|
15181
|
-
<span class="poofnet-instruction-action">${isDelete ? "Delete" : "Save"}</span>
|
|
15182
|
-
<span class="poofnet-instruction-collection">${this.escapeHtml(collection)}</span>
|
|
15183
|
-
</div>
|
|
15184
|
-
${documentId
|
|
15185
|
-
? `<div class="poofnet-instruction-id">ID: ${this.escapeHtml(documentId)}</div>`
|
|
15186
|
-
: ""}
|
|
15187
|
-
${fieldsHtml}
|
|
15188
|
-
</div>
|
|
15189
|
-
`;
|
|
15190
|
-
})
|
|
15191
|
-
.join("");
|
|
15192
15049
|
// Create summary text
|
|
15193
15050
|
let summaryText = "";
|
|
15194
15051
|
if (sets.length > 0 && deletes.length > 0) {
|
|
@@ -15200,50 +15057,65 @@ class OffchainAuthProvider {
|
|
|
15200
15057
|
else if (deletes.length > 0) {
|
|
15201
15058
|
summaryText = `${deletes.length} delete${deletes.length > 1 ? "s" : ""}`;
|
|
15202
15059
|
}
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15060
|
+
const { overlay, body, footer } = this.buildModalShell("🔐", "Confirm Transaction");
|
|
15061
|
+
if (instructions.length > 0) {
|
|
15062
|
+
if (summaryText) {
|
|
15063
|
+
this.appendTextElement(body, "div", "poofnet-summary", summaryText);
|
|
15064
|
+
}
|
|
15065
|
+
const list = this.createElement("div", "poofnet-instructions-list");
|
|
15066
|
+
for (const inst of instructions) {
|
|
15067
|
+
list.appendChild(this.buildInstructionElement(inst));
|
|
15068
|
+
}
|
|
15069
|
+
body.appendChild(list);
|
|
15070
|
+
}
|
|
15071
|
+
else {
|
|
15072
|
+
const section = this.createElement("div", "poofnet-section");
|
|
15073
|
+
this.appendTextElement(section, "h3", "poofnet-section-title", "Message");
|
|
15074
|
+
const raw = this.createElement("pre", "poofnet-raw-message", rawMessage.slice(0, 200) + (rawMessage.length > 200 ? "..." : ""));
|
|
15075
|
+
section.appendChild(raw);
|
|
15076
|
+
body.appendChild(section);
|
|
15077
|
+
}
|
|
15078
|
+
body.appendChild(this.buildInfoBox("This is a simulated transaction. No real fees will be charged."));
|
|
15079
|
+
const cancel = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Cancel");
|
|
15080
|
+
cancel.id = "poofnet-cancel-btn";
|
|
15081
|
+
cancel.type = "button";
|
|
15082
|
+
footer.appendChild(cancel);
|
|
15083
|
+
const confirm = this.createElement("button", "poofnet-btn poofnet-btn-confirm", "Confirm");
|
|
15084
|
+
confirm.id = "poofnet-confirm-btn";
|
|
15085
|
+
confirm.type = "button";
|
|
15086
|
+
footer.appendChild(confirm);
|
|
15087
|
+
return overlay;
|
|
15088
|
+
}
|
|
15089
|
+
buildInstructionElement(inst) {
|
|
15090
|
+
const { collection, documentId } = this.formatPath(inst.path);
|
|
15091
|
+
const isDelete = inst.type === "delete";
|
|
15092
|
+
const card = this.createElement("div", `poofnet-instruction ${isDelete ? "poofnet-action-delete" : "poofnet-action-set"}`);
|
|
15093
|
+
const header = this.createElement("div", "poofnet-instruction-header");
|
|
15094
|
+
this.appendTextElement(header, "span", "poofnet-instruction-icon", isDelete ? "🗑️" : "✏️");
|
|
15095
|
+
this.appendTextElement(header, "span", "poofnet-instruction-action", isDelete ? "Delete" : "Save");
|
|
15096
|
+
this.appendTextElement(header, "span", "poofnet-instruction-collection", collection);
|
|
15097
|
+
card.appendChild(header);
|
|
15098
|
+
if (documentId) {
|
|
15099
|
+
this.appendTextElement(card, "div", "poofnet-instruction-id", `ID: ${documentId}`);
|
|
15100
|
+
}
|
|
15101
|
+
if (inst.data && !isDelete) {
|
|
15102
|
+
const fieldKeys = Object.keys(inst.data).filter((key) => !key.startsWith("_"));
|
|
15103
|
+
const visibleFields = fieldKeys.slice(0, 4);
|
|
15104
|
+
if (visibleFields.length > 0) {
|
|
15105
|
+
const fields = this.createElement("div", "poofnet-fields");
|
|
15106
|
+
for (const key of visibleFields) {
|
|
15107
|
+
const row = this.createElement("div", "poofnet-field");
|
|
15108
|
+
this.appendTextElement(row, "span", "poofnet-field-key", `${key}:`);
|
|
15109
|
+
this.appendTextElement(row, "span", "poofnet-field-value", this.formatFieldValue(inst.data[key]));
|
|
15110
|
+
fields.appendChild(row);
|
|
15111
|
+
}
|
|
15112
|
+
if (fieldKeys.length > 4) {
|
|
15113
|
+
this.appendTextElement(fields, "div", "poofnet-field-more", `+${fieldKeys.length - 4} more fields`);
|
|
15114
|
+
}
|
|
15115
|
+
card.appendChild(fields);
|
|
15116
|
+
}
|
|
15117
|
+
}
|
|
15118
|
+
return card;
|
|
15247
15119
|
}
|
|
15248
15120
|
getModalStyles() {
|
|
15249
15121
|
return `
|
|
@@ -18579,9 +18451,7 @@ const emailProviderSingleton = new EmailAuthProvider();
|
|
|
18579
18451
|
function openEmailModal() {
|
|
18580
18452
|
return new Promise((resolve) => {
|
|
18581
18453
|
var _a;
|
|
18582
|
-
const root =
|
|
18583
|
-
root.id = 'bounded-auth-modal';
|
|
18584
|
-
root.innerHTML = MODAL_HTML;
|
|
18454
|
+
const root = createEmailModalTree();
|
|
18585
18455
|
const style = document.createElement('style');
|
|
18586
18456
|
style.textContent = MODAL_CSS;
|
|
18587
18457
|
root.appendChild(style);
|
|
@@ -18669,26 +18539,97 @@ function openEmailModal() {
|
|
|
18669
18539
|
});
|
|
18670
18540
|
});
|
|
18671
18541
|
}
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18542
|
+
function createEmailModalTree() {
|
|
18543
|
+
const root = document.createElement('div');
|
|
18544
|
+
root.id = 'bounded-auth-modal';
|
|
18545
|
+
const overlay = document.createElement('div');
|
|
18546
|
+
overlay.className = 'ba-overlay';
|
|
18547
|
+
root.appendChild(overlay);
|
|
18548
|
+
const card = document.createElement('div');
|
|
18549
|
+
card.className = 'ba-card';
|
|
18550
|
+
card.setAttribute('role', 'dialog');
|
|
18551
|
+
card.setAttribute('aria-modal', 'true');
|
|
18552
|
+
card.setAttribute('aria-label', 'Sign in');
|
|
18553
|
+
overlay.appendChild(card);
|
|
18554
|
+
const close = document.createElement('button');
|
|
18555
|
+
close.id = 'ba-close';
|
|
18556
|
+
close.className = 'ba-x';
|
|
18557
|
+
close.setAttribute('aria-label', 'Close');
|
|
18558
|
+
close.type = 'button';
|
|
18559
|
+
close.textContent = '×';
|
|
18560
|
+
card.appendChild(close);
|
|
18561
|
+
const brand = document.createElement('div');
|
|
18562
|
+
brand.className = 'ba-brand';
|
|
18563
|
+
const dot = document.createElement('span');
|
|
18564
|
+
dot.className = 'ba-dot';
|
|
18565
|
+
brand.appendChild(dot);
|
|
18566
|
+
brand.appendChild(document.createTextNode(' Sign in'));
|
|
18567
|
+
card.appendChild(brand);
|
|
18568
|
+
const emailStep = document.createElement('div');
|
|
18569
|
+
emailStep.id = 'ba-email-step';
|
|
18570
|
+
card.appendChild(emailStep);
|
|
18571
|
+
const emailLabel = document.createElement('label');
|
|
18572
|
+
emailLabel.className = 'ba-label';
|
|
18573
|
+
emailLabel.htmlFor = 'ba-email';
|
|
18574
|
+
emailLabel.textContent = 'Email';
|
|
18575
|
+
emailStep.appendChild(emailLabel);
|
|
18576
|
+
const emailInput = document.createElement('input');
|
|
18577
|
+
emailInput.id = 'ba-email';
|
|
18578
|
+
emailInput.className = 'ba-input';
|
|
18579
|
+
emailInput.type = 'email';
|
|
18580
|
+
emailInput.inputMode = 'email';
|
|
18581
|
+
emailInput.autocomplete = 'email';
|
|
18582
|
+
emailInput.placeholder = 'you@example.com';
|
|
18583
|
+
emailStep.appendChild(emailInput);
|
|
18584
|
+
const emailButton = document.createElement('button');
|
|
18585
|
+
emailButton.id = 'ba-email-btn';
|
|
18586
|
+
emailButton.className = 'ba-btn';
|
|
18587
|
+
emailButton.type = 'button';
|
|
18588
|
+
emailButton.textContent = 'Continue';
|
|
18589
|
+
emailStep.appendChild(emailButton);
|
|
18590
|
+
const otpStep = document.createElement('div');
|
|
18591
|
+
otpStep.id = 'ba-otp-step';
|
|
18592
|
+
otpStep.className = 'hidden';
|
|
18593
|
+
card.appendChild(otpStep);
|
|
18594
|
+
const otpLabel = document.createElement('label');
|
|
18595
|
+
otpLabel.className = 'ba-label';
|
|
18596
|
+
otpLabel.htmlFor = 'ba-otp';
|
|
18597
|
+
otpLabel.appendChild(document.createTextNode('Enter the code sent to '));
|
|
18598
|
+
const sentTo = document.createElement('span');
|
|
18599
|
+
sentTo.id = 'ba-sent-to';
|
|
18600
|
+
sentTo.className = 'ba-em';
|
|
18601
|
+
otpLabel.appendChild(sentTo);
|
|
18602
|
+
otpStep.appendChild(otpLabel);
|
|
18603
|
+
const otpInput = document.createElement('input');
|
|
18604
|
+
otpInput.id = 'ba-otp';
|
|
18605
|
+
otpInput.className = 'ba-input ba-code';
|
|
18606
|
+
otpInput.inputMode = 'numeric';
|
|
18607
|
+
otpInput.autocomplete = 'one-time-code';
|
|
18608
|
+
otpInput.maxLength = 8;
|
|
18609
|
+
otpInput.placeholder = '······';
|
|
18610
|
+
otpStep.appendChild(otpInput);
|
|
18611
|
+
const otpButton = document.createElement('button');
|
|
18612
|
+
otpButton.id = 'ba-otp-btn';
|
|
18613
|
+
otpButton.className = 'ba-btn';
|
|
18614
|
+
otpButton.type = 'button';
|
|
18615
|
+
otpButton.textContent = 'Verify & continue';
|
|
18616
|
+
otpStep.appendChild(otpButton);
|
|
18617
|
+
const backButton = document.createElement('button');
|
|
18618
|
+
backButton.id = 'ba-back';
|
|
18619
|
+
backButton.className = 'ba-link';
|
|
18620
|
+
backButton.type = 'button';
|
|
18621
|
+
backButton.textContent = 'Use a different email';
|
|
18622
|
+
otpStep.appendChild(backButton);
|
|
18623
|
+
const msg = document.createElement('div');
|
|
18624
|
+
msg.id = 'ba-msg';
|
|
18625
|
+
msg.className = 'ba-msg';
|
|
18626
|
+
card.appendChild(msg);
|
|
18627
|
+
const foot = document.createElement('div');
|
|
18628
|
+
foot.className = 'ba-foot';
|
|
18629
|
+
foot.textContent = 'Secured by Bounded';
|
|
18630
|
+
card.appendChild(foot);
|
|
18631
|
+
return root;
|
|
18632
|
+
}
|
|
18692
18633
|
const MODAL_CSS = `
|
|
18693
18634
|
#bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(8,10,18,.62);backdrop-filter:blur(4px);
|
|
18694
18635
|
display:flex;align-items:center;justify-content:center;z-index:2147483000;opacity:1;transition:opacity .16s ease;
|
|
@@ -19076,17 +19017,17 @@ function clearIncompatibleSession() {
|
|
|
19076
19017
|
// Lazy loaders for web-only providers.
|
|
19077
19018
|
// Using dynamic import() ensures Metro (RN) never resolves these modules.
|
|
19078
19019
|
async function loadPhantomWalletProvider() {
|
|
19079
|
-
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-
|
|
19020
|
+
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-MW2H0SFY.js'); });
|
|
19080
19021
|
return { PhantomWalletProvider: mod.PhantomWalletProvider };
|
|
19081
19022
|
}
|
|
19082
19023
|
// Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
|
|
19083
19024
|
// never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
|
|
19084
19025
|
async function loadPrivyWalletProvider() {
|
|
19085
|
-
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-
|
|
19026
|
+
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-dFxuvDf4.js'); });
|
|
19086
19027
|
return mod.PrivyWalletProvider;
|
|
19087
19028
|
}
|
|
19088
19029
|
async function loadSolanaMobileWalletProvider() {
|
|
19089
|
-
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-
|
|
19030
|
+
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-DAR0BLTQ.js'); });
|
|
19090
19031
|
return mod.SolanaMobileWalletProvider;
|
|
19091
19032
|
}
|
|
19092
19033
|
async function hotSwapToMWAProvider(config) {
|
|
@@ -20193,4 +20134,4 @@ exports.wsGet = wsGet;
|
|
|
20193
20134
|
exports.wsGetMany = wsGetMany;
|
|
20194
20135
|
exports.wsQuery = wsQuery;
|
|
20195
20136
|
exports.wsSet = wsSet;
|
|
20196
|
-
//# sourceMappingURL=index.native-
|
|
20137
|
+
//# sourceMappingURL=index.native-zD2ZzCLO.js.map
|