@bounded-sh/core 0.0.103 → 0.0.104

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 (27) hide show
  1. package/dist/client/solana-operations.d.ts +15 -0
  2. package/dist/{index-D7dRe0PL.js → index-62gjQH30.js} +55 -26
  3. package/dist/index-62gjQH30.js.map +1 -0
  4. package/dist/{index-CC2WVN43.mjs → index-CLst0IiM.mjs} +55 -26
  5. package/dist/index-CLst0IiM.mjs.map +1 -0
  6. package/dist/index.js +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/dist/{realtime-store-CuFYPLgk.js → realtime-store-9SCt1RPf.js} +2 -2
  9. package/dist/{realtime-store-CuFYPLgk.js.map → realtime-store-9SCt1RPf.js.map} +1 -1
  10. package/dist/{realtime-store-2iWofj5n.mjs → realtime-store-C9AgPg7U.mjs} +2 -2
  11. package/dist/{realtime-store-2iWofj5n.mjs.map → realtime-store-C9AgPg7U.mjs.map} +1 -1
  12. package/dist/{solana-message-DLBiBfnG.js → solana-message-Bf2q_JO1.js} +2 -2
  13. package/dist/{solana-message-DLBiBfnG.js.map → solana-message-Bf2q_JO1.js.map} +1 -1
  14. package/dist/{solana-message-Bx04VMG1.mjs → solana-message-Deru1tF1.mjs} +2 -2
  15. package/dist/{solana-message-Bx04VMG1.mjs.map → solana-message-Deru1tF1.mjs.map} +1 -1
  16. package/dist/{solana-operations-CCFNQIgd.mjs → solana-operations-Cm19J14R.mjs} +34 -5
  17. package/dist/{solana-operations-CCFNQIgd.mjs.map → solana-operations-Cm19J14R.mjs.map} +1 -1
  18. package/dist/{solana-operations-Be0dWtVZ.js → solana-operations-eTiLgak2.js} +34 -3
  19. package/dist/{solana-operations-Be0dWtVZ.js.map → solana-operations-eTiLgak2.js.map} +1 -1
  20. package/dist/{solana-v1-operations-Bbj0F4cp.js → solana-v1-operations-CnmiKiyj.js} +3 -3
  21. package/dist/{solana-v1-operations-Bbj0F4cp.js.map → solana-v1-operations-CnmiKiyj.js.map} +1 -1
  22. package/dist/{solana-v1-operations-C6Qev1fZ.mjs → solana-v1-operations-Dxs4XM_F.mjs} +3 -3
  23. package/dist/{solana-v1-operations-C6Qev1fZ.mjs.map → solana-v1-operations-Dxs4XM_F.mjs.map} +1 -1
  24. package/dist/types.d.ts +16 -1
  25. package/package.json +1 -1
  26. package/dist/index-CC2WVN43.mjs.map +0 -1
  27. package/dist/index-D7dRe0PL.js.map +0 -1
@@ -121,6 +121,21 @@ export declare function validateServerTransactionSemantics(input: {
121
121
  instructions: ServerTransactionInstructionView[];
122
122
  PublicKeyCtor: PublicKeyClass;
123
123
  }): void;
