@bounded-sh/core 0.0.14 → 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/index.js +12 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3780,24 +3780,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
3780
3780
|
/* ------------------------------------------------------------------ */
|
|
3781
3781
|
/* ENV helpers */
|
|
3782
3782
|
/* ------------------------------------------------------------------ */
|
|
3783
|
-
// Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI)
|
|
3784
|
-
//
|
|
3785
|
-
|
|
3786
|
-
const
|
|
3783
|
+
// Canonical `BOUNDED_PRIVATE_KEY` (matches the CLI). Only consulted when no
|
|
3784
|
+
// explicit keypair was provided (createWalletClient passes one).
|
|
3785
|
+
const ENV_KEYPAIR = "BOUNDED_PRIVATE_KEY";
|
|
3786
|
+
const LEGACY_ENV_KEYPAIR = "BOUNDED_SOLANA_KEYPAIR";
|
|
3787
3787
|
function loadKeypairFromEnv() {
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
const v = process.env[name];
|
|
3792
|
-
if (v) {
|
|
3793
|
-
secret = v;
|
|
3794
|
-
found = name;
|
|
3795
|
-
break;
|
|
3796
|
-
}
|
|
3788
|
+
if (process.env[LEGACY_ENV_KEYPAIR]) {
|
|
3789
|
+
throw new Error(`${LEGACY_ENV_KEYPAIR} is no longer supported. Set ${ENV_KEYPAIR} instead, ` +
|
|
3790
|
+
`or pass an explicit keypair via createWalletClient({ keypair }).`);
|
|
3797
3791
|
}
|
|
3792
|
+
const secret = process.env[ENV_KEYPAIR];
|
|
3798
3793
|
if (!secret) {
|
|
3799
3794
|
throw new Error(`No server keypair for this top-level call. The top-level get/set/subscribe/etc. use an ` +
|
|
3800
|
-
`AMBIENT session — set ${
|
|
3795
|
+
`AMBIENT session — set ${ENV_KEYPAIR} to a base-58 secret key (or JSON array) to provide one. ` +
|
|
3801
3796
|
`If you already created a wallet with createWalletClient({ keypair }), call ITS methods instead ` +
|
|
3802
3797
|
`(client.subscribe / client.set / client.get): that client is self-contained and deliberately does ` +
|
|
3803
3798
|
`not set the ambient session, so the top-level functions can't see it.`);
|
|
@@ -3809,7 +3804,7 @@ function loadKeypairFromEnv() {
|
|
|
3809
3804
|
return Keypair.fromSecretKey(secretKey);
|
|
3810
3805
|
}
|
|
3811
3806
|
catch (err) {
|
|
3812
|
-
throw new Error(`Unable to parse ${
|
|
3807
|
+
throw new Error(`Unable to parse ${ENV_KEYPAIR}. Ensure it is valid base-58 or JSON.`);
|
|
3813
3808
|
}
|
|
3814
3809
|
}
|
|
3815
3810
|
/* ------------------------------------------------------------------ */
|
|
@@ -3876,7 +3871,7 @@ class ServerSessionManager {
|
|
|
3876
3871
|
this.session = session;
|
|
3877
3872
|
}
|
|
3878
3873
|
/* ---------------------------------------------- *
|
|
3879
|
-
* CLEAR (e.g. after logout
|
|
3874
|
+
* CLEAR (e.g. after explicit logout)
|
|
3880
3875
|
* ---------------------------------------------- */
|
|
3881
3876
|
clearSession() {
|
|
3882
3877
|
this.session = null;
|
|
@@ -3900,11 +3895,6 @@ class ServerSessionManager {
|
|
|
3900
3895
|
/* The default singleton instance (reads keypair from env) */
|
|
3901
3896
|
ServerSessionManager.instance = new ServerSessionManager();
|
|
3902
3897
|
|
|
3903
|
-
var serverSessionManager = /*#__PURE__*/Object.freeze({
|
|
3904
|
-
__proto__: null,
|
|
3905
|
-
ServerSessionManager: ServerSessionManager
|
|
3906
|
-
});
|
|
3907
|
-
|
|
3908
3898
|
/**
|
|
3909
3899
|
* Safe base64 helpers for bounded-core.
|
|
3910
3900
|
*
|
|
@@ -4129,13 +4119,6 @@ async function refreshAuthSessionOnce(appId, isServer) {
|
|
|
4129
4119
|
async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
4130
4120
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4131
4121
|
const config = await getConfig();
|
|
4132
|
-
let hasRetriedAfterServerSessionReset = false;
|
|
4133
|
-
const clearServerSession = async () => {
|
|
4134
|
-
if (!config.isServer)
|
|
4135
|
-
return;
|
|
4136
|
-
const { ServerSessionManager } = await Promise.resolve().then(function () { return serverSessionManager; });
|
|
4137
|
-
ServerSessionManager.instance.clearSession();
|
|
4138
|
-
};
|
|
4139
4122
|
async function executeRequest() {
|
|
4140
4123
|
var _a;
|
|
4141
4124
|
// When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
|
|
@@ -4185,13 +4168,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
4185
4168
|
}
|
|
4186
4169
|
return await executeRequest();
|
|
4187
4170
|
}
|
|
4188
|
-
catch (
|
|
4189
|
-
// Server-side fallback: clear global session and retry once
|
|
4190
|
-
if (config.isServer && !hasRetriedAfterServerSessionReset) {
|
|
4191
|
-
hasRetriedAfterServerSessionReset = true;
|
|
4192
|
-
await clearServerSession();
|
|
4193
|
-
return await executeRequest();
|
|
4194
|
-
}
|
|
4171
|
+
catch (_j) {
|
|
4195
4172
|
throw error;
|
|
4196
4173
|
}
|
|
4197
4174
|
}
|