Skip to content

Latest commit

 

History

History
420 lines (290 loc) · 18.2 KB

File metadata and controls

420 lines (290 loc) · 18.2 KB

theblockchainapi.WalletApi

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

Method HTTP request Description
derivePrivateKey POST /{blockchain}/wallet/private_key Derive private key
deriveWalletIdentifier POST /{blockchain}/wallet/identifier Derive wallet identifier
generatePrivateKey POST /{blockchain}/wallet/generate/private_key Generate private key
generateSeedPhrase POST /{blockchain}/wallet/generate/secret_recovery_phrase Generate seed phrase
getAirdrop POST /{blockchain}/wallet/airdrop Get an airdrop
getBalance POST /{blockchain}/wallet/balance Get wallet's balance of X
transfer POST /{blockchain}/wallet/transfer Transfer crypto, a token, or an NFT to another wallet

derivePrivateKey

GeneralGeneratePrivateKeyResponse derivePrivateKey(blockchain, supplyWalletRequest)

Derive private key

<a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/derive-private-key\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Use this endpoint to securely derive a private key for a wallet. For example, if you have a seed phrase and want to derive the corresponding private key, use this endpoint. `Cost: 0 Credit` (Free) (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let supplyWalletRequest = new theblockchainapi.SupplyWalletRequest(); // SupplyWalletRequest | 
apiInstance.derivePrivateKey(blockchain, supplyWalletRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
supplyWalletRequest SupplyWalletRequest

Return type

GeneralGeneratePrivateKeyResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

deriveWalletIdentifier

WalletIdentifiers deriveWalletIdentifier(blockchain, supplyWalletRequest)

Derive wallet identifier

<a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/derive-wallet-identifier\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Derive the identifier for a wallet. `Cost: 0 Credit` (Free) (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let supplyWalletRequest = new theblockchainapi.SupplyWalletRequest(); // SupplyWalletRequest | 
apiInstance.deriveWalletIdentifier(blockchain, supplyWalletRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
supplyWalletRequest SupplyWalletRequest

Return type

WalletIdentifiers

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

generatePrivateKey

GeneralGeneratePrivateKeyResponse generatePrivateKey(blockchain)

Generate private key

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

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
apiInstance.generatePrivateKey(blockchain).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use

Return type

GeneralGeneratePrivateKeyResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

generateSeedPhrase

GeneralSecretPhrase generateSeedPhrase(blockchain, opts)

Generate seed phrase

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

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let opts = {
  'generateSeedPhraseRequest': new theblockchainapi.GenerateSeedPhraseRequest() // GenerateSeedPhraseRequest | 
};
apiInstance.generateSeedPhrase(blockchain, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
generateSeedPhraseRequest GenerateSeedPhraseRequest [optional]

Return type

GeneralSecretPhrase

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

getAirdrop

GeneralTransactionMadeResponse getAirdrop(blockchain, opts)

Get an airdrop

<a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/get-airdrop\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. - Ethereum: Receive an airdrop of 0.001 ETH on Ropsten (not real ETH). - Solana: 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 an NFT and then transfer it to another wallet. `Cost: 0 Credit` (Free) (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let opts = {
  'generalAirdropRequest': new theblockchainapi.GeneralAirdropRequest() // GeneralAirdropRequest | 
};
apiInstance.getAirdrop(blockchain, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
generalAirdropRequest GeneralAirdropRequest [optional]

Return type

GeneralTransactionMadeResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

getBalance

GeneralBalanceResponse getBalance(blockchain, opts)

Get wallet's balance of X

<a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/get-wallet-balance\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. See the balance of a wallet in the native blockchain currency (e.g., ETH, SOL) or any token (e.g., ERC-20, NFTs, SPL, etc.). To get the balance of a specific token, supply the `token_blockchain_identifier` of the token. You can also use this endpoint to see whether or not a person owns an NFT. Just supply the `token_blockchain_identifier` of the NFT. A balance of &quot;1&quot; means the person owns the NFT, and a balance of &quot;0&quot; means the person does not own the NFT. `Cost: 0.25 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let opts = {
  'generalBalanceRequest': new theblockchainapi.GeneralBalanceRequest() // GeneralBalanceRequest | 
};
apiInstance.getBalance(blockchain, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
generalBalanceRequest GeneralBalanceRequest [optional]

Return type

GeneralBalanceResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

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

transfer

GeneralTransactionResponse transfer(blockchain, opts)

Transfer crypto, a token, or an NFT to another wallet

<a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/transfer-crypto-token-or-nft\" target=&quot;_blank&quot;>See transfer ETH/SOL/crypto example (Python, JavaScript)</a>. <a href=&quot;https://github.com/BL0CK-X/blockchain-api/tree/main/examples/wallet/transfer-crypto-token-or-nft\" target=&quot;_blank&quot;>See transfer NFT/token example (Python, JavaScript)</a>. 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 - The native currency of the selected blockchain (e.g., SOL, ETH, BNB, etc.) - A token (e.g., an SPL token, ERC-20 token, etc.) - An NFT 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 or Metamask; no private keys required in this case). If you're transferring an NFT or a token, supply its respective `token_blockchain_identifier`. 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_blockchain_identifier`). If `return_compiled_transaction = true`, we compile the transaction (`sender_blockchain_identifier` is required in this case; do not provide `wallet`). RECIPIENT: `recipient_blockchain_identifier` 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 (if you want us to sign and submitting it). FEE_PAYER (Solana only): The fee payer of the transaction defaults to `wallet` (or `sender_blockchain_identifier`). To set a different fee payer, provide a value for `fee_payer_wallet`. `Cost: 2 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.WalletApi();
let blockchain = "blockchain_example"; // String | The blockchain you want to use 
let opts = {
  'generalTransferRequest': new theblockchainapi.GeneralTransferRequest() // GeneralTransferRequest | 
};
apiInstance.transfer(blockchain, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
blockchain String The blockchain you want to use
generalTransferRequest GeneralTransferRequest [optional]

Return type

GeneralTransactionResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

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