@bounded-sh/core 0.0.102 → 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 (33) hide show
  1. package/dist/client/realtime-store.d.ts +2 -0
  2. package/dist/client/reconnect-backoff.d.ts +16 -0
  3. package/dist/client/socket-heartbeat.d.ts +47 -0
  4. package/dist/client/solana-operations.d.ts +15 -0
  5. package/dist/client/subscription-v2.d.ts +6 -0
  6. package/dist/{index-BEGeDFQI.js → index-62gjQH30.js} +220 -26
  7. package/dist/index-62gjQH30.js.map +1 -0
  8. package/dist/{index-CMT0saxy.mjs → index-CLst0IiM.mjs} +220 -26
  9. package/dist/index-CLst0IiM.mjs.map +1 -0
  10. package/dist/index.js +1 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/{realtime-store-DrtEj-bE.js → realtime-store-9SCt1RPf.js} +2 -2
  13. package/dist/realtime-store-9SCt1RPf.js.map +1 -0
  14. package/dist/{realtime-store-DqAAqfo9.mjs → realtime-store-C9AgPg7U.mjs} +2 -2
  15. package/dist/realtime-store-C9AgPg7U.mjs.map +1 -0
  16. package/dist/{solana-message-CJTnYiJu.js → solana-message-Bf2q_JO1.js} +2 -2
  17. package/dist/{solana-message-CJTnYiJu.js.map → solana-message-Bf2q_JO1.js.map} +1 -1
  18. package/dist/{solana-message-C_717vAx.mjs → solana-message-Deru1tF1.mjs} +2 -2
  19. package/dist/{solana-message-C_717vAx.mjs.map → solana-message-Deru1tF1.mjs.map} +1 -1
  20. package/dist/{solana-operations-DGNA2nGZ.mjs → solana-operations-Cm19J14R.mjs} +34 -5
  21. package/dist/{solana-operations-DGNA2nGZ.mjs.map → solana-operations-Cm19J14R.mjs.map} +1 -1
  22. package/dist/{solana-operations-CU0YbiMu.js → solana-operations-eTiLgak2.js} +34 -3
  23. package/dist/{solana-operations-CU0YbiMu.js.map → solana-operations-eTiLgak2.js.map} +1 -1
  24. package/dist/{solana-v1-operations-yQII8r1s.js → solana-v1-operations-CnmiKiyj.js} +3 -3
  25. package/dist/{solana-v1-operations-yQII8r1s.js.map → solana-v1-operations-CnmiKiyj.js.map} +1 -1
  26. package/dist/{solana-v1-operations-Bpd4TASG.mjs → solana-v1-operations-Dxs4XM_F.mjs} +3 -3
  27. package/dist/{solana-v1-operations-Bpd4TASG.mjs.map → solana-v1-operations-Dxs4XM_F.mjs.map} +1 -1
  28. package/dist/types.d.ts +16 -1
  29. package/package.json +2 -2
  30. package/dist/index-BEGeDFQI.js.map +0 -1
  31. package/dist/index-CMT0saxy.mjs.map +0 -1
  32. package/dist/realtime-store-DqAAqfo9.mjs.map +0 -1
  33. package/dist/realtime-store-DrtEj-bE.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"solana-v1-operations-Bpd4TASG.mjs","sources":["../.rollup-tmp/client/solana-v1-operations.js"],"sourcesContent":["// solana-v1-operations.ts - the SIMD-0385 v1 half of the pre-built write lane.\n//\n// The realtime worker hands the SDK a serialized, possibly partially-signed\n// transaction (sponsor and attestation signatures may already be attached). For\n// v1 wires (first byte 0x81) @solana/web3.js's legacy/v0 classes cannot even\n// deserialize the bytes, so this lane decodes with @solana/kit, runs the SAME\n// semantic validation the v0 lane runs (program allow-list, setup-shape\n// recomputation, OA-0001 intent binding), refreshes the lifetime only while the\n// transaction is still unsigned, signs through the provider's `signTransactionV1`,\n// and submits base64 over the same RPC handle the v0 lane uses.\n//\n// Lazy-loaded: `@solana/kit` must never enter the SDK's initial chunk.\nimport { Buffer } from 'buffer';\nimport { getConfig } from './config';\nimport { BoundedOnchainRuleRejection, decodeBase58, encodeBase58, errorText, isBoundedOnchainRuleRejection, isDefinitiveSolanaSendFailure, validateServerTransactionSemantics, } from './solana-operations';\nimport { getTransactionJson } from './solana-transaction-read';\nfunction transactionHasSignature(transaction) {\n return Object.values(transaction.signatures).some((sig) => !!sig && sig.some((byte) => byte !== 0));\n}\nfunction sameBytes(a, b) {\n if (a.length !== b.length)\n return false;\n for (let i = 0; i < a.length; i += 1)\n if (a[i] !== b[i])\n return false;\n return true;\n}\nasync function decodeAndValidate(serializedTransaction, options) {\n const kit = await import('@solana/kit');\n const transaction = kit.getTransactionDecoder().decode(Buffer.from(serializedTransaction, 'base64'));\n const compiledMessage = kit.getCompiledTransactionMessageDecoder().decode(transaction.messageBytes);\n if (compiledMessage.version !== 1) {\n throw new Error(`${options.label} announced SIMD-0385 v1 but decoded as version ${String(compiledMessage.version)}`);\n }\n if (compiledMessage.instructionHeaders.length !== compiledMessage.instructionPayloads.length) {\n throw new Error(`${options.label} has mismatched v1 instruction headers and payloads`);\n }\n const { PublicKey } = await import('@solana/web3.js');\n const accountKeys = compiledMessage.staticAccounts.map((key) => new PublicKey(key));\n const instructions = compiledMessage.instructionHeaders.map((header, index) => {\n if (header.programAccountIndex >= accountKeys.length)\n throw new Error(`${options.label} has an invalid program account index`);\n const payload = compiledMessage.instructionPayloads[index];\n return {\n programId: accountKeys[header.programAccountIndex].toBase58(),\n accountKeyIndexes: [...payload.instructionAccountIndices],\n data: Uint8Array.from(payload.instructionData),\n };\n });\n validateServerTransactionSemantics(Object.assign(Object.assign({}, options), { accountKeys, isAccountSigner: (index) => index >= 0 && index < compiledMessage.header.numSignerAccounts, instructions, PublicKeyCtor: PublicKey }));\n return { transaction, compiledMessage, kit };\n}\n/**\n * LF-003 parity with the v0 lane: an UNSIGNED transaction is re-based on a live\n * blockhash before the wallet signs it; a transaction that already carries a\n * co-signer's signature must keep the exact message it was co-signed against,\n * and its fence must name that same blockhash.\n */\nasync function refreshLifetime(transaction, compiledMessage, kit, rpc, serverFence) {\n var _a;\n const fence = { blockhash: serverFence.blockhash, lastValidBlockHeight: serverFence.lastValidBlockHeight };\n if (transactionHasSignature(transaction)) {\n if (String(compiledMessage.lifetimeToken) !== fence.blockhash) {\n throw new Error(`The pre-built v1 transaction was co-signed against blockhash ${String(compiledMessage.lifetimeToken)} ` +\n `but its expiry fence names ${fence.blockhash}. Nothing was signed.`);\n }\n return { transaction, fence };\n }\n if (!rpc)\n return { transaction, fence };\n if (typeof rpc.getLatestBlockhash !== 'function') {\n throw new Error('Pre-built v1 signing needs a current blockhash, but the configured Solana RPC cannot report one. Nothing was signed.');\n }\n const latest = await rpc.getLatestBlockhash('confirmed');\n const decoded = decodeBase58(String((_a = latest === null || latest === void 0 ? void 0 : latest.blockhash) !== null && _a !== void 0 ? _a : ''));\n if (decoded === null || decoded.length !== 32) {\n throw new Error(`The configured Solana RPC returned \"${latest === null || latest === void 0 ? void 0 : latest.blockhash}\" as the current blockhash, which is not a 32-byte base58 value. Nothing was signed.`);\n }\n const decompiled = kit.decompileTransactionMessage(compiledMessage, { lastValidBlockHeight: BigInt(serverFence.lastValidBlockHeight) });\n const refreshed = kit.setTransactionMessageLifetimeUsingBlockhash({ blockhash: kit.blockhash(latest.blockhash), lastValidBlockHeight: BigInt(latest.lastValidBlockHeight) }, decompiled);\n return {\n transaction: kit.compileTransaction(refreshed),\n fence: { blockhash: latest.blockhash, lastValidBlockHeight: latest.lastValidBlockHeight },\n };\n}\nexport async function handlePreBuiltV1Transaction(tx, authProvider, options, expectedIntent) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n const config = (_b = (_a = options === null || options === void 0 ? void 0 : options._overrides) === null || _a === void 0 ? void 0 : _a._config) !== null && _b !== void 0 ? _b : await getConfig();\n const decoded = await decodeAndValidate(tx.serializedTransaction, {\n label: 'Pre-built v1 transaction', expectedAppId: config.appId, expectedIntent,\n });\n if (typeof authProvider.signTransactionV1 !== 'function') {\n // The worker only builds v1 for a client that advertised it; reaching this\n // means the provider changed underneath the write. Refuse before any RPC.\n throw new Error('The write came back as a Solana transaction v1 (SIMD-0385) but this auth provider cannot sign v1. Nothing was signed.');\n }\n const shouldSubmit = (options === null || options === void 0 ? void 0 : options.shouldSubmitTx) !== false;\n const rpcUrl = (_c = config.rpcUrl) === null || _c === void 0 ? void 0 : _c.trim();\n const injectedRpc = (_d = options === null || options === void 0 ? void 0 : options._overrides) === null || _d === void 0 ? void 0 : _d._solanaRpc;\n if (shouldSubmit && !rpcUrl && !injectedRpc) {\n throw new Error(`Pre-built Solana transaction submission requires init({ rpcUrl }) for ${tx.network}. ` +\n `Pass a TOP-LEVEL rpcUrl (with chain) to init(), e.g. ` +\n `init({ appId, chain: '${tx.network}', rpcUrl: '<your ${tx.network} RPC endpoint>' }); ` +\n `a nested walletLogin.rpcUrl only configures wallet login and does not enable submission.`);\n }\n const { Connection } = await import('@solana/web3.js');\n const connection = injectedRpc !== null && injectedRpc !== void 0 ? injectedRpc : (rpcUrl ? new Connection(rpcUrl, 'confirmed') : null);\n const refreshed = await refreshLifetime(decoded.transaction, decoded.compiledMessage, decoded.kit, connection, tx);\n const signedTx = await authProvider.signTransactionV1(refreshed.transaction);\n if (!sameBytes(signedTx.messageBytes, refreshed.transaction.messageBytes)) {\n throw new Error('The signer changed the v1 transaction message instead of signing the exact transaction. Nothing was submitted.');\n }\n const feePayerAddress = String((_e = decoded.compiledMessage.staticAccounts[0]) !== null && _e !== void 0 ? _e : '');\n const feePayerSignature = signedTx.signatures[feePayerAddress];\n const rawTx = Uint8Array.from(decoded.kit.getTransactionEncoder().encode(signedTx));\n const signedTransaction = Buffer.from(rawTx).toString('base64');\n if (!shouldSubmit) {\n return { outcome: 'signed', lane: 'solana', transactionSignature: null, signedTransaction, fence: refreshed.fence };\n }\n if (!feePayerSignature || feePayerSignature.every((byte) => byte === 0)) {\n throw new Error('The signed v1 transaction carries no fee-payer signature; it cannot be submitted.');\n }\n // The transaction id is the fee payer's signature, derived from the signed bytes\n // BEFORE broadcasting so a lost send response still yields a reconcilable id.\n const signature = encodeBase58(Uint8Array.from(feePayerSignature));\n const submitRpc = connection;\n try {\n await submitRpc.sendRawTransaction(rawTx, { skipPreflight: false, maxRetries: 3 });\n }\n catch (error) {\n if (isDefinitiveSolanaSendFailure(error)) {\n if (isBoundedOnchainRuleRejection(error))\n throw new BoundedOnchainRuleRejection(error);\n throw error;\n }\n return {\n outcome: 'submitted', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n reason: `Broadcast response was lost or inconclusive: ${errorText(error)}`,\n };\n }\n let confirmation;\n try {\n confirmation = await submitRpc.confirmTransaction({ signature, blockhash: refreshed.fence.blockhash, lastValidBlockHeight: refreshed.fence.lastValidBlockHeight }, 'confirmed');\n }\n catch (error) {\n return {\n outcome: 'submitted', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n reason: `Confirmation outcome unknown: ${errorText(error)}`,\n };\n }\n if ((_f = confirmation.value) === null || _f === void 0 ? void 0 : _f.err) {\n let logMessages;\n try {\n logMessages = (_h = (_g = (await getTransactionJson(submitRpc, signature, 'confirmed'))) === null || _g === void 0 ? void 0 : _g.meta) === null || _h === void 0 ? void 0 : _h.logMessages;\n }\n catch (_l) {\n // Diagnostic only; the on-chain error is the verdict.\n }\n if (isBoundedOnchainRuleRejection(confirmation.value.err, logMessages)) {\n throw new BoundedOnchainRuleRejection(confirmation.value.err, logMessages);\n }\n throw new Error(`Transaction failed: ${logMessages ? JSON.stringify(logMessages) : JSON.stringify(confirmation.value.err)}`);\n }\n return {\n outcome: 'confirmed', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n confirmationContextSlot: (_k = (_j = confirmation.context) === null || _j === void 0 ? void 0 : _j.slot) !== null && _k !== void 0 ? _k : 0,\n };\n}\n"],"names":["Buffer"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,SAAS,uBAAuB,CAAC,WAAW,EAAE;AAC9C,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;AACvG;AACA,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE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ACnJ,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"solana-v1-operations-Dxs4XM_F.mjs","sources":["../.rollup-tmp/client/solana-v1-operations.js"],"sourcesContent":["// solana-v1-operations.ts - the SIMD-0385 v1 half of the pre-built write lane.\n//\n// The realtime worker hands the SDK a serialized, possibly partially-signed\n// transaction (sponsor and attestation signatures may already be attached). For\n// v1 wires (first byte 0x81) @solana/web3.js's legacy/v0 classes cannot even\n// deserialize the bytes, so this lane decodes with @solana/kit, runs the SAME\n// semantic validation the v0 lane runs (program allow-list, setup-shape\n// recomputation, OA-0001 intent binding), refreshes the lifetime only while the\n// transaction is still unsigned, signs through the provider's `signTransactionV1`,\n// and submits base64 over the same RPC handle the v0 lane uses.\n//\n// Lazy-loaded: `@solana/kit` must never enter the SDK's initial chunk.\nimport { Buffer } from 'buffer';\nimport { getConfig } from './config';\nimport { BoundedOnchainRuleRejection, decodeBase58, encodeBase58, errorText, isBoundedOnchainRuleRejection, isDefinitiveSolanaSendFailure, validateServerTransactionSemantics, } from './solana-operations';\nimport { getTransactionJson } from './solana-transaction-read';\nfunction transactionHasSignature(transaction) {\n return Object.values(transaction.signatures).some((sig) => !!sig && sig.some((byte) => byte !== 0));\n}\nfunction sameBytes(a, b) {\n if (a.length !== b.length)\n return false;\n for (let i = 0; i < a.length; i += 1)\n if (a[i] !== b[i])\n return false;\n return true;\n}\nasync function decodeAndValidate(serializedTransaction, options) {\n const kit = await import('@solana/kit');\n const transaction = kit.getTransactionDecoder().decode(Buffer.from(serializedTransaction, 'base64'));\n const compiledMessage = kit.getCompiledTransactionMessageDecoder().decode(transaction.messageBytes);\n if (compiledMessage.version !== 1) {\n throw new Error(`${options.label} announced SIMD-0385 v1 but decoded as version ${String(compiledMessage.version)}`);\n }\n if (compiledMessage.instructionHeaders.length !== compiledMessage.instructionPayloads.length) {\n throw new Error(`${options.label} has mismatched v1 instruction headers and payloads`);\n }\n const { PublicKey } = await import('@solana/web3.js');\n const accountKeys = compiledMessage.staticAccounts.map((key) => new PublicKey(key));\n const instructions = compiledMessage.instructionHeaders.map((header, index) => {\n if (header.programAccountIndex >= accountKeys.length)\n throw new Error(`${options.label} has an invalid program account index`);\n const payload = compiledMessage.instructionPayloads[index];\n return {\n programId: accountKeys[header.programAccountIndex].toBase58(),\n accountKeyIndexes: [...payload.instructionAccountIndices],\n data: Uint8Array.from(payload.instructionData),\n };\n });\n validateServerTransactionSemantics(Object.assign(Object.assign({}, options), { accountKeys, isAccountSigner: (index) => index >= 0 && index < compiledMessage.header.numSignerAccounts, instructions, PublicKeyCtor: PublicKey }));\n return { transaction, compiledMessage, kit };\n}\n/**\n * LF-003 parity with the v0 lane: an UNSIGNED transaction is re-based on a live\n * blockhash before the wallet signs it; a transaction that already carries a\n * co-signer's signature must keep the exact message it was co-signed against,\n * and its fence must name that same blockhash.\n */\nasync function refreshLifetime(transaction, compiledMessage, kit, rpc, serverFence) {\n var _a;\n const fence = { blockhash: serverFence.blockhash, lastValidBlockHeight: serverFence.lastValidBlockHeight };\n if (transactionHasSignature(transaction)) {\n if (String(compiledMessage.lifetimeToken) !== fence.blockhash) {\n throw new Error(`The pre-built v1 transaction was co-signed against blockhash ${String(compiledMessage.lifetimeToken)} ` +\n `but its expiry fence names ${fence.blockhash}. Nothing was signed.`);\n }\n return { transaction, fence };\n }\n if (!rpc)\n return { transaction, fence };\n if (typeof rpc.getLatestBlockhash !== 'function') {\n throw new Error('Pre-built v1 signing needs a current blockhash, but the configured Solana RPC cannot report one. Nothing was signed.');\n }\n const latest = await rpc.getLatestBlockhash('confirmed');\n const decoded = decodeBase58(String((_a = latest === null || latest === void 0 ? void 0 : latest.blockhash) !== null && _a !== void 0 ? _a : ''));\n if (decoded === null || decoded.length !== 32) {\n throw new Error(`The configured Solana RPC returned \"${latest === null || latest === void 0 ? void 0 : latest.blockhash}\" as the current blockhash, which is not a 32-byte base58 value. Nothing was signed.`);\n }\n const decompiled = kit.decompileTransactionMessage(compiledMessage, { lastValidBlockHeight: BigInt(serverFence.lastValidBlockHeight) });\n const refreshed = kit.setTransactionMessageLifetimeUsingBlockhash({ blockhash: kit.blockhash(latest.blockhash), lastValidBlockHeight: BigInt(latest.lastValidBlockHeight) }, decompiled);\n return {\n transaction: kit.compileTransaction(refreshed),\n fence: { blockhash: latest.blockhash, lastValidBlockHeight: latest.lastValidBlockHeight },\n };\n}\nexport async function handlePreBuiltV1Transaction(tx, authProvider, options, expectedIntent) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n const config = (_b = (_a = options === null || options === void 0 ? void 0 : options._overrides) === null || _a === void 0 ? void 0 : _a._config) !== null && _b !== void 0 ? _b : await getConfig();\n const decoded = await decodeAndValidate(tx.serializedTransaction, {\n label: 'Pre-built v1 transaction', expectedAppId: config.appId, expectedIntent,\n });\n if (typeof authProvider.signTransactionV1 !== 'function') {\n // The worker only builds v1 for a client that advertised it; reaching this\n // means the provider changed underneath the write. Refuse before any RPC.\n throw new Error('The write came back as a Solana transaction v1 (SIMD-0385) but this auth provider cannot sign v1. Nothing was signed.');\n }\n const shouldSubmit = (options === null || options === void 0 ? void 0 : options.shouldSubmitTx) !== false;\n const rpcUrl = (_c = config.rpcUrl) === null || _c === void 0 ? void 0 : _c.trim();\n const injectedRpc = (_d = options === null || options === void 0 ? void 0 : options._overrides) === null || _d === void 0 ? void 0 : _d._solanaRpc;\n if (shouldSubmit && !rpcUrl && !injectedRpc) {\n throw new Error(`Pre-built Solana transaction submission requires init({ rpcUrl }) for ${tx.network}. ` +\n `Pass a TOP-LEVEL rpcUrl (with chain) to init(), e.g. ` +\n `init({ appId, chain: '${tx.network}', rpcUrl: '<your ${tx.network} RPC endpoint>' }); ` +\n `a nested walletLogin.rpcUrl only configures wallet login and does not enable submission.`);\n }\n const { Connection } = await import('@solana/web3.js');\n const connection = injectedRpc !== null && injectedRpc !== void 0 ? injectedRpc : (rpcUrl ? new Connection(rpcUrl, 'confirmed') : null);\n const refreshed = await refreshLifetime(decoded.transaction, decoded.compiledMessage, decoded.kit, connection, tx);\n const signedTx = await authProvider.signTransactionV1(refreshed.transaction);\n if (!sameBytes(signedTx.messageBytes, refreshed.transaction.messageBytes)) {\n throw new Error('The signer changed the v1 transaction message instead of signing the exact transaction. Nothing was submitted.');\n }\n const feePayerAddress = String((_e = decoded.compiledMessage.staticAccounts[0]) !== null && _e !== void 0 ? _e : '');\n const feePayerSignature = signedTx.signatures[feePayerAddress];\n const rawTx = Uint8Array.from(decoded.kit.getTransactionEncoder().encode(signedTx));\n const signedTransaction = Buffer.from(rawTx).toString('base64');\n if (!shouldSubmit) {\n return { outcome: 'signed', lane: 'solana', transactionSignature: null, signedTransaction, fence: refreshed.fence };\n }\n if (!feePayerSignature || feePayerSignature.every((byte) => byte === 0)) {\n throw new Error('The signed v1 transaction carries no fee-payer signature; it cannot be submitted.');\n }\n // The transaction id is the fee payer's signature, derived from the signed bytes\n // BEFORE broadcasting so a lost send response still yields a reconcilable id.\n const signature = encodeBase58(Uint8Array.from(feePayerSignature));\n const submitRpc = connection;\n try {\n await submitRpc.sendRawTransaction(rawTx, { skipPreflight: false, maxRetries: 3 });\n }\n catch (error) {\n if (isDefinitiveSolanaSendFailure(error)) {\n if (isBoundedOnchainRuleRejection(error))\n throw new BoundedOnchainRuleRejection(error);\n throw error;\n }\n return {\n outcome: 'submitted', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n reason: `Broadcast response was lost or inconclusive: ${errorText(error)}`,\n };\n }\n let confirmation;\n try {\n confirmation = await submitRpc.confirmTransaction({ signature, blockhash: refreshed.fence.blockhash, lastValidBlockHeight: refreshed.fence.lastValidBlockHeight }, 'confirmed');\n }\n catch (error) {\n return {\n outcome: 'submitted', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n reason: `Confirmation outcome unknown: ${errorText(error)}`,\n };\n }\n if ((_f = confirmation.value) === null || _f === void 0 ? void 0 : _f.err) {\n let logMessages;\n try {\n logMessages = (_h = (_g = (await getTransactionJson(submitRpc, signature, 'confirmed'))) === null || _g === void 0 ? void 0 : _g.meta) === null || _h === void 0 ? void 0 : _h.logMessages;\n }\n catch (_l) {\n // Diagnostic only; the on-chain error is the verdict.\n }\n if (isBoundedOnchainRuleRejection(confirmation.value.err, logMessages)) {\n throw new BoundedOnchainRuleRejection(confirmation.value.err, logMessages);\n }\n throw new Error(`Transaction failed: ${logMessages ? JSON.stringify(logMessages) : JSON.stringify(confirmation.value.err)}`);\n }\n return {\n outcome: 'confirmed', lane: 'solana', transactionSignature: signature, signedTransaction, fence: refreshed.fence,\n confirmationContextSlot: (_k = (_j = confirmation.context) === null || _j === void 0 ? void 0 : _j.slot) !== null && _k !== void 0 ? _k : 0,\n };\n}\n"],"names":["Buffer"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,SAAS,uBAAuB,CAAC,WAAW,EAAE;AAC9C,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;AACvG;AACA,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AACzB,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;AAC7B,QAAQ,OAAO,KAAK;AACpB,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;AACxC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzB,YAAY,OAAO,KAAK;AACxB,IAAI,OAAO,IAAI;AACf;AACA,eAAe,iBAAiB,CAAC,qBAAqB,EAAE,OAAO,EAAE;AACjE,IAAI,MAAM,GAAG,GAAG,MAAM,OAAO,aAAa,CAAC;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,QAAQ;AACR,QAAQ,OAAO,EAAE,EAAE;AACnB;AACA,QAAQ;AACR,QAAQ,IAAI,6BAA6B,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE;AAChF,YAAY,MAAM,IAAI,2BAA2B,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC;AACtF,QAAQ;AACR,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,oBAAoB,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACpI,IAAI;AACJ,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK;AACxH,QAAQ,uBAAuB,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,CAAC;AACnJ,KAAK;AACL;;;;"}
package/dist/types.d.ts CHANGED
@@ -246,6 +246,21 @@ export type SolanaSignedSetResult = {
246
246
  signedTransaction: string;
247
247
  fence: SolanaFence;
248
248
  };
249
+ /**
250
+ * `shouldSubmitTx: false` on poofnet: the approval message was signed and NOT
251
+ * committed. Poofnet has no chain and no blockhash lifetime, so there is no
252
+ * fence; the write commits only if `signedTransaction` is later sent with
253
+ * `poofnetIntentId` to the worker's `items/signed`, before the intent expires.
254
+ */
255
+ export type PoofnetSignedSetResult = {
256
+ status: 'signed';
257
+ appId: string;
258
+ requestedDocuments: SetDocuments;
259
+ chain: 'realtime_offchain';
260
+ transactionId: null;
261
+ signedTransaction: string;
262
+ poofnetIntentId: string;
263
+ };
249
264
  /**
250
265
  * What every Bounded write resolves to. Discriminate on `status` first.
251
266
  *
@@ -254,7 +269,7 @@ export type SolanaSignedSetResult = {
254
269
  * direct write is ambiguous. The SDK never retries writes for that reason;
255
270
  * resolve an ambiguous direct write by reading the path back, not by resubmitting.
256
271
  */
257
- export type SetResult = CommittedSetResult | SolanaConfirmedSetResult | SolanaSubmittedSetResult | SolanaExpiredNotLandedSetResult | SolanaSignedSetResult;
272
+ export type SetResult = CommittedSetResult | SolanaConfirmedSetResult | SolanaSubmittedSetResult | SolanaExpiredNotLandedSetResult | SolanaSignedSetResult | PoofnetSignedSetResult;
258
273
  /**
259
274
  * What the Solana pre-built write lane resolves to. Discriminated so the
260
275
  * identifier ESCAPES an unknown confirmation outcome:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bounded-sh/core",
3
- "version": "0.0.102",
3
+ "version": "0.0.104",
4
4
  "description": "Shared client, data-plane, and transport primitives for Bounded, the full-stack app builder and runtime for AI-built apps: policy-enforced operations, files, functions, and realtime.",
5
5
  "homepage": "https://bounded.sh/docs/sdk",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "rm -rf ./dist ./.rollup-tmp && tsc -p tsconfig.build.json --outDir .rollup-tmp --declarationDir .rollup-tmp --emitDeclarationOnly false && rollup -c && tsc -p tsconfig.build.json --emitDeclarationOnly --declarationDir dist && rm -rf ./.rollup-tmp",
18
18
  "watch": "rollup -c -w",
19
- "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-api-rule-evaluation-failed-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-auth-api-server-credential-test.mjs && node src/utils/run-auth-api-revoke-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-web-session-manager-signout-test.mjs && node src/utils/run-web-session-manager-refresh-transport-test.mjs && node src/utils/refresh-error.source.test.mjs && node src/utils/run-auth-api-refresh-per-token-test.mjs && node src/utils/run-core-platform-encode-test.mjs && node src/utils/rn-session-manager-example.source.test.mjs && node src/utils/run-session-protocol-test.mjs && node src/utils/run-auth-token-freshness-test.mjs && node src/utils/run-api-401-recovery-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-decline-cause-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-reconnect-dependency-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/run-subscription-shard-test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-set-result-test.mjs && node src/client/run-solana-prebuilt-blockhash-test.mjs && node src/client/run-reconcile-set-result-test.mjs && node src/client/run-set-file-result-test.mjs && node src/client/run-set-result-types-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs && node src/client/run-app-token-test.mjs && node src/client/run-wallet-config-binding-test.mjs && node src/client/run-functions-timeout-test.mjs && node src/run-user-address-nullable-test.mjs && node src/utils/sol/run-solana-sign-in-message-test.mjs",
19
+ "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-api-rule-evaluation-failed-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-auth-api-server-credential-test.mjs && node src/utils/run-auth-api-revoke-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-web-session-manager-signout-test.mjs && node src/utils/run-web-session-manager-refresh-transport-test.mjs && node src/utils/refresh-error.source.test.mjs && node src/utils/run-auth-api-refresh-per-token-test.mjs && node src/utils/run-core-platform-encode-test.mjs && node src/utils/rn-session-manager-example.source.test.mjs && node src/utils/run-session-protocol-test.mjs && node src/utils/run-auth-token-freshness-test.mjs && node src/utils/run-api-401-recovery-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-decline-cause-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-reconnect-dependency-test.mjs && node src/client/run-reconnect-backoff-test.mjs && node src/client/run-socket-heartbeat-test.mjs && node src/client/run-subscription-heartbeat-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/run-subscription-shard-test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-set-result-test.mjs && node src/client/run-solana-prebuilt-blockhash-test.mjs && node src/client/run-reconcile-set-result-test.mjs && node src/client/run-set-file-result-test.mjs && node src/client/run-set-result-types-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs && node src/client/run-app-token-test.mjs && node src/client/run-wallet-config-binding-test.mjs && node src/client/run-functions-timeout-test.mjs && node src/run-user-address-nullable-test.mjs && node src/utils/sol/run-solana-sign-in-message-test.mjs",
20
20
  "prepare": "npm run build"
21
21
  },
22
22
  "files": [