Module: @moralisweb3/common-sol-utils
moralis-monorepo / @moralisweb3/common-sol-utils
Module: @moralisweb3/common-sol-utils
Table of contents
DataType Classes
Other Classes
- CommonSolUtils
- CommonSolUtilsConfigSetup
- SolGetTokenMetadataNetworkEnum
- SolGetTokenPriceNetworkEnum
- SolMetaplexToken
- SolNetworkResolver
- SolSPLNativePrice
- SolSPLTokenPrice
- SolTokenMetadata
Variables
- CommonSolUtilsConfig
- GetTokenMetadataOperation
- GetTokenPriceOperation
- getBalanceOperation
- getNFTMetadataOperation
- getNFTsOperation
- getPortfolioOperation
- getSPLOperation
- getTokenPriceOperation
- operations
- operationsV2
- operationsV2All
Type Aliases
- GetBalanceJSONRequest
- GetBalanceResponse
- GetNFTMetadataJSONRequest
- GetNFTMetadataResponse
- GetNFTsJSONRequest
- GetNFTsResponse
- GetPortfolioJSONRequest
- GetPortfolioResponse
- GetSPLJSONRequest
- GetSPLResponse
- GetTokenMetadataOperationResponse
- GetTokenMetadataOperationResponseJSON
- GetTokenPriceJSONRequest
- GetTokenPriceOperationResponse
- GetTokenPriceOperationResponseJSON
- GetTokenPriceResponse
- SolAddressInput
- SolAddressJSON
- SolAddressish
- SolGetTokenMetadataNetworkEnumInput
- SolGetTokenMetadataNetworkEnumJSON
- SolGetTokenMetadataNetworkEnumValue
- SolGetTokenPriceNetworkEnumInput
- SolGetTokenPriceNetworkEnumJSON
- SolGetTokenPriceNetworkEnumValue
- SolNativeInput
- SolNativeJSON
- SolNativeUnit
- SolNativeish
- SolNetworkInput
- SolNetworkJSON
- SolNetworkName
- SolNetworkish
Interfaces
- GetBalanceJSONResponse
- GetBalanceRequest
- GetBalanceResponseAdapter
- GetNFTMetadataJSONResponse
- GetNFTMetadataRequest
- GetNFTMetadataResponseAdapter
- GetNFTsJSONResponse
- GetNFTsRequest
- GetNFTsResponseAdapter
- GetPortfolioJSONResponse
- GetPortfolioRequest
- GetPortfolioResponseAdapter
- GetSPLJSONResponse
- GetSPLRequest
- GetSPLResponseAdapter
- GetTokenMetadataOperationRequest
- GetTokenMetadataOperationRequestJSON
- GetTokenPriceJSONResponse
- GetTokenPriceOperationRequest
- GetTokenPriceOperationRequestJSON
- GetTokenPriceRequest
- GetTokenPriceResponseAdapter
- SolMetaplexTokenInput
- SolMetaplexTokenJSON
- SolSPLNativePriceInput
- SolSPLNativePriceJSON
- SolSPLTokenPriceInput
- SolSPLTokenPriceJSON
- SolTokenMetadataInput
- SolTokenMetadataJSON
Variables
CommonSolUtilsConfig
• Const
CommonSolUtilsConfig: Object
Type declaration
Name | Type |
---|---|
defaultSolNetwork | ConfigKey <SolNetworkInput > |
GetTokenMetadataOperation
• Const
GetTokenMetadataOperation: Object
Type declaration
Name | Type |
---|---|
groupName | string |
hasBody | boolean |
hasResponse | boolean |
httpMethod | string |
operationId | string |
parameterNames | string [] |
parseResponse | (json : SolTokenMetadataJSON ) => SolTokenMetadata |
routePattern | string |
serializeRequest | (request : GetTokenMetadataOperationRequest ) => GetTokenMetadataOperationRequestJSON |
GetTokenPriceOperation
• Const
GetTokenPriceOperation: Object
Type declaration
Name | Type |
---|---|
groupName | string |
hasBody | boolean |
hasResponse | boolean |
httpMethod | string |
operationId | string |
parameterNames | string [] |
parseResponse | (json : SolSPLTokenPriceJSON ) => SolSPLTokenPrice |
routePattern | string |
serializeRequest | (request : GetTokenPriceOperationRequest ) => GetTokenPriceOperationRequestJSON |
getBalanceOperation
• Const
getBalanceOperation: Operation
<GetBalanceRequest
, GetBalanceJSONRequest
, GetBalanceResponse
, GetBalanceJSONResponse
>
Gets native balance owned by the given network and address
getNFTMetadataOperation
• Const
getNFTMetadataOperation: Operation
<GetNFTMetadataRequest
, GetNFTMetadataJSONRequest
, GetNFTMetadataResponse
, GetNFTMetadataJSONResponse
>
Gets the contract level metadata (mint, standard, name, symbol, metaplex) for the given network and contract
getNFTsOperation
• Const
getNFTsOperation: Operation
<GetNFTsRequest
, GetNFTsJSONRequest
, any
[], GetNFTsJSONResponse
>
Gets NFTs owned by the given network and address
getPortfolioOperation
• Const
getPortfolioOperation: Operation
<GetPortfolioRequest
, GetPortfolioJSONRequest
, GetPortfolioResponse
, GetPortfolioJSONResponse
>
Gets the portfolio of the given network and address
getSPLOperation
• Const
getSPLOperation: Operation
<GetSPLRequest
, GetSPLJSONRequest
, any
[], GetSPLJSONResponse
>
Gets token balances owned by the given network and address
getTokenPriceOperation
• Const
getTokenPriceOperation: Operation
<GetTokenPriceRequest
, GetTokenPriceJSONRequest
, GetTokenPriceResponse
, GetTokenPriceJSONResponse
>
Gets the token price (usd and native) for a given contract address and network
operations
• Const
operations: ({ groupName
: string
= "token"; hasBody
: boolean
= false; hasResponse
: boolean
= true; httpMethod
: string
= "get"; operationId
: string
= "getTokenPrice"; parameterNames
: string
[] ; parseResponse
: (json
: SolSPLTokenPriceJSON
) => SolSPLTokenPrice
; routePattern
: string
= "/token/{network}/{address}/price"; serializeRequest
: (request
: GetTokenPriceOperationRequest
) => GetTokenPriceOperationRequestJSON
} | { groupName
: string
= "token"; hasBody
: boolean
= false; hasResponse
: boolean
= true; httpMethod
: string
= "get"; operationId
: string
= "getTokenMetadata"; parameterNames
: string
[] ; parseResponse
: (json
: SolTokenMetadataJSON
) => SolTokenMetadata
; routePattern
: string
= "/token/{network}/{address}/metadata"; serializeRequest
: (request
: GetTokenMetadataOperationRequest
) => GetTokenMetadataOperationRequestJSON
})[]
operationsV2
• Const
operationsV2: (Operation
<GetBalanceRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, SolNative
, GetBalanceJSONResponse
> | Operation
<GetNFTsRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= item.name; symbol
: string
= item.symbol }[], GetNFTsJSONResponse
> | Operation
<GetPortfolioRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { nativeBalance
: SolNative
; nfts
: { associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= nft.name; symbol
: string
= nft.symbol }[] ; tokens
: { amount
: SolNative
; associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= token.name; symbol
: string
= token.symbol }[] }, GetPortfolioJSONResponse
> | Operation
<GetNFTMetadataRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { metaplex
: { isMutable
: boolean
= jsonResponse.metaplex.isMutable; masterEdition
: boolean
= jsonResponse.metaplex.masterEdition; metadataUri
: string
= jsonResponse.metaplex.metadataUri; primarySaleHappened
: number
= jsonResponse.metaplex.primarySaleHappened; sellerFeeBasisPoints
: number
= jsonResponse.metaplex.sellerFeeBasisPoints; updateAuthority
: SolAddress
} ; mint
: SolAddress
; name
: string
= jsonResponse.name; standard
: string
= jsonResponse.standard; symbol
: string
= jsonResponse.symbol }, GetNFTMetadataJSONResponse
>)[]
operationsV2All
• Const
operationsV2All: (Operation
<GetBalanceRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, SolNative
, GetBalanceJSONResponse
> | Operation
<GetNFTsRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= item.name; symbol
: string
= item.symbol }[], GetNFTsJSONResponse
> | Operation
<GetPortfolioRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { nativeBalance
: SolNative
; nfts
: { associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= nft.name; symbol
: string
= nft.symbol }[] ; tokens
: { amount
: SolNative
; associatedTokenAddress
: SolAddress
; mint
: SolAddress
; name
: string
= token.name; symbol
: string
= token.symbol }[] }, GetPortfolioJSONResponse
> | Operation
<GetNFTMetadataRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, { metaplex
: { isMutable
: boolean
= jsonResponse.metaplex.isMutable; masterEdition
: boolean
= jsonResponse.metaplex.masterEdition; metadataUri
: string
= jsonResponse.metaplex.metadataUri; primarySaleHappened
: number
= jsonResponse.metaplex.primarySaleHappened; sellerFeeBasisPoints
: number
= jsonResponse.metaplex.sellerFeeBasisPoints; updateAuthority
: SolAddress
} ; mint
: SolAddress
; name
: string
= jsonResponse.name; standard
: string
= jsonResponse.standard; symbol
: string
= jsonResponse.symbol }, GetNFTMetadataJSONResponse
> | Operation
<GetTokenPriceRequest
, { address
: string
; network
: "mainnet"
| "devnet"
}, SolSPLTokenPrice
, GetTokenPriceJSONResponse
>)[]
Deprecated
This list includes upgraded operations to the hybrid approach in the old format.
Type Aliases
GetBalanceJSONRequest
Ƭ GetBalanceJSONRequest: ReturnType
<typeof serializeRequest
>
GetBalanceResponse
Ƭ GetBalanceResponse: ReturnType
<typeof deserializeResponse
>
GetNFTMetadataJSONRequest
Ƭ GetNFTMetadataJSONRequest: ReturnType
<typeof serializeRequest
>
GetNFTMetadataResponse
Ƭ GetNFTMetadataResponse: ReturnType
<typeof deserializeResponse
>
GetNFTsJSONRequest
Ƭ GetNFTsJSONRequest: ReturnType
<typeof serializeRequest
>
GetNFTsResponse
Ƭ GetNFTsResponse: ReturnType
<typeof deserializeResponse
>
GetPortfolioJSONRequest
Ƭ GetPortfolioJSONRequest: ReturnType
<typeof serializeRequest
>
GetPortfolioResponse
Ƭ GetPortfolioResponse: ReturnType
<typeof deserializeResponse
>
GetSPLJSONRequest
Ƭ GetSPLJSONRequest: ReturnType
<typeof serializeRequest
>
GetSPLResponse
Ƭ GetSPLResponse: ReturnType
<typeof deserializeResponse
>
GetTokenMetadataOperationResponse
Ƭ GetTokenMetadataOperationResponse: SolTokenMetadata
GetTokenMetadataOperationResponseJSON
Ƭ GetTokenMetadataOperationResponseJSON: SolTokenMetadataJSON
GetTokenPriceJSONRequest
Ƭ GetTokenPriceJSONRequest: ReturnType
<typeof serializeRequest
>
GetTokenPriceOperationResponse
Ƭ GetTokenPriceOperationResponse: SolSPLTokenPrice
GetTokenPriceOperationResponseJSON
Ƭ GetTokenPriceOperationResponseJSON: SolSPLTokenPriceJSON
GetTokenPriceResponse
Ƭ GetTokenPriceResponse: ReturnType
<typeof deserializeResponse
>
SolAddressInput
Ƭ SolAddressInput: SolAddress
| string
SolAddressJSON
Ƭ SolAddressJSON: string
SolAddressish
Ƭ SolAddressish: SolAddressInput
Valid input for a new SolAddress instance. This can be an existing SolAddress or a valid address string.
Example
"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
Example
SolAddress.create("9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM")
SolGetTokenMetadataNetworkEnumInput
Ƭ SolGetTokenMetadataNetworkEnumInput: "mainnet"
| "devnet"
SolGetTokenMetadataNetworkEnumJSON
Ƭ SolGetTokenMetadataNetworkEnumJSON: "mainnet"
| "devnet"
SolGetTokenMetadataNetworkEnumValue
Ƭ SolGetTokenMetadataNetworkEnumValue: "mainnet"
| "devnet"
SolGetTokenPriceNetworkEnumInput
Ƭ SolGetTokenPriceNetworkEnumInput: "mainnet"
SolGetTokenPriceNetworkEnumJSON
Ƭ SolGetTokenPriceNetworkEnumJSON: "mainnet"
SolGetTokenPriceNetworkEnumValue
Ƭ SolGetTokenPriceNetworkEnumValue: "mainnet"
SolNativeInput
Ƭ SolNativeInput: SolNative
| BigNumberish
SolNativeJSON
Ƭ SolNativeJSON: string
SolNativeUnit
Ƭ SolNativeUnit: "solana"
| "lamports"
| number
Type containing valid Solana native units
SolNativeish
Ƭ SolNativeish: SolNativeInput
Valid input for a new SolNative instance. This can be an existing SolNative or a valid BigNumberish type
SolNetworkInput
Ƭ SolNetworkInput: SolNetwork
| SolNetworkName
| string
SolNetworkJSON
Ƭ SolNetworkJSON: string
SolNetworkName
Ƭ SolNetworkName: typeof solNetworkNames
[number
]
A name of Solana network.
Example
"mainnet"
Example
"devnet"
SolNetworkish
Ƭ SolNetworkish: SolNetworkInput
Valid input for a new SolNetwork instance. This can be an existing SolNetwork or a valid network name.
Example
"mainnet"
Example
"devnet"
Example
SolNetwork.create("mainnet")