@oobe-protocol-labs/synapse-client-sdk 1.0.2 → 1.0.4
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 +93 -2
- package/dist/cjs/accounts/helpers.d.ts +88 -0
- package/dist/cjs/accounts/helpers.d.ts.map +1 -0
- package/dist/cjs/accounts/helpers.js +117 -0
- package/dist/cjs/accounts/helpers.js.map +1 -0
- package/dist/cjs/accounts/index.d.ts +105 -0
- package/dist/cjs/accounts/index.d.ts.map +1 -0
- package/dist/cjs/accounts/index.js +137 -0
- package/dist/cjs/accounts/index.js.map +1 -0
- package/dist/cjs/accounts/lookup.d.ts +30 -0
- package/dist/cjs/accounts/lookup.d.ts.map +1 -0
- package/dist/cjs/accounts/lookup.js +31 -0
- package/dist/cjs/accounts/lookup.js.map +1 -0
- package/dist/cjs/accounts/nonce.d.ts +30 -0
- package/dist/cjs/accounts/nonce.d.ts.map +1 -0
- package/dist/cjs/accounts/nonce.js +31 -0
- package/dist/cjs/accounts/nonce.js.map +1 -0
- package/dist/cjs/accounts/stake.d.ts +33 -0
- package/dist/cjs/accounts/stake.d.ts.map +1 -0
- package/dist/cjs/accounts/stake.js +34 -0
- package/dist/cjs/accounts/stake.js.map +1 -0
- package/dist/cjs/accounts/token.d.ts +98 -0
- package/dist/cjs/accounts/token.d.ts.map +1 -0
- package/dist/cjs/accounts/token.js +126 -0
- package/dist/cjs/accounts/token.js.map +1 -0
- package/dist/cjs/ai/tools/index.d.ts +1 -1
- package/dist/cjs/ai/tools/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/index.js +11 -2
- package/dist/cjs/ai/tools/index.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/index.d.ts +13 -1
- package/dist/cjs/ai/tools/protocols/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/index.js +32 -1
- package/dist/cjs/ai/tools/protocols/index.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/index.d.ts +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/index.js +2 -1
- package/dist/cjs/ai/tools/protocols/jupiter/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 +22 -22
- package/dist/cjs/ai/tools/protocols/jupiter/schemas.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/tools.d.ts +9 -4
- package/dist/cjs/ai/tools/protocols/jupiter/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter/tools.js +38 -6
- package/dist/cjs/ai/tools/protocols/jupiter/tools.js.map +1 -1
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/index.d.ts +13 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/index.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/index.js +20 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/index.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/schemas.d.ts +11 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/schemas.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/schemas.js +286 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/schemas.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.d.ts +58 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.js +342 -0
- package/dist/cjs/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/index.d.ts +13 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/index.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/index.js +20 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/index.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/schemas.d.ts +11 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/schemas.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/schemas.js +288 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/schemas.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.d.ts +58 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.d.ts.map +1 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.js +384 -0
- package/dist/cjs/ai/tools/protocols/raydium-onchain/tools.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/shared.d.ts +8 -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/zod/index.d.ts +1 -1
- package/dist/cjs/ai/tools/zod/index.d.ts.map +1 -1
- package/dist/cjs/ai/tools/zod/index.js +2 -2
- package/dist/cjs/ai/tools/zod/index.js.map +1 -1
- package/dist/cjs/ai/tools/zod/types.d.ts +2 -0
- package/dist/cjs/ai/tools/zod/types.d.ts.map +1 -1
- package/dist/cjs/ai/tools/zod/types.js.map +1 -1
- package/dist/cjs/core/client.d.ts +25 -0
- package/dist/cjs/core/client.d.ts.map +1 -1
- package/dist/cjs/core/client.js +30 -0
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/decoders/index.d.ts +36 -0
- package/dist/cjs/decoders/index.d.ts.map +1 -0
- package/dist/cjs/decoders/index.js +62 -0
- package/dist/cjs/decoders/index.js.map +1 -0
- package/dist/cjs/decoders/layout.d.ts +105 -0
- package/dist/cjs/decoders/layout.d.ts.map +1 -0
- package/dist/cjs/decoders/layout.js +188 -0
- package/dist/cjs/decoders/layout.js.map +1 -0
- package/dist/cjs/decoders/lookup-table.d.ts +60 -0
- package/dist/cjs/decoders/lookup-table.d.ts.map +1 -0
- package/dist/cjs/decoders/lookup-table.js +75 -0
- package/dist/cjs/decoders/lookup-table.js.map +1 -0
- package/dist/cjs/decoders/multisig.d.ts +49 -0
- package/dist/cjs/decoders/multisig.d.ts.map +1 -0
- package/dist/cjs/decoders/multisig.js +50 -0
- package/dist/cjs/decoders/multisig.js.map +1 -0
- package/dist/cjs/decoders/nonce.d.ts +54 -0
- package/dist/cjs/decoders/nonce.d.ts.map +1 -0
- package/dist/cjs/decoders/nonce.js +48 -0
- package/dist/cjs/decoders/nonce.js.map +1 -0
- package/dist/cjs/decoders/stake.d.ts +65 -0
- package/dist/cjs/decoders/stake.d.ts.map +1 -0
- package/dist/cjs/decoders/stake.js +86 -0
- package/dist/cjs/decoders/stake.js.map +1 -0
- package/dist/cjs/decoders/token-2022.d.ts +134 -0
- package/dist/cjs/decoders/token-2022.d.ts.map +1 -0
- package/dist/cjs/decoders/token-2022.js +160 -0
- package/dist/cjs/decoders/token-2022.js.map +1 -0
- package/dist/cjs/decoders/token.d.ts +87 -0
- package/dist/cjs/decoders/token.d.ts.map +1 -0
- package/dist/cjs/decoders/token.js +71 -0
- package/dist/cjs/decoders/token.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/AccountReader.html +61 -0
- package/dist/docs/classes/AccountsClient.html +43 -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/NetworkError.html +5 -5
- package/dist/docs/classes/RpcMethodNotFoundError.html +4 -4
- package/dist/docs/classes/SolanaRpc.html +55 -55
- package/dist/docs/classes/SynapseClient.html +35 -25
- 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/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 +23 -0
- 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/base58Encode.html +1 -1
- package/dist/docs/functions/base64ToBytes.html +7 -0
- 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/createSynapse.html +1 -1
- package/dist/docs/functions/decodeLookupTable.html +17 -0
- package/dist/docs/functions/decodeMint.html +6 -0
- package/dist/docs/functions/decodeMultisig.html +13 -0
- package/dist/docs/functions/decodeNonceAccount.html +14 -0
- package/dist/docs/functions/decodeStakeAccount.html +12 -0
- package/dist/docs/functions/decodeToken2022Account.html +5 -0
- package/dist/docs/functions/decodeToken2022Mint.html +5 -0
- package/dist/docs/functions/decodeTokenAccount.html +6 -0
- package/dist/docs/functions/encodeBase58.html +7 -0
- package/dist/docs/functions/fetchLookupTable.html +10 -0
- package/dist/docs/functions/fetchMint.html +11 -0
- package/dist/docs/functions/fetchNonceAccount.html +10 -0
- package/dist/docs/functions/fetchStakeAccount.html +10 -0
- package/dist/docs/functions/fetchTokenAccount.html +12 -0
- package/dist/docs/functions/fetchTokenAccountsByOwner.html +11 -0
- 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/getDecodedAccount.html +14 -0
- package/dist/docs/functions/getDecodedAccounts.html +9 -0
- 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/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/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/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/toKitLamports.html +1 -1
- package/dist/docs/functions/toKitSignatureString.html +1 -1
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/interfaces/AccountInfo.html +7 -7
- package/dist/docs/interfaces/AccountNotification.html +2 -2
- package/dist/docs/interfaces/AccountSubParams.html +2 -2
- package/dist/docs/interfaces/AssetSignatureInfo.html +2 -2
- package/dist/docs/interfaces/AssetSignaturesPage.html +2 -2
- 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/CallOptions.html +6 -6
- package/dist/docs/interfaces/ConfirmedTransaction.html +6 -6
- package/dist/docs/interfaces/ContactInfo.html +2 -2
- 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 +10 -0
- package/dist/docs/interfaces/DecodedLookupTable.html +20 -0
- package/dist/docs/interfaces/DecodedMint.html +16 -0
- package/dist/docs/interfaces/DecodedMultisig.html +14 -0
- package/dist/docs/interfaces/DecodedNonceAccount.html +16 -0
- package/dist/docs/interfaces/DecodedStakeAccount.html +7 -0
- package/dist/docs/interfaces/DecodedToken2022Account.html +20 -0
- package/dist/docs/interfaces/DecodedToken2022Mint.html +14 -0
- package/dist/docs/interfaces/DecodedTokenAccount.html +22 -0
- package/dist/docs/interfaces/DefaultAccountStateExt.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/FetchedMint.html +13 -0
- package/dist/docs/interfaces/FetchedTokenAccount.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 +4 -0
- 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/InterestBearingConfigExt.html +9 -0
- package/dist/docs/interfaces/LatencyProbeResult.html +2 -2
- package/dist/docs/interfaces/LogsNotification.html +2 -2
- package/dist/docs/interfaces/LogsSubParams.html +2 -2
- package/dist/docs/interfaces/MemoTransferExt.html +5 -0
- package/dist/docs/interfaces/MetadataPointerExt.html +6 -0
- package/dist/docs/interfaces/MintCloseAuthorityExt.html +5 -0
- package/dist/docs/interfaces/NonTransferableExt.html +4 -0
- 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 +5 -0
- 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/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/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/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 +5 -0
- package/dist/docs/interfaces/StakeDelegation.html +9 -0
- package/dist/docs/interfaces/StakeLockup.html +9 -0
- package/dist/docs/interfaces/StakeMeta.html +6 -0
- package/dist/docs/interfaces/Supply.html +5 -5
- package/dist/docs/interfaces/SynapseClientConfig.html +9 -9
- package/dist/docs/interfaces/SynapseEndpoint.html +7 -7
- 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/TransactionMeta.html +11 -11
- package/dist/docs/interfaces/TransferFeeAmount.html +5 -0
- package/dist/docs/interfaces/TransferFeeConfig.html +9 -0
- package/dist/docs/interfaces/TransportConfig.html +7 -7
- package/dist/docs/interfaces/UnknownExtension.html +6 -0
- package/dist/docs/interfaces/VoteAccount.html +9 -9
- package/dist/docs/interfaces/VoteAccountsResult.html +3 -3
- package/dist/docs/interfaces/WsConfig.html +6 -6
- package/dist/docs/media/CHANGELOG.md +93 -2
- package/dist/docs/modules.html +65 -2
- package/dist/docs/types/AccountFetchOpts.html +3 -0
- 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 +3 -0
- 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 +3 -0
- 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/Signature.html +1 -1
- package/dist/docs/types/Slot.html +1 -1
- package/dist/docs/types/StakeAccountType.html +3 -0
- package/dist/docs/types/SubscriptionId.html +1 -1
- package/dist/docs/types/TokenAccountState.html +3 -0
- 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/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 +3 -0
- package/dist/docs/variables/LOOKUP_TABLE_PROGRAM_ID.html +3 -0
- package/dist/docs/variables/MARINADE_PROGRAMS.html +1 -1
- package/dist/docs/variables/MAX_MULTISIG_SIGNERS.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 +3 -0
- package/dist/docs/variables/MULTISIG_SIZE.html +3 -0
- package/dist/docs/variables/NONCE_ACCOUNT_SIZE.html +3 -0
- 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 +3 -0
- 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_PROGRAMS.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAM_ID.html +3 -0
- package/dist/docs/variables/TOKEN_2022_PROGRAM_ID.html +3 -0
- package/dist/docs/variables/TOKEN_ACCOUNT_SIZE.html +3 -0
- package/dist/docs/variables/TOKEN_PROGRAM_ID.html +3 -0
- package/dist/esm/accounts/helpers.d.ts +88 -0
- package/dist/esm/accounts/helpers.d.ts.map +1 -0
- package/dist/esm/accounts/helpers.js +112 -0
- package/dist/esm/accounts/helpers.js.map +1 -0
- package/dist/esm/accounts/index.d.ts +105 -0
- package/dist/esm/accounts/index.d.ts.map +1 -0
- package/dist/esm/accounts/index.js +124 -0
- package/dist/esm/accounts/index.js.map +1 -0
- package/dist/esm/accounts/lookup.d.ts +30 -0
- package/dist/esm/accounts/lookup.d.ts.map +1 -0
- package/dist/esm/accounts/lookup.js +28 -0
- package/dist/esm/accounts/lookup.js.map +1 -0
- package/dist/esm/accounts/nonce.d.ts +30 -0
- package/dist/esm/accounts/nonce.d.ts.map +1 -0
- package/dist/esm/accounts/nonce.js +28 -0
- package/dist/esm/accounts/nonce.js.map +1 -0
- package/dist/esm/accounts/stake.d.ts +33 -0
- package/dist/esm/accounts/stake.d.ts.map +1 -0
- package/dist/esm/accounts/stake.js +31 -0
- package/dist/esm/accounts/stake.js.map +1 -0
- package/dist/esm/accounts/token.d.ts +98 -0
- package/dist/esm/accounts/token.d.ts.map +1 -0
- package/dist/esm/accounts/token.js +121 -0
- package/dist/esm/accounts/token.js.map +1 -0
- package/dist/esm/ai/tools/index.d.ts +1 -1
- package/dist/esm/ai/tools/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/index.js +4 -4
- package/dist/esm/ai/tools/index.js.map +1 -1
- package/dist/esm/ai/tools/protocols/index.d.ts +13 -1
- package/dist/esm/ai/tools/protocols/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/index.js +23 -1
- package/dist/esm/ai/tools/protocols/index.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/index.d.ts +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/index.js +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/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 +22 -22
- package/dist/esm/ai/tools/protocols/jupiter/schemas.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/tools.d.ts +9 -4
- package/dist/esm/ai/tools/protocols/jupiter/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter/tools.js +37 -5
- package/dist/esm/ai/tools/protocols/jupiter/tools.js.map +1 -1
- package/dist/esm/ai/tools/protocols/jupiter-onchain/index.d.ts +13 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/index.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/index.js +13 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/index.js.map +1 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/schemas.d.ts +11 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/schemas.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/schemas.js +283 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/schemas.js.map +1 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.d.ts +58 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.js +336 -0
- package/dist/esm/ai/tools/protocols/jupiter-onchain/tools.js.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/index.d.ts +13 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/index.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/index.js +13 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/index.js.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/schemas.d.ts +11 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/schemas.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/schemas.js +285 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/schemas.js.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.d.ts +58 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.d.ts.map +1 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.js +378 -0
- package/dist/esm/ai/tools/protocols/raydium-onchain/tools.js.map +1 -0
- package/dist/esm/ai/tools/protocols/shared.d.ts +8 -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/zod/index.d.ts +1 -1
- package/dist/esm/ai/tools/zod/index.d.ts.map +1 -1
- package/dist/esm/ai/tools/zod/index.js +2 -2
- package/dist/esm/ai/tools/zod/index.js.map +1 -1
- package/dist/esm/ai/tools/zod/types.d.ts +2 -0
- package/dist/esm/ai/tools/zod/types.d.ts.map +1 -1
- package/dist/esm/ai/tools/zod/types.js.map +1 -1
- package/dist/esm/core/client.d.ts +25 -0
- package/dist/esm/core/client.d.ts.map +1 -1
- package/dist/esm/core/client.js +30 -0
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/decoders/index.d.ts +36 -0
- package/dist/esm/decoders/index.d.ts.map +1 -0
- package/dist/esm/decoders/index.js +37 -0
- package/dist/esm/decoders/index.js.map +1 -0
- package/dist/esm/decoders/layout.d.ts +105 -0
- package/dist/esm/decoders/layout.d.ts.map +1 -0
- package/dist/esm/decoders/layout.js +183 -0
- package/dist/esm/decoders/layout.js.map +1 -0
- package/dist/esm/decoders/lookup-table.d.ts +60 -0
- package/dist/esm/decoders/lookup-table.d.ts.map +1 -0
- package/dist/esm/decoders/lookup-table.js +71 -0
- package/dist/esm/decoders/lookup-table.js.map +1 -0
- package/dist/esm/decoders/multisig.d.ts +49 -0
- package/dist/esm/decoders/multisig.d.ts.map +1 -0
- package/dist/esm/decoders/multisig.js +46 -0
- package/dist/esm/decoders/multisig.js.map +1 -0
- package/dist/esm/decoders/nonce.d.ts +54 -0
- package/dist/esm/decoders/nonce.d.ts.map +1 -0
- package/dist/esm/decoders/nonce.js +44 -0
- package/dist/esm/decoders/nonce.js.map +1 -0
- package/dist/esm/decoders/stake.d.ts +65 -0
- package/dist/esm/decoders/stake.d.ts.map +1 -0
- package/dist/esm/decoders/stake.js +82 -0
- package/dist/esm/decoders/stake.js.map +1 -0
- package/dist/esm/decoders/token-2022.d.ts +134 -0
- package/dist/esm/decoders/token-2022.d.ts.map +1 -0
- package/dist/esm/decoders/token-2022.js +155 -0
- package/dist/esm/decoders/token-2022.js.map +1 -0
- package/dist/esm/decoders/token.d.ts +87 -0
- package/dist/esm/decoders/token.d.ts.map +1 -0
- package/dist/esm/decoders/token.js +66 -0
- package/dist/esm/decoders/token.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TOKEN_PROGRAM_ID | @oobe-protocol-labs/synapse-client-sdk</title><meta name="description" content="Documentation for @oobe-protocol-labs/synapse-client-sdk"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@oobe-protocol-labs/synapse-client-sdk</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@oobe-protocol-labs/synapse-client-sdk</a></li><li><a href="TOKEN_PROGRAM_ID.html">TOKEN_PROGRAM_ID</a></li></ul><h1>Variable TOKEN_PROGRAM_ID<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">TOKEN_<wbr/>PROGRAM_<wbr/>ID</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"</span><span class="tsd-signature-symbol"> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'</span></div><div class="tsd-comment tsd-typography"><p>SPL Token Program ID.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-Since"><h4 class="tsd-anchor-link"><a id="Since" class="tsd-anchor"></a>Since<a href="#Since" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>1.1.0</p>
|
|
3
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OOBE-PROTOCOL/synapse-client-sdk/blob/c6e0bb4bb599c7462e5b7f8c1a895d0fdb4f83a7/src/decoders/token.ts#L86">packages/synapse-client-sdk/src/decoders/token.ts:86</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@oobe-protocol-labs/synapse-client-sdk</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic decoded account fetcher utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable pattern for fetching raw account data via RPC
|
|
5
|
+
* and decoding it with a typed decoder function.
|
|
6
|
+
*
|
|
7
|
+
* @module accounts/helpers
|
|
8
|
+
* @since 1.1.0
|
|
9
|
+
*/
|
|
10
|
+
import type { HttpTransport, CallOptions } from '../core/transport';
|
|
11
|
+
import type { Pubkey, Commitment } from '../core/types';
|
|
12
|
+
/** @internal Minimal account info from base64-encoded RPC response. */
|
|
13
|
+
interface RawAccountInfo {
|
|
14
|
+
data: [string, string] | string;
|
|
15
|
+
executable: boolean;
|
|
16
|
+
lamports: number;
|
|
17
|
+
owner: string;
|
|
18
|
+
rentEpoch: number;
|
|
19
|
+
space: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of a decoded account fetch.
|
|
23
|
+
*
|
|
24
|
+
* @typeParam T - The decoded account type.
|
|
25
|
+
* @since 1.1.0
|
|
26
|
+
*/
|
|
27
|
+
export interface DecodedAccountResult<T> {
|
|
28
|
+
/** Decoded account data. */
|
|
29
|
+
decoded: T;
|
|
30
|
+
/** Raw account info as returned by the RPC (base64 encoding). */
|
|
31
|
+
raw: RawAccountInfo;
|
|
32
|
+
/** Slot at which the data was fetched. */
|
|
33
|
+
slot: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Base64-decode a Solana RPC account data field.
|
|
37
|
+
*
|
|
38
|
+
* The RPC returns account data as `[base64String, "base64"]` when
|
|
39
|
+
* `encoding: "base64"` is used.
|
|
40
|
+
*
|
|
41
|
+
* @param data - The raw data field from getAccountInfo.
|
|
42
|
+
* @returns Decoded Uint8Array.
|
|
43
|
+
* @since 1.1.0
|
|
44
|
+
*/
|
|
45
|
+
export declare function base64ToBytes(data: [string, string] | string | unknown): Uint8Array;
|
|
46
|
+
/**
|
|
47
|
+
* Fetch a raw account and decode its data using the provided decoder.
|
|
48
|
+
*
|
|
49
|
+
* This is the core building block for all typed account fetchers.
|
|
50
|
+
* It handles the RPC call, base64 decoding, and applies the decoder.
|
|
51
|
+
*
|
|
52
|
+
* @typeParam T - The decoded account type.
|
|
53
|
+
* @param transport - HTTP transport for RPC calls.
|
|
54
|
+
* @param pubkey - Account public key to fetch.
|
|
55
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
56
|
+
* @param opts - RPC options (commitment, call overrides).
|
|
57
|
+
* @returns Decoded result, or `null` if the account doesn't exist.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { getDecodedAccount } from '@oobe-protocol-labs/synapse-client-sdk/accounts';
|
|
62
|
+
* import { decodeTokenAccount } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
63
|
+
*
|
|
64
|
+
* const result = await getDecodedAccount(transport, pubkey, decodeTokenAccount);
|
|
65
|
+
* if (result) console.log(`Amount: ${result.decoded.amount}`);
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @since 1.1.0
|
|
69
|
+
*/
|
|
70
|
+
export declare function getDecodedAccount<T>(transport: HttpTransport, pubkey: Pubkey, decoder: (data: Uint8Array) => T, opts?: {
|
|
71
|
+
commitment?: Commitment;
|
|
72
|
+
} & CallOptions): Promise<DecodedAccountResult<T> | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetch multiple accounts and decode them in batch (single RPC call).
|
|
75
|
+
*
|
|
76
|
+
* @typeParam T - The decoded account type.
|
|
77
|
+
* @param transport - HTTP transport for RPC calls.
|
|
78
|
+
* @param pubkeys - Account public keys to fetch.
|
|
79
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
80
|
+
* @param opts - RPC options.
|
|
81
|
+
* @returns Array of decoded results (null entries for non-existent accounts).
|
|
82
|
+
* @since 1.1.0
|
|
83
|
+
*/
|
|
84
|
+
export declare function getDecodedAccounts<T>(transport: HttpTransport, pubkeys: Pubkey[], decoder: (data: Uint8Array) => T, opts?: {
|
|
85
|
+
commitment?: Commitment;
|
|
86
|
+
} & CallOptions): Promise<(DecodedAccountResult<T> | null)[]>;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/accounts/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAQ,MAAM,eAAe,CAAC;AAU9D,uEAAuE;AACvE,UAAU,cAAc;IACtB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,4BAA4B;IAC5B,OAAO,EAAE,CAAC,CAAC;IACX,iEAAiE;IACjE,GAAG,EAAE,cAAc,CAAC;IACpB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAoBnF;AAID;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,EAChC,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAgB,GACnD,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAqBzC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,EAChC,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAgB,GACnD,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAoB7C"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic decoded account fetcher utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable pattern for fetching raw account data via RPC
|
|
5
|
+
* and decoding it with a typed decoder function.
|
|
6
|
+
*
|
|
7
|
+
* @module accounts/helpers
|
|
8
|
+
* @since 1.1.0
|
|
9
|
+
*/
|
|
10
|
+
// ── Base64 decoding ────────────────────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* Base64-decode a Solana RPC account data field.
|
|
13
|
+
*
|
|
14
|
+
* The RPC returns account data as `[base64String, "base64"]` when
|
|
15
|
+
* `encoding: "base64"` is used.
|
|
16
|
+
*
|
|
17
|
+
* @param data - The raw data field from getAccountInfo.
|
|
18
|
+
* @returns Decoded Uint8Array.
|
|
19
|
+
* @since 1.1.0
|
|
20
|
+
*/
|
|
21
|
+
export function base64ToBytes(data) {
|
|
22
|
+
let b64;
|
|
23
|
+
if (Array.isArray(data) && typeof data[0] === 'string') {
|
|
24
|
+
b64 = data[0];
|
|
25
|
+
}
|
|
26
|
+
else if (typeof data === 'string') {
|
|
27
|
+
b64 = data;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error('Unexpected account data format: expected [base64, "base64"] or string');
|
|
31
|
+
}
|
|
32
|
+
// Node.js Buffer path (fast)
|
|
33
|
+
if (typeof Buffer !== 'undefined') {
|
|
34
|
+
return new Uint8Array(Buffer.from(b64, 'base64'));
|
|
35
|
+
}
|
|
36
|
+
// Browser / edge path
|
|
37
|
+
const binary = atob(b64);
|
|
38
|
+
const bytes = new Uint8Array(binary.length);
|
|
39
|
+
for (let i = 0; i < binary.length; i++)
|
|
40
|
+
bytes[i] = binary.charCodeAt(i);
|
|
41
|
+
return bytes;
|
|
42
|
+
}
|
|
43
|
+
// ── Core fetcher ───────────────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Fetch a raw account and decode its data using the provided decoder.
|
|
46
|
+
*
|
|
47
|
+
* This is the core building block for all typed account fetchers.
|
|
48
|
+
* It handles the RPC call, base64 decoding, and applies the decoder.
|
|
49
|
+
*
|
|
50
|
+
* @typeParam T - The decoded account type.
|
|
51
|
+
* @param transport - HTTP transport for RPC calls.
|
|
52
|
+
* @param pubkey - Account public key to fetch.
|
|
53
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
54
|
+
* @param opts - RPC options (commitment, call overrides).
|
|
55
|
+
* @returns Decoded result, or `null` if the account doesn't exist.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { getDecodedAccount } from '@oobe-protocol-labs/synapse-client-sdk/accounts';
|
|
60
|
+
* import { decodeTokenAccount } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
61
|
+
*
|
|
62
|
+
* const result = await getDecodedAccount(transport, pubkey, decodeTokenAccount);
|
|
63
|
+
* if (result) console.log(`Amount: ${result.decoded.amount}`);
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @since 1.1.0
|
|
67
|
+
*/
|
|
68
|
+
export async function getDecodedAccount(transport, pubkey, decoder, opts = {}) {
|
|
69
|
+
const { commitment, ...callOpts } = opts;
|
|
70
|
+
const cfg = { encoding: 'base64' };
|
|
71
|
+
if (commitment)
|
|
72
|
+
cfg.commitment = commitment;
|
|
73
|
+
const result = await transport.request('getAccountInfo', [pubkey, cfg], callOpts);
|
|
74
|
+
if (!result.value)
|
|
75
|
+
return null;
|
|
76
|
+
const bytes = base64ToBytes(result.value.data);
|
|
77
|
+
const decoded = decoder(bytes);
|
|
78
|
+
return {
|
|
79
|
+
decoded,
|
|
80
|
+
raw: result.value,
|
|
81
|
+
slot: result.context.slot,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Fetch multiple accounts and decode them in batch (single RPC call).
|
|
86
|
+
*
|
|
87
|
+
* @typeParam T - The decoded account type.
|
|
88
|
+
* @param transport - HTTP transport for RPC calls.
|
|
89
|
+
* @param pubkeys - Account public keys to fetch.
|
|
90
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
91
|
+
* @param opts - RPC options.
|
|
92
|
+
* @returns Array of decoded results (null entries for non-existent accounts).
|
|
93
|
+
* @since 1.1.0
|
|
94
|
+
*/
|
|
95
|
+
export async function getDecodedAccounts(transport, pubkeys, decoder, opts = {}) {
|
|
96
|
+
const { commitment, ...callOpts } = opts;
|
|
97
|
+
const cfg = { encoding: 'base64' };
|
|
98
|
+
if (commitment)
|
|
99
|
+
cfg.commitment = commitment;
|
|
100
|
+
const result = await transport.request('getMultipleAccounts', [pubkeys, cfg], callOpts);
|
|
101
|
+
return result.value.map((acct) => {
|
|
102
|
+
if (!acct)
|
|
103
|
+
return null;
|
|
104
|
+
const bytes = base64ToBytes(acct.data);
|
|
105
|
+
return {
|
|
106
|
+
decoded: decoder(bytes),
|
|
107
|
+
raw: acct,
|
|
108
|
+
slot: result.context.slot,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/accounts/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwCH,kEAAkE;AAElE;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,IAAyC;IACrE,IAAI,GAAW,CAAC;IAChB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvD,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,GAAG,GAAG,IAAI,CAAC;IACb,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IAED,6BAA6B;IAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,sBAAsB;IACtB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,kEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAwB,EACxB,MAAc,EACd,OAAgC,EAChC,OAAkD,EAAE;IAEpD,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,GAAG,GAA4B,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAC5D,IAAI,UAAU;QAAE,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;IAE5C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CACpC,gBAAgB,EAChB,CAAC,MAAM,EAAE,GAAG,CAAC,EACb,QAAQ,CACT,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAE/B,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO;QACL,OAAO;QACP,GAAG,EAAE,MAAM,CAAC,KAAK;QACjB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;KAC1B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,SAAwB,EACxB,OAAiB,EACjB,OAAgC,EAChC,OAAkD,EAAE;IAEpD,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,GAAG,GAA4B,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAC5D,IAAI,UAAU;QAAE,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;IAE5C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CACpC,qBAAqB,EACrB,CAAC,OAAO,EAAE,GAAG,CAAC,EACd,QAAQ,CACT,CAAC;IAEF,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;SAC1B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed account fetchers with built-in decoding.
|
|
3
|
+
*
|
|
4
|
+
* Provides high-level methods that fetch raw account data via RPC
|
|
5
|
+
* and return fully decoded, typed objects. This is the "batteries-included"
|
|
6
|
+
* layer that eliminates manual base64 decoding and byte layout parsing.
|
|
7
|
+
*
|
|
8
|
+
* @module accounts
|
|
9
|
+
* @since 1.1.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const client = new SynapseClient({ endpoint: '...' });
|
|
14
|
+
*
|
|
15
|
+
* // One call, fully decoded:
|
|
16
|
+
* const mint = await client.accounts.fetchMint(mintPubkey);
|
|
17
|
+
* console.log(`Supply: ${mint.decoded.supply}, Decimals: ${mint.decoded.decimals}`);
|
|
18
|
+
*
|
|
19
|
+
* const acct = await client.accounts.fetchTokenAccount(tokenPubkey);
|
|
20
|
+
* console.log(`Balance: ${acct.decoded.amount}`);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { HttpTransport, CallOptions } from '../core/transport';
|
|
24
|
+
import type { Pubkey, Commitment } from '../core/types';
|
|
25
|
+
export { fetchTokenAccount, fetchMint, fetchTokenAccountsByOwner } from './token';
|
|
26
|
+
export { fetchStakeAccount } from './stake';
|
|
27
|
+
export { fetchNonceAccount } from './nonce';
|
|
28
|
+
export { fetchLookupTable } from './lookup';
|
|
29
|
+
export { getDecodedAccount, getDecodedAccounts, base64ToBytes } from './helpers';
|
|
30
|
+
export type { DecodedAccountResult } from './helpers';
|
|
31
|
+
export type { FetchedTokenAccount, FetchedMint } from './token';
|
|
32
|
+
/** Options for account fetch methods. @since 1.1.0 */
|
|
33
|
+
export type AccountFetchOpts = {
|
|
34
|
+
commitment?: Commitment;
|
|
35
|
+
} & CallOptions;
|
|
36
|
+
/**
|
|
37
|
+
* High-level accounts client with decoded fetch methods.
|
|
38
|
+
*
|
|
39
|
+
* Exposed as `client.accounts` on {@link SynapseClient}. Each method
|
|
40
|
+
* fetches raw data, base64-decodes it, and runs the appropriate native
|
|
41
|
+
* decoder — returning a fully typed object.
|
|
42
|
+
*
|
|
43
|
+
* @since 1.1.0
|
|
44
|
+
*/
|
|
45
|
+
export declare class AccountsClient {
|
|
46
|
+
private readonly transport;
|
|
47
|
+
constructor(transport: HttpTransport);
|
|
48
|
+
/**
|
|
49
|
+
* Fetch and decode a single SPL Token account.
|
|
50
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
51
|
+
* @since 1.1.0
|
|
52
|
+
*/
|
|
53
|
+
fetchTokenAccount(pubkey: Pubkey, opts?: AccountFetchOpts): Promise<import("./token").FetchedTokenAccount | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch and decode a token mint.
|
|
56
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
57
|
+
* @since 1.1.0
|
|
58
|
+
*/
|
|
59
|
+
fetchMint(pubkey: Pubkey, opts?: AccountFetchOpts): Promise<import("./token").FetchedMint | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Fetch all token accounts owned by a wallet, optionally filtered by mint.
|
|
62
|
+
* @since 1.1.0
|
|
63
|
+
*/
|
|
64
|
+
fetchTokenAccountsByOwner(owner: Pubkey, mint?: Pubkey, opts?: AccountFetchOpts & {
|
|
65
|
+
programId?: Pubkey;
|
|
66
|
+
}): Promise<import("./token").FetchedTokenAccount[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Fetch and decode a stake account.
|
|
69
|
+
* @since 1.1.0
|
|
70
|
+
*/
|
|
71
|
+
fetchStakeAccount(pubkey: Pubkey, opts?: AccountFetchOpts): Promise<import("./helpers").DecodedAccountResult<import("..").DecodedStakeAccount> | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Fetch and decode a durable nonce account.
|
|
74
|
+
* @since 1.1.0
|
|
75
|
+
*/
|
|
76
|
+
fetchNonceAccount(pubkey: Pubkey, opts?: AccountFetchOpts): Promise<import("./helpers").DecodedAccountResult<import("..").DecodedNonceAccount> | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Fetch and decode an Address Lookup Table.
|
|
79
|
+
* @since 1.1.0
|
|
80
|
+
*/
|
|
81
|
+
fetchLookupTable(pubkey: Pubkey, opts?: AccountFetchOpts): Promise<import("./helpers").DecodedAccountResult<import("..").DecodedLookupTable> | null>;
|
|
82
|
+
/**
|
|
83
|
+
* Fetch any account and decode it with a custom decoder function.
|
|
84
|
+
*
|
|
85
|
+
* @typeParam T - The decoded type.
|
|
86
|
+
* @param pubkey - Account public key.
|
|
87
|
+
* @param decoder - Custom decoder function `(data: Uint8Array) => T`.
|
|
88
|
+
* @param opts - RPC options.
|
|
89
|
+
* @returns Decoded result or null.
|
|
90
|
+
* @since 1.1.0
|
|
91
|
+
*/
|
|
92
|
+
fetchDecoded<T>(pubkey: Pubkey, decoder: (data: Uint8Array) => T, opts?: AccountFetchOpts): Promise<import("./helpers").DecodedAccountResult<T> | null>;
|
|
93
|
+
/**
|
|
94
|
+
* Fetch multiple accounts and decode them with a custom decoder (single RPC call).
|
|
95
|
+
*
|
|
96
|
+
* @typeParam T - The decoded type.
|
|
97
|
+
* @param pubkeys - Account public keys.
|
|
98
|
+
* @param decoder - Custom decoder function.
|
|
99
|
+
* @param opts - RPC options.
|
|
100
|
+
* @returns Array of decoded results (null for non-existent).
|
|
101
|
+
* @since 1.1.0
|
|
102
|
+
*/
|
|
103
|
+
fetchDecodedBatch<T>(pubkeys: Pubkey[], decoder: (data: Uint8Array) => T, opts?: AccountFetchOpts): Promise<(import("./helpers").DecodedAccountResult<T> | null)[]>;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accounts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQxD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACjF,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEhE,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAW,CAAC;AAEzE;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAIrD;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAIzD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAIjD;;;OAGG;IACH,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAMxG;;;OAGG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAMzD;;;OAGG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAMzD;;;OAGG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAMxD;;;;;;;;;OASG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAIzF;;;;;;;;;OASG;IACH,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,gBAAgB;CAGlG"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed account fetchers with built-in decoding.
|
|
3
|
+
*
|
|
4
|
+
* Provides high-level methods that fetch raw account data via RPC
|
|
5
|
+
* and return fully decoded, typed objects. This is the "batteries-included"
|
|
6
|
+
* layer that eliminates manual base64 decoding and byte layout parsing.
|
|
7
|
+
*
|
|
8
|
+
* @module accounts
|
|
9
|
+
* @since 1.1.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const client = new SynapseClient({ endpoint: '...' });
|
|
14
|
+
*
|
|
15
|
+
* // One call, fully decoded:
|
|
16
|
+
* const mint = await client.accounts.fetchMint(mintPubkey);
|
|
17
|
+
* console.log(`Supply: ${mint.decoded.supply}, Decimals: ${mint.decoded.decimals}`);
|
|
18
|
+
*
|
|
19
|
+
* const acct = await client.accounts.fetchTokenAccount(tokenPubkey);
|
|
20
|
+
* console.log(`Balance: ${acct.decoded.amount}`);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { fetchTokenAccount, fetchMint, fetchTokenAccountsByOwner } from './token.js';
|
|
24
|
+
import { fetchStakeAccount } from './stake.js';
|
|
25
|
+
import { fetchNonceAccount } from './nonce.js';
|
|
26
|
+
import { fetchLookupTable } from './lookup.js';
|
|
27
|
+
import { getDecodedAccount, getDecodedAccounts } from './helpers.js';
|
|
28
|
+
// ── Re-export individual fetchers for tree-shaking ─────────────
|
|
29
|
+
export { fetchTokenAccount, fetchMint, fetchTokenAccountsByOwner } from './token.js';
|
|
30
|
+
export { fetchStakeAccount } from './stake.js';
|
|
31
|
+
export { fetchNonceAccount } from './nonce.js';
|
|
32
|
+
export { fetchLookupTable } from './lookup.js';
|
|
33
|
+
export { getDecodedAccount, getDecodedAccounts, base64ToBytes } from './helpers.js';
|
|
34
|
+
/**
|
|
35
|
+
* High-level accounts client with decoded fetch methods.
|
|
36
|
+
*
|
|
37
|
+
* Exposed as `client.accounts` on {@link SynapseClient}. Each method
|
|
38
|
+
* fetches raw data, base64-decodes it, and runs the appropriate native
|
|
39
|
+
* decoder — returning a fully typed object.
|
|
40
|
+
*
|
|
41
|
+
* @since 1.1.0
|
|
42
|
+
*/
|
|
43
|
+
export class AccountsClient {
|
|
44
|
+
transport;
|
|
45
|
+
constructor(transport) {
|
|
46
|
+
this.transport = transport;
|
|
47
|
+
}
|
|
48
|
+
// ── Token ────────────────────────────────────────────────────
|
|
49
|
+
/**
|
|
50
|
+
* Fetch and decode a single SPL Token account.
|
|
51
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
52
|
+
* @since 1.1.0
|
|
53
|
+
*/
|
|
54
|
+
fetchTokenAccount(pubkey, opts) {
|
|
55
|
+
return fetchTokenAccount(this.transport, pubkey, opts);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Fetch and decode a token mint.
|
|
59
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
60
|
+
* @since 1.1.0
|
|
61
|
+
*/
|
|
62
|
+
fetchMint(pubkey, opts) {
|
|
63
|
+
return fetchMint(this.transport, pubkey, opts);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Fetch all token accounts owned by a wallet, optionally filtered by mint.
|
|
67
|
+
* @since 1.1.0
|
|
68
|
+
*/
|
|
69
|
+
fetchTokenAccountsByOwner(owner, mint, opts) {
|
|
70
|
+
return fetchTokenAccountsByOwner(this.transport, owner, mint, opts);
|
|
71
|
+
}
|
|
72
|
+
// ── Stake ────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* Fetch and decode a stake account.
|
|
75
|
+
* @since 1.1.0
|
|
76
|
+
*/
|
|
77
|
+
fetchStakeAccount(pubkey, opts) {
|
|
78
|
+
return fetchStakeAccount(this.transport, pubkey, opts);
|
|
79
|
+
}
|
|
80
|
+
// ── Nonce ────────────────────────────────────────────────────
|
|
81
|
+
/**
|
|
82
|
+
* Fetch and decode a durable nonce account.
|
|
83
|
+
* @since 1.1.0
|
|
84
|
+
*/
|
|
85
|
+
fetchNonceAccount(pubkey, opts) {
|
|
86
|
+
return fetchNonceAccount(this.transport, pubkey, opts);
|
|
87
|
+
}
|
|
88
|
+
// ── Lookup Table ─────────────────────────────────────────────
|
|
89
|
+
/**
|
|
90
|
+
* Fetch and decode an Address Lookup Table.
|
|
91
|
+
* @since 1.1.0
|
|
92
|
+
*/
|
|
93
|
+
fetchLookupTable(pubkey, opts) {
|
|
94
|
+
return fetchLookupTable(this.transport, pubkey, opts);
|
|
95
|
+
}
|
|
96
|
+
// ── Generic ──────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* Fetch any account and decode it with a custom decoder function.
|
|
99
|
+
*
|
|
100
|
+
* @typeParam T - The decoded type.
|
|
101
|
+
* @param pubkey - Account public key.
|
|
102
|
+
* @param decoder - Custom decoder function `(data: Uint8Array) => T`.
|
|
103
|
+
* @param opts - RPC options.
|
|
104
|
+
* @returns Decoded result or null.
|
|
105
|
+
* @since 1.1.0
|
|
106
|
+
*/
|
|
107
|
+
fetchDecoded(pubkey, decoder, opts) {
|
|
108
|
+
return getDecodedAccount(this.transport, pubkey, decoder, opts);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Fetch multiple accounts and decode them with a custom decoder (single RPC call).
|
|
112
|
+
*
|
|
113
|
+
* @typeParam T - The decoded type.
|
|
114
|
+
* @param pubkeys - Account public keys.
|
|
115
|
+
* @param decoder - Custom decoder function.
|
|
116
|
+
* @param opts - RPC options.
|
|
117
|
+
* @returns Array of decoded results (null for non-existent).
|
|
118
|
+
* @since 1.1.0
|
|
119
|
+
*/
|
|
120
|
+
fetchDecodedBatch(pubkeys, decoder, opts) {
|
|
121
|
+
return getDecodedAccounts(this.transport, pubkeys, decoder, opts);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/accounts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAElE,kEAAkE;AAClE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAOjF;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,gEAAgE;IAEhE;;;;OAIG;IACH,iBAAiB,CAAC,MAAc,EAAE,IAAuB;QACvD,OAAO,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,MAAc,EAAE,IAAuB;QAC/C,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,yBAAyB,CAAC,KAAa,EAAE,IAAa,EAAE,IAAgD;QACtG,OAAO,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;IAED,gEAAgE;IAEhE;;;OAGG;IACH,iBAAiB,CAAC,MAAc,EAAE,IAAuB;QACvD,OAAO,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,gEAAgE;IAEhE;;;OAGG;IACH,iBAAiB,CAAC,MAAc,EAAE,IAAuB;QACvD,OAAO,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,gEAAgE;IAEhE;;;OAGG;IACH,gBAAgB,CAAC,MAAc,EAAE,IAAuB;QACtD,OAAO,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,gEAAgE;IAEhE;;;;;;;;;OASG;IACH,YAAY,CAAI,MAAc,EAAE,OAAgC,EAAE,IAAuB;QACvF,OAAO,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,iBAAiB,CAAI,OAAiB,EAAE,OAAgC,EAAE,IAAuB;QAC/F,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level Address Lookup Table fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module accounts/lookup
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
*/
|
|
7
|
+
import type { HttpTransport, CallOptions } from '../core/transport';
|
|
8
|
+
import type { Pubkey, Commitment } from '../core/types';
|
|
9
|
+
import type { DecodedLookupTable } from '../decoders/lookup-table';
|
|
10
|
+
import type { DecodedAccountResult } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* Fetch and decode an Address Lookup Table account.
|
|
13
|
+
*
|
|
14
|
+
* @param transport - HTTP transport.
|
|
15
|
+
* @param pubkey - Lookup table account public key.
|
|
16
|
+
* @param opts - RPC options.
|
|
17
|
+
* @returns Decoded lookup table, or `null` if not found.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const lut = await fetchLookupTable(transport, lutPubkey);
|
|
22
|
+
* if (lut) console.log(`Contains ${lut.decoded.addresses.length} addresses`);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @since 1.1.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchLookupTable(transport: HttpTransport, pubkey: Pubkey, opts?: {
|
|
28
|
+
commitment?: Commitment;
|
|
29
|
+
} & CallOptions): Promise<DecodedAccountResult<DecodedLookupTable> | null>;
|
|
30
|
+
//# sourceMappingURL=lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../src/accounts/lookup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAgB,GACnD,OAAO,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAE1D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level Address Lookup Table fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module accounts/lookup
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
*/
|
|
7
|
+
import { decodeLookupTable } from '../decoders/lookup-table.js';
|
|
8
|
+
import { getDecodedAccount } from './helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Fetch and decode an Address Lookup Table account.
|
|
11
|
+
*
|
|
12
|
+
* @param transport - HTTP transport.
|
|
13
|
+
* @param pubkey - Lookup table account public key.
|
|
14
|
+
* @param opts - RPC options.
|
|
15
|
+
* @returns Decoded lookup table, or `null` if not found.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const lut = await fetchLookupTable(transport, lutPubkey);
|
|
20
|
+
* if (lut) console.log(`Contains ${lut.decoded.addresses.length} addresses`);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @since 1.1.0
|
|
24
|
+
*/
|
|
25
|
+
export async function fetchLookupTable(transport, pubkey, opts = {}) {
|
|
26
|
+
return getDecodedAccount(transport, pubkey, decodeLookupTable, opts);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/accounts/lookup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAwB,EACxB,MAAc,EACd,OAAkD,EAAE;IAEpD,OAAO,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level typed nonce account fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module accounts/nonce
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
*/
|
|
7
|
+
import type { HttpTransport, CallOptions } from '../core/transport';
|
|
8
|
+
import type { Pubkey, Commitment } from '../core/types';
|
|
9
|
+
import type { DecodedNonceAccount } from '../decoders/nonce';
|
|
10
|
+
import type { DecodedAccountResult } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* Fetch and decode a Solana nonce account.
|
|
13
|
+
*
|
|
14
|
+
* @param transport - HTTP transport.
|
|
15
|
+
* @param pubkey - Nonce account public key.
|
|
16
|
+
* @param opts - RPC options.
|
|
17
|
+
* @returns Decoded nonce account, or `null` if not found.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const nonce = await fetchNonceAccount(transport, noncePubkey);
|
|
22
|
+
* if (nonce) console.log(`Blockhash: ${nonce.decoded.blockhash}`);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @since 1.1.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchNonceAccount(transport: HttpTransport, pubkey: Pubkey, opts?: {
|
|
28
|
+
commitment?: Commitment;
|
|
29
|
+
} & CallOptions): Promise<DecodedAccountResult<DecodedNonceAccount> | null>;
|
|
30
|
+
//# sourceMappingURL=nonce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../../../src/accounts/nonce.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAgB,GACnD,OAAO,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAE3D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level typed nonce account fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module accounts/nonce
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
*/
|
|
7
|
+
import { decodeNonceAccount } from '../decoders/nonce.js';
|
|
8
|
+
import { getDecodedAccount } from './helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Fetch and decode a Solana nonce account.
|
|
11
|
+
*
|
|
12
|
+
* @param transport - HTTP transport.
|
|
13
|
+
* @param pubkey - Nonce account public key.
|
|
14
|
+
* @param opts - RPC options.
|
|
15
|
+
* @returns Decoded nonce account, or `null` if not found.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const nonce = await fetchNonceAccount(transport, noncePubkey);
|
|
20
|
+
* if (nonce) console.log(`Blockhash: ${nonce.decoded.blockhash}`);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @since 1.1.0
|
|
24
|
+
*/
|
|
25
|
+
export async function fetchNonceAccount(transport, pubkey, opts = {}) {
|
|
26
|
+
return getDecodedAccount(transport, pubkey, decodeNonceAccount, opts);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=nonce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.js","sourceRoot":"","sources":["../../../src/accounts/nonce.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAwB,EACxB,MAAc,EACd,OAAkD,EAAE;IAEpD,OAAO,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level typed stake account fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module accounts/stake
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
*/
|
|
7
|
+
import type { HttpTransport, CallOptions } from '../core/transport';
|
|
8
|
+
import type { Pubkey, Commitment } from '../core/types';
|
|
9
|
+
import type { DecodedStakeAccount } from '../decoders/stake';
|
|
10
|
+
import type { DecodedAccountResult } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* Fetch and decode a Solana stake account.
|
|
13
|
+
*
|
|
14
|
+
* @param transport - HTTP transport.
|
|
15
|
+
* @param pubkey - Stake account public key.
|
|
16
|
+
* @param opts - RPC options.
|
|
17
|
+
* @returns Decoded stake account, or `null` if not found.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const stake = await fetchStakeAccount(transport, stakeAccountPubkey);
|
|
22
|
+
* if (stake?.decoded.type === 'delegated') {
|
|
23
|
+
* console.log(`Delegated to: ${stake.decoded.stake!.voterPubkey}`);
|
|
24
|
+
* console.log(`Stake amount: ${stake.decoded.stake!.stake} lamports`);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @since 1.1.0
|
|
29
|
+
*/
|
|
30
|
+
export declare function fetchStakeAccount(transport: HttpTransport, pubkey: Pubkey, opts?: {
|
|
31
|
+
commitment?: Commitment;
|
|
32
|
+
} & CallOptions): Promise<DecodedAccountResult<DecodedStakeAccount> | null>;
|
|
33
|
+
//# sourceMappingURL=stake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stake.d.ts","sourceRoot":"","sources":["../../../src/accounts/stake.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAgB,GACnD,OAAO,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAE3D"}
|