@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
|
@@ -38,6 +38,7 @@ import type { SolanaRpc } from '../rpc/solana-rpc';
|
|
|
38
38
|
import type { DasClient } from '../das/client';
|
|
39
39
|
import type { WsClient } from '../websocket/client';
|
|
40
40
|
import type { GrpcTransport } from '../grpc/transport';
|
|
41
|
+
import type { AccountsClient } from '../accounts/index';
|
|
41
42
|
import type { EndpointConnectConfig } from '../utils/synapse';
|
|
42
43
|
/**
|
|
43
44
|
* Configuration for {@link SynapseClient}.
|
|
@@ -58,6 +59,7 @@ export declare class SynapseClient {
|
|
|
58
59
|
private _das?;
|
|
59
60
|
private _ws?;
|
|
60
61
|
private _grpc?;
|
|
62
|
+
private _accounts?;
|
|
61
63
|
private _kitRpc?;
|
|
62
64
|
private _kitSubs?;
|
|
63
65
|
constructor(config: SynapseClientConfig);
|
|
@@ -131,6 +133,29 @@ export declare class SynapseClient {
|
|
|
131
133
|
* @since 1.0.0
|
|
132
134
|
*/
|
|
133
135
|
get grpc(): GrpcTransport;
|
|
136
|
+
/**
|
|
137
|
+
* Typed account fetchers with built-in binary decoding.
|
|
138
|
+
*
|
|
139
|
+
* Fetches raw accounts via RPC, base64-decodes the data, and applies
|
|
140
|
+
* zero-dep DataView decoders — returning fully typed objects for
|
|
141
|
+
* Token, Mint, Stake, Nonce, Lookup Table, and custom accounts.
|
|
142
|
+
*
|
|
143
|
+
* Lazy-loaded on first access.
|
|
144
|
+
*
|
|
145
|
+
* @since 1.1.0
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* import { Pubkey } from '@oobe-protocol-labs/synapse-client-sdk';
|
|
150
|
+
*
|
|
151
|
+
* const mint = await client.accounts.fetchMint(Pubkey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'));
|
|
152
|
+
* console.log(`USDC supply: ${mint?.decoded.supply}, decimals: ${mint?.decoded.decimals}`);
|
|
153
|
+
*
|
|
154
|
+
* const token = await client.accounts.fetchTokenAccount(Pubkey('...'));
|
|
155
|
+
* console.log(`Balance: ${token?.decoded.amount}`);
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
get accounts(): AccountsClient;
|
|
134
159
|
/**
|
|
135
160
|
* Gracefully shut down all active connections (WebSocket, gRPC).
|
|
136
161
|
* @since 1.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,eAA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A;KAAE,EAAE,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAM5G;;;;OAIG;IACH,IAAI,GAAG,IAAI,SAAS,CAMnB;IAED;;;;OAIG;IACH,IAAI,GAAG,IAAI,SAAS,CAMnB;IAED;;;;OAIG;IACH,IAAI,EAAE,IAAI,QAAQ,CAMjB;IAED;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,aAAa,CAaxB;IAID;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,QAAQ,IAAI,cAAc,CAM7B;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,MAAM,IAAI,GAAG,CAAC,YAAY,CAAC,CAc9B;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,yBAAyB,CAAC,CAkBlE;CACF"}
|
package/dist/cjs/core/client.js
CHANGED
|
@@ -46,6 +46,7 @@ class SynapseClient {
|
|
|
46
46
|
_das;
|
|
47
47
|
_ws;
|
|
48
48
|
_grpc;
|
|
49
|
+
_accounts;
|
|
49
50
|
// Kit-native lazy singletons
|
|
50
51
|
_kitRpc;
|
|
51
52
|
_kitSubs;
|
|
@@ -170,6 +171,35 @@ class SynapseClient {
|
|
|
170
171
|
return this._grpc;
|
|
171
172
|
}
|
|
172
173
|
// ── Lifecycle ─────────────────────────────────────────────────
|
|
174
|
+
/**
|
|
175
|
+
* Typed account fetchers with built-in binary decoding.
|
|
176
|
+
*
|
|
177
|
+
* Fetches raw accounts via RPC, base64-decodes the data, and applies
|
|
178
|
+
* zero-dep DataView decoders — returning fully typed objects for
|
|
179
|
+
* Token, Mint, Stake, Nonce, Lookup Table, and custom accounts.
|
|
180
|
+
*
|
|
181
|
+
* Lazy-loaded on first access.
|
|
182
|
+
*
|
|
183
|
+
* @since 1.1.0
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* import { Pubkey } from '@oobe-protocol-labs/synapse-client-sdk';
|
|
188
|
+
*
|
|
189
|
+
* const mint = await client.accounts.fetchMint(Pubkey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'));
|
|
190
|
+
* console.log(`USDC supply: ${mint?.decoded.supply}, decimals: ${mint?.decoded.decimals}`);
|
|
191
|
+
*
|
|
192
|
+
* const token = await client.accounts.fetchTokenAccount(Pubkey('...'));
|
|
193
|
+
* console.log(`Balance: ${token?.decoded.amount}`);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
get accounts() {
|
|
197
|
+
if (!this._accounts) {
|
|
198
|
+
const { AccountsClient: Ctor } = require('../accounts/index');
|
|
199
|
+
this._accounts = new Ctor(this.transport);
|
|
200
|
+
}
|
|
201
|
+
return this._accounts;
|
|
202
|
+
}
|
|
173
203
|
/**
|
|
174
204
|
* Gracefully shut down all active connections (WebSocket, gRPC).
|
|
175
205
|
* @since 1.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH,2CAAoF;AACpF,sCAAyC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH,2CAAoF;AACpF,sCAAyC;AAYzC,8CAA0G;AAe1G,MAAa,aAAa;IACf,SAAS,CAAgB;IACjB,GAAG,CAAsB;IAE1C,kBAAkB;IACV,IAAI,CAAa;IACjB,IAAI,CAAa;IACjB,GAAG,CAAY;IACf,KAAK,CAAiB;IACtB,SAAS,CAAkB;IAEnC,6BAA6B;IACrB,OAAO,CAAqB;IAC5B,QAAQ,CAA+C;IAE/D,YAAY,MAA2B;Q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,qBAAqB,EACrB,+BAA+B,EAC/B,sCAAsC,EACtC,iDAAiD,EACjD,gCAAgC,GACjC,GAAG,OAAO,CAAC,aAAa,CAAiC,CAAC;YAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC;gBACpC,GAAG,EAAE,+BAA+B,CAAC,gCAAgC,CAAC;gBACtE,SAAS,EAAE,sCAAsC,CAAC;oBAChD,aAAa,EAAE,iDAAiD,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;iBACjF,CAAC;aACH,CAAgD,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AA5QD,sCA4QC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native Solana account data decoders.
|
|
3
|
+
*
|
|
4
|
+
* Zero-dependency, DataView-based decoders for the most common Solana
|
|
5
|
+
* account types. Each decoder is a pure function that takes raw bytes
|
|
6
|
+
* and returns a fully typed object.
|
|
7
|
+
*
|
|
8
|
+
* @module decoders
|
|
9
|
+
* @since 1.1.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import {
|
|
14
|
+
* decodeTokenAccount, decodeMint, decodeStakeAccount,
|
|
15
|
+
* decodeNonceAccount, decodeLookupTable, decodeMultisig,
|
|
16
|
+
* } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
17
|
+
*
|
|
18
|
+
* const tokenAcct = decodeTokenAccount(rawBytes);
|
|
19
|
+
* const mint = decodeMint(mintBytes);
|
|
20
|
+
* const stake = decodeStakeAccount(stakeBytes);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export { AccountReader, encodeBase58 } from './layout';
|
|
24
|
+
export { decodeTokenAccount, decodeMint, TOKEN_ACCOUNT_SIZE, MINT_SIZE, TOKEN_PROGRAM_ID, } from './token';
|
|
25
|
+
export type { DecodedTokenAccount, DecodedMint, TokenAccountState, } from './token';
|
|
26
|
+
export { decodeToken2022Account, decodeToken2022Mint, TokenExtensionType, TOKEN_2022_PROGRAM_ID, } from './token-2022';
|
|
27
|
+
export type { DecodedToken2022Account, DecodedToken2022Mint, DecodedExtension, TransferFeeConfig, TransferFeeAmount, MintCloseAuthorityExt, DefaultAccountStateExt, ImmutableOwnerExt, MemoTransferExt, NonTransferableExt, InterestBearingConfigExt, PermanentDelegateExt, MetadataPointerExt, UnknownExtension, } from './token-2022';
|
|
28
|
+
export { decodeStakeAccount, STAKE_PROGRAM_ID, } from './stake';
|
|
29
|
+
export type { DecodedStakeAccount, StakeAccountType, StakeMeta, StakeAuthorized, StakeLockup, StakeDelegation, } from './stake';
|
|
30
|
+
export { decodeNonceAccount, NONCE_ACCOUNT_SIZE, SYSTEM_PROGRAM_ID, } from './nonce';
|
|
31
|
+
export type { DecodedNonceAccount, NonceState, } from './nonce';
|
|
32
|
+
export { decodeLookupTable, LOOKUP_TABLE_PROGRAM_ID, LOOKUP_TABLE_HEADER_SIZE, } from './lookup-table';
|
|
33
|
+
export type { DecodedLookupTable, } from './lookup-table';
|
|
34
|
+
export { decodeMultisig, MAX_MULTISIG_SIGNERS, MULTISIG_SIZE, } from './multisig';
|
|
35
|
+
export type { DecodedMultisig, } from './multisig';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decoders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGvD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,WAAW,EACX,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,mBAAmB,EACnB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Native Solana account data decoders.
|
|
4
|
+
*
|
|
5
|
+
* Zero-dependency, DataView-based decoders for the most common Solana
|
|
6
|
+
* account types. Each decoder is a pure function that takes raw bytes
|
|
7
|
+
* and returns a fully typed object.
|
|
8
|
+
*
|
|
9
|
+
* @module decoders
|
|
10
|
+
* @since 1.1.0
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import {
|
|
15
|
+
* decodeTokenAccount, decodeMint, decodeStakeAccount,
|
|
16
|
+
* decodeNonceAccount, decodeLookupTable, decodeMultisig,
|
|
17
|
+
* } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
18
|
+
*
|
|
19
|
+
* const tokenAcct = decodeTokenAccount(rawBytes);
|
|
20
|
+
* const mint = decodeMint(mintBytes);
|
|
21
|
+
* const stake = decodeStakeAccount(stakeBytes);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.MULTISIG_SIZE = exports.MAX_MULTISIG_SIGNERS = exports.decodeMultisig = exports.LOOKUP_TABLE_HEADER_SIZE = exports.LOOKUP_TABLE_PROGRAM_ID = exports.decodeLookupTable = exports.SYSTEM_PROGRAM_ID = exports.NONCE_ACCOUNT_SIZE = exports.decodeNonceAccount = exports.STAKE_PROGRAM_ID = exports.decodeStakeAccount = exports.TOKEN_2022_PROGRAM_ID = exports.TokenExtensionType = exports.decodeToken2022Mint = exports.decodeToken2022Account = exports.TOKEN_PROGRAM_ID = exports.MINT_SIZE = exports.TOKEN_ACCOUNT_SIZE = exports.decodeMint = exports.decodeTokenAccount = exports.encodeBase58 = exports.AccountReader = void 0;
|
|
26
|
+
// ── Core reader ────────────────────────────────────────────────
|
|
27
|
+
var layout_1 = require("./layout");
|
|
28
|
+
Object.defineProperty(exports, "AccountReader", { enumerable: true, get: function () { return layout_1.AccountReader; } });
|
|
29
|
+
Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return layout_1.encodeBase58; } });
|
|
30
|
+
// ── SPL Token (v1) ─────────────────────────────────────────────
|
|
31
|
+
var token_1 = require("./token");
|
|
32
|
+
Object.defineProperty(exports, "decodeTokenAccount", { enumerable: true, get: function () { return token_1.decodeTokenAccount; } });
|
|
33
|
+
Object.defineProperty(exports, "decodeMint", { enumerable: true, get: function () { return token_1.decodeMint; } });
|
|
34
|
+
Object.defineProperty(exports, "TOKEN_ACCOUNT_SIZE", { enumerable: true, get: function () { return token_1.TOKEN_ACCOUNT_SIZE; } });
|
|
35
|
+
Object.defineProperty(exports, "MINT_SIZE", { enumerable: true, get: function () { return token_1.MINT_SIZE; } });
|
|
36
|
+
Object.defineProperty(exports, "TOKEN_PROGRAM_ID", { enumerable: true, get: function () { return token_1.TOKEN_PROGRAM_ID; } });
|
|
37
|
+
// ── SPL Token-2022 ─────────────────────────────────────────────
|
|
38
|
+
var token_2022_1 = require("./token-2022");
|
|
39
|
+
Object.defineProperty(exports, "decodeToken2022Account", { enumerable: true, get: function () { return token_2022_1.decodeToken2022Account; } });
|
|
40
|
+
Object.defineProperty(exports, "decodeToken2022Mint", { enumerable: true, get: function () { return token_2022_1.decodeToken2022Mint; } });
|
|
41
|
+
Object.defineProperty(exports, "TokenExtensionType", { enumerable: true, get: function () { return token_2022_1.TokenExtensionType; } });
|
|
42
|
+
Object.defineProperty(exports, "TOKEN_2022_PROGRAM_ID", { enumerable: true, get: function () { return token_2022_1.TOKEN_2022_PROGRAM_ID; } });
|
|
43
|
+
// ── Stake ──────────────────────────────────────────────────────
|
|
44
|
+
var stake_1 = require("./stake");
|
|
45
|
+
Object.defineProperty(exports, "decodeStakeAccount", { enumerable: true, get: function () { return stake_1.decodeStakeAccount; } });
|
|
46
|
+
Object.defineProperty(exports, "STAKE_PROGRAM_ID", { enumerable: true, get: function () { return stake_1.STAKE_PROGRAM_ID; } });
|
|
47
|
+
// ── Nonce ──────────────────────────────────────────────────────
|
|
48
|
+
var nonce_1 = require("./nonce");
|
|
49
|
+
Object.defineProperty(exports, "decodeNonceAccount", { enumerable: true, get: function () { return nonce_1.decodeNonceAccount; } });
|
|
50
|
+
Object.defineProperty(exports, "NONCE_ACCOUNT_SIZE", { enumerable: true, get: function () { return nonce_1.NONCE_ACCOUNT_SIZE; } });
|
|
51
|
+
Object.defineProperty(exports, "SYSTEM_PROGRAM_ID", { enumerable: true, get: function () { return nonce_1.SYSTEM_PROGRAM_ID; } });
|
|
52
|
+
// ── Address Lookup Table ───────────────────────────────────────
|
|
53
|
+
var lookup_table_1 = require("./lookup-table");
|
|
54
|
+
Object.defineProperty(exports, "decodeLookupTable", { enumerable: true, get: function () { return lookup_table_1.decodeLookupTable; } });
|
|
55
|
+
Object.defineProperty(exports, "LOOKUP_TABLE_PROGRAM_ID", { enumerable: true, get: function () { return lookup_table_1.LOOKUP_TABLE_PROGRAM_ID; } });
|
|
56
|
+
Object.defineProperty(exports, "LOOKUP_TABLE_HEADER_SIZE", { enumerable: true, get: function () { return lookup_table_1.LOOKUP_TABLE_HEADER_SIZE; } });
|
|
57
|
+
// ── Multisig ───────────────────────────────────────────────────
|
|
58
|
+
var multisig_1 = require("./multisig");
|
|
59
|
+
Object.defineProperty(exports, "decodeMultisig", { enumerable: true, get: function () { return multisig_1.decodeMultisig; } });
|
|
60
|
+
Object.defineProperty(exports, "MAX_MULTISIG_SIGNERS", { enumerable: true, get: function () { return multisig_1.MAX_MULTISIG_SIGNERS; } });
|
|
61
|
+
Object.defineProperty(exports, "MULTISIG_SIZE", { enumerable: true, get: function () { return multisig_1.MULTISIG_SIZE; } });
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoders/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,kEAAkE;AAClE,mCAAuD;AAA9C,uGAAA,aAAa,OAAA;AAAE,sGAAA,YAAY,OAAA;AAEpC,kEAAkE;AAClE,iCAMiB;AALf,2GAAA,kBAAkB,OAAA;AAClB,mGAAA,UAAU,OAAA;AACV,2GAAA,kBAAkB,OAAA;AAClB,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAQlB,kEAAkE;AAClE,2CAKsB;AAJpB,oHAAA,sBAAsB,OAAA;AACtB,iHAAA,mBAAmB,OAAA;AACnB,gHAAA,kBAAkB,OAAA;AAClB,mHAAA,qBAAqB,OAAA;AAmBvB,kEAAkE;AAClE,iCAGiB;AAFf,2GAAA,kBAAkB,OAAA;AAClB,yGAAA,gBAAgB,OAAA;AAWlB,kEAAkE;AAClE,iCAIiB;AAHf,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AAClB,0GAAA,iBAAiB,OAAA;AAOnB,kEAAkE;AAClE,+CAIwB;AAHtB,iHAAA,iBAAiB,OAAA;AACjB,uHAAA,uBAAuB,OAAA;AACvB,wHAAA,wBAAwB,OAAA;AAM1B,kEAAkE;AAClE,uCAIoB;AAHlB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,yGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccountReader — zero-dependency DataView-based binary reader for Solana account data.
|
|
3
|
+
*
|
|
4
|
+
* Provides typed reading primitives (u8, u16, u32, u64, i64, f64, pubkey, bool)
|
|
5
|
+
* with automatic offset tracking and little-endian byte order (Solana standard).
|
|
6
|
+
*
|
|
7
|
+
* @module decoders/layout
|
|
8
|
+
* @since 1.1.0
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { AccountReader } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
13
|
+
*
|
|
14
|
+
* const reader = new AccountReader(rawBytes);
|
|
15
|
+
* const mint = reader.pubkey();
|
|
16
|
+
* const owner = reader.pubkey();
|
|
17
|
+
* const amount = reader.u64();
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { Pubkey } from '../core/types';
|
|
21
|
+
/**
|
|
22
|
+
* Encode a Uint8Array to a base58 string.
|
|
23
|
+
*
|
|
24
|
+
* Used internally for converting 32-byte pubkey buffers to base58.
|
|
25
|
+
* Self-contained — no external dependencies.
|
|
26
|
+
*
|
|
27
|
+
* @param bytes - Raw byte array to encode.
|
|
28
|
+
* @returns Base58-encoded string.
|
|
29
|
+
* @since 1.1.0
|
|
30
|
+
*/
|
|
31
|
+
export declare function encodeBase58(bytes: Uint8Array): string;
|
|
32
|
+
/**
|
|
33
|
+
* Zero-allocation binary reader for Solana account data.
|
|
34
|
+
*
|
|
35
|
+
* Reads little-endian integers, pubkeys, booleans, and COption fields
|
|
36
|
+
* from a Uint8Array with automatic offset tracking. All reads advance
|
|
37
|
+
* the internal cursor.
|
|
38
|
+
*
|
|
39
|
+
* @since 1.1.0
|
|
40
|
+
*/
|
|
41
|
+
export declare class AccountReader {
|
|
42
|
+
private offset;
|
|
43
|
+
private readonly view;
|
|
44
|
+
private readonly bytes;
|
|
45
|
+
constructor(data: Uint8Array);
|
|
46
|
+
/** Current read position. @since 1.1.0 */
|
|
47
|
+
get position(): number;
|
|
48
|
+
/** Total data length. @since 1.1.0 */
|
|
49
|
+
get length(): number;
|
|
50
|
+
/** Remaining bytes after current position. @since 1.1.0 */
|
|
51
|
+
get remaining(): number;
|
|
52
|
+
/** Read an unsigned 8-bit integer. @since 1.1.0 */
|
|
53
|
+
u8(): number;
|
|
54
|
+
/** Read an unsigned 16-bit integer (little-endian). @since 1.1.0 */
|
|
55
|
+
u16(): number;
|
|
56
|
+
/** Read an unsigned 32-bit integer (little-endian). @since 1.1.0 */
|
|
57
|
+
u32(): number;
|
|
58
|
+
/** Read an unsigned 64-bit integer (little-endian). @since 1.1.0 */
|
|
59
|
+
u64(): bigint;
|
|
60
|
+
/** Read a signed 64-bit integer (little-endian). @since 1.1.0 */
|
|
61
|
+
i64(): bigint;
|
|
62
|
+
/** Read a 64-bit float (little-endian). @since 1.1.0 */
|
|
63
|
+
f64(): number;
|
|
64
|
+
/** Read a boolean (1 byte, 0 = false, non-zero = true). @since 1.1.0 */
|
|
65
|
+
bool(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Read a 32-byte Solana public key and return as branded {@link Pubkey}.
|
|
68
|
+
* @since 1.1.0
|
|
69
|
+
*/
|
|
70
|
+
pubkey(): Pubkey;
|
|
71
|
+
/**
|
|
72
|
+
* Read a 32-byte hash and return as base58 string.
|
|
73
|
+
* @since 1.1.0
|
|
74
|
+
*/
|
|
75
|
+
hash(): string;
|
|
76
|
+
/**
|
|
77
|
+
* Read a raw byte slice of the given length.
|
|
78
|
+
* @since 1.1.0
|
|
79
|
+
*/
|
|
80
|
+
slice(length: number): Uint8Array;
|
|
81
|
+
/**
|
|
82
|
+
* Read a Solana COption — 4-byte discriminator (0 = None, 1 = Some)
|
|
83
|
+
* followed by the inner value.
|
|
84
|
+
*
|
|
85
|
+
* **Important:** The reader function is ALWAYS called to advance the
|
|
86
|
+
* offset past the fixed-size data region (C ABI: data is always present,
|
|
87
|
+
* only the tag indicates validity).
|
|
88
|
+
*
|
|
89
|
+
* @param reader - Function to read the inner value.
|
|
90
|
+
* @returns The inner value or `null` if tag is 0 (None).
|
|
91
|
+
* @since 1.1.0
|
|
92
|
+
*/
|
|
93
|
+
coption<T>(reader: () => T): T | null;
|
|
94
|
+
/**
|
|
95
|
+
* Skip N bytes without reading.
|
|
96
|
+
* @since 1.1.0
|
|
97
|
+
*/
|
|
98
|
+
skip(n: number): void;
|
|
99
|
+
/**
|
|
100
|
+
* Seek to an absolute offset.
|
|
101
|
+
* @since 1.1.0
|
|
102
|
+
*/
|
|
103
|
+
seek(offset: number): void;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/decoders/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMvC;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CA2BtD;AAID;;;;;;;;GAQG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;gBAEvB,IAAI,EAAE,UAAU;IAK5B,0CAA0C;IAC1C,IAAI,QAAQ,IAAI,MAAM,CAAwB;IAE9C,sCAAsC;IACtC,IAAI,MAAM,IAAI,MAAM,CAAkC;IAEtD,2DAA2D;IAC3D,IAAI,SAAS,IAAI,MAAM,CAAgD;IAEvE,mDAAmD;IACnD,EAAE,IAAI,MAAM;IAMZ,oEAAoE;IACpE,GAAG,IAAI,MAAM;IAMb,oEAAoE;IACpE,GAAG,IAAI,MAAM;IAMb,oEAAoE;IACpE,GAAG,IAAI,MAAM;IAMb,iEAAiE;IACjE,GAAG,IAAI,MAAM;IAMb,wDAAwD;IACxD,GAAG,IAAI,MAAM;IAMb,wEAAwE;IACxE,IAAI,IAAI,OAAO;IAIf;;;OAGG;IACH,MAAM,IAAI,MAAM;IAMhB;;;OAGG;IACH,IAAI,IAAI,MAAM;IAMd;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAMjC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI;IAMrC;;;OAGG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIrB;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAG3B"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AccountReader — zero-dependency DataView-based binary reader for Solana account data.
|
|
4
|
+
*
|
|
5
|
+
* Provides typed reading primitives (u8, u16, u32, u64, i64, f64, pubkey, bool)
|
|
6
|
+
* with automatic offset tracking and little-endian byte order (Solana standard).
|
|
7
|
+
*
|
|
8
|
+
* @module decoders/layout
|
|
9
|
+
* @since 1.1.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { AccountReader } from '@oobe-protocol-labs/synapse-client-sdk/decoders';
|
|
14
|
+
*
|
|
15
|
+
* const reader = new AccountReader(rawBytes);
|
|
16
|
+
* const mint = reader.pubkey();
|
|
17
|
+
* const owner = reader.pubkey();
|
|
18
|
+
* const amount = reader.u64();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.AccountReader = void 0;
|
|
23
|
+
exports.encodeBase58 = encodeBase58;
|
|
24
|
+
const types_1 = require("../core/types");
|
|
25
|
+
// ── Minimal base58 encoder (self-contained, no deps) ──────────
|
|
26
|
+
const B58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
27
|
+
/**
|
|
28
|
+
* Encode a Uint8Array to a base58 string.
|
|
29
|
+
*
|
|
30
|
+
* Used internally for converting 32-byte pubkey buffers to base58.
|
|
31
|
+
* Self-contained — no external dependencies.
|
|
32
|
+
*
|
|
33
|
+
* @param bytes - Raw byte array to encode.
|
|
34
|
+
* @returns Base58-encoded string.
|
|
35
|
+
* @since 1.1.0
|
|
36
|
+
*/
|
|
37
|
+
function encodeBase58(bytes) {
|
|
38
|
+
if (bytes.length === 0)
|
|
39
|
+
return '';
|
|
40
|
+
let zeros = 0;
|
|
41
|
+
while (zeros < bytes.length && bytes[zeros] === 0)
|
|
42
|
+
zeros++;
|
|
43
|
+
const size = ((bytes.length - zeros) * 138 / 100 + 1) >>> 0;
|
|
44
|
+
const b58 = new Uint8Array(size);
|
|
45
|
+
let length = 0;
|
|
46
|
+
for (let i = zeros; i < bytes.length; i++) {
|
|
47
|
+
let carry = bytes[i];
|
|
48
|
+
let j = 0;
|
|
49
|
+
for (let k = size - 1; (carry !== 0 || j < length) && k >= 0; k--, j++) {
|
|
50
|
+
carry += 256 * b58[k];
|
|
51
|
+
b58[k] = carry % 58;
|
|
52
|
+
carry = (carry / 58) >>> 0;
|
|
53
|
+
}
|
|
54
|
+
length = j;
|
|
55
|
+
}
|
|
56
|
+
let idx = size - length;
|
|
57
|
+
while (idx < size && b58[idx] === 0)
|
|
58
|
+
idx++;
|
|
59
|
+
let str = '1'.repeat(zeros);
|
|
60
|
+
for (; idx < size; idx++)
|
|
61
|
+
str += B58_ALPHABET[b58[idx]];
|
|
62
|
+
return str;
|
|
63
|
+
}
|
|
64
|
+
// ── AccountReader ──────────────────────────────────────────────
|
|
65
|
+
/**
|
|
66
|
+
* Zero-allocation binary reader for Solana account data.
|
|
67
|
+
*
|
|
68
|
+
* Reads little-endian integers, pubkeys, booleans, and COption fields
|
|
69
|
+
* from a Uint8Array with automatic offset tracking. All reads advance
|
|
70
|
+
* the internal cursor.
|
|
71
|
+
*
|
|
72
|
+
* @since 1.1.0
|
|
73
|
+
*/
|
|
74
|
+
class AccountReader {
|
|
75
|
+
offset = 0;
|
|
76
|
+
view;
|
|
77
|
+
bytes;
|
|
78
|
+
constructor(data) {
|
|
79
|
+
this.bytes = data;
|
|
80
|
+
this.view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
81
|
+
}
|
|
82
|
+
/** Current read position. @since 1.1.0 */
|
|
83
|
+
get position() { return this.offset; }
|
|
84
|
+
/** Total data length. @since 1.1.0 */
|
|
85
|
+
get length() { return this.bytes.byteLength; }
|
|
86
|
+
/** Remaining bytes after current position. @since 1.1.0 */
|
|
87
|
+
get remaining() { return this.bytes.byteLength - this.offset; }
|
|
88
|
+
/** Read an unsigned 8-bit integer. @since 1.1.0 */
|
|
89
|
+
u8() {
|
|
90
|
+
const v = this.view.getUint8(this.offset);
|
|
91
|
+
this.offset += 1;
|
|
92
|
+
return v;
|
|
93
|
+
}
|
|
94
|
+
/** Read an unsigned 16-bit integer (little-endian). @since 1.1.0 */
|
|
95
|
+
u16() {
|
|
96
|
+
const v = this.view.getUint16(this.offset, true);
|
|
97
|
+
this.offset += 2;
|
|
98
|
+
return v;
|
|
99
|
+
}
|
|
100
|
+
/** Read an unsigned 32-bit integer (little-endian). @since 1.1.0 */
|
|
101
|
+
u32() {
|
|
102
|
+
const v = this.view.getUint32(this.offset, true);
|
|
103
|
+
this.offset += 4;
|
|
104
|
+
return v;
|
|
105
|
+
}
|
|
106
|
+
/** Read an unsigned 64-bit integer (little-endian). @since 1.1.0 */
|
|
107
|
+
u64() {
|
|
108
|
+
const v = this.view.getBigUint64(this.offset, true);
|
|
109
|
+
this.offset += 8;
|
|
110
|
+
return v;
|
|
111
|
+
}
|
|
112
|
+
/** Read a signed 64-bit integer (little-endian). @since 1.1.0 */
|
|
113
|
+
i64() {
|
|
114
|
+
const v = this.view.getBigInt64(this.offset, true);
|
|
115
|
+
this.offset += 8;
|
|
116
|
+
return v;
|
|
117
|
+
}
|
|
118
|
+
/** Read a 64-bit float (little-endian). @since 1.1.0 */
|
|
119
|
+
f64() {
|
|
120
|
+
const v = this.view.getFloat64(this.offset, true);
|
|
121
|
+
this.offset += 8;
|
|
122
|
+
return v;
|
|
123
|
+
}
|
|
124
|
+
/** Read a boolean (1 byte, 0 = false, non-zero = true). @since 1.1.0 */
|
|
125
|
+
bool() {
|
|
126
|
+
return this.u8() !== 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Read a 32-byte Solana public key and return as branded {@link Pubkey}.
|
|
130
|
+
* @since 1.1.0
|
|
131
|
+
*/
|
|
132
|
+
pubkey() {
|
|
133
|
+
const slice = this.bytes.slice(this.offset, this.offset + 32);
|
|
134
|
+
this.offset += 32;
|
|
135
|
+
return (0, types_1.Pubkey)(encodeBase58(slice));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Read a 32-byte hash and return as base58 string.
|
|
139
|
+
* @since 1.1.0
|
|
140
|
+
*/
|
|
141
|
+
hash() {
|
|
142
|
+
const slice = this.bytes.slice(this.offset, this.offset + 32);
|
|
143
|
+
this.offset += 32;
|
|
144
|
+
return encodeBase58(slice);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Read a raw byte slice of the given length.
|
|
148
|
+
* @since 1.1.0
|
|
149
|
+
*/
|
|
150
|
+
slice(length) {
|
|
151
|
+
const s = this.bytes.slice(this.offset, this.offset + length);
|
|
152
|
+
this.offset += length;
|
|
153
|
+
return s;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Read a Solana COption — 4-byte discriminator (0 = None, 1 = Some)
|
|
157
|
+
* followed by the inner value.
|
|
158
|
+
*
|
|
159
|
+
* **Important:** The reader function is ALWAYS called to advance the
|
|
160
|
+
* offset past the fixed-size data region (C ABI: data is always present,
|
|
161
|
+
* only the tag indicates validity).
|
|
162
|
+
*
|
|
163
|
+
* @param reader - Function to read the inner value.
|
|
164
|
+
* @returns The inner value or `null` if tag is 0 (None).
|
|
165
|
+
* @since 1.1.0
|
|
166
|
+
*/
|
|
167
|
+
coption(reader) {
|
|
168
|
+
const tag = this.u32();
|
|
169
|
+
const value = reader(); // Always read to advance offset past fixed-size data
|
|
170
|
+
return tag === 0 ? null : value;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Skip N bytes without reading.
|
|
174
|
+
* @since 1.1.0
|
|
175
|
+
*/
|
|
176
|
+
skip(n) {
|
|
177
|
+
this.offset += n;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Seek to an absolute offset.
|
|
181
|
+
* @since 1.1.0
|
|
182
|
+
*/
|
|
183
|
+
seek(offset) {
|
|
184
|
+
this.offset = offset;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.AccountReader = AccountReader;
|
|
188
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/decoders/layout.ts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,IAAI,EAAE,CAAC;QAClB,OAAO,IAAA,cAAM,EAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAClB,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAc;QAClB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAI,MAAe;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,qDAAqD;QAC7E,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,CAAS;QACZ,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,MAAc;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAjID,sCAiIC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Address Lookup Table decoder.
|
|
3
|
+
*
|
|
4
|
+
* Decodes v0 transaction lookup table accounts used for compressing
|
|
5
|
+
* transaction address lists.
|
|
6
|
+
*
|
|
7
|
+
* @module decoders/lookup-table
|
|
8
|
+
* @since 1.1.0
|
|
9
|
+
*/
|
|
10
|
+
import type { Pubkey } from '../core/types';
|
|
11
|
+
/**
|
|
12
|
+
* Decoded Address Lookup Table account.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const lut = decodeLookupTable(rawBytes);
|
|
17
|
+
* console.log(`Addresses: ${lut.addresses.length}, Active: ${!lut.isDeactivated}`);
|
|
18
|
+
* ```
|
|
19
|
+
* @since 1.1.0
|
|
20
|
+
*/
|
|
21
|
+
export interface DecodedLookupTable {
|
|
22
|
+
/** Discriminator (always 1 for lookup tables). */
|
|
23
|
+
discriminator: number;
|
|
24
|
+
/** Slot at which deactivation was requested. `MAX_U64` if still active. */
|
|
25
|
+
deactivationSlot: bigint;
|
|
26
|
+
/** Last slot during which the table was extended. */
|
|
27
|
+
lastExtendedSlot: bigint;
|
|
28
|
+
/** Start index within the last extension batch. */
|
|
29
|
+
lastExtendedSlotStartIndex: number;
|
|
30
|
+
/** Authority that can extend/close the table. `null` if frozen. */
|
|
31
|
+
authority: Pubkey | null;
|
|
32
|
+
/** List of addresses stored in the table. */
|
|
33
|
+
addresses: Pubkey[];
|
|
34
|
+
/** Whether the table has been deactivated. */
|
|
35
|
+
isDeactivated: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Address Lookup Table Program ID. @since 1.1.0 */
|
|
38
|
+
export declare const LOOKUP_TABLE_PROGRAM_ID = "AddressLookupTab1e1111111111111111111111111";
|
|
39
|
+
/** Header size of a lookup table account. @since 1.1.0 */
|
|
40
|
+
export declare const LOOKUP_TABLE_HEADER_SIZE = 56;
|
|
41
|
+
/**
|
|
42
|
+
* Decode an Address Lookup Table account from raw bytes.
|
|
43
|
+
*
|
|
44
|
+
* Layout:
|
|
45
|
+
* - [0..4] u32 — discriminator (always 1)
|
|
46
|
+
* - [4..12] u64 — deactivation slot (MAX_U64 = active)
|
|
47
|
+
* - [12..20] u64 — last extended slot
|
|
48
|
+
* - [20] u8 — last extended slot start index
|
|
49
|
+
* - [21] u8 — has authority (0 or 1)
|
|
50
|
+
* - [22..24] [u8;2] — padding
|
|
51
|
+
* - [24..56] [u8;32] — authority (meaningful only if has_authority=1)
|
|
52
|
+
* - [56..] [Pubkey] — addresses (32 bytes each)
|
|
53
|
+
*
|
|
54
|
+
* @param data - Raw account data (must be >= 56 bytes).
|
|
55
|
+
* @returns Decoded lookup table.
|
|
56
|
+
* @throws {Error} If data is too short.
|
|
57
|
+
* @since 1.1.0
|
|
58
|
+
*/
|
|
59
|
+
export declare function decodeLookupTable(data: Uint8Array): DecodedLookupTable;
|
|
60
|
+
//# sourceMappingURL=lookup-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup-table.d.ts","sourceRoot":"","sources":["../../../src/decoders/lookup-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,0BAA0B,EAAE,MAAM,CAAC;IACnC,mEAAmE;IACnE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8CAA8C;IAC9C,aAAa,EAAE,OAAO,CAAC;CACxB;AAID,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,gDAAgD,CAAC;AAErF,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAO3C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,CAwCtE"}
|