Skip to content

BL0CK-X/theblockchainapi-csharp-wrapper

Repository files navigation

Org.OpenAPITools - the C# library for the The Blockchain API

About

Our vision is to make it super easy to interact with the decentralized web. We want you to be able to do this in any coding language and do it easily and quickly.

You're a key part of our vision. We love feature requests! <a href="#section/Feature-Requests">Make one!

How to Use the API

To use the API, you simply need to create an API key pair.

Doing so takes less than a minute. Simply go to <a target="_blank" href="https://dashboard.blockchainapi.com\">the dashboard, create an account, and generate a key pair. You can now use this pair to make API requests. You must create your first pair via the dashboard.

Feature Requests

Got a feature request? Submit it as an issue on <a target="_blank" href="https://github.com/BL0CK-X/the-blockchain-api/issues/new/choose\">our GitHub repo or email us.

Contact

Text / Call: +1 (415) 888 4745

Email us: [email protected]

Join our Discord

Follow us on Twitter

Star us on Github

Security

Common dogma is to never give out your seed phrase. We agree. It's a matter of security, and anyone who has your seed phrase can irreversibly empty your wallet.

When using an API endpoint that requires a seed phrase, we highly recommend that users use or create a wallet that they do not use as their primary wallet.

How you make this work depends on what you're doing. If you're minting an NFT for example, we recommend creating a new wallet and then transferring just enough SOL to that wallet to mint the NFT. This is possible on Solana because such transactions cost less than a penny. We will have more tutorials in the future that make it easier for you to be secure when using our API.

We have easy-to-use endpoints for <a href="#tag/Solana-Wallet/paths/1solana1wallet1secret_recovery_phrase/post">creating a new seed phrase and then <a href="#tag/Solana-Wallet/paths/1solana1wallet1public_key/post">deriving a public key to enable you to transfer to that new wallet.

Let's have a constructive dialog about this. Feel free to <a href="#section/Contact">contact us. I made a video discussing this matter <a target="_blank" href="https://youtu.be/m9unUb8Z9qU\">here.

