@oobe-protocol-labs/synapse-client-sdk 1.0.7 → 1.2.0
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 +114 -0
- package/dist/cjs/ai/gateway/index.d.ts +5 -5
- package/dist/cjs/ai/gateway/index.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/index.js +2 -2
- package/dist/cjs/ai/gateway/index.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 +5 -2
- package/dist/cjs/ai/index.js.map +1 -1
- package/dist/cjs/ai/tools/index.d.ts +4 -4
- package/dist/cjs/ai/tools/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/index.js +5 -2
- package/dist/cjs/ai/tools/index.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/index.d.ts +9 -3
- package/dist/cjs/ai/tools/protocols/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/index.js +16 -2
- package/dist/cjs/ai/tools/protocols/index.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/schemas.d.ts +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/schemas.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/schemas.js +126 -28
- package/dist/cjs/ai/tools/protocols/jupiter/schemas.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/tools.d.ts +4 -3
- package/dist/cjs/ai/tools/protocols/jupiter/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/tools.js +91 -9
- package/dist/cjs/ai/tools/protocols/jupiter/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.d.ts +4 -4
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.js +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/metaplex/tools.d.ts +7 -4
- package/dist/cjs/ai/tools/protocols/metaplex/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/metaplex/tools.js +4 -1
- package/dist/cjs/ai/tools/protocols/metaplex/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.d.ts +4 -4
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.js +1 -1
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/solana-programs/index.d.ts +7 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/index.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/index.js +13 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/index.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/schemas.d.ts +11 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/schemas.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/schemas.js +160 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/schemas.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/tools.d.ts +57 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/tools.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/tools.js +226 -0
- package/dist/cjs/ai/tools/protocols/solana-programs/tools.js.map +1 -0
- package/dist/cjs/context/container.d.ts +341 -0
- package/dist/cjs/context/container.d.ts.map +1 -0
- package/dist/cjs/context/container.js +670 -0
- package/dist/cjs/context/container.js.map +1 -0
- package/dist/cjs/context/hooks.d.ts +357 -0
- package/dist/cjs/context/hooks.d.ts.map +1 -0
- package/dist/cjs/context/hooks.js +451 -0
- package/dist/cjs/context/hooks.js.map +1 -0
- package/dist/cjs/context/index.d.ts +81 -0
- package/dist/cjs/context/index.d.ts.map +1 -0
- package/dist/cjs/context/index.js +125 -0
- package/dist/cjs/context/index.js.map +1 -0
- package/dist/cjs/context/providers.d.ts +176 -0
- package/dist/cjs/context/providers.d.ts.map +1 -0
- package/dist/cjs/context/providers.js +184 -0
- package/dist/cjs/context/providers.js.map +1 -0
- package/dist/cjs/context/refs.d.ts +491 -0
- package/dist/cjs/context/refs.d.ts.map +1 -0
- package/dist/cjs/context/refs.js +673 -0
- package/dist/cjs/context/refs.js.map +1 -0
- package/dist/cjs/context/types.d.ts +251 -0
- package/dist/cjs/context/types.d.ts.map +1 -0
- package/dist/cjs/context/types.js +87 -0
- package/dist/cjs/context/types.js.map +1 -0
- package/dist/cjs/core/client.d.ts +31 -1
- package/dist/cjs/core/client.d.ts.map +1 -1
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/programs/associated-token.d.ts +97 -0
- package/dist/cjs/programs/associated-token.d.ts.map +1 -0
- package/dist/cjs/programs/associated-token.js +113 -0
- package/dist/cjs/programs/associated-token.js.map +1 -0
- package/dist/cjs/programs/compute-budget.d.ts +105 -0
- package/dist/cjs/programs/compute-budget.d.ts.map +1 -0
- package/dist/cjs/programs/compute-budget.js +99 -0
- package/dist/cjs/programs/compute-budget.js.map +1 -0
- package/dist/cjs/programs/index.d.ts +74 -0
- package/dist/cjs/programs/index.d.ts.map +1 -0
- package/dist/cjs/programs/index.js +112 -0
- package/dist/cjs/programs/index.js.map +1 -0
- package/dist/cjs/programs/memo.d.ts +70 -0
- package/dist/cjs/programs/memo.d.ts.map +1 -0
- package/dist/cjs/programs/memo.js +74 -0
- package/dist/cjs/programs/memo.js.map +1 -0
- package/dist/cjs/programs/spl-token.d.ts +373 -0
- package/dist/cjs/programs/spl-token.d.ts.map +1 -0
- package/dist/cjs/programs/spl-token.js +358 -0
- package/dist/cjs/programs/spl-token.js.map +1 -0
- package/dist/cjs/programs/system.d.ts +231 -0
- package/dist/cjs/programs/system.d.ts.map +1 -0
- package/dist/cjs/programs/system.js +231 -0
- package/dist/cjs/programs/system.js.map +1 -0
- package/dist/cjs/programs/types.d.ts +111 -0
- package/dist/cjs/programs/types.d.ts.map +1 -0
- package/dist/cjs/programs/types.js +166 -0
- package/dist/cjs/programs/types.js.map +1 -0
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/AccountReader.html +18 -18
- package/dist/docs/classes/AccountsClient.html +10 -10
- package/dist/docs/classes/AsyncProviderError.html +39 -0
- package/dist/docs/classes/CircularDependencyError.html +39 -0
- 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 +37 -0
- package/dist/docs/classes/MemoryGuard.html +27 -0
- package/dist/docs/classes/NetworkError.html +5 -5
- package/dist/docs/classes/RefRegistry.html +40 -0
- package/dist/docs/classes/RefReleasedError.html +39 -0
- package/dist/docs/classes/RpcMethodNotFoundError.html +4 -4
- package/dist/docs/classes/ServiceNotFoundError.html +39 -0
- package/dist/docs/classes/ServiceRef.html +60 -0
- package/dist/docs/classes/SolanaRpc.html +55 -55
- package/dist/docs/classes/SynapseClient.html +39 -27
- package/dist/docs/classes/SynapseContext.html +151 -0
- 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 +17 -0
- 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 +11 -0
- package/dist/docs/functions/base58Encode.html +1 -1
- package/dist/docs/functions/base64ToBytes.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 +6 -0
- package/dist/docs/functions/createBinding.html +11 -0
- package/dist/docs/functions/createBoundHook.html +8 -0
- package/dist/docs/functions/createReactAdapter.html +11 -0
- package/dist/docs/functions/createRefHook.html +10 -0
- package/dist/docs/functions/createServerMiddleware.html +11 -0
- package/dist/docs/functions/createServiceHook.html +10 -0
- package/dist/docs/functions/createSynapse.html +1 -1
- package/dist/docs/functions/createSynapseContext.html +12 -0
- package/dist/docs/functions/createToken.html +9 -0
- package/dist/docs/functions/decodeBase58.html +2 -0
- 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 +4 -0
- 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 +3 -0
- 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 +3 -0
- package/dist/docs/functions/readonlySigner.html +3 -0
- 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 +9 -0
- 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/toKitAddress.html +1 -1
- package/dist/docs/functions/toKitInstruction.html +9 -0
- package/dist/docs/functions/toKitLamports.html +1 -1
- package/dist/docs/functions/toKitSignatureString.html +1 -1
- package/dist/docs/functions/tryGetContext.html +3 -0
- package/dist/docs/functions/tryUseService.html +4 -0
- package/dist/docs/functions/useBoundServices.html +10 -0
- package/dist/docs/functions/useService.html +13 -0
- package/dist/docs/functions/useSharedRef.html +14 -0
- package/dist/docs/functions/withRef.html +14 -0
- package/dist/docs/functions/withRefAsync.html +12 -0
- package/dist/docs/functions/writable.html +3 -0
- package/dist/docs/functions/writableSigner.html +3 -0
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/interfaces/AccountInfo.html +7 -7
- package/dist/docs/interfaces/AccountMeta.html +9 -0
- package/dist/docs/interfaces/AccountNotification.html +2 -2
- package/dist/docs/interfaces/AccountSubParams.html +2 -2
- package/dist/docs/interfaces/AddMemoParams.html +11 -0
- package/dist/docs/interfaces/AdvanceNonceParams.html +7 -0
- package/dist/docs/interfaces/AliasProvider.html +6 -0
- package/dist/docs/interfaces/AllocateParams.html +7 -0
- package/dist/docs/interfaces/ApproveCheckedParams.html +19 -0
- package/dist/docs/interfaces/ApproveParams.html +15 -0
- package/dist/docs/interfaces/AssetSignatureInfo.html +2 -2
- package/dist/docs/interfaces/AssetSignaturesPage.html +2 -2
- package/dist/docs/interfaces/AssignParams.html +7 -0
- package/dist/docs/interfaces/AsyncFactoryProvider.html +7 -0
- package/dist/docs/interfaces/AuthorizeNonceParams.html +9 -0
- 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 +17 -0
- package/dist/docs/interfaces/BurnParams.html +15 -0
- package/dist/docs/interfaces/CallOptions.html +6 -6
- package/dist/docs/interfaces/ClassProvider.html +6 -0
- package/dist/docs/interfaces/CloseAccountParams.html +13 -0
- package/dist/docs/interfaces/ConfirmedTransaction.html +6 -6
- package/dist/docs/interfaces/ContactInfo.html +2 -2
- package/dist/docs/interfaces/ContextAdapter.html +15 -0
- package/dist/docs/interfaces/ContextEvents.html +13 -0
- package/dist/docs/interfaces/ContextModule.html +12 -0
- package/dist/docs/interfaces/CreateATAParams.html +13 -0
- package/dist/docs/interfaces/CreateAccountParams.html +13 -0
- package/dist/docs/interfaces/CreateAccountWithSeedParams.html +17 -0
- package/dist/docs/interfaces/CreateSynapseContextOpts.html +18 -0
- 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 +5 -0
- 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 +7 -0
- package/dist/docs/interfaces/FetchedMint.html +6 -6
- package/dist/docs/interfaces/FetchedTokenAccount.html +6 -6
- package/dist/docs/interfaces/FreezeThawParams.html +13 -0
- 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 +11 -0
- package/dist/docs/interfaces/InitializeMintParams.html +13 -0
- package/dist/docs/interfaces/InitializeNonceParams.html +7 -0
- package/dist/docs/interfaces/InterestBearingConfigExt.html +2 -2
- package/dist/docs/interfaces/LatencyProbeResult.html +2 -2
- package/dist/docs/interfaces/LeakReport.html +12 -0
- 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 +20 -0
- package/dist/docs/interfaces/MetadataPointerExt.html +2 -2
- package/dist/docs/interfaces/MintCloseAuthorityExt.html +2 -2
- package/dist/docs/interfaces/MintToCheckedParams.html +17 -0
- package/dist/docs/interfaces/MintToParams.html +15 -0
- 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 +108 -0
- 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 +8 -0
- package/dist/docs/interfaces/RecoverNestedParams.html +15 -0
- package/dist/docs/interfaces/RefRegistryConfig.html +9 -0
- package/dist/docs/interfaces/RefStats.html +15 -0
- package/dist/docs/interfaces/RequestHeapFrameParams.html +5 -0
- package/dist/docs/interfaces/ResolveMiddleware.html +8 -0
- package/dist/docs/interfaces/RevokeParams.html +11 -0
- 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 +2 -2
- package/dist/docs/interfaces/RpcResponse.html +2 -2
- package/dist/docs/interfaces/SendTransactionOpts.html +6 -6
- package/dist/docs/interfaces/ServerAdapterConfig.html +13 -0
- package/dist/docs/interfaces/ServiceBinding.html +17 -0
- package/dist/docs/interfaces/ServiceRegistration.html +7 -0
- package/dist/docs/interfaces/ServiceResolver.html +16 -0
- package/dist/docs/interfaces/ServiceToken.html +13 -0
- package/dist/docs/interfaces/SetComputeUnitLimitParams.html +5 -0
- package/dist/docs/interfaces/SetComputeUnitPriceParams.html +5 -0
- package/dist/docs/interfaces/SetLoadedAccountsDataSizeLimitParams.html +5 -0
- 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/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 +14 -0
- package/dist/docs/interfaces/SynapseEndpoint.html +7 -7
- package/dist/docs/interfaces/SyncNativeParams.html +7 -0
- package/dist/docs/interfaces/SystemTransferParams.html +9 -0
- 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 +15 -0
- package/dist/docs/interfaces/TransactionInstruction.html +11 -0
- package/dist/docs/interfaces/TransactionMeta.html +11 -11
- package/dist/docs/interfaces/TransferCheckedParams.html +19 -0
- 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 +4 -0
- package/dist/docs/interfaces/VoteAccount.html +9 -9
- package/dist/docs/interfaces/VoteAccountsResult.html +3 -3
- package/dist/docs/interfaces/WithdrawNonceParams.html +11 -0
- package/dist/docs/interfaces/WsConfig.html +6 -6
- package/dist/docs/media/CHANGELOG.md +114 -0
- package/dist/docs/modules.html +107 -1
- 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 +25 -0
- package/dist/docs/types/ServiceProvider.html +3 -0
- 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 +3 -0
- package/dist/docs/variables/AssociatedToken.html +13 -0
- package/dist/docs/variables/COMPUTE_BUDGET_PROGRAM.html +3 -0
- package/dist/docs/variables/ComputeBudget.html +19 -0
- 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 +3 -0
- package/dist/docs/variables/MEMO_PROGRAM_V2.html +3 -0
- 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 +9 -0
- 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 +3 -0
- 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 +38 -0
- package/dist/docs/variables/SystemProgram.html +42 -0
- package/dist/docs/variables/TOKEN_2022_PROGRAM.html +3 -0
- 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 +3 -0
- package/dist/docs/variables/TOKEN_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/Tokens.html +16 -0
- package/dist/esm/ai/gateway/index.d.ts +5 -5
- package/dist/esm/ai/gateway/index.d.ts.map +1 -1
- package/dist/esm/ai/gateway/index.js +2 -2
- package/dist/esm/ai/gateway/index.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 +2 -2
- package/dist/esm/ai/index.js.map +1 -1
- package/dist/esm/ai/tools/index.d.ts +4 -4
- package/dist/esm/ai/tools/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/index.js +3 -3
- package/dist/esm/ai/tools/index.js.map +1 -1
- package/dist/esm/ai/tools/protocols/index.d.ts +9 -3
- package/dist/esm/ai/tools/protocols/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/index.js +12 -1
- package/dist/esm/ai/tools/protocols/index.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/schemas.d.ts +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/schemas.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/schemas.js +126 -28
- package/dist/esm/ai/tools/protocols/jupiter/schemas.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/tools.d.ts +4 -3
- package/dist/esm/ai/tools/protocols/jupiter/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/tools.js +91 -9
- package/dist/esm/ai/tools/protocols/jupiter/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.d.ts +4 -4
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.js +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/metaplex/tools.d.ts +7 -4
- package/dist/esm/ai/tools/protocols/metaplex/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/metaplex/tools.js +4 -1
- package/dist/esm/ai/tools/protocols/metaplex/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.d.ts +4 -4
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.js +1 -1
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/solana-programs/index.d.ts +7 -0
- package/dist/esm/ai/tools/protocols/solana-programs/index.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/solana-programs/index.js +7 -0
- package/dist/esm/ai/tools/protocols/solana-programs/index.js.map +1 -0
- package/dist/esm/ai/tools/protocols/solana-programs/schemas.d.ts +11 -0
- package/dist/esm/ai/tools/protocols/solana-programs/schemas.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/solana-programs/schemas.js +157 -0
- package/dist/esm/ai/tools/protocols/solana-programs/schemas.js.map +1 -0
- package/dist/esm/ai/tools/protocols/solana-programs/tools.d.ts +57 -0
- package/dist/esm/ai/tools/protocols/solana-programs/tools.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/solana-programs/tools.js +220 -0
- package/dist/esm/ai/tools/protocols/solana-programs/tools.js.map +1 -0
- package/dist/esm/context/container.d.ts +341 -0
- package/dist/esm/context/container.d.ts.map +1 -0
- package/dist/esm/context/container.js +666 -0
- package/dist/esm/context/container.js.map +1 -0
- package/dist/esm/context/hooks.d.ts +357 -0
- package/dist/esm/context/hooks.d.ts.map +1 -0
- package/dist/esm/context/hooks.js +434 -0
- package/dist/esm/context/hooks.js.map +1 -0
- package/dist/esm/context/index.d.ts +81 -0
- package/dist/esm/context/index.d.ts.map +1 -0
- package/dist/esm/context/index.js +98 -0
- package/dist/esm/context/index.js.map +1 -0
- package/dist/esm/context/providers.d.ts +176 -0
- package/dist/esm/context/providers.d.ts.map +1 -0
- package/dist/esm/context/providers.js +179 -0
- package/dist/esm/context/providers.js.map +1 -0
- package/dist/esm/context/refs.d.ts +491 -0
- package/dist/esm/context/refs.d.ts.map +1 -0
- package/dist/esm/context/refs.js +664 -0
- package/dist/esm/context/refs.js.map +1 -0
- package/dist/esm/context/types.d.ts +251 -0
- package/dist/esm/context/types.d.ts.map +1 -0
- package/dist/esm/context/types.js +79 -0
- package/dist/esm/context/types.js.map +1 -0
- package/dist/esm/core/client.d.ts +31 -1
- package/dist/esm/core/client.d.ts.map +1 -1
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/programs/associated-token.d.ts +97 -0
- package/dist/esm/programs/associated-token.d.ts.map +1 -0
- package/dist/esm/programs/associated-token.js +110 -0
- package/dist/esm/programs/associated-token.js.map +1 -0
- package/dist/esm/programs/compute-budget.d.ts +105 -0
- package/dist/esm/programs/compute-budget.d.ts.map +1 -0
- package/dist/esm/programs/compute-budget.js +96 -0
- package/dist/esm/programs/compute-budget.js.map +1 -0
- package/dist/esm/programs/index.d.ts +74 -0
- package/dist/esm/programs/index.d.ts.map +1 -0
- package/dist/esm/programs/index.js +90 -0
- package/dist/esm/programs/index.js.map +1 -0
- package/dist/esm/programs/memo.d.ts +70 -0
- package/dist/esm/programs/memo.d.ts.map +1 -0
- package/dist/esm/programs/memo.js +71 -0
- package/dist/esm/programs/memo.js.map +1 -0
- package/dist/esm/programs/spl-token.d.ts +373 -0
- package/dist/esm/programs/spl-token.d.ts.map +1 -0
- package/dist/esm/programs/spl-token.js +355 -0
- package/dist/esm/programs/spl-token.js.map +1 -0
- package/dist/esm/programs/system.d.ts +231 -0
- package/dist/esm/programs/system.d.ts.map +1 -0
- package/dist/esm/programs/system.js +228 -0
- package/dist/esm/programs/system.js.map +1 -0
- package/dist/esm/programs/types.d.ts +111 -0
- package/dist/esm/programs/types.d.ts.map +1 -0
- package/dist/esm/programs/types.js +157 -0
- package/dist/esm/programs/types.js.map +1 -0
- package/package.json +41 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic hooks and adapters for the Synapse context provider.
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities to integrate the IoC container with any UI framework
|
|
5
|
+
* (React, Vue, Svelte, etc.) or backend framework (Express, Fastify,
|
|
6
|
+
* NestJS, etc.) via a simple adapter interface.
|
|
7
|
+
*
|
|
8
|
+
* ## Architecture
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* ┌──────────────────────────────────────────────────┐
|
|
12
|
+
* │ ContextAdapter<Framework> │
|
|
13
|
+
* │ ┌────────────────────┐ ┌─────────────────────┐ │
|
|
14
|
+
* │ │ React: useService │ │ Express: middleware │ │
|
|
15
|
+
* │ │ Vue: inject │ │ Fastify: decorator │ │
|
|
16
|
+
* │ └────────────────────┘ └─────────────────────┘ │
|
|
17
|
+
* │ │ │ │
|
|
18
|
+
* │ ▼ ▼ │
|
|
19
|
+
* │ ┌──────────────────────────────────────────────┐ │
|
|
20
|
+
* │ │ SynapseContext (IoC core) │ │
|
|
21
|
+
* │ └──────────────────────────────────────────────┘ │
|
|
22
|
+
* └──────────────────────────────────────────────────┘
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module context/hooks
|
|
26
|
+
* @since 1.2.0
|
|
27
|
+
*/
|
|
28
|
+
import type { ServiceToken } from './types';
|
|
29
|
+
import type { SynapseContext } from './container';
|
|
30
|
+
import type { ServiceRef, ServiceBinding } from './refs';
|
|
31
|
+
/**
|
|
32
|
+
* Set the global context reference.
|
|
33
|
+
*
|
|
34
|
+
* Call this once during application bootstrap. Framework adapters
|
|
35
|
+
* call this automatically.
|
|
36
|
+
*
|
|
37
|
+
* @param ctx - The context to make globally available.
|
|
38
|
+
* @since 1.2.0
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const ctx = createSynapseContext(config);
|
|
43
|
+
* setGlobalContext(ctx);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function setGlobalContext(ctx: SynapseContext | undefined): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get the current global context.
|
|
49
|
+
*
|
|
50
|
+
* @throws {Error} If no context has been set.
|
|
51
|
+
* @since 1.2.0
|
|
52
|
+
*/
|
|
53
|
+
export declare function getContext(): SynapseContext;
|
|
54
|
+
/**
|
|
55
|
+
* Try to get the global context; returns `undefined` if not set.
|
|
56
|
+
* @since 1.2.0
|
|
57
|
+
*/
|
|
58
|
+
export declare function tryGetContext(): SynapseContext | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve a service from the global context.
|
|
61
|
+
*
|
|
62
|
+
* This is the simplest way to access services without dependency on
|
|
63
|
+
* any specific framework. Works in Node.js, Deno, Bun, and browsers.
|
|
64
|
+
*
|
|
65
|
+
* @typeParam T - The service type.
|
|
66
|
+
* @param token - The service token to resolve.
|
|
67
|
+
* @returns The resolved service instance.
|
|
68
|
+
* @throws {Error} If no context is set.
|
|
69
|
+
* @throws {ServiceNotFoundError} If the token is not registered.
|
|
70
|
+
* @since 1.2.0
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { useService, Tokens } from '@oobe-protocol-labs/synapse-client-sdk/context';
|
|
75
|
+
*
|
|
76
|
+
* const rpc = useService(Tokens.RPC);
|
|
77
|
+
* const balance = await rpc.getBalance(pubkey);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function useService<T>(token: ServiceToken<T>): T;
|
|
81
|
+
/**
|
|
82
|
+
* Try to resolve a service from the global context.
|
|
83
|
+
* Returns `undefined` if no context is set or the token is not registered.
|
|
84
|
+
*
|
|
85
|
+
* @since 1.2.0
|
|
86
|
+
*/
|
|
87
|
+
export declare function tryUseService<T>(token: ServiceToken<T>): T | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Base interface for framework-specific context adapters.
|
|
90
|
+
*
|
|
91
|
+
* Implement this interface to create adapters for React, Vue, Express,
|
|
92
|
+
* or any other framework. The adapter wraps a `SynapseContext` and
|
|
93
|
+
* provides framework-idiomatic access patterns.
|
|
94
|
+
*
|
|
95
|
+
* @typeParam TFrameworkOpts - Framework-specific options.
|
|
96
|
+
* @since 1.2.0
|
|
97
|
+
*/
|
|
98
|
+
export interface ContextAdapter<TFrameworkOpts = unknown> {
|
|
99
|
+
/** Adapter name (e.g. 'react', 'express', 'vue'). */
|
|
100
|
+
readonly name: string;
|
|
101
|
+
/** The underlying context. */
|
|
102
|
+
readonly context: SynapseContext;
|
|
103
|
+
/** Initialize the adapter with framework-specific options. */
|
|
104
|
+
init(opts?: TFrameworkOpts): void;
|
|
105
|
+
/** Tear down the adapter. */
|
|
106
|
+
destroy(): void | Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* React adapter configuration.
|
|
110
|
+
* @since 1.2.0
|
|
111
|
+
*/
|
|
112
|
+
export interface ReactAdapterConfig {
|
|
113
|
+
/** If true, sets the global context on mount. @default true */
|
|
114
|
+
setGlobal?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Creates a React adapter blueprint.
|
|
118
|
+
*
|
|
119
|
+
* This does NOT depend on React — it returns plain functions and
|
|
120
|
+
* descriptors that a React wrapper can use. This keeps React as
|
|
121
|
+
* an optional peer dependency.
|
|
122
|
+
*
|
|
123
|
+
* @param ctx - The Synapse context to wrap.
|
|
124
|
+
* @returns Adapter blueprint with `Provider` props and hook factories.
|
|
125
|
+
* @since 1.2.0
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* // In your React app:
|
|
130
|
+
* import React, { createContext, useContext } from 'react';
|
|
131
|
+
* import { createReactAdapter, Tokens } from '@oobe-protocol-labs/synapse-client-sdk/context';
|
|
132
|
+
*
|
|
133
|
+
* const adapter = createReactAdapter(ctx);
|
|
134
|
+
* const SynapseReactContext = createContext(adapter.context);
|
|
135
|
+
*
|
|
136
|
+
* function SynapseProvider({ children }) {
|
|
137
|
+
* adapter.init({ setGlobal: true });
|
|
138
|
+
* return <SynapseReactContext.Provider value={adapter.context}>{children}</SynapseReactContext.Provider>;
|
|
139
|
+
* }
|
|
140
|
+
*
|
|
141
|
+
* function useRpc() {
|
|
142
|
+
* const ctx = useContext(SynapseReactContext);
|
|
143
|
+
* return ctx.resolve(Tokens.RPC);
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare function createReactAdapter(ctx: SynapseContext): ContextAdapter<ReactAdapterConfig>;
|
|
148
|
+
/**
|
|
149
|
+
* Server middleware adapter configuration.
|
|
150
|
+
* @since 1.2.0
|
|
151
|
+
*/
|
|
152
|
+
export interface ServerAdapterConfig {
|
|
153
|
+
/** Create a new scope per request. @default true */
|
|
154
|
+
scopePerRequest?: boolean;
|
|
155
|
+
/** Key on the request object to store the scoped context. @default 'synapseCtx' */
|
|
156
|
+
contextKey?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Create request-scoped middleware for Express/Fastify-style servers.
|
|
160
|
+
*
|
|
161
|
+
* Returns a middleware function that creates a child scope per
|
|
162
|
+
* request and attaches it to `req[contextKey]`.
|
|
163
|
+
*
|
|
164
|
+
* @param ctx - The root Synapse context.
|
|
165
|
+
* @param opts - Server adapter options.
|
|
166
|
+
* @returns A middleware function `(req, res, next) => void`.
|
|
167
|
+
* @since 1.2.0
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* import express from 'express';
|
|
172
|
+
* import { createSynapseContext, createServerMiddleware, Tokens } from '@oobe-protocol-labs/synapse-client-sdk/context';
|
|
173
|
+
*
|
|
174
|
+
* const ctx = createSynapseContext(config);
|
|
175
|
+
* const app = express();
|
|
176
|
+
*
|
|
177
|
+
* app.use(createServerMiddleware(ctx));
|
|
178
|
+
*
|
|
179
|
+
* app.get('/balance/:address', async (req, res) => {
|
|
180
|
+
* const scope = req.synapseCtx;
|
|
181
|
+
* const rpc = scope.resolve(Tokens.RPC);
|
|
182
|
+
* const balance = await rpc.getBalance(Pubkey(req.params.address));
|
|
183
|
+
* res.json({ balance });
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function createServerMiddleware(ctx: SynapseContext, opts?: ServerAdapterConfig): (req: Record<string, unknown>, res: unknown, next: () => void) => void;
|
|
188
|
+
/**
|
|
189
|
+
* Create a typed accessor function bound to a specific token.
|
|
190
|
+
*
|
|
191
|
+
* Returns a zero-argument function that resolves the service from
|
|
192
|
+
* the global context. Perfect for composable patterns.
|
|
193
|
+
*
|
|
194
|
+
* @param token - The service token.
|
|
195
|
+
* @returns A function `() => T` that resolves on each call.
|
|
196
|
+
* @since 1.2.0
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* // Define once:
|
|
201
|
+
* const useRpc = createServiceHook(Tokens.RPC);
|
|
202
|
+
* const useDas = createServiceHook(Tokens.DAS);
|
|
203
|
+
*
|
|
204
|
+
* // Use anywhere:
|
|
205
|
+
* const rpc = useRpc();
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare function createServiceHook<T>(token: ServiceToken<T>): () => T;
|
|
209
|
+
/**
|
|
210
|
+
* Create a typed accessor bound to a specific context instance.
|
|
211
|
+
*
|
|
212
|
+
* Unlike `createServiceHook`, this does not use the global context —
|
|
213
|
+
* it's bound directly to the provided context.
|
|
214
|
+
*
|
|
215
|
+
* @param ctx - The context to bind to.
|
|
216
|
+
* @param token - The service token.
|
|
217
|
+
* @returns A function `() => T`.
|
|
218
|
+
* @since 1.2.0
|
|
219
|
+
*/
|
|
220
|
+
export declare function createBoundHook<T>(ctx: SynapseContext, token: ServiceToken<T>): () => T;
|
|
221
|
+
/**
|
|
222
|
+
* Wire a plain object's methods to use services from the context.
|
|
223
|
+
*
|
|
224
|
+
* Creates a Proxy that resolves services lazily on property access.
|
|
225
|
+
* Useful for creating "service bags" that group multiple services.
|
|
226
|
+
*
|
|
227
|
+
* @param ctx - The context to resolve from.
|
|
228
|
+
* @param tokens - A record of property names → service tokens.
|
|
229
|
+
* @returns A proxy object with lazy-resolved properties.
|
|
230
|
+
* @since 1.2.0
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* const services = autoWire(ctx, {
|
|
235
|
+
* rpc: Tokens.RPC,
|
|
236
|
+
* das: Tokens.DAS,
|
|
237
|
+
* programs: Tokens.PROGRAMS,
|
|
238
|
+
* });
|
|
239
|
+
*
|
|
240
|
+
* // Each property is resolved lazily:
|
|
241
|
+
* const balance = await services.rpc.getBalance(pubkey);
|
|
242
|
+
* const asset = await services.das.getAsset(assetId);
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
export declare function autoWire<T extends Record<string, ServiceToken>>(ctx: SynapseContext, tokens: T): {
|
|
246
|
+
[K in keyof T]: T[K] extends ServiceToken<infer U> ? U : never;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Acquire a tracked, ref-counted reference from the global context.
|
|
250
|
+
*
|
|
251
|
+
* The returned {@link ServiceRef} **must** be `.release()`'d when the
|
|
252
|
+
* component/module is done with the service. This ensures the SDK can
|
|
253
|
+
* track how many consumers hold a service and detect leaks.
|
|
254
|
+
*
|
|
255
|
+
* @typeParam T - The service type.
|
|
256
|
+
* @param token - The service token.
|
|
257
|
+
* @returns A new `ServiceRef<T>`.
|
|
258
|
+
* @throws {Error} If no global context is set.
|
|
259
|
+
* @throws {ServiceNotFoundError} If the token is not registered.
|
|
260
|
+
* @since 1.2.0
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* // In a React component:
|
|
265
|
+
* useEffect(() => {
|
|
266
|
+
* const rpcRef = useSharedRef(Tokens.RPC);
|
|
267
|
+
* rpcRef.current.getBalance(pubkey).then(setBalance);
|
|
268
|
+
* return () => rpcRef.release(); // cleanup on unmount
|
|
269
|
+
* }, []);
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
export declare function useSharedRef<T>(token: ServiceToken<T>): ServiceRef<T>;
|
|
273
|
+
/**
|
|
274
|
+
* Acquire tracked refs for multiple tokens from the global context.
|
|
275
|
+
*
|
|
276
|
+
* Returns a {@link ServiceBinding} whose `.services` proxy lazily
|
|
277
|
+
* resolves each token. A single `.release()` frees all refs at once.
|
|
278
|
+
*
|
|
279
|
+
* @param tokens - Record mapping property names to service tokens.
|
|
280
|
+
* @returns A binding with lazy services and batch release.
|
|
281
|
+
* @since 1.2.0
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* const binding = useBoundServices({
|
|
286
|
+
* rpc: Tokens.RPC,
|
|
287
|
+
* das: Tokens.DAS,
|
|
288
|
+
* });
|
|
289
|
+
*
|
|
290
|
+
* await binding.services.rpc.getBalance(pubkey);
|
|
291
|
+
* binding.release(); // releases all
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
export declare function useBoundServices<T extends Record<string, ServiceToken>>(tokens: T): ServiceBinding<T>;
|
|
295
|
+
/**
|
|
296
|
+
* RAII pattern: acquire a ref, run `fn`, auto-release.
|
|
297
|
+
*
|
|
298
|
+
* The ref is released in a `finally` block so cleanup is guaranteed
|
|
299
|
+
* even if `fn` throws. Zero chance of leaking.
|
|
300
|
+
*
|
|
301
|
+
* @typeParam T - The service type.
|
|
302
|
+
* @typeParam R - The return type of `fn`.
|
|
303
|
+
* @param ctx - The context to acquire from.
|
|
304
|
+
* @param token - The service token.
|
|
305
|
+
* @param fn - Receives the unwrapped service value.
|
|
306
|
+
* @returns The return value of `fn`.
|
|
307
|
+
* @since 1.2.0
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* const balance = withRef(ctx, Tokens.RPC, rpc => rpc.getBalance(pubkey));
|
|
312
|
+
* // ref is auto-released — no leak
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
export declare function withRef<T, R>(ctx: SynapseContext, token: ServiceToken<T>, fn: (service: T) => R): R;
|
|
316
|
+
/**
|
|
317
|
+
* Async RAII pattern: acquire a ref, await `fn`, auto-release.
|
|
318
|
+
*
|
|
319
|
+
* @typeParam T - The service type.
|
|
320
|
+
* @typeParam R - The return type of `fn`.
|
|
321
|
+
* @param ctx - The context to acquire from.
|
|
322
|
+
* @param token - The service token.
|
|
323
|
+
* @param fn - Async function that receives the unwrapped service.
|
|
324
|
+
* @returns The return value of `fn`.
|
|
325
|
+
* @since 1.2.0
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```ts
|
|
329
|
+
* const balance = await withRefAsync(ctx, Tokens.RPC, async rpc => {
|
|
330
|
+
* return rpc.getBalance(pubkey);
|
|
331
|
+
* });
|
|
332
|
+
* // ref is auto-released after await
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
export declare function withRefAsync<T, R>(ctx: SynapseContext, token: ServiceToken<T>, fn: (service: T) => Promise<R>): Promise<R>;
|
|
336
|
+
/**
|
|
337
|
+
* Create a reusable hook that acquires a tracked ref on each call.
|
|
338
|
+
*
|
|
339
|
+
* Unlike `createServiceHook` (which returns the raw service),
|
|
340
|
+
* this returns a `ServiceRef<T>` that must be released.
|
|
341
|
+
*
|
|
342
|
+
* @param token - The service token.
|
|
343
|
+
* @returns A function `() => ServiceRef<T>`.
|
|
344
|
+
* @since 1.2.0
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* const useRpcRef = createRefHook(Tokens.RPC);
|
|
349
|
+
*
|
|
350
|
+
* // In a component:
|
|
351
|
+
* const rpcRef = useRpcRef();
|
|
352
|
+
* await rpcRef.current.getBalance(pubkey);
|
|
353
|
+
* rpcRef.release();
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export declare function createRefHook<T>(token: ServiceToken<T>): () => ServiceRef<T>;
|
|
357
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/context/hooks.ts"],"names":[],"mappings":"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"}
|