@oobe-protocol-labs/synapse-client-sdk 1.0.1 → 1.0.3
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 +61 -0
- 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/gateway/x402/facilitator.d.ts +4 -4
- package/dist/cjs/ai/gateway/x402/facilitator.js +4 -4
- 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 +97 -9
- package/dist/cjs/core/client.d.ts.map +1 -1
- package/dist/cjs/core/client.js +120 -5
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/core/transport.d.ts +1 -1
- package/dist/cjs/core/transport.d.ts.map +1 -1
- package/dist/cjs/core/transport.js +5 -5
- package/dist/cjs/core/transport.js.map +1 -1
- package/dist/cjs/core/types.d.ts +23 -4
- package/dist/cjs/core/types.d.ts.map +1 -1
- package/dist/cjs/core/types.js +5 -1
- package/dist/cjs/core/types.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 +3 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/kit/index.d.ts +94 -0
- package/dist/cjs/kit/index.d.ts.map +1 -0
- package/dist/cjs/kit/index.js +196 -0
- package/dist/cjs/kit/index.js.map +1 -0
- package/dist/docs/assets/highlight.css +7 -0
- 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/SolanaError.html +40 -0
- package/dist/docs/classes/SolanaRpc.html +55 -55
- package/dist/docs/classes/SynapseClient.html +50 -19
- 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/AccountRole.html +40 -0
- 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-1.html → Lamports-2.html} +2 -2
- 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/addSignersToTransactionMessage.html +14 -0
- package/dist/docs/functions/address-1.html +15 -0
- package/dist/docs/functions/airdropFactory.html +9 -0
- package/dist/docs/functions/appendTransactionMessageInstruction.html +8 -0
- package/dist/docs/functions/appendTransactionMessageInstructions.html +8 -0
- package/dist/docs/functions/assertAccountDecoded.html +13 -0
- package/dist/docs/functions/assertAccountExists.html +10 -0
- package/dist/docs/functions/assertIsAddress.html +7 -0
- package/dist/docs/functions/assertIsKeyPairSigner.html +6 -0
- package/dist/docs/functions/assertIsKitSignature.html +7 -0
- package/dist/docs/functions/assertIsTransactionSigner.html +7 -0
- 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/blockhash.html +15 -0
- package/dist/docs/functions/chunk.html +1 -1
- package/dist/docs/functions/commitmentComparator.html +1 -0
- package/dist/docs/functions/compileTransaction.html +14 -0
- package/dist/docs/functions/compileTransactionMessage.html +8 -0
- package/dist/docs/functions/computeBalanceChanges.html +1 -1
- package/dist/docs/functions/computeTokenBalanceChanges.html +1 -1
- package/dist/docs/functions/createAddressWithSeed.html +6 -0
- package/dist/docs/functions/createDefaultRpcSubscriptionsTransport.html +7 -0
- package/dist/docs/functions/createDefaultRpcTransport.html +10 -0
- package/dist/docs/functions/createDefaultSolanaRpcSubscriptionsChannelCreator.html +5 -0
- package/dist/docs/functions/createKeyPairFromBytes.html +12 -0
- package/dist/docs/functions/createKeyPairFromPrivateKeyBytes.html +17 -0
- package/dist/docs/functions/createKeyPairSignerFromBytes.html +6 -0
- package/dist/docs/functions/createKeyPairSignerFromPrivateKeyBytes.html +6 -0
- package/dist/docs/functions/createNoopSigner.html +6 -0
- package/dist/docs/functions/createRpc.html +3 -0
- package/dist/docs/functions/createSignableMessage.html +6 -0
- package/dist/docs/functions/createSignerFromKeyPair.html +12 -0
- package/dist/docs/functions/createSolanaRpc.html +4 -0
- package/dist/docs/functions/createSolanaRpcApi.html +12 -0
- package/dist/docs/functions/createSolanaRpcFromTransport.html +3 -0
- package/dist/docs/functions/createSolanaRpcSubscriptions.html +4 -0
- package/dist/docs/functions/createSolanaRpcSubscriptionsApi.html +1 -0
- package/dist/docs/functions/createSolanaRpcSubscriptionsFromTransport.html +3 -0
- package/dist/docs/functions/createSolanaRpcSubscriptions_UNSTABLE.html +4 -0
- package/dist/docs/functions/createSynapse.html +1 -1
- package/dist/docs/functions/createTransactionMessage.html +6 -0
- package/dist/docs/functions/decodeAccount.html +9 -0
- 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/devnet.html +2 -0
- package/dist/docs/functions/encodeBase58.html +7 -0
- package/dist/docs/functions/fetchEncodedAccount.html +9 -0
- package/dist/docs/functions/fetchEncodedAccounts.html +11 -0
- package/dist/docs/functions/fetchJsonParsedAccount.html +12 -0
- package/dist/docs/functions/fetchJsonParsedAccounts.html +14 -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 +5 -0
- package/dist/docs/functions/generateKeyPair.html +6 -0
- package/dist/docs/functions/generateKeyPairSigner.html +7 -0
- package/dist/docs/functions/getAccountInfo.html +1 -1
- package/dist/docs/functions/getAddressCodec.html +6 -0
- package/dist/docs/functions/getAddressComparator.html +1 -0
- package/dist/docs/functions/getAddressDecoder.html +6 -0
- package/dist/docs/functions/getAddressEncoder.html +5 -0
- package/dist/docs/functions/getAddressFromPublicKey.html +5 -0
- 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/getBase58Codec.html +26 -0
- package/dist/docs/functions/getBase58Decoder.html +10 -0
- package/dist/docs/functions/getBase58Encoder.html +11 -0
- package/dist/docs/functions/getBase64Codec.html +26 -0
- package/dist/docs/functions/getBase64Decoder.html +10 -0
- package/dist/docs/functions/getBase64Encoder.html +11 -0
- 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/getProgramDerivedAddress.html +6 -0
- 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/isAddress.html +6 -0
- package/dist/docs/functions/isBlockhashValid.html +1 -1
- package/dist/docs/functions/isBrowser.html +1 -1
- package/dist/docs/functions/isKeyPairSigner.html +6 -0
- package/dist/docs/functions/isKitSignature.html +6 -0
- package/dist/docs/functions/isProgramInCategory.html +1 -1
- package/dist/docs/functions/isServer.html +1 -1
- package/dist/docs/functions/isTransactionSigner.html +7 -0
- package/dist/docs/functions/isValidPubkey.html +1 -1
- package/dist/docs/functions/isValidSignature.html +1 -1
- package/dist/docs/functions/kitSignature.html +6 -0
- package/dist/docs/functions/kitUnixTimestamp.html +6 -0
- package/dist/docs/functions/lamports-1.html +6 -0
- 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/mainnet.html +2 -0
- package/dist/docs/functions/minimumLedgerSlot.html +1 -1
- package/dist/docs/functions/parseAccountUpdate.html +1 -1
- package/dist/docs/functions/parseBase58RpcAccount.html +7 -0
- package/dist/docs/functions/parseBase64RpcAccount.html +7 -0
- 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/parseJsonRpcAccount.html +9 -0
- 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/partiallySignTransaction.html +12 -0
- package/dist/docs/functions/partiallySignTransactionMessageWithSigners.html +22 -0
- package/dist/docs/functions/pipe.html +95 -0
- package/dist/docs/functions/prependTransactionMessageInstruction.html +8 -0
- package/dist/docs/functions/prependTransactionMessageInstructions.html +8 -0
- 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/sendAndConfirmDurableNonceTransactionFactory.html +6 -0
- package/dist/docs/functions/sendAndConfirmTransactionFactory.html +6 -0
- package/dist/docs/functions/sendTransaction.html +1 -1
- package/dist/docs/functions/sendTransactionWithoutConfirmingFactory.html +6 -0
- package/dist/docs/functions/setTransactionMessageFeePayer.html +7 -0
- package/dist/docs/functions/setTransactionMessageFeePayerSigner.html +8 -0
- package/dist/docs/functions/setTransactionMessageLifetimeUsingBlockhash.html +7 -0
- package/dist/docs/functions/setTransactionMessageLifetimeUsingDurableNonce.html +9 -0
- package/dist/docs/functions/signAndSendTransactionMessageWithSigners.html +32 -0
- package/dist/docs/functions/signBytes.html +7 -0
- package/dist/docs/functions/signTransaction.html +10 -0
- package/dist/docs/functions/signTransactionMessageWithSigners.html +13 -0
- package/dist/docs/functions/simulateTransaction.html +1 -1
- package/dist/docs/functions/sleep.html +1 -1
- package/dist/docs/functions/solToLamports.html +2 -2
- package/dist/docs/functions/testnet.html +2 -0
- package/dist/docs/functions/toClientConfig.html +1 -1
- package/dist/docs/functions/toKitAddress.html +8 -0
- package/dist/docs/functions/toKitLamports.html +6 -0
- package/dist/docs/functions/toKitSignatureString.html +5 -0
- package/dist/docs/functions/verifySignature.html +8 -0
- 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/TransactionMessageWithBlockhashLifetime.html +12 -0
- 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 +61 -0
- package/dist/docs/modules.html +182 -6
- package/dist/docs/types/AccountFetchOpts.html +3 -0
- package/dist/docs/types/AccountFilter.html +1 -1
- package/dist/docs/types/Address.html +5 -0
- 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/KeyPairSigner.html +17 -0
- package/dist/docs/types/KitCommitment.html +4 -0
- package/dist/docs/types/Lamports.html +2 -1
- package/dist/docs/types/LogsFilter.html +1 -1
- package/dist/docs/types/MemcmpFilter.html +1 -1
- package/dist/docs/types/MessagePartialSigner.html +23 -0
- package/dist/docs/types/MessageSigner.html +8 -0
- package/dist/docs/types/NonceState.html +3 -0
- package/dist/docs/types/NoopSigner.html +18 -0
- package/dist/docs/types/ParsedGeyserUpdate.html +1 -1
- package/dist/docs/types/Pubkey.html +3 -2
- package/dist/docs/types/Rpc.html +4 -0
- package/dist/docs/types/RpcSubscriptions.html +5 -0
- package/dist/docs/types/RpcTransport.html +3 -0
- package/dist/docs/types/RuntimeEnv.html +1 -1
- package/dist/docs/types/Signature.html +3 -2
- package/dist/docs/types/SignatureBytes.html +5 -0
- package/dist/docs/types/Slot.html +1 -1
- package/dist/docs/types/SolanaRpcApi.html +3 -0
- package/dist/docs/types/SolanaRpcApiDevnet.html +3 -0
- package/dist/docs/types/SolanaRpcApiMainnet.html +4 -0
- package/dist/docs/types/SolanaRpcApiTestnet.html +3 -0
- package/dist/docs/types/SolanaRpcSubscriptionsApi.html +1 -0
- 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/TransactionMessage.html +1 -0
- package/dist/docs/types/TransactionModifyingSigner.html +30 -0
- package/dist/docs/types/TransactionPartialSigner.html +22 -0
- package/dist/docs/types/TransactionSendingSigner.html +33 -0
- package/dist/docs/types/TransactionSigner.html +9 -0
- 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/DEFAULT_RPC_CONFIG.html +6 -0
- package/dist/docs/variables/DEFAULT_RPC_SUBSCRIPTIONS_CONFIG.html +1 -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 +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/gateway/index.js +2 -2
- package/dist/esm/ai/gateway/x402/facilitator.d.ts +4 -4
- package/dist/esm/ai/gateway/x402/facilitator.js +4 -4
- package/dist/esm/ai/index.js +2 -2
- package/dist/esm/ai/tools/index.js +3 -3
- package/dist/esm/ai/tools/protocols/index.js +6 -6
- 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 +97 -9
- package/dist/esm/core/client.d.ts.map +1 -1
- package/dist/esm/core/client.js +120 -5
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/core/transport.d.ts +1 -1
- package/dist/esm/core/transport.d.ts.map +1 -1
- package/dist/esm/core/transport.js +5 -5
- package/dist/esm/core/transport.js.map +1 -1
- package/dist/esm/core/types.d.ts +23 -4
- package/dist/esm/core/types.d.ts.map +1 -1
- package/dist/esm/core/types.js +5 -1
- package/dist/esm/core/types.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 +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/kit/index.d.ts +94 -0
- package/dist/esm/kit/index.d.ts.map +1 -0
- package/dist/esm/kit/index.js +100 -0
- package/dist/esm/kit/index.js.map +1 -0
- package/package.json +45 -48
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.0.3] — 2026-02-27
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Native Solana account data decoders** (`src/decoders/`) — zero-dependency binary decoders
|
|
14
|
+
verified field-by-field against official Solana source code (`solana-program/token`, `anza-xyz/agave`).
|
|
15
|
+
- `AccountReader` — DataView-based binary reader with LE byte order, COption (C ABI) support.
|
|
16
|
+
- `decodeTokenAccount` — SPL Token Account (165 bytes): mint, owner, amount, delegate, state,
|
|
17
|
+
isNative, delegatedAmount, closeAuthority.
|
|
18
|
+
- `decodeMint` — SPL Token Mint (82 bytes): mintAuthority, supply, decimals, isInitialized,
|
|
19
|
+
freezeAuthority.
|
|
20
|
+
- `decodeToken2022Account` / `decodeToken2022Mint` — Token Extensions with TLV parser
|
|
21
|
+
(TransferFeeConfig, MintCloseAuthority, MetadataPointer, ImmutableOwner, MemoTransfer, etc.).
|
|
22
|
+
- `decodeStakeAccount` — Stake program (200 bytes): Meta (authorized + lockup) + Delegation
|
|
23
|
+
(voterPubkey, stake, activationEpoch, deactivationEpoch, warmupCooldownRate) + creditsObserved.
|
|
24
|
+
- `decodeNonceAccount` — Durable nonce (80 bytes): version, state, authority, blockhash,
|
|
25
|
+
lamportsPerSignature.
|
|
26
|
+
- `decodeLookupTable` — Address Lookup Table (56-byte header + N×32 addresses):
|
|
27
|
+
deactivationSlot, lastExtendedSlot, authority, addresses.
|
|
28
|
+
- `decodeMultisig` — SPL Multisig (355 bytes): m, n, isInitialized, signers[11].
|
|
29
|
+
- `encodeBase58` — self-contained base58 encoder (no external dependencies).
|
|
30
|
+
- **Typed account fetchers** (`src/accounts/`) — high-level account fetching with automatic
|
|
31
|
+
decoding wired into `SynapseClient`.
|
|
32
|
+
- `AccountsClient` class accessible via `client.accounts`.
|
|
33
|
+
- `fetchTokenAccount` / `fetchMint` — auto-detects Token vs Token-2022 by program owner.
|
|
34
|
+
- `fetchTokenAccountsByOwner` — batch fetch all token accounts for a wallet.
|
|
35
|
+
- `fetchStakeAccount` / `fetchNonceAccount` / `fetchLookupTable`.
|
|
36
|
+
- `getDecodedAccount<T>` / `getDecodedAccounts<T>` generic helpers.
|
|
37
|
+
- **Sub-path exports** — `./decoders` and `./accounts` added to `package.json` exports map.
|
|
38
|
+
- **37 new unit tests** for all decoders with hand-crafted byte buffers (415 total, all passing).
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## [1.0.2] — 2026-02-26
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- **@solana/kit bridge module** (`src/kit/index.ts`) — curated re-exports and bridge utilities
|
|
46
|
+
between Synapse branded types and `@solana/kit` v6 native types.
|
|
47
|
+
- `toKitAddress` / `fromKitAddress` for `Pubkey` ↔ `Address` conversion.
|
|
48
|
+
- `toKitSignatureString` / `toKitLamports` for `Signature` & `Lamports`.
|
|
49
|
+
- Re-exports: `Address`, `KeyPairSigner`, `createSolanaRpc`, `pipe`, codecs, account helpers.
|
|
50
|
+
- **`kitRpc` / `kitSubscriptions`** lazy accessors on `SynapseClient` — gives consumers direct
|
|
51
|
+
access to `@solana/kit`-native `Rpc<SolanaRpcApi>` and `RpcSubscriptions<SolanaRpcSubscriptionsApi>`
|
|
52
|
+
backed by the same endpoint.
|
|
53
|
+
- **`./kit` sub-path export** in `package.json` — `import { Address, toKitAddress } from '@oobe-protocol-labs/synapse-client-sdk/kit'`.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- **Critical: `@/` path aliases leaking into compiled output** — TypeScript `paths` aliases were
|
|
57
|
+
not rewritten by `tsc`, causing `@/core/types` imports in `dist/cjs` and `dist/esm` that
|
|
58
|
+
Webpack, Next.js, Vite, and other bundlers could not resolve. Converted all 9 `@/` imports to
|
|
59
|
+
relative paths and removed the `paths` block from `tsconfig.json` to prevent regression.
|
|
60
|
+
- **ESM directory imports broken** — the post-build `fix-esm-imports.mjs` script blindly appended
|
|
61
|
+
`.js` to all bare specifiers, producing `./tools.js` instead of `./tools/index.js` for directory
|
|
62
|
+
re-exports (`tools/`, `protocols/`, `zod/`, `jupiter/`, `raydium/`, `metaplex/`, `x402/`).
|
|
63
|
+
Rewrote the script with filesystem-aware resolution using `existsSync`.
|
|
64
|
+
- **`@langchain/core` peer dependency too permissive** — the open-ended `>=0.3.0` range could
|
|
65
|
+
resolve `@langchain/core@1.x`, which is incompatible with `@langchain/openai@0.5.x`. Tightened
|
|
66
|
+
to `>=0.3.0 <0.4.0`. Also updated `zod` peerDep to `>=3.23.0 || >=4.0.0`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
10
70
|
## [1.0.1] — 2025-07-15
|
|
11
71
|
|
|
12
72
|
### Added
|
|
@@ -56,5 +116,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
56
116
|
|
|
57
117
|
---
|
|
58
118
|
|
|
119
|
+
[1.0.2]: https://github.com/oobe-protocol-labs/synapse-client-sdk/compare/v1.0.1...v1.0.2
|
|
59
120
|
[1.0.1]: https://github.com/oobe-protocol-labs/synapse-client-sdk/compare/v1.0.0-beta...v1.0.1
|
|
60
121
|
[1.0.0-beta]: https://github.com/oobe-protocol-labs/synapse-client-sdk/releases/tag/v1.0.0-beta
|
|
@@ -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,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic decoded account fetcher utilities.
|
|
4
|
+
*
|
|
5
|
+
* Provides a reusable pattern for fetching raw account data via RPC
|
|
6
|
+
* and decoding it with a typed decoder function.
|
|
7
|
+
*
|
|
8
|
+
* @module accounts/helpers
|
|
9
|
+
* @since 1.1.0
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.base64ToBytes = base64ToBytes;
|
|
13
|
+
exports.getDecodedAccount = getDecodedAccount;
|
|
14
|
+
exports.getDecodedAccounts = getDecodedAccounts;
|
|
15
|
+
// ── Base64 decoding ────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* Base64-decode a Solana RPC account data field.
|
|
18
|
+
*
|
|
19
|
+
* The RPC returns account data as `[base64String, "base64"]` when
|
|
20
|
+
* `encoding: "base64"` is used.
|
|
21
|
+
*
|
|
22
|
+
* @param data - The raw data field from getAccountInfo.
|
|
23
|
+
* @returns Decoded Uint8Array.
|
|
24
|
+
* @since 1.1.0
|
|
25
|
+
*/
|
|
26
|
+
function base64ToBytes(data) {
|
|
27
|
+
let b64;
|
|
28
|
+
if (Array.isArray(data) && typeof data[0] === 'string') {
|
|
29
|
+
b64 = data[0];
|
|
30
|
+
}
|
|
31
|
+
else if (typeof data === 'string') {
|
|
32
|
+
b64 = data;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error('Unexpected account data format: expected [base64, "base64"] or string');
|
|
36
|
+
}
|
|
37
|
+
// Node.js Buffer path (fast)
|
|
38
|
+
if (typeof Buffer !== 'undefined') {
|
|
39
|
+
return new Uint8Array(Buffer.from(b64, 'base64'));
|
|
40
|
+
}
|
|
41
|
+
// Browser / edge path
|
|
42
|
+
const binary = atob(b64);
|
|
43
|
+
const bytes = new Uint8Array(binary.length);
|
|
44
|
+
for (let i = 0; i < binary.length; i++)
|
|
45
|
+
bytes[i] = binary.charCodeAt(i);
|
|
46
|
+
return bytes;
|
|
47
|
+
}
|
|
48
|
+
// ── Core fetcher ───────────────────────────────────────────────
|
|
49
|
+
/**
|
|
50
|
+
* Fetch a raw account and decode its data using the provided decoder.
|
|
51
|
+
*
|
|
52
|
+
* This is the core building block for all typed account fetchers.
|
|
53
|
+
* It handles the RPC call, base64 decoding, and applies the decoder.
|
|
54
|
+
*
|
|
55
|
+
* @typeParam T - The decoded account type.
|
|
56
|
+
* @param transport - HTTP transport for RPC calls.
|
|
57
|
+
* @param pubkey - Account public key to fetch.
|
|
58
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
59
|
+
* @param opts - RPC options (commitment, call overrides).
|
|
60
|
+
* @returns Decoded result, or `null` if the account doesn't exist.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { getDecodedAccount } from '@oobe-protocol-labs/synapse-client-sdk/accounts';
|
|
65
|
+
* import { decodeTokenAccount } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
66
|
+
*
|
|
67
|
+
* const result = await getDecodedAccount(transport, pubkey, decodeTokenAccount);
|
|
68
|
+
* if (result) console.log(`Amount: ${result.decoded.amount}`);
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @since 1.1.0
|
|
72
|
+
*/
|
|
73
|
+
async function getDecodedAccount(transport, pubkey, decoder, opts = {}) {
|
|
74
|
+
const { commitment, ...callOpts } = opts;
|
|
75
|
+
const cfg = { encoding: 'base64' };
|
|
76
|
+
if (commitment)
|
|
77
|
+
cfg.commitment = commitment;
|
|
78
|
+
const result = await transport.request('getAccountInfo', [pubkey, cfg], callOpts);
|
|
79
|
+
if (!result.value)
|
|
80
|
+
return null;
|
|
81
|
+
const bytes = base64ToBytes(result.value.data);
|
|
82
|
+
const decoded = decoder(bytes);
|
|
83
|
+
return {
|
|
84
|
+
decoded,
|
|
85
|
+
raw: result.value,
|
|
86
|
+
slot: result.context.slot,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Fetch multiple accounts and decode them in batch (single RPC call).
|
|
91
|
+
*
|
|
92
|
+
* @typeParam T - The decoded account type.
|
|
93
|
+
* @param transport - HTTP transport for RPC calls.
|
|
94
|
+
* @param pubkeys - Account public keys to fetch.
|
|
95
|
+
* @param decoder - Function that decodes raw bytes into type T.
|
|
96
|
+
* @param opts - RPC options.
|
|
97
|
+
* @returns Array of decoded results (null entries for non-existent accounts).
|
|
98
|
+
* @since 1.1.0
|
|
99
|
+
*/
|
|
100
|
+
async function getDecodedAccounts(transport, pubkeys, decoder, opts = {}) {
|
|
101
|
+
const { commitment, ...callOpts } = opts;
|
|
102
|
+
const cfg = { encoding: 'base64' };
|
|
103
|
+
if (commitment)
|
|
104
|
+
cfg.commitment = commitment;
|
|
105
|
+
const result = await transport.request('getMultipleAccounts', [pubkeys, cfg], callOpts);
|
|
106
|
+
return result.value.map((acct) => {
|
|
107
|
+
if (!acct)
|
|
108
|
+
return null;
|
|
109
|
+
const bytes = base64ToBytes(acct.data);
|
|
110
|
+
return {
|
|
111
|
+
decoded: decoder(bytes),
|
|
112
|
+
raw: acct,
|
|
113
|
+
slot: result.context.slot,
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/accounts/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAoDH,sCAoBC;AA4BD,8CA0BC;AAaD,gDAyBC;AA5HD,kEAAkE;AAElE;;;;;;;;;GASG;AACH,SAAgB,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;AACI,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;AACI,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,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Typed account fetchers with built-in decoding.
|
|
4
|
+
*
|
|
5
|
+
* Provides high-level methods that fetch raw account data via RPC
|
|
6
|
+
* and return fully decoded, typed objects. This is the "batteries-included"
|
|
7
|
+
* layer that eliminates manual base64 decoding and byte layout parsing.
|
|
8
|
+
*
|
|
9
|
+
* @module accounts
|
|
10
|
+
* @since 1.1.0
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const client = new SynapseClient({ endpoint: '...' });
|
|
15
|
+
*
|
|
16
|
+
* // One call, fully decoded:
|
|
17
|
+
* const mint = await client.accounts.fetchMint(mintPubkey);
|
|
18
|
+
* console.log(`Supply: ${mint.decoded.supply}, Decimals: ${mint.decoded.decimals}`);
|
|
19
|
+
*
|
|
20
|
+
* const acct = await client.accounts.fetchTokenAccount(tokenPubkey);
|
|
21
|
+
* console.log(`Balance: ${acct.decoded.amount}`);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.AccountsClient = exports.base64ToBytes = exports.getDecodedAccounts = exports.getDecodedAccount = exports.fetchLookupTable = exports.fetchNonceAccount = exports.fetchStakeAccount = exports.fetchTokenAccountsByOwner = exports.fetchMint = exports.fetchTokenAccount = void 0;
|
|
26
|
+
const token_1 = require("./token");
|
|
27
|
+
const stake_1 = require("./stake");
|
|
28
|
+
const nonce_1 = require("./nonce");
|
|
29
|
+
const lookup_1 = require("./lookup");
|
|
30
|
+
const helpers_1 = require("./helpers");
|
|
31
|
+
// ── Re-export individual fetchers for tree-shaking ─────────────
|
|
32
|
+
var token_2 = require("./token");
|
|
33
|
+
Object.defineProperty(exports, "fetchTokenAccount", { enumerable: true, get: function () { return token_2.fetchTokenAccount; } });
|
|
34
|
+
Object.defineProperty(exports, "fetchMint", { enumerable: true, get: function () { return token_2.fetchMint; } });
|
|
35
|
+
Object.defineProperty(exports, "fetchTokenAccountsByOwner", { enumerable: true, get: function () { return token_2.fetchTokenAccountsByOwner; } });
|
|
36
|
+
var stake_2 = require("./stake");
|
|
37
|
+
Object.defineProperty(exports, "fetchStakeAccount", { enumerable: true, get: function () { return stake_2.fetchStakeAccount; } });
|
|
38
|
+
var nonce_2 = require("./nonce");
|
|
39
|
+
Object.defineProperty(exports, "fetchNonceAccount", { enumerable: true, get: function () { return nonce_2.fetchNonceAccount; } });
|
|
40
|
+
var lookup_2 = require("./lookup");
|
|
41
|
+
Object.defineProperty(exports, "fetchLookupTable", { enumerable: true, get: function () { return lookup_2.fetchLookupTable; } });
|
|
42
|
+
var helpers_2 = require("./helpers");
|
|
43
|
+
Object.defineProperty(exports, "getDecodedAccount", { enumerable: true, get: function () { return helpers_2.getDecodedAccount; } });
|
|
44
|
+
Object.defineProperty(exports, "getDecodedAccounts", { enumerable: true, get: function () { return helpers_2.getDecodedAccounts; } });
|
|
45
|
+
Object.defineProperty(exports, "base64ToBytes", { enumerable: true, get: function () { return helpers_2.base64ToBytes; } });
|
|
46
|
+
/**
|
|
47
|
+
* High-level accounts client with decoded fetch methods.
|
|
48
|
+
*
|
|
49
|
+
* Exposed as `client.accounts` on {@link SynapseClient}. Each method
|
|
50
|
+
* fetches raw data, base64-decodes it, and runs the appropriate native
|
|
51
|
+
* decoder — returning a fully typed object.
|
|
52
|
+
*
|
|
53
|
+
* @since 1.1.0
|
|
54
|
+
*/
|
|
55
|
+
class AccountsClient {
|
|
56
|
+
transport;
|
|
57
|
+
constructor(transport) {
|
|
58
|
+
this.transport = transport;
|
|
59
|
+
}
|
|
60
|
+
// ── Token ────────────────────────────────────────────────────
|
|
61
|
+
/**
|
|
62
|
+
* Fetch and decode a single SPL Token account.
|
|
63
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
64
|
+
* @since 1.1.0
|
|
65
|
+
*/
|
|
66
|
+
fetchTokenAccount(pubkey, opts) {
|
|
67
|
+
return (0, token_1.fetchTokenAccount)(this.transport, pubkey, opts);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Fetch and decode a token mint.
|
|
71
|
+
* Auto-detects Token vs Token-2022 and includes extensions.
|
|
72
|
+
* @since 1.1.0
|
|
73
|
+
*/
|
|
74
|
+
fetchMint(pubkey, opts) {
|
|
75
|
+
return (0, token_1.fetchMint)(this.transport, pubkey, opts);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Fetch all token accounts owned by a wallet, optionally filtered by mint.
|
|
79
|
+
* @since 1.1.0
|
|
80
|
+
*/
|
|
81
|
+
fetchTokenAccountsByOwner(owner, mint, opts) {
|
|
82
|
+
return (0, token_1.fetchTokenAccountsByOwner)(this.transport, owner, mint, opts);
|
|
83
|
+
}
|
|
84
|
+
// ── Stake ────────────────────────────────────────────────────
|
|
85
|
+
/**
|
|
86
|
+
* Fetch and decode a stake account.
|
|
87
|
+
* @since 1.1.0
|
|
88
|
+
*/
|
|
89
|
+
fetchStakeAccount(pubkey, opts) {
|
|
90
|
+
return (0, stake_1.fetchStakeAccount)(this.transport, pubkey, opts);
|
|
91
|
+
}
|
|
92
|
+
// ── Nonce ────────────────────────────────────────────────────
|
|
93
|
+
/**
|
|
94
|
+
* Fetch and decode a durable nonce account.
|
|
95
|
+
* @since 1.1.0
|
|
96
|
+
*/
|
|
97
|
+
fetchNonceAccount(pubkey, opts) {
|
|
98
|
+
return (0, nonce_1.fetchNonceAccount)(this.transport, pubkey, opts);
|
|
99
|
+
}
|
|
100
|
+
// ── Lookup Table ─────────────────────────────────────────────
|
|
101
|
+
/**
|
|
102
|
+
* Fetch and decode an Address Lookup Table.
|
|
103
|
+
* @since 1.1.0
|
|
104
|
+
*/
|
|
105
|
+
fetchLookupTable(pubkey, opts) {
|
|
106
|
+
return (0, lookup_1.fetchLookupTable)(this.transport, pubkey, opts);
|
|
107
|
+
}
|
|
108
|
+
// ── Generic ──────────────────────────────────────────────────
|
|
109
|
+
/**
|
|
110
|
+
* Fetch any account and decode it with a custom decoder function.
|
|
111
|
+
*
|
|
112
|
+
* @typeParam T - The decoded type.
|
|
113
|
+
* @param pubkey - Account public key.
|
|
114
|
+
* @param decoder - Custom decoder function `(data: Uint8Array) => T`.
|
|
115
|
+
* @param opts - RPC options.
|
|
116
|
+
* @returns Decoded result or null.
|
|
117
|
+
* @since 1.1.0
|
|
118
|
+
*/
|
|
119
|
+
fetchDecoded(pubkey, decoder, opts) {
|
|
120
|
+
return (0, helpers_1.getDecodedAccount)(this.transport, pubkey, decoder, opts);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Fetch multiple accounts and decode them with a custom decoder (single RPC call).
|
|
124
|
+
*
|
|
125
|
+
* @typeParam T - The decoded type.
|
|
126
|
+
* @param pubkeys - Account public keys.
|
|
127
|
+
* @param decoder - Custom decoder function.
|
|
128
|
+
* @param opts - RPC options.
|
|
129
|
+
* @returns Array of decoded results (null for non-existent).
|
|
130
|
+
* @since 1.1.0
|
|
131
|
+
*/
|
|
132
|
+
fetchDecodedBatch(pubkeys, decoder, opts) {
|
|
133
|
+
return (0, helpers_1.getDecodedAccounts)(this.transport, pubkeys, decoder, opts);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.AccountsClient = AccountsClient;
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/accounts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAIH,mCAAkF;AAClF,mCAA4C;AAC5C,mCAA4C;AAC5C,qCAA4C;AAC5C,uCAAkE;AAElE,kEAAkE;AAClE,iCAAkF;AAAzE,0GAAA,iBAAiB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,kHAAA,yBAAyB,OAAA;AAChE,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAC1B,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAC1B,mCAA4C;AAAnC,0GAAA,gBAAgB,OAAA;AACzB,qCAAiF;AAAxE,4GAAA,iBAAiB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,wGAAA,aAAa,OAAA;AAO7D;;;;;;;;GAQG;AACH,MAAa,cAAc;IACI;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,gEAAgE;IAEhE;;;;OAIG;IACH,iBAAiB,CAAC,MAAc,EAAE,IAAuB;QACvD,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,MAAc,EAAE,IAAuB;QAC/C,OAAO,IAAA,iBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,yBAAyB,CAAC,KAAa,EAAE,IAAa,EAAE,IAAgD;QACtG,OAAO,IAAA,iCAAyB,EAAC,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,IAAA,yBAAiB,EAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,gEAAgE;IAEhE;;;OAGG;IACH,iBAAiB,CAAC,MAAc,EAAE,IAAuB;QACvD,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,gEAAgE;IAEhE;;;OAGG;IACH,gBAAgB,CAAC,MAAc,EAAE,IAAuB;QACtD,OAAO,IAAA,yBAAgB,EAAC,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,IAAA,2BAAiB,EAAC,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,IAAA,4BAAkB,EAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CACF;AA1FD,wCA0FC"}
|
|
@@ -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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* High-level Address Lookup Table fetcher.
|
|
4
|
+
*
|
|
5
|
+
* @module accounts/lookup
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.fetchLookupTable = fetchLookupTable;
|
|
10
|
+
const lookup_table_1 = require("../decoders/lookup-table");
|
|
11
|
+
const helpers_1 = require("./helpers");
|
|
12
|
+
/**
|
|
13
|
+
* Fetch and decode an Address Lookup Table account.
|
|
14
|
+
*
|
|
15
|
+
* @param transport - HTTP transport.
|
|
16
|
+
* @param pubkey - Lookup table account public key.
|
|
17
|
+
* @param opts - RPC options.
|
|
18
|
+
* @returns Decoded lookup table, or `null` if not found.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const lut = await fetchLookupTable(transport, lutPubkey);
|
|
23
|
+
* if (lut) console.log(`Contains ${lut.decoded.addresses.length} addresses`);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @since 1.1.0
|
|
27
|
+
*/
|
|
28
|
+
async function fetchLookupTable(transport, pubkey, opts = {}) {
|
|
29
|
+
return (0, helpers_1.getDecodedAccount)(transport, pubkey, lookup_table_1.decodeLookupTable, opts);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/accounts/lookup.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAyBH,4CAMC;AA3BD,2DAA6D;AAE7D,uCAA8C;AAG9C;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,gBAAgB,CACpC,SAAwB,EACxB,MAAc,EACd,OAAkD,EAAE;IAEpD,OAAO,IAAA,2BAAiB,EAAC,SAAS,EAAE,MAAM,EAAE,gCAAiB,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"}
|