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 |
open class func solanaDeriveAssociatedTokenAccountAddress(publicKey: String, mintAddress: String, completion: @escaping (_ data: ATAResponse?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let publicKey = "publicKey_example" // String | The public key of the wallet
let mintAddress = "mintAddress_example" // String | The mint address of the token (either SPL or NFT)
// Derive an associated token account address
SolanaWalletAPI.solanaDeriveAssociatedTokenAccountAddress(publicKey: publicKey, mintAddress: mintAddress) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
publicKey | String | The public key of the wallet | |
mintAddress | String | The mint address of the token (either SPL or NFT) |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaDerivePrivateKey(getPublicKeyRequest: GetPublicKeyRequest, completion: @escaping (_ data: GeneratePrivateKey?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let getPublicKeyRequest = GetPublicKeyRequest(wallet: Wallet(secretRecoveryPhrase: "secretRecoveryPhrase_example", derivationPath: "derivationPath_example", passphrase: "passphrase_example", privateKey: "TODO", b58PrivateKey: "b58PrivateKey_example")) // GetPublicKeyRequest |
// Derive private key
SolanaWalletAPI.solanaDerivePrivateKey(getPublicKeyRequest: getPublicKeyRequest) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
getPublicKeyRequest | GetPublicKeyRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaDerivePublicKey(getPublicKeyRequest: GetPublicKeyRequest, completion: @escaping (_ data: PublicKey?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let getPublicKeyRequest = GetPublicKeyRequest(wallet: Wallet(secretRecoveryPhrase: "secretRecoveryPhrase_example", derivationPath: "derivationPath_example", passphrase: "passphrase_example", privateKey: "TODO", b58PrivateKey: "b58PrivateKey_example")) // GetPublicKeyRequest |
// Derive public key
SolanaWalletAPI.solanaDerivePublicKey(getPublicKeyRequest: getPublicKeyRequest) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
getPublicKeyRequest | GetPublicKeyRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGeneratePrivateKey(completion: @escaping (_ data: GeneratePrivateKey?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
// Generate private key
SolanaWalletAPI.solanaGeneratePrivateKey() { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGenerateSecretRecoveryPhrase(completion: @escaping (_ data: SecretPhrase?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
// Generate secret phrase
SolanaWalletAPI.solanaGenerateSecretRecoveryPhrase() { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGetAirdrop(airdropRequest: AirdropRequest? = nil, completion: @escaping (_ data: TransferResponse?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let airdropRequest = AirdropRequest(recipientAddress: "recipientAddress_example") // AirdropRequest | (optional)
// Get an airdrop on devnet
SolanaWalletAPI.solanaGetAirdrop(airdropRequest: airdropRequest) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
airdropRequest | AirdropRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGetBalance(balanceRequest: BalanceRequest? = nil, completion: @escaping (_ data: BalanceResponse?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let balanceRequest = BalanceRequest(publicKey: "publicKey_example", unit: "unit_example", network: "network_example", mintAddress: "mintAddress_example") // BalanceRequest | (optional)
// Get wallet's balance in SOL or any SPL
SolanaWalletAPI.solanaGetBalance(balanceRequest: balanceRequest) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
balanceRequest | BalanceRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGetNFTsBelongingToWallet(network: String, publicKey: String, completion: @escaping (_ data: ListNFTsResponse?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let network = "network_example" // String | The network ID (devnet, mainnet-beta)
let publicKey = "publicKey_example" // String | The public key of the account whose list of owned NFTs you want to get
// Get address's NFTs
SolanaWalletAPI.solanaGetNFTsBelongingToWallet(network: network, publicKey: publicKey) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
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 |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGetTokensBelongingToWallet(network: String, publicKey: String, includeNfts: Bool? = nil, includeZeroBalanceHoldings: Bool? = nil, completion: @escaping (_ data: [AnyCodable]?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let network = "network_example" // String | The network ID (devnet, mainnet-beta)
let publicKey = "publicKey_example" // String | The public key of the account whose list of owned NFTs you want to get
let includeNfts = false // Bool | Whether or not to include NFTs in the response (optional) (default to false)
let 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)
// Get address's tokens and respective balances
SolanaWalletAPI.solanaGetTokensBelongingToWallet(network: network, publicKey: publicKey, includeNfts: includeNfts, includeZeroBalanceHoldings: includeZeroBalanceHoldings) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaGetWalletTransactions(network: String, publicKey: String, completion: @escaping (_ data: [String]?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let network = "network_example" // String | The network ID (devnet, mainnet-beta)
let publicKey = "publicKey_example" // String | The public key of the account whose list of signatures you want to get
// Get address's associated transaction signatures
SolanaWalletAPI.solanaGetWalletTransactions(network: network, publicKey: publicKey) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
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 |
[String]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
open class func solanaTransfer(transferRequest: TransferRequest? = nil, completion: @escaping (_ data: DoubleTransferResponse?, _ error: Error?) -> Void)
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)
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import theblockchainapi
let transferRequest = TransferRequest(waitForConfirmation: false, recipientAddress: "recipientAddress_example", wallet: Wallet(secretRecoveryPhrase: "secretRecoveryPhrase_example", derivationPath: "derivationPath_example", passphrase: "passphrase_example", privateKey: "TODO", b58PrivateKey: "b58PrivateKey_example"), tokenAddress: "tokenAddress_example", network: "network_example", amount: "amount_example", returnCompiledTransaction: false, senderPublicKey: "senderPublicKey_example", feePayerWallet: FeePayerWallet(secretRecoveryPhrase: "secretRecoveryPhrase_example", derivationPath: "derivationPath_example", passphrase: "passphrase_example", privateKey: "TODO", b58PrivateKey: "b58PrivateKey_example")) // TransferRequest | (optional)
// Transfer SOL, a token, or an NFT to another address
SolanaWalletAPI.solanaTransfer(transferRequest: transferRequest) { (response, error) in
guard error == nil else {
print(error)
return
}
if (response) {
dump(response)
}
}
Name | Type | Description | Notes |
---|---|---|---|
transferRequest | TransferRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]