Note: We have had a couple of individuals harrass and threaten us. These individuals did not try our API or speak to anyone who has used it. They simply saw that we require a seed phrase for certain endpoints and figured that the proper response was to attack us. (I explain why we do <a target="_blank" href="https://youtu.be/m9unUb8Z9qU\">here.) Such harrassment and threats are not only harmful, but they are also illegal, and we will report offenders. Do not harrass us. Rather, feel free to discuss your concerns with us and we will be more than happy to work with you to come up with a solution.

Pricing

Each user receives 50,000 free credits each month. Each endpoint costs a certain amount credits. Scroll below to any endpoint (i.e., function) to see how much each endpoint costs. (Or CMD+F Cost: 0 Credit, for example)

You can learn more about our pricing <a href="https://dashboard.blockchainapi.com/billing\" target="_blank">here.

We frequently do custom plans. If our pricing doesn't work for you, <a href="#section/Contact">contact us.

If you have questions, concerns, feedback, or ideas, <a href="#section/Contact">contact us.

SDKs / API Wrappers

We have examples using both our <a href="https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples\" target="_blank">Python wrapper and our JavaScript wrapper here.

We have built a custom <a href="https://github.com/BL0CK-X/the-blockchain-api-python-wrapper\" target="_blank">Python wrapper.

pip install theblockchainapi

We also have published a <a href="https://github.com/BL0CK-X/theblockchainapi-javascript-wrapper\" target="_blank">JavaScript Wrapper.

npm install theblockchainapi

We also have auto-generated wrappers for the following languages:

If you would like a different language as well, submit an issue <a href="https://github.com/BL0CK-X/theblockchainapi-wrappers/issues/new\" target="_blank">here.

If you run into any bugs with the wrappers, submit an issue <a href="https://github.com/BL0CK-X/theblockchainapi-wrappers/issues/new\" target="_blank">here.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: null
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

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

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration.Default.BasePath = "https://api.blockchainapi.com/v1";
            // Configure API key authorization: APIKeyID
            Configuration.Default.ApiKey.Add("APIKeyID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("APIKeyID", "Bearer");
            // Configure API key authorization: APISecretKey
            Configuration.Default.ApiKey.Add("APISecretKey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("APISecretKey", "Bearer");

            var apiInstance = new CCPaymentApi(Configuration.Default);
            var projectId = project_WDQskRIfHQxj53N5mk5K;  // string | The ID of the project. Created and returned when a project is created.
            var paymentIdentifier = ["payment_97jA1szpVjrSI5EvOb5zxNQFq5CfrC"];  // string | You can supply either `payment_id` or `payment_validation_code`.  The `payment_id` is only visible by you and uniquely identifies a payment.  The `payment_validation_code` is shown exclusively to the customer and the owner of the project. It can be used to redeem a payment. You can verify a payment by pulling the payment with the `payment_validation_code`.

            try
            {
                // Get a payment 
                CCPayment result = apiInstance.GetCCPayment(projectId, paymentIdentifier);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling CCPaymentApi.GetCCPayment: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
CCPaymentApi GetCCPayment GET /checkout/v1/project/{project_id}/payment/{payment_identifier} Get a payment
CCPaymentApi ListAllCCPayments GET /checkout/v1/payments List all payments
CCPaymentApi ListCCProjectPayments GET /checkout/v1/project/{project_id}/payments List a project's payments
CCProjectApi CreateCCProject POST /checkout/v1/project Create a project
CCProjectApi DeleteCCProject DELETE /checkout/v1/project/{project_id} Delete a project
CCProjectApi GetCCProject GET /checkout/v1/project/{project_id} Get a project
CCProjectApi ListCCProjects GET /checkout/v1/projects List projects
CCProjectApi UpdateCCProject PUT /checkout/v1/project/{project_id} Update a project
CCWebhookApi GetCCWebhook POST /webhook/v1/project/{project_id}/webhook/{webhook_identifier} Get a webhook
CCWebhookApi ListCCProjectWebhooks POST /webhook/v1/project/{project_id}/webhooks List project's webhooks
CCWebhookApi ValidateCCWebhook POST /webhook/v1/project/{project_id}/webhook/{webhook_identifier}/validate Validate a webhook
NameServiceApi GetBlockchainIdentifierFromName POST /{blockchain}/{network}/name_service/name_to_blockchain_identifier Get the identifier
NameServiceApi GetNameForBlockchainIdentifier POST /{blockchain}/{network}/name_service/blockchain_identifier_to_name Get the name
SolanaAccountApi SolanaGetAccount GET /solana/account/{network}/{public_key} Get the details of an account on Solana
SolanaAccountApi SolanaGetAccountIsCandyMachine GET /solana/account/{network}/{public_key}/is_candy_machine Get if account is candy machine
SolanaAccountApi SolanaGetAccountIsNFT GET /solana/account/{network}/{public_key}/is_nft Get if account is NFT
SolanaCandyMachineApi SolanaGetAllNFTsFromCandyMachine GET /solana/nft/candy_machine/{network}/{candy_machine_id}/nfts Get CM's NFTs
SolanaCandyMachineApi SolanaGetCandyMachineMetadata POST /solana/nft/candy_machine/metadata Get a CM's metadata
SolanaCandyMachineApi SolanaListAllCandyMachines GET /solana/nft/candy_machine/list List all CMs
SolanaCandyMachineApi SolanaSearchCandyMachines POST /solana/nft/candy_machine/search Search CMs
SolanaNFTApi SolanaCreateNFT POST /solana/nft Create an NFT on Solana
SolanaNFTApi SolanaGetNFT GET /solana/nft/{network}/{mint_address} Get an NFT's metadata
SolanaNFTApi SolanaGetNFTMintFee GET /solana/nft/mint/fee Get the NFT mint fee
SolanaNFTApi SolanaGetNFTOwner GET /solana/nft/{network}/{mint_address}/owner Get owner of an NFT
SolanaNFTApi SolanaGetNFTOwnerAdvanced GET /solana/nft/{network}/{mint_address}/owner_advanced Get owner of an NFT (advanced)
SolanaNFTApi SolanaGetNFTsCandyMachineId POST /solana/nft/candy_machine_id Get the ID of the candy machine of an NFT
SolanaNFTApi SolanaSearchNFTs POST /solana/nft/search Search NFTs on Solana
SolanaSPLTokenApi SolanaGetSPLToken GET /solana/spl-token/{network}/{public_key} Get SPL token metadata
SolanaTransactionApi SolanaGetTransaction GET /solana/transaction/{network}/{tx_signature} Get the details of a transaction made on Solana
SolanaWalletApi SolanaDeriveAssociatedTokenAccountAddress GET /solana/wallet/{public_key}/associated_token_account/{mint_address} Derive an associated token account address
SolanaWalletApi SolanaDerivePrivateKey POST /solana/wallet/private_key Derive private key
SolanaWalletApi SolanaDerivePublicKey POST /solana/wallet/public_key Derive public key
SolanaWalletApi SolanaGeneratePrivateKey POST /solana/wallet/generate/private_key Generate private key
SolanaWalletApi SolanaGenerateSecretRecoveryPhrase POST /solana/wallet/generate/secret_recovery_phrase Generate secret phrase
SolanaWalletApi SolanaGetAirdrop POST /solana/wallet/airdrop Get an airdrop on devnet
SolanaWalletApi SolanaGetBalance POST /solana/wallet/balance Get wallet's balance in SOL or any SPL
SolanaWalletApi SolanaGetNFTsBelongingToWallet GET /solana/wallet/{network}/{public_key}/nfts Get address's NFTs
SolanaWalletApi SolanaGetTokensBelongingToWallet GET /solana/wallet/{network}/{public_key}/tokens Get address's tokens and respective balances
SolanaWalletApi SolanaGetWalletTransactions GET /solana/wallet/{network}/{public_key}/transactions Get address's associated transaction signatures
SolanaWalletApi SolanaTransfer POST /solana/wallet/transfer Transfer SOL, a token, or an NFT to another address
TokenApi GetTokenMetadata GET /{blockchain}/{network}/token/{token_blockchain_identifier} Get a token's metadata
TokenApi ListAllTokens GET /{blockchain}/{network}/all_tokens List all tokens
TransactionApi GetTransaction GET /{blockchain}/transaction/{network}/{transaction_blockchain_identifier} Get the details of a transaction made on a blockchain
WalletApi DerivePrivateKey POST /{blockchain}/wallet/private_key Derive private key
WalletApi DeriveWalletIdentifier POST /{blockchain}/wallet/identifier Derive wallet identifier
WalletApi GeneratePrivateKey POST /{blockchain}/wallet/generate/private_key Generate private key
WalletApi GenerateSeedPhrase POST /{blockchain}/wallet/generate/secret_recovery_phrase Generate seed phrase
WalletApi GetAirdrop POST /{blockchain}/wallet/airdrop Get an airdrop
WalletApi GetBalance POST /{blockchain}/wallet/balance Get wallet's balance of X
WalletApi Transfer POST /{blockchain}/wallet/transfer Transfer crypto, a token, or an NFT to another wallet

Documentation for Models

Documentation for Authorization

APIKeyID

  • Type: API key

  • API key parameter name: APIKeyID

  • Location: HTTP header

APISecretKey

  • Type: API key

  • API key parameter name: APISecretKey

  • Location: HTTP header

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages