Skip to content

Latest commit

 

History

History
991 lines (747 loc) · 42.9 KB

SolanaWalletApi.md

File metadata and controls

991 lines (747 loc) · 42.9 KB

Org.OpenAPITools.Api.SolanaWalletApi

All URIs are relative to https://api.blockchainapi.com/v1

Method HTTP request Description
SolanaDeriveAssociatedTokenAccountAddress GET /solana/wallet/{public_key}/associated_token_account/{mint_address} Derive an associated token account address
SolanaDerivePrivateKey POST /solana/wallet/private_key Derive private key
SolanaDerivePublicKey POST /solana/wallet/public_key Derive public key
SolanaGeneratePrivateKey POST /solana/wallet/generate/private_key Generate private key
SolanaGenerateSecretRecoveryPhrase POST /solana/wallet/generate/secret_recovery_phrase Generate secret phrase
SolanaGetAirdrop POST /solana/wallet/airdrop Get an airdrop on devnet
SolanaGetBalance POST /solana/wallet/balance Get wallet's balance in SOL or any SPL
SolanaGetNFTsBelongingToWallet GET /solana/wallet/{network}/{public_key}/nfts Get address's NFTs
SolanaGetTokensBelongingToWallet GET /solana/wallet/{network}/{public_key}/tokens Get address's tokens and respective balances
SolanaGetWalletTransactions GET /solana/wallet/{network}/{public_key}/transactions Get address's associated transaction signatures
SolanaTransfer POST /solana/wallet/transfer Transfer SOL, a token, or an NFT to another address

SolanaDeriveAssociatedTokenAccountAddress

ATAResponse SolanaDeriveAssociatedTokenAccountAddress (string publicKey, string mintAddress)

Derive an associated token account address

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/derive-associated-token-account-address\" target="_blank">See example (Python, JavaScript). Each wallet can own tokens, but in Solana, each token is actually held by an <a href="https://spl.solana.com/associated-token-account\" target="_blank">associated token account (ATA), which is an account specific for a token owned by the wallet. When you transfer an SPL token, such as Serum, or transfer an NFT, you're transfering from an ATA you own to another person's ATA for that specific token. With this endpoint, you can derive an associated token address given a wallet and a token address. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaDeriveAssociatedTokenAccountAddressExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var publicKey = 31LKs39pjT5oj6fWjC3F76dHWf9489asCthmgj8wu7pj;  // string | The public key of the wallet
            var mintAddress = 7EWJNaNYfPYMaqzdAAa4ps5kpqW95B7VHsjhW1kr18sj;  // string | The mint address of the token (either SPL or NFT)

            try
            {
                // Derive an associated token account address
                ATAResponse result = apiInstance.SolanaDeriveAssociatedTokenAccountAddress(publicKey, mintAddress);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaDeriveAssociatedTokenAccountAddress: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
publicKey string The public key of the wallet
mintAddress string The mint address of the token (either SPL or NFT)

Return type

ATAResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaDerivePrivateKey

GeneratePrivateKey SolanaDerivePrivateKey (GetPublicKeyRequest getPublicKeyRequest)

Derive private key

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/derive-private-key\" target="_blank">See examples (Python, JavaScript). Returns a private key array and a base58-encoded private key given wallet authentication. A wallet is defined by a public key. A public key is derived from a combination of seed phrase, derivation path, and passphrase. Changing any one of these three will change the public key output. You can generate a unique public key with each combination of secret recovery phrase, passphrase, and derivation path. Thus, with a single secret recovery phrase, you can generate many public keys. If you are just starting, just supply the secret recovery phrase you generated with the Solana Wallet Secret Recovery Phrase endpoint. If you are trying to get a public key that already exists (e.g., created in the Phantom wallet), make sure you use the correct derivation path and passphrase. To read more about that, see the descriptions of those parameters below. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaDerivePrivateKeyExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var getPublicKeyRequest = new GetPublicKeyRequest(); // GetPublicKeyRequest | 

            try
            {
                // Derive private key
                GeneratePrivateKey result = apiInstance.SolanaDerivePrivateKey(getPublicKeyRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaDerivePrivateKey: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
getPublicKeyRequest GetPublicKeyRequest

Return type

GeneratePrivateKey

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaDerivePublicKey

PublicKey SolanaDerivePublicKey (GetPublicKeyRequest getPublicKeyRequest)

Derive public key

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/derive-public-key\" target="_blank">See examples (Python, JavaScript). Returns a public key given wallet authentication. A wallet is identified by a public key. A public key is derived from a combination of seed phrase, derivation path, and passphrase. Changing any one of these three will change the public key output. It can also be derived from a private key. *You can generate a unique public key with each combination of secret recovery phrase, passphrase, and derivation path; or from a private key. Thus, with a single secret recovery phrase, you can generate many public keys; however, with a private key, you can only generate one public key. If you are just starting, generate a <a href="#operation/solanaGenerateSecretRecoveryPhrase">secret recovery phrase or <a href="#operation/solanaGeneratePrivateKey">private key. If you are trying to get a public key that already exists (e.g., created in the Phantom wallet), make sure you use the correct derivation path and passphrase; or just use the private key. To read more about that, see the descriptions of those parameters below. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaDerivePublicKeyExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var getPublicKeyRequest = new GetPublicKeyRequest(); // GetPublicKeyRequest | 

            try
            {
                // Derive public key
                PublicKey result = apiInstance.SolanaDerivePublicKey(getPublicKeyRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaDerivePublicKey: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
getPublicKeyRequest GetPublicKeyRequest

Return type

PublicKey

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGeneratePrivateKey

GeneratePrivateKey SolanaGeneratePrivateKey ()

Generate private key

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/generate-private-key\" target="_blank">See examples (Python, JavaScript). Use this endpoint to securely and randomly generate a private key for a Solana wallet. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGeneratePrivateKeyExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);

            try
            {
                // Generate private key
                GeneratePrivateKey result = apiInstance.SolanaGeneratePrivateKey();
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGeneratePrivateKey: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

GeneratePrivateKey

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGenerateSecretRecoveryPhrase

SecretPhrase SolanaGenerateSecretRecoveryPhrase ()

Generate secret phrase

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/generate-secret-phrase\" target="_blank">See examples (Python, JavaScript). Use this endpoint to securely and randomly generate a secret recovery phrase for a Solana wallet. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGenerateSecretRecoveryPhraseExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);

            try
            {
                // Generate secret phrase
                SecretPhrase result = apiInstance.SolanaGenerateSecretRecoveryPhrase();
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGenerateSecretRecoveryPhrase: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

SecretPhrase

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGetAirdrop

TransferResponse SolanaGetAirdrop (AirdropRequest airdropRequest = null)

Get an airdrop on devnet

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/get-airdrop\" target="_blank">See examples (Python, JavaScript). Use this endpoint to get an airdrop of SOL on the devnet (not real SOL). Amount of 0.015, which is the minimum amount of SOL you need to mint a Metaplex NFT and then transfer it to another wallet. Cost: 0 Credit (Free) (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGetAirdropExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var airdropRequest = new AirdropRequest(); // AirdropRequest |  (optional) 

            try
            {
                // Get an airdrop on devnet
                TransferResponse result = apiInstance.SolanaGetAirdrop(airdropRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGetAirdrop: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
airdropRequest AirdropRequest [optional]

Return type

TransferResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGetBalance

BalanceResponse SolanaGetBalance (BalanceRequest balanceRequest = null)

Get wallet's balance in SOL or any SPL

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/get-wallet-balance\" target="_blank">See examples (Python, JavaScript). See the balance of a wallet in SOL or any SPL token. To get the balance of an SPL token, supply the mint_address of the SPL token. The list of SPL tokens can be viewed <a href="https://raw.githubusercontent.com/solana-labs/token-list/main/src/tokens/solana.tokenlist.json\" target="_blank">here. You can also use this endpoint to see whether or not a person owns an NFT. Just supply the mint_address of the NFT. A balance of "1" means the person owns the NFT, and a balance of "0" means the person does not own the NFT. This works in most cases, but we are aware of one edge case where a balance of "0" will show up for a person who is actually the owner of the NFT. We just recommend using the <a href="#operation/solanaGetNFTOwner">getNFTOwner endpoint and comparing that output to the expected address. Cost: 0.25 Credit (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGetBalanceExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var balanceRequest = new BalanceRequest(); // BalanceRequest |  (optional) 

            try
            {
                // Get wallet's balance in SOL or any SPL
                BalanceResponse result = apiInstance.SolanaGetBalance(balanceRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGetBalance: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
balanceRequest BalanceRequest [optional]

Return type

BalanceResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGetNFTsBelongingToWallet

ListNFTsResponse SolanaGetNFTsBelongingToWallet (string network, string publicKey)

Get address's NFTs

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/get-wallet-nfts\" target="_blank">See examples (Python, JavaScript). See the NFTs that belong to a given public key address Cost: 3 Credits (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGetNFTsBelongingToWalletExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var network = mainnet-beta;  // string | The network ID (devnet, mainnet-beta)
            var publicKey = HE3ZYk4aWfKD7R9EmFQbxjj75JdgHuDztNAsseKVan82;  // string | The public key of the account whose list of owned NFTs you want to get

            try
            {
                // Get address's NFTs
                ListNFTsResponse result = apiInstance.SolanaGetNFTsBelongingToWallet(network, publicKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGetNFTsBelongingToWallet: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
network string The network ID (devnet, mainnet-beta)
publicKey string The public key of the account whose list of owned NFTs you want to get

Return type

ListNFTsResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGetTokensBelongingToWallet

List<Object> SolanaGetTokensBelongingToWallet (string network, string publicKey, bool? includeNfts = null, bool? includeZeroBalanceHoldings = null)

Get address's tokens and respective balances

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/get-wallet-token-holdings\" target="_blank">See examples (Python, JavaScript). See the token holdings of a given public key address Cost: 2 Credits (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGetTokensBelongingToWalletExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var network = mainnet-beta;  // string | The network ID (devnet, mainnet-beta)
            var publicKey = GKNcUmNacSJo4S2Kq3DuYRYRGw3sNUfJ4tyqd198t6vQ;  // string | The public key of the account whose list of owned NFTs you want to get
            var includeNfts = false;  // bool? | Whether or not to include NFTs in the response (optional)  (default to false)
            var includeZeroBalanceHoldings = false;  // bool? | Whether or not to include holdings that have zero balance. This indicates that the wallet held this token or NFT in the past, but no longer holds it. (optional)  (default to false)

            try
            {
                // Get address's tokens and respective balances
                List<Object> result = apiInstance.SolanaGetTokensBelongingToWallet(network, publicKey, includeNfts, includeZeroBalanceHoldings);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGetTokensBelongingToWallet: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
network string The network ID (devnet, mainnet-beta)
publicKey string The public key of the account whose list of owned NFTs you want to get
includeNfts bool? Whether or not to include NFTs in the response [optional] [default to false]
includeZeroBalanceHoldings bool? Whether or not to include holdings that have zero balance. This indicates that the wallet held this token or NFT in the past, but no longer holds it. [optional] [default to false]

Return type

List

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaGetWalletTransactions

List<string> SolanaGetWalletTransactions (string network, string publicKey)

Get address's associated transaction signatures

<a href="https://github.com/BL0CK-X/blockchain-api/tree/main/examples/solana-wallet/get-wallet-transactions\" target="_blank">See examples (Python, JavaScript). See the transaction signatures of a given public key address Cost: 1 Credits (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaGetWalletTransactionsExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var network = mainnet-beta;  // string | The network ID (devnet, mainnet-beta)
            var publicKey = GKNcUmNacSJo4S2Kq3DuYRYRGw3sNUfJ4tyqd198t6vQ;  // string | The public key of the account whose list of signatures you want to get

            try
            {
                // Get address's associated transaction signatures
                List<string> result = apiInstance.SolanaGetWalletTransactions(network, publicKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaGetWalletTransactions: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
network string The network ID (devnet, mainnet-beta)
publicKey string The public key of the account whose list of signatures you want to get

Return type

List

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

SolanaTransfer

DoubleTransferResponse SolanaTransfer (TransferRequest transferRequest = null)

Transfer SOL, a token, or an NFT to another address

<a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/transfer-sol\" target="_blank">See transfer SOL example (Python, JavaScript). <a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-wallet/transfer-nft\" target="_blank">See transfer NFT example (can also be used for SPL token) (Python, JavaScript). This is a powerful function. It might be slightly confusing because there are several optional parameters, so take some time to review it. This function can send SOL, send an SPL token, or send an NFT. You can set the fee payer of the transaction; you can sign and submit the transaction for confirmation; and you can select to simply return the compiled transaction so that you can submit it to the user for signing (e.g., via Phantom; no private keys required in this case). Transfer SOL, a token or an NFT to another address. If you're transferring an NFT, supply the mint (the address of the mint) for the token_address. SENDER: Note that the wallet information is used to authorize the sending of the tokens and identifies the source of the tokens. If return_compiled_transaction = false, we sign and submit the transaction (wallet is required in this case; do not provide a value for sender_public_key). If return_compiled_transaction = true, we compile the transaction (one of wallet or sender_public_key is required in this case; do not provide both). RECIPIENT: recipient_address identifies the receiver. This is entirely separate from the information used for the SENDER above. So, in this API call, there are two wallets involved, but only one (namely, the SENDER) is needed to authorize the transaction. FEE_PAYER: The fee payer of the transaction defaults to wallet (or sender_public_key). To set a different fee payer, provide a value for fee_payer_wallet. If you're transfering a token, supply the token address found on the explorer (e.g., see SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt for <a href="https://explorer.solana.com/address/SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt\" target="_blank">Serum Token) for the token_address. If you're transferring SOL, do not supply a value for token_address. Cost: 2 Credit (<a href="#section/Pricing">See Pricing)

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class SolanaTransferExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.AddApiKey("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.AddApiKey("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("APISecretKey", "Bearer");

            var apiInstance = new SolanaWalletApi(Configuration.Default);
            var transferRequest = new TransferRequest(); // TransferRequest |  (optional) 

            try
            {
                // Transfer SOL, a token, or an NFT to another address
                DoubleTransferResponse result = apiInstance.SolanaTransfer(transferRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling SolanaWalletApi.SolanaTransfer: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
transferRequest TransferRequest [optional]

Return type

DoubleTransferResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Bad request (check response message) -
401 Invalid API key pair in headers -
402 Payment required. Occurs when you run out of API requests. Upgrade <a href=&quot;https://dashboard.theblockchainapi.com/billing\" target=&quot;_blank&quot;>here</a>. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]