Skip to content

CloudCoinConsortium/CloudCoin-Csharp-SDK

Repository files navigation

CloudCoin-Csharp-SDK

A .NET Framework class library written to provide quick access to methods that communicate with a server that has a CloudCoin Wallet with CloudBank enabled, in order to create applications that can use CloudCoins.

Usage

Create a BankKeys object that contains the keys to the CloudService server you wish to connect to, then create an instance of the class CloudBankUtils using that BankKeys. Call CloudBankUtils' methods to communicate with the CloudService.

An Example application that can be used to test this SDK can be found here: https://github.com/CloudCoinConsortium/CloudBankTester

Dependencies

Newtonsoft.Json is used to Deserialize http responses sent in json format.

CloudBankUtils Class

Constructors

CloudBankUtils(BankKeys startKeys) CloudBankUtils(BankKeys startKeys, HttpClient client)

BankKeys are an object that contain url, privatekey, and account Strings. The keys for your cloudbank are created and saved to a json format text file when you enable cloudbank on your cloudcoin wallet. If you decide not to provide a HttpClient for the CloudBankUtils to use, then the constructor will create an instance for itself.

Public Methods

async Task showCoins()

Calls the CloudBank's show_coins service for the server that this object holds the keys for. The results are saved in this class's public properties: onesInBank, fivesInBank, twentyfivesInBank, hundredsInBank, twohundredfiftiesInBank.

async Task echoFrombank()

Calls the echo service from the CloudBank server that this object holds the keys for. The response's message is sent to console.out

async Task printWelcomeFromBank()

Calls the print_welcome service from the CloudBank server that this object holds the keys for. The response's message is sent to console.out

void loadStackFromFile(string filepath)

Sets private field rawStackForDeposit to a CloudCoin stack read from a file found in parameter filepath This needs to be run before using some this classes other methods.

async Task sendStackToCloudBank(string memo = "Sent with C# SDK")

Sends the CloudCoin in private field rawStackForDeposit to the CloudBank server that this object holds the keys for An optional note or memo is sent as well loadStackFromFile needs to be called first

async Task sendStackToCloudBank(string toPublicURL, string memo = "Sent with C# SDK")

Sends the CloudCoin in private field rawStackForDeposit to the CloudBank server specified by toPublicUrl An optional note or memo is sent as well loadStackFromFile needs to be called first

async Task getReceipt()

Retrieve the receipt generated by the CloudBank for the last call that sends back a receipt id Requires sendStackToCloudBank, or one of the Skywallet functions to have been previously called The retrieved receipt will be saved in private field rawReceipt

async Task getStackFromCloudBank( int amountToWithdraw, string memo = "Sent to C# SDK")

Retrieves a CloudCoin stack file from the CloudBank server that this object holds the keys for. The resulting stack that is retrieved is saved in private field rawStackFromWithdrawal

async Task SendToSkywallet(int amountToSend, string skywalletDestination)

This this will make the CloudBank send CloudCoins from the local wallet saved in the CloudBank to a Skywallet Account.Specify the amount to be sent. The CloudBank will make change if necessary. The address of the skywallet you are sending coins to should be in [name].skywallet.cc format

async Task RecieveFromSkywallet()

Downloads all the coin in the Skywallet set in your CloudBank's settings to the CloudBank's local wallet. This is will return that the process has started but not the results.\

async Task TransferBetweenSkywallets(int amountToSend, string skywalletDestination)

Sends Coins from the skywallet set in your CloudBank's settings to another specified Skywallet

Interpretation interpretReceipt()

Parses pertinent information from the receipt last gathered by getReceipt and returns it in the form of an Interpretation object the only function that allows public access to receipt data

void saveStackToFile(string path)

Writes a CloudCoin stack file for the CloudCoin retrieved the last call of either getStackFromCloudBank or a skywallet function and saved in rawStackFromWithdrawal

About

CloudCoin CloudB Client Classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages