@oobe-protocol-labs/synapse-client-sdk 2.0.0 → 2.0.5
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/CHANGELOG.md +103 -0
- package/README.md +2 -2
- package/dist/cjs/ai/actions/server.d.ts.map +1 -1
- package/dist/cjs/ai/actions/server.js +5 -3
- package/dist/cjs/ai/actions/server.js.map +1 -1
- package/dist/cjs/ai/gateway/index.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/index.js.map +1 -1
- package/dist/cjs/ai/gateway/x402/client.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/x402/client.js +0 -3
- package/dist/cjs/ai/gateway/x402/client.js.map +1 -1
- package/dist/cjs/ai/gateway/x402/paywall.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/x402/paywall.js.map +1 -1
- package/dist/cjs/ai/index.d.ts +1 -1
- package/dist/cjs/ai/index.d.ts.map +1 -1
- package/dist/cjs/ai/index.js +12 -28
- package/dist/cjs/ai/index.js.map +1 -1
- package/dist/cjs/ai/intents/executor.js.map +1 -1
- package/dist/cjs/ai/intents/parser.d.ts.map +1 -1
- package/dist/cjs/ai/intents/parser.js.map +1 -1
- package/dist/cjs/ai/intents/planner.js.map +1 -1
- package/dist/cjs/ai/mcp/client.js +1 -1
- package/dist/cjs/ai/mcp/client.js.map +1 -1
- package/dist/cjs/ai/persistence/postgresql.js.map +1 -1
- package/dist/cjs/ai/plugins/registry.js +1 -1
- package/dist/cjs/ai/plugins/registry.js.map +1 -1
- package/dist/cjs/ai/sap/client.d.ts +197 -0
- package/dist/cjs/ai/sap/client.d.ts.map +1 -0
- package/dist/cjs/ai/sap/client.js +334 -0
- package/dist/cjs/ai/sap/client.js.map +1 -0
- package/dist/cjs/ai/sap/index.d.ts +69 -52
- package/dist/cjs/ai/sap/index.d.ts.map +1 -1
- package/dist/cjs/ai/sap/index.js +73 -77
- package/dist/cjs/ai/sap/index.js.map +1 -1
- package/dist/cjs/ai/sap/provider.d.ts +180 -0
- package/dist/cjs/ai/sap/provider.d.ts.map +1 -0
- package/dist/cjs/ai/sap/provider.js +219 -0
- package/dist/cjs/ai/sap/provider.js.map +1 -0
- package/dist/cjs/ai/sap/types.d.ts +120 -384
- package/dist/cjs/ai/sap/types.d.ts.map +1 -1
- package/dist/cjs/ai/sap/types.js +20 -200
- package/dist/cjs/ai/sap/types.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/shared.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/shared.js +4 -1
- package/dist/cjs/ai/tools/protocols/shared.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/solana-programs/tools.js.map +1 -1
- package/dist/cjs/context/container.d.ts.map +1 -1
- package/dist/cjs/context/container.js.map +1 -1
- package/dist/cjs/grpc/parser/geyser-parser.d.ts.map +1 -1
- package/dist/cjs/grpc/parser/geyser-parser.js.map +1 -1
- package/dist/cjs/next/index.d.ts.map +1 -1
- package/dist/cjs/next/index.js +7 -1
- package/dist/cjs/next/index.js.map +1 -1
- package/dist/cjs/programs/index.d.ts.map +1 -1
- package/dist/cjs/programs/index.js.map +1 -1
- package/dist/cjs/utils/helpers.js.map +1 -1
- package/dist/docs/classes/AccountReader.html +18 -18
- package/dist/docs/classes/AccountsClient.html +10 -10
- package/dist/docs/classes/AsyncProviderError.html +4 -4
- package/dist/docs/classes/CircularDependencyError.html +4 -4
- package/dist/docs/classes/DasClient.html +13 -13
- package/dist/docs/classes/GeyserParser.html +17 -17
- package/dist/docs/classes/GrpcTransport.html +6 -6
- package/dist/docs/classes/HttpTransport.html +4 -4
- package/dist/docs/classes/InstructionWriter.html +11 -11
- package/dist/docs/classes/MemoryGuard.html +9 -9
- package/dist/docs/classes/NetworkError.html +5 -5
- package/dist/docs/classes/RefRegistry.html +11 -11
- package/dist/docs/classes/RefReleasedError.html +4 -4
- package/dist/docs/classes/RpcMethodNotFoundError.html +4 -4
- package/dist/docs/classes/ServiceNotFoundError.html +4 -4
- package/dist/docs/classes/ServiceRef.html +13 -13
- package/dist/docs/classes/SolanaRpc.html +55 -55
- package/dist/docs/classes/SynapseClient.html +15 -15
- package/dist/docs/classes/SynapseContext.html +27 -27
- package/dist/docs/classes/SynapseError.html +4 -4
- package/dist/docs/classes/TimeoutError.html +4 -4
- package/dist/docs/classes/UpstreamError.html +6 -6
- package/dist/docs/classes/WeakServiceRef.html +4 -4
- package/dist/docs/classes/WsClient.html +10 -10
- package/dist/docs/enums/SynapseNetwork.html +2 -2
- package/dist/docs/enums/SynapseRegion.html +2 -2
- package/dist/docs/enums/TokenExtensionType.html +2 -2
- package/dist/docs/functions/Epoch-1.html +1 -1
- package/dist/docs/functions/Lamports-2.html +1 -1
- package/dist/docs/functions/Pubkey-1.html +1 -1
- package/dist/docs/functions/Sig.html +1 -1
- package/dist/docs/functions/Slot-1.html +1 -1
- package/dist/docs/functions/UnixTs.html +1 -1
- package/dist/docs/functions/autoSelectRegion.html +1 -1
- package/dist/docs/functions/autoWire.html +1 -1
- package/dist/docs/functions/base58Encode.html +1 -1
- package/dist/docs/functions/base64ToBytes.html +1 -1
- package/dist/docs/functions/bigIntReplacer.html +1 -1
- package/dist/docs/functions/chunk.html +1 -1
- package/dist/docs/functions/computeBalanceChanges.html +1 -1
- package/dist/docs/functions/computeTokenBalanceChanges.html +1 -1
- package/dist/docs/functions/createBareContext.html +1 -1
- package/dist/docs/functions/createBinding.html +1 -1
- package/dist/docs/functions/createBoundHook.html +1 -1
- package/dist/docs/functions/createReactAdapter.html +1 -1
- package/dist/docs/functions/createRefHook.html +1 -1
- package/dist/docs/functions/createServerMiddleware.html +1 -1
- package/dist/docs/functions/createServiceHook.html +1 -1
- package/dist/docs/functions/createSingleton.html +1 -1
- package/dist/docs/functions/createSynapse.html +1 -1
- package/dist/docs/functions/createSynapseContext.html +1 -1
- package/dist/docs/functions/createToken.html +1 -1
- package/dist/docs/functions/decodeBase58.html +1 -1
- package/dist/docs/functions/decodeLookupTable.html +1 -1
- package/dist/docs/functions/decodeMint.html +1 -1
- package/dist/docs/functions/decodeMultisig.html +1 -1
- package/dist/docs/functions/decodeNonceAccount.html +1 -1
- package/dist/docs/functions/decodeStakeAccount.html +1 -1
- package/dist/docs/functions/decodeToken2022Account.html +1 -1
- package/dist/docs/functions/decodeToken2022Mint.html +1 -1
- package/dist/docs/functions/decodeTokenAccount.html +1 -1
- package/dist/docs/functions/encodeBase58.html +1 -1
- package/dist/docs/functions/fetchLookupTable.html +1 -1
- package/dist/docs/functions/fetchMint.html +1 -1
- package/dist/docs/functions/fetchNonceAccount.html +1 -1
- package/dist/docs/functions/fetchStakeAccount.html +1 -1
- package/dist/docs/functions/fetchTokenAccount.html +1 -1
- package/dist/docs/functions/fetchTokenAccountsByOwner.html +1 -1
- package/dist/docs/functions/fromKitAddress.html +1 -1
- package/dist/docs/functions/getAccountInfo.html +1 -1
- package/dist/docs/functions/getAsset.html +1 -1
- package/dist/docs/functions/getAssetBatch.html +1 -1
- package/dist/docs/functions/getAssetProof.html +1 -1
- package/dist/docs/functions/getAssetProofBatch.html +1 -1
- package/dist/docs/functions/getAssetsByAuthority.html +1 -1
- package/dist/docs/functions/getAssetsByCreator.html +1 -1
- package/dist/docs/functions/getAssetsByGroup.html +1 -1
- package/dist/docs/functions/getAssetsByOwner.html +1 -1
- package/dist/docs/functions/getBalance.html +1 -1
- package/dist/docs/functions/getBlock.html +1 -1
- package/dist/docs/functions/getBlockCommitment.html +1 -1
- package/dist/docs/functions/getBlockHeight.html +1 -1
- package/dist/docs/functions/getBlockProduction.html +1 -1
- package/dist/docs/functions/getBlockTime.html +1 -1
- package/dist/docs/functions/getBlocks.html +1 -1
- package/dist/docs/functions/getBlocksWithLimit.html +1 -1
- package/dist/docs/functions/getClusterNodes.html +1 -1
- package/dist/docs/functions/getContext.html +1 -1
- package/dist/docs/functions/getDecodedAccount.html +1 -1
- package/dist/docs/functions/getDecodedAccounts.html +1 -1
- package/dist/docs/functions/getEnvironment.html +1 -1
- package/dist/docs/functions/getEpochInfo.html +1 -1
- package/dist/docs/functions/getEpochSchedule.html +1 -1
- package/dist/docs/functions/getFeeForMessage.html +1 -1
- package/dist/docs/functions/getFirstAvailableBlock.html +1 -1
- package/dist/docs/functions/getGenesisHash.html +1 -1
- package/dist/docs/functions/getHealth.html +1 -1
- package/dist/docs/functions/getHighestSnapshotSlot.html +1 -1
- package/dist/docs/functions/getIdentity.html +1 -1
- package/dist/docs/functions/getInflationGovernor.html +1 -1
- package/dist/docs/functions/getInflationRate.html +1 -1
- package/dist/docs/functions/getInflationReward.html +1 -1
- package/dist/docs/functions/getLargestAccounts.html +1 -1
- package/dist/docs/functions/getLatestBlockhash.html +1 -1
- package/dist/docs/functions/getLeaderSchedule.html +1 -1
- package/dist/docs/functions/getMaxRetransmitSlot.html +1 -1
- package/dist/docs/functions/getMaxShredInsertSlot.html +1 -1
- package/dist/docs/functions/getMinimumBalanceForRentExemption.html +1 -1
- package/dist/docs/functions/getMultipleAccounts.html +1 -1
- package/dist/docs/functions/getProgramAccounts.html +1 -1
- package/dist/docs/functions/getProgramCategory.html +1 -1
- package/dist/docs/functions/getRecentPerformanceSamples.html +1 -1
- package/dist/docs/functions/getRecentPrioritizationFees.html +1 -1
- package/dist/docs/functions/getSignatureStatuses.html +1 -1
- package/dist/docs/functions/getSignaturesForAddress.html +1 -1
- package/dist/docs/functions/getSignaturesForAsset.html +1 -1
- package/dist/docs/functions/getSlot.html +1 -1
- package/dist/docs/functions/getSlotLeader.html +1 -1
- package/dist/docs/functions/getSlotLeaders.html +1 -1
- package/dist/docs/functions/getStakeActivation.html +1 -1
- package/dist/docs/functions/getStakeMinimumDelegation.html +1 -1
- package/dist/docs/functions/getSupply.html +1 -1
- package/dist/docs/functions/getTokenAccountBalance.html +1 -1
- package/dist/docs/functions/getTokenAccounts.html +1 -1
- package/dist/docs/functions/getTokenAccountsByDelegate.html +1 -1
- package/dist/docs/functions/getTokenAccountsByOwner.html +1 -1
- package/dist/docs/functions/getTokenLargestAccounts.html +1 -1
- package/dist/docs/functions/getTokenSupply.html +1 -1
- package/dist/docs/functions/getTransaction.html +1 -1
- package/dist/docs/functions/getTransactionCount.html +1 -1
- package/dist/docs/functions/getVersion.html +1 -1
- package/dist/docs/functions/getVoteAccounts.html +1 -1
- package/dist/docs/functions/isBlockhashValid.html +1 -1
- package/dist/docs/functions/isBrowser.html +1 -1
- package/dist/docs/functions/isDisposable.html +1 -1
- package/dist/docs/functions/isProgramInCategory.html +1 -1
- package/dist/docs/functions/isServer.html +1 -1
- package/dist/docs/functions/isValidPubkey.html +1 -1
- package/dist/docs/functions/isValidSignature.html +1 -1
- package/dist/docs/functions/lamportsToSol.html +1 -1
- package/dist/docs/functions/listEndpoints.html +1 -1
- package/dist/docs/functions/listNetworks.html +1 -1
- package/dist/docs/functions/listRegions.html +1 -1
- package/dist/docs/functions/minimumLedgerSlot.html +1 -1
- package/dist/docs/functions/parseAccountUpdate.html +1 -1
- package/dist/docs/functions/parseBlockMeta.html +1 -1
- package/dist/docs/functions/parseEntry.html +1 -1
- package/dist/docs/functions/parseGeyserUpdate.html +1 -1
- package/dist/docs/functions/parseSlotUpdate.html +1 -1
- package/dist/docs/functions/parseTimestamp.html +1 -1
- package/dist/docs/functions/parseTransaction.html +1 -1
- package/dist/docs/functions/probeLatency.html +1 -1
- package/dist/docs/functions/rawBufferToBase58.html +1 -1
- package/dist/docs/functions/rawBufferToBase64.html +1 -1
- package/dist/docs/functions/rawBufferToBytes.html +1 -1
- package/dist/docs/functions/rawBufferToHex.html +1 -1
- package/dist/docs/functions/readonly.html +1 -1
- package/dist/docs/functions/readonlySigner.html +1 -1
- package/dist/docs/functions/requestAirdrop.html +1 -1
- package/dist/docs/functions/resolveEndpoint.html +1 -1
- package/dist/docs/functions/resolveProgram.html +1 -1
- package/dist/docs/functions/resolveProgramBatch.html +1 -1
- package/dist/docs/functions/retry.html +1 -1
- package/dist/docs/functions/searchAssets.html +1 -1
- package/dist/docs/functions/sendTransaction.html +1 -1
- package/dist/docs/functions/setGlobalContext.html +1 -1
- package/dist/docs/functions/simulateTransaction.html +1 -1
- package/dist/docs/functions/sleep.html +1 -1
- package/dist/docs/functions/solToLamports.html +1 -1
- package/dist/docs/functions/toClientConfig.html +1 -1
- package/dist/docs/functions/toJsonSafe.html +1 -1
- package/dist/docs/functions/toKitAddress.html +1 -1
- package/dist/docs/functions/toKitInstruction.html +1 -1
- package/dist/docs/functions/toKitLamports.html +1 -1
- package/dist/docs/functions/toKitSignatureString.html +1 -1
- package/dist/docs/functions/tryGetContext.html +1 -1
- package/dist/docs/functions/tryUseService.html +1 -1
- package/dist/docs/functions/useBoundServices.html +1 -1
- package/dist/docs/functions/useService.html +1 -1
- package/dist/docs/functions/useSharedRef.html +1 -1
- package/dist/docs/functions/withRef.html +1 -1
- package/dist/docs/functions/withRefAsync.html +1 -1
- package/dist/docs/functions/writable.html +1 -1
- package/dist/docs/functions/writableSigner.html +1 -1
- package/dist/docs/index.html +2 -2
- package/dist/docs/interfaces/AccountInfo.html +7 -7
- package/dist/docs/interfaces/AccountMeta.html +4 -4
- package/dist/docs/interfaces/AccountNotification.html +2 -2
- package/dist/docs/interfaces/AccountSubParams.html +2 -2
- package/dist/docs/interfaces/AddMemoParams.html +5 -5
- package/dist/docs/interfaces/AdvanceNonceParams.html +3 -3
- package/dist/docs/interfaces/AliasProvider.html +2 -2
- package/dist/docs/interfaces/AllocateParams.html +3 -3
- package/dist/docs/interfaces/ApproveCheckedParams.html +9 -9
- package/dist/docs/interfaces/ApproveParams.html +7 -7
- package/dist/docs/interfaces/AssetSignatureInfo.html +2 -2
- package/dist/docs/interfaces/AssetSignaturesPage.html +2 -2
- package/dist/docs/interfaces/AssignParams.html +3 -3
- package/dist/docs/interfaces/AsyncFactoryProvider.html +2 -2
- package/dist/docs/interfaces/AuthorizeNonceParams.html +4 -4
- package/dist/docs/interfaces/BalanceChange.html +6 -6
- package/dist/docs/interfaces/BlockProduction.html +3 -3
- package/dist/docs/interfaces/BlockResult.html +2 -2
- package/dist/docs/interfaces/BlockReward.html +2 -2
- package/dist/docs/interfaces/BlockhashResult.html +2 -2
- package/dist/docs/interfaces/BurnCheckedParams.html +8 -8
- package/dist/docs/interfaces/BurnParams.html +7 -7
- package/dist/docs/interfaces/CallOptions.html +6 -6
- package/dist/docs/interfaces/ClassProvider.html +2 -2
- package/dist/docs/interfaces/CloseAccountParams.html +6 -6
- package/dist/docs/interfaces/ConfirmedTransaction.html +6 -6
- package/dist/docs/interfaces/ContactInfo.html +2 -2
- package/dist/docs/interfaces/ContextAdapter.html +5 -5
- package/dist/docs/interfaces/ContextEvents.html +6 -6
- package/dist/docs/interfaces/ContextModule.html +3 -3
- package/dist/docs/interfaces/CreateATAParams.html +6 -6
- package/dist/docs/interfaces/CreateAccountParams.html +6 -6
- package/dist/docs/interfaces/CreateAccountWithSeedParams.html +8 -8
- package/dist/docs/interfaces/CreateSynapseContextOpts.html +4 -4
- package/dist/docs/interfaces/DasAsset.html +2 -2
- package/dist/docs/interfaces/DasAssetProof.html +2 -2
- package/dist/docs/interfaces/DasAuthority.html +2 -2
- package/dist/docs/interfaces/DasCompression.html +2 -2
- package/dist/docs/interfaces/DasContent.html +2 -2
- package/dist/docs/interfaces/DasCreator.html +2 -2
- package/dist/docs/interfaces/DasFile.html +2 -2
- package/dist/docs/interfaces/DasGrouping.html +2 -2
- package/dist/docs/interfaces/DasOpts.html +2 -2
- package/dist/docs/interfaces/DasOwnership.html +2 -2
- package/dist/docs/interfaces/DasPage.html +2 -2
- package/dist/docs/interfaces/DasRoyalty.html +2 -2
- package/dist/docs/interfaces/DasSearchParams.html +2 -2
- package/dist/docs/interfaces/DasSupply.html +2 -2
- package/dist/docs/interfaces/DataSlice.html +3 -3
- package/dist/docs/interfaces/DecodedAccountResult.html +4 -4
- package/dist/docs/interfaces/DecodedLookupTable.html +8 -8
- package/dist/docs/interfaces/DecodedMint.html +6 -6
- package/dist/docs/interfaces/DecodedMultisig.html +5 -5
- package/dist/docs/interfaces/DecodedNonceAccount.html +6 -6
- package/dist/docs/interfaces/DecodedStakeAccount.html +2 -2
- package/dist/docs/interfaces/DecodedToken2022Account.html +9 -9
- package/dist/docs/interfaces/DecodedToken2022Mint.html +6 -6
- package/dist/docs/interfaces/DecodedTokenAccount.html +9 -9
- package/dist/docs/interfaces/DefaultAccountStateExt.html +2 -2
- package/dist/docs/interfaces/Disposable.html +2 -2
- package/dist/docs/interfaces/EndpointConnectConfig.html +5 -5
- package/dist/docs/interfaces/EpochInfo.html +7 -7
- package/dist/docs/interfaces/EpochSchedule.html +2 -2
- package/dist/docs/interfaces/FactoryProvider.html +2 -2
- package/dist/docs/interfaces/FetchedMint.html +6 -6
- package/dist/docs/interfaces/FetchedTokenAccount.html +6 -6
- package/dist/docs/interfaces/FreezeThawParams.html +6 -6
- package/dist/docs/interfaces/GetAccountInfoOpts.html +6 -6
- package/dist/docs/interfaces/GetAssetsByAuthorityParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByCreatorParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByGroupParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByOwnerParams.html +2 -2
- package/dist/docs/interfaces/GetBlockOpts.html +6 -6
- package/dist/docs/interfaces/GetBlockProductionOpts.html +6 -6
- package/dist/docs/interfaces/GetMultipleAccountsOpts.html +6 -6
- package/dist/docs/interfaces/GetProgramAccountsOpts.html +6 -6
- package/dist/docs/interfaces/GetSignatureStatusesOpts.html +6 -6
- package/dist/docs/interfaces/GetSignaturesOpts.html +7 -7
- package/dist/docs/interfaces/GetTokenAccountsParams.html +2 -2
- package/dist/docs/interfaces/GetTransactionOpts.html +6 -6
- package/dist/docs/interfaces/GeyserParserConfig.html +6 -6
- package/dist/docs/interfaces/GeyserParserEvents.html +9 -9
- package/dist/docs/interfaces/GeyserParserStats.html +2 -2
- package/dist/docs/interfaces/GrpcCallOptions.html +2 -2
- package/dist/docs/interfaces/GrpcTransportConfig.html +6 -6
- package/dist/docs/interfaces/ImmutableOwnerExt.html +2 -2
- package/dist/docs/interfaces/InflationGovernor.html +2 -2
- package/dist/docs/interfaces/InflationRate.html +2 -2
- package/dist/docs/interfaces/InflationReward.html +2 -2
- package/dist/docs/interfaces/InitializeAccountParams.html +5 -5
- package/dist/docs/interfaces/InitializeMintParams.html +6 -6
- package/dist/docs/interfaces/InitializeNonceParams.html +3 -3
- package/dist/docs/interfaces/InterestBearingConfigExt.html +2 -2
- package/dist/docs/interfaces/LatencyProbeResult.html +2 -2
- package/dist/docs/interfaces/LeakReport.html +5 -5
- package/dist/docs/interfaces/LogsNotification.html +2 -2
- package/dist/docs/interfaces/LogsSubParams.html +2 -2
- package/dist/docs/interfaces/MemoTransferExt.html +2 -2
- package/dist/docs/interfaces/MemoryGuardConfig.html +4 -4
- package/dist/docs/interfaces/MetadataPointerExt.html +2 -2
- package/dist/docs/interfaces/MintCloseAuthorityExt.html +2 -2
- package/dist/docs/interfaces/MintToCheckedParams.html +8 -8
- package/dist/docs/interfaces/MintToParams.html +7 -7
- package/dist/docs/interfaces/NonTransferableExt.html +2 -2
- package/dist/docs/interfaces/PaginationOpts.html +2 -2
- package/dist/docs/interfaces/ParsedAccountUpdate.html +16 -16
- package/dist/docs/interfaces/ParsedBlockMeta.html +2 -2
- package/dist/docs/interfaces/ParsedEntry.html +2 -2
- package/dist/docs/interfaces/ParsedInstruction.html +9 -9
- package/dist/docs/interfaces/ParsedSlotUpdate.html +3 -3
- package/dist/docs/interfaces/ParsedTransaction.html +19 -19
- package/dist/docs/interfaces/PerfSample.html +2 -2
- package/dist/docs/interfaces/PermanentDelegateExt.html +2 -2
- package/dist/docs/interfaces/ProgramAccount.html +2 -2
- package/dist/docs/interfaces/ProgramNotification.html +2 -2
- package/dist/docs/interfaces/ProgramSubParams.html +2 -2
- package/dist/docs/interfaces/ProgramsBundle.html +33 -33
- package/dist/docs/interfaces/RawAccountInfo.html +2 -2
- package/dist/docs/interfaces/RawBlockMeta.html +2 -2
- package/dist/docs/interfaces/RawBuffer.html +2 -2
- package/dist/docs/interfaces/RawCompiledInstruction.html +2 -2
- package/dist/docs/interfaces/RawEntry.html +2 -2
- package/dist/docs/interfaces/RawGeyserUpdate.html +2 -2
- package/dist/docs/interfaces/RawInnerInstruction.html +2 -2
- package/dist/docs/interfaces/RawSlotInfo.html +2 -2
- package/dist/docs/interfaces/RawTimestamp.html +2 -2
- package/dist/docs/interfaces/RawTokenBalance.html +2 -2
- package/dist/docs/interfaces/RawTransactionInfo.html +2 -2
- package/dist/docs/interfaces/ReactAdapterConfig.html +2 -2
- package/dist/docs/interfaces/RecoverNestedParams.html +7 -7
- package/dist/docs/interfaces/RefRegistryConfig.html +2 -2
- package/dist/docs/interfaces/RefStats.html +7 -7
- package/dist/docs/interfaces/RequestHeapFrameParams.html +2 -2
- package/dist/docs/interfaces/ResolveMiddleware.html +1 -1
- package/dist/docs/interfaces/RevokeParams.html +5 -5
- package/dist/docs/interfaces/RootNotification.html +2 -2
- package/dist/docs/interfaces/RootSubParams.html +1 -1
- package/dist/docs/interfaces/RpcContext.html +2 -2
- package/dist/docs/interfaces/RpcError.html +4 -4
- package/dist/docs/interfaces/RpcRequest.html +3 -3
- package/dist/docs/interfaces/RpcResponse.html +2 -2
- package/dist/docs/interfaces/SendTransactionOpts.html +6 -6
- package/dist/docs/interfaces/ServerAdapterConfig.html +3 -3
- package/dist/docs/interfaces/ServiceBinding.html +6 -6
- package/dist/docs/interfaces/ServiceRegistration.html +3 -3
- package/dist/docs/interfaces/ServiceResolver.html +6 -6
- package/dist/docs/interfaces/ServiceToken.html +4 -4
- package/dist/docs/interfaces/SetComputeUnitLimitParams.html +2 -2
- package/dist/docs/interfaces/SetComputeUnitPriceParams.html +2 -2
- package/dist/docs/interfaces/SetLoadedAccountsDataSizeLimitParams.html +2 -2
- package/dist/docs/interfaces/SignatureInfo.html +7 -7
- package/dist/docs/interfaces/SignatureNotification.html +2 -2
- package/dist/docs/interfaces/SignatureStatus.html +5 -5
- package/dist/docs/interfaces/SignatureSubParams.html +2 -2
- package/dist/docs/interfaces/SignaturesForAssetParams.html +2 -2
- package/dist/docs/interfaces/SimulateResult.html +2 -2
- package/dist/docs/interfaces/SimulateTransactionOpts.html +7 -7
- package/dist/docs/interfaces/SingletonOptions.html +2 -2
- package/dist/docs/interfaces/SlotNotification.html +2 -2
- package/dist/docs/interfaces/SlotSubParams.html +1 -1
- package/dist/docs/interfaces/SortOpts.html +2 -2
- package/dist/docs/interfaces/StakeAuthorized.html +2 -2
- package/dist/docs/interfaces/StakeDelegation.html +3 -3
- package/dist/docs/interfaces/StakeLockup.html +4 -4
- package/dist/docs/interfaces/StakeMeta.html +2 -2
- package/dist/docs/interfaces/Supply.html +5 -5
- package/dist/docs/interfaces/SynapseClientConfig.html +9 -9
- package/dist/docs/interfaces/SynapseClientLike.html +2 -2
- package/dist/docs/interfaces/SynapseEndpoint.html +7 -7
- package/dist/docs/interfaces/SyncNativeParams.html +3 -3
- package/dist/docs/interfaces/SystemTransferParams.html +4 -4
- package/dist/docs/interfaces/TokenAccount.html +3 -3
- package/dist/docs/interfaces/TokenAccountsByOwnerResult.html +2 -2
- package/dist/docs/interfaces/TokenAmount.html +5 -5
- package/dist/docs/interfaces/TokenBalanceChange.html +2 -2
- package/dist/docs/interfaces/TokenTransferParams.html +7 -7
- package/dist/docs/interfaces/TransactionInstruction.html +4 -4
- package/dist/docs/interfaces/TransactionMeta.html +11 -11
- package/dist/docs/interfaces/TransferCheckedParams.html +9 -9
- package/dist/docs/interfaces/TransferFeeAmount.html +2 -2
- package/dist/docs/interfaces/TransferFeeConfig.html +2 -2
- package/dist/docs/interfaces/TransportConfig.html +7 -7
- package/dist/docs/interfaces/UnknownExtension.html +2 -2
- package/dist/docs/interfaces/ValueProvider.html +2 -2
- package/dist/docs/interfaces/VoteAccount.html +9 -9
- package/dist/docs/interfaces/VoteAccountsResult.html +3 -3
- package/dist/docs/interfaces/WithdrawNonceParams.html +5 -5
- package/dist/docs/interfaces/WsConfig.html +6 -6
- package/dist/docs/media/CHANGELOG.md +103 -0
- package/dist/docs/types/AccountFetchOpts.html +1 -1
- package/dist/docs/types/AccountFilter.html +1 -1
- package/dist/docs/types/Base58.html +1 -1
- package/dist/docs/types/Brand.html +1 -1
- package/dist/docs/types/Commitment.html +1 -1
- package/dist/docs/types/DasSortBy.html +1 -1
- package/dist/docs/types/DasSortDirection.html +1 -1
- package/dist/docs/types/DataSizeFilter.html +1 -1
- package/dist/docs/types/DecodedExtension.html +1 -1
- package/dist/docs/types/Encoding.html +1 -1
- package/dist/docs/types/Epoch.html +1 -1
- package/dist/docs/types/Lamports.html +1 -1
- package/dist/docs/types/LogsFilter.html +1 -1
- package/dist/docs/types/MemcmpFilter.html +1 -1
- package/dist/docs/types/NonceState.html +1 -1
- package/dist/docs/types/ParsedGeyserUpdate.html +1 -1
- package/dist/docs/types/Pubkey.html +1 -1
- package/dist/docs/types/RuntimeEnv.html +1 -1
- package/dist/docs/types/ServiceLifecycle.html +1 -1
- package/dist/docs/types/ServiceProvider.html +1 -1
- package/dist/docs/types/Signature.html +1 -1
- package/dist/docs/types/Slot.html +1 -1
- package/dist/docs/types/StakeAccountType.html +1 -1
- package/dist/docs/types/SubscriptionId.html +1 -1
- package/dist/docs/types/TokenAccountState.html +1 -1
- package/dist/docs/types/TransactionDetail.html +1 -1
- package/dist/docs/types/UnaryMethod.html +1 -1
- package/dist/docs/types/UnixTimestamp.html +1 -1
- package/dist/docs/types/WsNotification.html +1 -1
- package/dist/docs/variables/ASSOCIATED_TOKEN_PROGRAM.html +1 -1
- package/dist/docs/variables/AssociatedToken.html +4 -4
- package/dist/docs/variables/COMPUTE_BUDGET_PROGRAM.html +1 -1
- package/dist/docs/variables/ComputeBudget.html +5 -5
- package/dist/docs/variables/JUPITER_PROGRAMS.html +1 -1
- package/dist/docs/variables/KNOWN_PROGRAMS.html +1 -1
- package/dist/docs/variables/KNOWN_PROGRAMS_COUNT.html +1 -1
- package/dist/docs/variables/LOOKUP_TABLE_HEADER_SIZE.html +1 -1
- package/dist/docs/variables/LOOKUP_TABLE_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/MARINADE_PROGRAMS.html +1 -1
- package/dist/docs/variables/MAX_MULTISIG_SIGNERS.html +1 -1
- package/dist/docs/variables/MEMO_PROGRAM_V1.html +1 -1
- package/dist/docs/variables/MEMO_PROGRAM_V2.html +1 -1
- package/dist/docs/variables/METAPLEX_PROGRAMS.html +1 -1
- package/dist/docs/variables/METEORA_PROGRAMS.html +1 -1
- package/dist/docs/variables/MINT_SIZE.html +1 -1
- package/dist/docs/variables/MULTISIG_SIZE.html +1 -1
- package/dist/docs/variables/Memo.html +2 -2
- package/dist/docs/variables/NONCE_ACCOUNT_SIZE.html +1 -1
- package/dist/docs/variables/ORCA_PROGRAMS.html +1 -1
- package/dist/docs/variables/OTHER_PROGRAMS.html +1 -1
- package/dist/docs/variables/RAYDIUM_PROGRAMS.html +1 -1
- package/dist/docs/variables/SDK_USER_AGENT.html +1 -1
- package/dist/docs/variables/SPL_PROGRAMS.html +1 -1
- package/dist/docs/variables/STAKE_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/SYNAPSE_DEVNET_EU.html +1 -1
- package/dist/docs/variables/SYNAPSE_DEVNET_US.html +1 -1
- package/dist/docs/variables/SYNAPSE_ENDPOINTS.html +1 -1
- package/dist/docs/variables/SYNAPSE_MAINNET_EU.html +1 -1
- package/dist/docs/variables/SYNAPSE_MAINNET_US.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAM.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAMS.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/SplToken.html +16 -16
- package/dist/docs/variables/SystemProgram.html +10 -10
- package/dist/docs/variables/TOKEN_2022_PROGRAM.html +1 -1
- package/dist/docs/variables/TOKEN_2022_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/TOKEN_ACCOUNT_SIZE.html +1 -1
- package/dist/docs/variables/TOKEN_PROGRAM.html +1 -1
- package/dist/docs/variables/TOKEN_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/Tokens.html +1 -1
- package/dist/esm/ai/actions/server.d.ts.map +1 -1
- package/dist/esm/ai/actions/server.js +5 -3
- package/dist/esm/ai/actions/server.js.map +1 -1
- package/dist/esm/ai/gateway/index.d.ts.map +1 -1
- package/dist/esm/ai/gateway/index.js.map +1 -1
- package/dist/esm/ai/gateway/x402/client.d.ts.map +1 -1
- package/dist/esm/ai/gateway/x402/client.js +0 -3
- package/dist/esm/ai/gateway/x402/client.js.map +1 -1
- package/dist/esm/ai/gateway/x402/paywall.d.ts.map +1 -1
- package/dist/esm/ai/gateway/x402/paywall.js.map +1 -1
- package/dist/esm/ai/index.d.ts +1 -1
- package/dist/esm/ai/index.d.ts.map +1 -1
- package/dist/esm/ai/index.js +9 -11
- package/dist/esm/ai/index.js.map +1 -1
- package/dist/esm/ai/intents/executor.js.map +1 -1
- package/dist/esm/ai/intents/parser.d.ts.map +1 -1
- package/dist/esm/ai/intents/parser.js.map +1 -1
- package/dist/esm/ai/intents/planner.js.map +1 -1
- package/dist/esm/ai/mcp/client.js +1 -1
- package/dist/esm/ai/mcp/client.js.map +1 -1
- package/dist/esm/ai/persistence/postgresql.js.map +1 -1
- package/dist/esm/ai/plugins/registry.js +1 -1
- package/dist/esm/ai/plugins/registry.js.map +1 -1
- package/dist/esm/ai/sap/client.d.ts +197 -0
- package/dist/esm/ai/sap/client.d.ts.map +1 -0
- package/dist/esm/ai/sap/client.js +330 -0
- package/dist/esm/ai/sap/client.js.map +1 -0
- package/dist/esm/ai/sap/index.d.ts +69 -52
- package/dist/esm/ai/sap/index.d.ts.map +1 -1
- package/dist/esm/ai/sap/index.js +68 -49
- package/dist/esm/ai/sap/index.js.map +1 -1
- package/dist/esm/ai/sap/provider.d.ts +180 -0
- package/dist/esm/ai/sap/provider.d.ts.map +1 -0
- package/dist/esm/ai/sap/provider.js +215 -0
- package/dist/esm/ai/sap/provider.js.map +1 -0
- package/dist/esm/ai/sap/types.d.ts +120 -384
- package/dist/esm/ai/sap/types.d.ts.map +1 -1
- package/dist/esm/ai/sap/types.js +18 -195
- package/dist/esm/ai/sap/types.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/shared.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/shared.js +4 -1
- package/dist/esm/ai/tools/protocols/shared.js.map +1 -1
- package/dist/esm/ai/tools/protocols/solana-programs/tools.js.map +1 -1
- package/dist/esm/context/container.d.ts.map +1 -1
- package/dist/esm/context/container.js.map +1 -1
- package/dist/esm/grpc/parser/geyser-parser.d.ts.map +1 -1
- package/dist/esm/grpc/parser/geyser-parser.js.map +1 -1
- package/dist/esm/next/index.d.ts.map +1 -1
- package/dist/esm/next/index.js +7 -1
- package/dist/esm/next/index.js.map +1 -1
- package/dist/esm/programs/index.d.ts.map +1 -1
- package/dist/esm/programs/index.js.map +1 -1
- package/dist/esm/utils/helpers.js.map +1 -1
- package/package.json +31 -20
- package/dist/cjs/ai/sap/adapter.d.ts +0 -140
- package/dist/cjs/ai/sap/adapter.d.ts.map +0 -1
- package/dist/cjs/ai/sap/adapter.js +0 -181
- package/dist/cjs/ai/sap/adapter.js.map +0 -1
- package/dist/cjs/ai/sap/discovery.d.ts +0 -165
- package/dist/cjs/ai/sap/discovery.d.ts.map +0 -1
- package/dist/cjs/ai/sap/discovery.js +0 -316
- package/dist/cjs/ai/sap/discovery.js.map +0 -1
- package/dist/cjs/ai/sap/pda.d.ts +0 -205
- package/dist/cjs/ai/sap/pda.d.ts.map +0 -1
- package/dist/cjs/ai/sap/pda.js +0 -547
- package/dist/cjs/ai/sap/pda.js.map +0 -1
- package/dist/cjs/ai/sap/program.d.ts +0 -153
- package/dist/cjs/ai/sap/program.d.ts.map +0 -1
- package/dist/cjs/ai/sap/program.js +0 -227
- package/dist/cjs/ai/sap/program.js.map +0 -1
- package/dist/cjs/ai/sap/registry.d.ts +0 -218
- package/dist/cjs/ai/sap/registry.d.ts.map +0 -1
- package/dist/cjs/ai/sap/registry.js +0 -519
- package/dist/cjs/ai/sap/registry.js.map +0 -1
- package/dist/cjs/ai/sap/scoring.d.ts +0 -138
- package/dist/cjs/ai/sap/scoring.d.ts.map +0 -1
- package/dist/cjs/ai/sap/scoring.js +0 -266
- package/dist/cjs/ai/sap/scoring.js.map +0 -1
- package/dist/cjs/ai/sap/subnetwork.d.ts +0 -201
- package/dist/cjs/ai/sap/subnetwork.d.ts.map +0 -1
- package/dist/cjs/ai/sap/subnetwork.js +0 -365
- package/dist/cjs/ai/sap/subnetwork.js.map +0 -1
- package/dist/cjs/ai/sap/validator.d.ts +0 -160
- package/dist/cjs/ai/sap/validator.d.ts.map +0 -1
- package/dist/cjs/ai/sap/validator.js +0 -619
- package/dist/cjs/ai/sap/validator.js.map +0 -1
- package/dist/esm/ai/sap/adapter.d.ts +0 -140
- package/dist/esm/ai/sap/adapter.d.ts.map +0 -1
- package/dist/esm/ai/sap/adapter.js +0 -177
- package/dist/esm/ai/sap/adapter.js.map +0 -1
- package/dist/esm/ai/sap/discovery.d.ts +0 -165
- package/dist/esm/ai/sap/discovery.d.ts.map +0 -1
- package/dist/esm/ai/sap/discovery.js +0 -311
- package/dist/esm/ai/sap/discovery.js.map +0 -1
- package/dist/esm/ai/sap/pda.d.ts +0 -205
- package/dist/esm/ai/sap/pda.d.ts.map +0 -1
- package/dist/esm/ai/sap/pda.js +0 -535
- package/dist/esm/ai/sap/pda.js.map +0 -1
- package/dist/esm/ai/sap/program.d.ts +0 -153
- package/dist/esm/ai/sap/program.d.ts.map +0 -1
- package/dist/esm/ai/sap/program.js +0 -222
- package/dist/esm/ai/sap/program.js.map +0 -1
- package/dist/esm/ai/sap/registry.d.ts +0 -218
- package/dist/esm/ai/sap/registry.d.ts.map +0 -1
- package/dist/esm/ai/sap/registry.js +0 -515
- package/dist/esm/ai/sap/registry.js.map +0 -1
- package/dist/esm/ai/sap/scoring.d.ts +0 -138
- package/dist/esm/ai/sap/scoring.d.ts.map +0 -1
- package/dist/esm/ai/sap/scoring.js +0 -262
- package/dist/esm/ai/sap/scoring.js.map +0 -1
- package/dist/esm/ai/sap/subnetwork.d.ts +0 -201
- package/dist/esm/ai/sap/subnetwork.d.ts.map +0 -1
- package/dist/esm/ai/sap/subnetwork.js +0 -361
- package/dist/esm/ai/sap/subnetwork.js.map +0 -1
- package/dist/esm/ai/sap/validator.d.ts +0 -160
- package/dist/esm/ai/sap/validator.d.ts.map +0 -1
- package/dist/esm/ai/sap/validator.js +0 -614
- package/dist/esm/ai/sap/validator.js.map +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/sap/provider
|
|
3
|
+
* @description HMR-safe factories and React integration blueprints for SAP.
|
|
4
|
+
*
|
|
5
|
+
* Provides:
|
|
6
|
+
* - **`createSapProvider`** — HMR-safe singleton factory for `SynapseAnchorSap`
|
|
7
|
+
* (follows the same pattern as `createSynapseProvider` from `@oobe-protocol-labs/synapse-client-sdk/next`)
|
|
8
|
+
* - **`createSapContextBlueprint`** — Returns a typed React context + hook
|
|
9
|
+
* factory that consumers wire into their own Next.js providers
|
|
10
|
+
*
|
|
11
|
+
* The SDK does **not** depend on React — these utilities produce typed
|
|
12
|
+
* blueprints that consumers implement with their own React installation.
|
|
13
|
+
*
|
|
14
|
+
* @since 2.1.0
|
|
15
|
+
*/
|
|
16
|
+
import { type SingletonOptions } from '../../utils/helpers';
|
|
17
|
+
import { SynapseAnchorSap } from './client';
|
|
18
|
+
import type { SapBridgeConfig, SapProviderConfig, SapWallet, SapContextValue } from './types';
|
|
19
|
+
/**
|
|
20
|
+
* Create an HMR-safe `SynapseAnchorSap` singleton factory.
|
|
21
|
+
*
|
|
22
|
+
* Stores the instance on `globalThis` to survive hot-module reloads
|
|
23
|
+
* in Next.js development. Identical in spirit to
|
|
24
|
+
* `createSynapseProvider` and `createGatewayProvider`.
|
|
25
|
+
*
|
|
26
|
+
* **Server-side only** — requires a static wallet (e.g., a Keypair
|
|
27
|
+
* loaded from an environment variable). For client-side usage with
|
|
28
|
+
* wallet-adapter, use {@link createSapContextBlueprint} instead.
|
|
29
|
+
*
|
|
30
|
+
* @param wallet - Server wallet with signing capability
|
|
31
|
+
* @param config - Network, region, and SAP configuration
|
|
32
|
+
* @param opts - Singleton options (version for cache busting)
|
|
33
|
+
* @returns A zero-arg getter that always returns the same instance
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // lib/sap.ts (Next.js server)
|
|
38
|
+
* import { createSapProvider } from '@oobe-protocol-labs/synapse-client-sdk/ai/sap';
|
|
39
|
+
* import { loadWallet } from './wallet';
|
|
40
|
+
*
|
|
41
|
+
* export const getSap = createSapProvider(loadWallet(), {
|
|
42
|
+
* network: SynapseNetwork.Mainnet,
|
|
43
|
+
* commitment: 'confirmed',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // API route
|
|
47
|
+
* export async function GET() {
|
|
48
|
+
* const sap = getSap();
|
|
49
|
+
* const agent = await sap.agent.fetch();
|
|
50
|
+
* return Response.json(agent);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function createSapProvider(wallet: SapWallet, config?: SapProviderConfig, opts?: SingletonOptions): () => SynapseAnchorSap;
|
|
55
|
+
/**
|
|
56
|
+
* Blueprint result returned by {@link createSapContextBlueprint}.
|
|
57
|
+
*
|
|
58
|
+
* Contains everything needed to wire SAP into a React tree,
|
|
59
|
+
* without importing React in the SDK itself.
|
|
60
|
+
*/
|
|
61
|
+
export interface SapContextBlueprint {
|
|
62
|
+
/**
|
|
63
|
+
* The default context value (disconnected state).
|
|
64
|
+
* Use as the initial value for `React.createContext<SapContextValue>()`.
|
|
65
|
+
*/
|
|
66
|
+
defaultValue: SapContextValue<SynapseAnchorSap>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a state manager for the SAP provider.
|
|
69
|
+
*
|
|
70
|
+
* Call this inside your provider component to get `connect`,
|
|
71
|
+
* `disconnect`, and the current context value.
|
|
72
|
+
*
|
|
73
|
+
* @returns Object with `{ value, connect, disconnect }` — pass
|
|
74
|
+
* `value` to your context provider.
|
|
75
|
+
*/
|
|
76
|
+
createManager(): SapStateManager;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* State manager returned by `SapContextBlueprint.createManager()`.
|
|
80
|
+
*
|
|
81
|
+
* This is a plain-object state machine — no React hooks inside.
|
|
82
|
+
* Use it in a `useEffect` + `useState` pattern in your provider.
|
|
83
|
+
*/
|
|
84
|
+
export interface SapStateManager {
|
|
85
|
+
/** Connect to SAP with the given wallet. Creates a SynapseAnchorSap. */
|
|
86
|
+
connect(wallet: SapWallet): void;
|
|
87
|
+
/** Disconnect and clear the client. */
|
|
88
|
+
disconnect(): void;
|
|
89
|
+
/** Get the current context value (snapshot). */
|
|
90
|
+
getValue(): SapContextValue<SynapseAnchorSap>;
|
|
91
|
+
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
92
|
+
subscribe(listener: () => void): () => void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a React context blueprint for SAP integration.
|
|
96
|
+
*
|
|
97
|
+
* Returns a blueprint object with the default context value and a
|
|
98
|
+
* state manager factory. The consumer wires these into their own
|
|
99
|
+
* React provider using `createContext`, `useState`, and `useEffect`.
|
|
100
|
+
*
|
|
101
|
+
* This approach keeps the SDK free of React dependencies while
|
|
102
|
+
* providing full type safety and a clear integration pattern.
|
|
103
|
+
*
|
|
104
|
+
* @param config - SAP bridge configuration (network, region, etc.)
|
|
105
|
+
* @returns Blueprint with default value and manager factory
|
|
106
|
+
*
|
|
107
|
+
* @example Next.js App Router provider
|
|
108
|
+
* ```tsx
|
|
109
|
+
* // app/providers/sap-provider.tsx
|
|
110
|
+
* 'use client';
|
|
111
|
+
*
|
|
112
|
+
* import { createContext, useContext, useState, useCallback, useMemo, type ReactNode } from 'react';
|
|
113
|
+
* import { useWallet } from '@solana/wallet-adapter-react';
|
|
114
|
+
* import {
|
|
115
|
+
* createSapContextBlueprint,
|
|
116
|
+
* type SapContextValue,
|
|
117
|
+
* type SynapseAnchorSap,
|
|
118
|
+
* } from '@oobe-protocol-labs/synapse-client-sdk/ai/sap';
|
|
119
|
+
* import { SynapseNetwork } from '@oobe-protocol-labs/synapse-client-sdk/utils';
|
|
120
|
+
*
|
|
121
|
+
* const blueprint = createSapContextBlueprint({ network: SynapseNetwork.Mainnet });
|
|
122
|
+
* const SapContext = createContext<SapContextValue<SynapseAnchorSap>>(blueprint.defaultValue);
|
|
123
|
+
*
|
|
124
|
+
* export function SapProvider({ children }: { children: ReactNode }) {
|
|
125
|
+
* const { wallet, connected } = useWallet();
|
|
126
|
+
* const [client, setClient] = useState<SynapseAnchorSap | null>(null);
|
|
127
|
+
* const [loading, setLoading] = useState(false);
|
|
128
|
+
* const [error, setError] = useState<Error | null>(null);
|
|
129
|
+
*
|
|
130
|
+
* const connect = useCallback(async (w: any) => {
|
|
131
|
+
* setLoading(true);
|
|
132
|
+
* setError(null);
|
|
133
|
+
* try {
|
|
134
|
+
* const mgr = blueprint.createManager();
|
|
135
|
+
* mgr.connect(w);
|
|
136
|
+
* setClient(mgr.getValue().client);
|
|
137
|
+
* } catch (e) {
|
|
138
|
+
* setError(e instanceof Error ? e : new Error(String(e)));
|
|
139
|
+
* } finally {
|
|
140
|
+
* setLoading(false);
|
|
141
|
+
* }
|
|
142
|
+
* }, []);
|
|
143
|
+
*
|
|
144
|
+
* const disconnect = useCallback(() => {
|
|
145
|
+
* setClient(null);
|
|
146
|
+
* setError(null);
|
|
147
|
+
* }, []);
|
|
148
|
+
*
|
|
149
|
+
* const value = useMemo(() => ({
|
|
150
|
+
* client,
|
|
151
|
+
* loading,
|
|
152
|
+
* error,
|
|
153
|
+
* connect,
|
|
154
|
+
* disconnect,
|
|
155
|
+
* }), [client, loading, error, connect, disconnect]);
|
|
156
|
+
*
|
|
157
|
+
* return <SapContext.Provider value={value}>{children}</SapContext.Provider>;
|
|
158
|
+
* }
|
|
159
|
+
*
|
|
160
|
+
* export const useSap = () => useContext(SapContext);
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example Using the hook
|
|
164
|
+
* ```tsx
|
|
165
|
+
* 'use client';
|
|
166
|
+
* import { useSap } from './sap-provider';
|
|
167
|
+
*
|
|
168
|
+
* export function AgentDashboard() {
|
|
169
|
+
* const { client, loading, error } = useSap();
|
|
170
|
+
*
|
|
171
|
+
* if (!client) return <p>Connect your wallet to use SAP</p>;
|
|
172
|
+
* if (loading) return <p>Initializing SAP...</p>;
|
|
173
|
+
* if (error) return <p>Error: {error.message}</p>;
|
|
174
|
+
*
|
|
175
|
+
* return <AgentPanel sap={client} />;
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export declare function createSapContextBlueprint(config?: Omit<SapBridgeConfig, 'wallet'>): SapContextBlueprint;
|
|
180
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/ai/sap/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,eAAe,EAChB,MAAM,SAAS,CAAC;AAMjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,iBAAiB,EAC1B,IAAI,CAAC,EAAE,gBAAgB,GACtB,MAAM,gBAAgB,CAUxB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,YAAY,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAEhD;;;;;;;;OAQG;IACH,aAAa,IAAI,eAAe,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,uCAAuC;IACvC,UAAU,IAAI,IAAI,CAAC;IACnB,gDAAgD;IAChD,QAAQ,IAAI,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC9C,mEAAmE;IACnE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GACvC,mBAAmB,CAwErB"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/sap/provider
|
|
3
|
+
* @description HMR-safe factories and React integration blueprints for SAP.
|
|
4
|
+
*
|
|
5
|
+
* Provides:
|
|
6
|
+
* - **`createSapProvider`** — HMR-safe singleton factory for `SynapseAnchorSap`
|
|
7
|
+
* (follows the same pattern as `createSynapseProvider` from `@oobe-protocol-labs/synapse-client-sdk/next`)
|
|
8
|
+
* - **`createSapContextBlueprint`** — Returns a typed React context + hook
|
|
9
|
+
* factory that consumers wire into their own Next.js providers
|
|
10
|
+
*
|
|
11
|
+
* The SDK does **not** depend on React — these utilities produce typed
|
|
12
|
+
* blueprints that consumers implement with their own React installation.
|
|
13
|
+
*
|
|
14
|
+
* @since 2.1.0
|
|
15
|
+
*/
|
|
16
|
+
import { createSingleton } from '../../utils/helpers.js';
|
|
17
|
+
import { SynapseAnchorSap } from './client.js';
|
|
18
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
19
|
+
* createSapProvider — HMR-safe singleton (server-side / Node.js)
|
|
20
|
+
* ═══════════════════════════════════════════════════════════════ */
|
|
21
|
+
/**
|
|
22
|
+
* Create an HMR-safe `SynapseAnchorSap` singleton factory.
|
|
23
|
+
*
|
|
24
|
+
* Stores the instance on `globalThis` to survive hot-module reloads
|
|
25
|
+
* in Next.js development. Identical in spirit to
|
|
26
|
+
* `createSynapseProvider` and `createGatewayProvider`.
|
|
27
|
+
*
|
|
28
|
+
* **Server-side only** — requires a static wallet (e.g., a Keypair
|
|
29
|
+
* loaded from an environment variable). For client-side usage with
|
|
30
|
+
* wallet-adapter, use {@link createSapContextBlueprint} instead.
|
|
31
|
+
*
|
|
32
|
+
* @param wallet - Server wallet with signing capability
|
|
33
|
+
* @param config - Network, region, and SAP configuration
|
|
34
|
+
* @param opts - Singleton options (version for cache busting)
|
|
35
|
+
* @returns A zero-arg getter that always returns the same instance
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* // lib/sap.ts (Next.js server)
|
|
40
|
+
* import { createSapProvider } from '@oobe-protocol-labs/synapse-client-sdk/ai/sap';
|
|
41
|
+
* import { loadWallet } from './wallet.js';
|
|
42
|
+
*
|
|
43
|
+
* export const getSap = createSapProvider(loadWallet(), {
|
|
44
|
+
* network: SynapseNetwork.Mainnet,
|
|
45
|
+
* commitment: 'confirmed',
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // API route
|
|
49
|
+
* export async function GET() {
|
|
50
|
+
* const sap = getSap();
|
|
51
|
+
* const agent = await sap.agent.fetch();
|
|
52
|
+
* return Response.json(agent);
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function createSapProvider(wallet, config, opts) {
|
|
57
|
+
const singletonOpts = {
|
|
58
|
+
...opts,
|
|
59
|
+
...(config?.version != null ? { version: Number(config.version) || 0 } : {}),
|
|
60
|
+
};
|
|
61
|
+
return createSingleton('__synapse_sap__', () => SynapseAnchorSap.create({ wallet, ...config }), singletonOpts);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a React context blueprint for SAP integration.
|
|
65
|
+
*
|
|
66
|
+
* Returns a blueprint object with the default context value and a
|
|
67
|
+
* state manager factory. The consumer wires these into their own
|
|
68
|
+
* React provider using `createContext`, `useState`, and `useEffect`.
|
|
69
|
+
*
|
|
70
|
+
* This approach keeps the SDK free of React dependencies while
|
|
71
|
+
* providing full type safety and a clear integration pattern.
|
|
72
|
+
*
|
|
73
|
+
* @param config - SAP bridge configuration (network, region, etc.)
|
|
74
|
+
* @returns Blueprint with default value and manager factory
|
|
75
|
+
*
|
|
76
|
+
* @example Next.js App Router provider
|
|
77
|
+
* ```tsx
|
|
78
|
+
* // app/providers/sap-provider.tsx
|
|
79
|
+
* 'use client';
|
|
80
|
+
*
|
|
81
|
+
* import { createContext, useContext, useState, useCallback, useMemo, type ReactNode } from 'react';
|
|
82
|
+
* import { useWallet } from '@solana/wallet-adapter-react';
|
|
83
|
+
* import {
|
|
84
|
+
* createSapContextBlueprint,
|
|
85
|
+
* type SapContextValue,
|
|
86
|
+
* type SynapseAnchorSap,
|
|
87
|
+
* } from '@oobe-protocol-labs/synapse-client-sdk/ai/sap';
|
|
88
|
+
* import { SynapseNetwork } from '@oobe-protocol-labs/synapse-client-sdk/utils';
|
|
89
|
+
*
|
|
90
|
+
* const blueprint = createSapContextBlueprint({ network: SynapseNetwork.Mainnet });
|
|
91
|
+
* const SapContext = createContext<SapContextValue<SynapseAnchorSap>>(blueprint.defaultValue);
|
|
92
|
+
*
|
|
93
|
+
* export function SapProvider({ children }: { children: ReactNode }) {
|
|
94
|
+
* const { wallet, connected } = useWallet();
|
|
95
|
+
* const [client, setClient] = useState<SynapseAnchorSap | null>(null);
|
|
96
|
+
* const [loading, setLoading] = useState(false);
|
|
97
|
+
* const [error, setError] = useState<Error | null>(null);
|
|
98
|
+
*
|
|
99
|
+
* const connect = useCallback(async (w: any) => {
|
|
100
|
+
* setLoading(true);
|
|
101
|
+
* setError(null);
|
|
102
|
+
* try {
|
|
103
|
+
* const mgr = blueprint.createManager();
|
|
104
|
+
* mgr.connect(w);
|
|
105
|
+
* setClient(mgr.getValue().client);
|
|
106
|
+
* } catch (e) {
|
|
107
|
+
* setError(e instanceof Error ? e : new Error(String(e)));
|
|
108
|
+
* } finally {
|
|
109
|
+
* setLoading(false);
|
|
110
|
+
* }
|
|
111
|
+
* }, []);
|
|
112
|
+
*
|
|
113
|
+
* const disconnect = useCallback(() => {
|
|
114
|
+
* setClient(null);
|
|
115
|
+
* setError(null);
|
|
116
|
+
* }, []);
|
|
117
|
+
*
|
|
118
|
+
* const value = useMemo(() => ({
|
|
119
|
+
* client,
|
|
120
|
+
* loading,
|
|
121
|
+
* error,
|
|
122
|
+
* connect,
|
|
123
|
+
* disconnect,
|
|
124
|
+
* }), [client, loading, error, connect, disconnect]);
|
|
125
|
+
*
|
|
126
|
+
* return <SapContext.Provider value={value}>{children}</SapContext.Provider>;
|
|
127
|
+
* }
|
|
128
|
+
*
|
|
129
|
+
* export const useSap = () => useContext(SapContext);
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example Using the hook
|
|
133
|
+
* ```tsx
|
|
134
|
+
* 'use client';
|
|
135
|
+
* import { useSap } from './sap-provider.js';
|
|
136
|
+
*
|
|
137
|
+
* export function AgentDashboard() {
|
|
138
|
+
* const { client, loading, error } = useSap();
|
|
139
|
+
*
|
|
140
|
+
* if (!client) return <p>Connect your wallet to use SAP</p>;
|
|
141
|
+
* if (loading) return <p>Initializing SAP...</p>;
|
|
142
|
+
* if (error) return <p>Error: {error.message}</p>;
|
|
143
|
+
*
|
|
144
|
+
* return <AgentPanel sap={client} />;
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export function createSapContextBlueprint(config) {
|
|
149
|
+
const defaultValue = {
|
|
150
|
+
client: null,
|
|
151
|
+
loading: false,
|
|
152
|
+
error: null,
|
|
153
|
+
connect: async () => {
|
|
154
|
+
/* no-op until provider mounts */
|
|
155
|
+
},
|
|
156
|
+
disconnect: () => {
|
|
157
|
+
/* no-op until provider mounts */
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
function createManager() {
|
|
161
|
+
let client = null;
|
|
162
|
+
let loading = false;
|
|
163
|
+
let error = null;
|
|
164
|
+
const listeners = new Set();
|
|
165
|
+
function notify() {
|
|
166
|
+
for (const fn of listeners)
|
|
167
|
+
fn();
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
connect(wallet) {
|
|
171
|
+
loading = true;
|
|
172
|
+
error = null;
|
|
173
|
+
notify();
|
|
174
|
+
try {
|
|
175
|
+
client = SynapseAnchorSap.create({ wallet, ...config });
|
|
176
|
+
loading = false;
|
|
177
|
+
notify();
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
error = e instanceof Error ? e : new Error(String(e));
|
|
181
|
+
loading = false;
|
|
182
|
+
client = null;
|
|
183
|
+
notify();
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
disconnect() {
|
|
187
|
+
client = null;
|
|
188
|
+
error = null;
|
|
189
|
+
loading = false;
|
|
190
|
+
notify();
|
|
191
|
+
},
|
|
192
|
+
getValue() {
|
|
193
|
+
return {
|
|
194
|
+
client,
|
|
195
|
+
loading,
|
|
196
|
+
error,
|
|
197
|
+
connect: async (w) => {
|
|
198
|
+
this.connect(w);
|
|
199
|
+
},
|
|
200
|
+
disconnect: () => {
|
|
201
|
+
this.disconnect();
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
subscribe(listener) {
|
|
206
|
+
listeners.add(listener);
|
|
207
|
+
return () => {
|
|
208
|
+
listeners.delete(listener);
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return { defaultValue, createManager };
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/ai/sap/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C;;qEAEqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAiB,EACjB,MAA0B,EAC1B,IAAuB;IAEvB,MAAM,aAAa,GAAqB;QACtC,GAAG,IAAI;QACP,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;IACF,OAAO,eAAe,CACpB,iBAAiB,EACjB,GAAG,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EACpD,aAAa,CACd,CAAC;AACJ,CAAC;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAwC;IAExC,MAAM,YAAY,GAAsC;QACtD,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,iCAAiC;QACnC,CAAC;QACD,UAAU,EAAE,GAAG,EAAE;YACf,iCAAiC;QACnC,CAAC;KACF,CAAC;IAEF,SAAS,aAAa;QACpB,IAAI,MAAM,GAA4B,IAAI,CAAC;QAC3C,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,KAAK,GAAiB,IAAI,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;QAExC,SAAS,MAAM;YACb,KAAK,MAAM,EAAE,IAAI,SAAS;gBAAE,EAAE,EAAE,CAAC;QACnC,CAAC;QAED,OAAO;YACL,OAAO,CAAC,MAAiB;gBACvB,OAAO,GAAG,IAAI,CAAC;gBACf,KAAK,GAAG,IAAI,CAAC;gBACb,MAAM,EAAE,CAAC;gBAET,IAAI,CAAC;oBACH,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;oBACxD,OAAO,GAAG,KAAK,CAAC;oBAChB,MAAM,EAAE,CAAC;gBACX,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtD,OAAO,GAAG,KAAK,CAAC;oBAChB,MAAM,GAAG,IAAI,CAAC;oBACd,MAAM,EAAE,CAAC;gBACX,CAAC;YACH,CAAC;YAED,UAAU;gBACR,MAAM,GAAG,IAAI,CAAC;gBACd,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO,GAAG,KAAK,CAAC;gBAChB,MAAM,EAAE,CAAC;YACX,CAAC;YAED,QAAQ;gBACN,OAAO;oBACL,MAAM;oBACN,OAAO;oBACP,KAAK;oBACL,OAAO,EAAE,KAAK,EAAE,CAAY,EAAE,EAAE;wBAC9B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAClB,CAAC;oBACD,UAAU,EAAE,GAAG,EAAE;wBACf,IAAI,CAAC,UAAU,EAAE,CAAC;oBACpB,CAAC;iBACF,CAAC;YACJ,CAAC;YAED,SAAS,CAAC,QAAoB;gBAC5B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,GAAG,EAAE;oBACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC7B,CAAC,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACzC,CAAC"}
|