124
+ /**
125
+ * Poofnet lane of the onchain 202. Poofnet has no chain, so there is nothing to
126
+ * submit and no blockhash to refresh: the worker issued an unsendable message
127
+ * (off-curve fee payer) that only proves this wallet approved this write. It is
128
+ * validated exactly like a mainnet transaction before the wallet sees it, signed
129
+ * by the same provider method, and returned for the worker to verify and commit.
130
+ */
131
+ /**
132
+ * The fee payer of every poofnet approval message (realtime's
133
+ * POOFNET_VOID_FEE_PAYER): an off-curve address with no private key, so a message
134
+ * it pays for can never land on any cluster. Pinned here so a 202 from anything
135
+ * else can never get a live, broadcastable transaction signed.
136
+ */
137
+ export declare const POOFNET_VOID_FEE_PAYER = "CAXES7Tt3KGsSw4A5knQXKKUJZWsrguu6PC7SDBL4oq2";
138
+ export declare function signPoofnetTransaction(serializedTransaction: string, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent): Promise<string>;
124
139
  export declare function handlePreBuiltTransaction(tx: {
125
140
  serializedTransaction: string;
126
141
  blockhash: string;
@@ -4190,7 +4190,7 @@ class ServerSessionManager {
4190
4190
  const sessionConfig = (_a = this.sessionConfig) !== null && _a !== void 0 ? _a : undefined;
4191
4191
  /* fetch nonce from auth API (bound to the snapshotted app+issuer) */
4192
4192
  const nonce = await genAuthNonce(sessionConfig);
4193
- const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-DLBiBfnG.js'); });
4193
+ const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-Bf2q_JO1.js'); });
4194
4194
  const message = await genSolanaMessage(address, nonce, sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.appId);
4195
4195
  /* sign the message */
4196
4196
  const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
@@ -7469,7 +7469,7 @@ async function doReconnectWithNewAuth() {
7469
7469
  console.warn('[WS v2] Failed to clear HTTP read cache on auth change:', error);
7470
7470
  }
7471
7471
  try {
7472
- const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-CuFYPLgk.js'); });
7472
+ const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-9SCt1RPf.js'); });
7473
7473
  await reconnectRealtimeStoreWithNewAuth();
7474
7474
  }
7475
7475
  catch (error) {
@@ -8812,7 +8812,7 @@ async function set(path, document, options) {
8812
8812
  * state appears only under `observation`/`mirrorSync` once actually observed.
8813
8813
  */
8814
8814
  async function setMany(many, options) {
8815
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
8815
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
8816
8816
  // Returns the data that was set, or undefined if the document was already set.
8817
8817
  try {
8818
8818
  // A server WalletClient threads its immutable config snapshot; the default
@@ -8917,13 +8917,35 @@ async function setMany(many, options) {
8917
8917
  throw new Error('The write response carried no execution-chain tag, so this receipt could not state where the write ran. ' +
8918
8918
  'Nothing was signed or submitted.');
8919
8919
  }
8920
+ if (workerChain === 'realtime_offchain') {
8921
+ // Poofnet: the wallet signs the worker's unsendable approval message and
8922
+ // the worker verifies and commits it. Nothing is submitted to any chain.
8923
+ if (typeof curTx.serializedTransaction !== 'string' || typeof curTx.poofnetIntentId !== 'string') {
8924
+ throw new Error('Unsupported 202 transaction shape: a poofnet write needs serializedTransaction and poofnetIntentId');
8925
+ }
8926
+ const { signPoofnetTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-eTiLgak2.js'); });
8927
+ const signedTransaction = await signPoofnetTransaction(curTx.serializedTransaction, authProvider, options, buildExpectedWriteIntent(documents));
8928
+ // Signing-only, exactly as on a real chain: signed and NOT committed.
8929
+ if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
8930
+ return {
8931
+ status: 'signed', appId, requestedDocuments: buildRequestedDocuments(documents),
8932
+ chain: 'realtime_offchain', transactionId: null, signedTransaction,
8933
+ poofnetIntentId: curTx.poofnetIntentId,
8934
+ };
8935
+ }
8936
+ const commitResponse = await makeApiRequest('PUT', 'items/signed', { intentId: curTx.poofnetIntentId, signedTransaction }, options === null || options === void 0 ? void 0 : options._overrides);
8937
+ if (commitResponse.status !== 200) {
8938
+ throw new Error(`Poofnet signed write was not committed (status ${commitResponse.status})`);
8939
+ }
8940
+ return directCommitResult(commitResponse, documents);
8941
+ }
8920
8942
  if (curTx.serializedTransaction) {
8921
8943
  if (!SOLANA_CHAIN_TAGS.has(workerChain)) {
8922
8944
  throw new Error(`The write response reported execution chain "${workerChain}" for a Solana transaction. ` +
8923
8945
  'Nothing was signed or submitted.');
8924
8946
  }
8925
8947
  const solanaChain = workerChain;
8926
- const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-Be0dWtVZ.js'); });
8948
+ const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-eTiLgak2.js'); });
8927
8949
  // OA-0001: derive the expected intent from OUR OWN request (the one
8928
8950
  // ground truth a tampered builder response cannot change) so the
8929
8951
  // validator can reject any transaction whose operation semantics
@@ -8966,26 +8988,7 @@ async function setMany(many, options) {
8966
8988
  }
8967
8989
  }
8968
8990
  else if (setResponse.status === 200) {
8969
- // Direct commit: the worker applied the batch itself. The receipt is
8970
- // batch-level — `transactionId` comes from the worker's own receipt and is
8971
- // NEVER lifted out of a result document (a delete returns the PREVIOUS
8972
- // document, so its stale `_transaction_hash` would misreport the delete).
8973
- const body = (setResponse.data && typeof setResponse.data === 'object' && !Array.isArray(setResponse.data))
8974
- ? setResponse.data
8975
- : null;
8976
- const receipt = ((body === null || body === void 0 ? void 0 : body.receipt) && typeof body.receipt === 'object' && !Array.isArray(body.receipt))
8977
- ? body.receipt
8978
- : null;
8979
- const rawTransactionId = receipt === null || receipt === void 0 ? void 0 : receipt.transactionId;
8980
- return {
8981
- status: 'committed',
8982
- requestedDocuments: buildRequestedDocuments(documents),
8983
- observation: observationFromDirectCommit(documents.map(d => d.destinationPath), receipt === null || receipt === void 0 ? void 0 : receipt.observation),
8984
- // A worker predating the batch receipt reports no lane. Say so rather
8985
- // than inventing one — and never discard a committed write's receipt.
8986
- chain: ((_l = readWorkerChainTag(receipt)) !== null && _l !== void 0 ? _l : 'unknown'),
8987
- transactionId: typeof rawTransactionId === 'string' && rawTransactionId.length > 0 ? rawTransactionId : null,
8988
- };
8991
+ return directCommitResult(setResponse, documents);
8989
8992
  }
8990
8993
  else {
8991
8994
  throw new Error(`Failed to set document: ${setResponse}`);
@@ -8995,6 +8998,32 @@ async function setMany(many, options) {
8995
8998
  throw error;
8996
8999
  }
8997
9000
  }
9001
+ /**
9002
+ * Direct commit: the worker applied the batch itself (an offchain write, or a
9003
+ * poofnet onchain write after its signature verified). The receipt is batch-level
9004
+ * - `transactionId` comes from the worker's own receipt and is NEVER lifted out
9005
+ * of a result document (a delete returns the PREVIOUS document, so its stale
9006
+ * `_transaction_hash` would misreport the delete).
9007
+ */
9008
+ function directCommitResult(response, documents) {
9009
+ var _a;
9010
+ const body = (response.data && typeof response.data === 'object' && !Array.isArray(response.data))
9011
+ ? response.data
9012
+ : null;
9013
+ const receipt = ((body === null || body === void 0 ? void 0 : body.receipt) && typeof body.receipt === 'object' && !Array.isArray(body.receipt))
9014
+ ? body.receipt
9015
+ : null;
9016
+ const rawTransactionId = receipt === null || receipt === void 0 ? void 0 : receipt.transactionId;
9017
+ return {
9018
+ status: 'committed',
9019
+ requestedDocuments: buildRequestedDocuments(documents),
9020
+ observation: observationFromDirectCommit(documents.map(d => d.destinationPath), receipt === null || receipt === void 0 ? void 0 : receipt.observation),
9021
+ // A worker predating the batch receipt reports no lane. Say so rather
9022
+ // than inventing one - and never discard a committed write's receipt.
9023
+ chain: ((_a = readWorkerChainTag(receipt)) !== null && _a !== void 0 ? _a : 'unknown'),
9024
+ transactionId: typeof rawTransactionId === 'string' && rawTransactionId.length > 0 ? rawTransactionId : null,
9025
+ };
9026
+ }
8998
9027
  /**
8999
9028
  * Extract the document/collection path from a cache key. Keys are
9000
9029
  * `<appId:principal>|<path>:<...>` (H1 principal-scoped) — strip the principal
@@ -10698,7 +10727,7 @@ function toMillis(seconds) {
10698
10727
 
10699
10728
  /** SIWS message creation is async already, so its onchain module can be lazy. */
10700
10729
  async function genSolanaMessage(address, nonce) {
10701
- const implementation = await Promise.resolve().then(function () { return require('./solana-message-DLBiBfnG.js'); });
10730
+ const implementation = await Promise.resolve().then(function () { return require('./solana-message-Bf2q_JO1.js'); });
10702
10731
  return implementation.genSolanaMessage(address, nonce);
10703
10732
  }
10704
10733
 
@@ -11345,4 +11374,4 @@ exports.toMillis = toMillis;
11345
11374
  exports.toSeconds = toSeconds;
11346
11375
  exports.waitForSetResult = waitForSetResult;
11347
11376
  exports.withEffects = withEffects;
11348
- //# sourceMappingURL=index-D7dRe0PL.js.map
11377
+ //# sourceMappingURL=index-62gjQH30.js.map