- Notifications
You must be signed in to change notification settings - Fork1
Client for Hathor Wallet API
License
michielpost/Hathor.Client
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
C# / .NET Client forHathor Wallet API
Install the latest version fromNuGet
NuGet package name:Hathor
Make sure you have access to theHathor Headless Wallet API. You can use thehathornetwork/hathor-wallet-headless docker image.
Start docker image:
dockerpullhathornetwork/hathor-wallet-headlessdockerrun-p8000:8000hathornetwork/hathor-wallet-headless--seed_default"YOUR24SEEDWORDS"#Example,donotuse:dockerrun-p8000:8000hathornetwork/hathor-wallet-headless--seed_default"workaboveeconomycaptainadvancebreadlogicpaddlecopperchangemazetonguesalonsadnesscannonfishdebrisneedmakepurposeusageworthvaultshrug"#Examplefortestnet,donotuse:dockerrun-p8000:8000hathornetwork/hathor-wallet-headless--network"testnet"--server"https://node1.testnet.hathor.network/v1a/"--seed_default"workaboveeconomycaptainadvancebreadlogicpaddlecopperchangemazetonguesalonsadnesscannonfishdebrisneedmakepurposeusageworthvaultshrug"#ExamplewithAPIkey,donotuse:dockerrun-p8000:8000hathornetwork/hathor-wallet-headless--api_key"MYSECRETKEY"--seed_default"workaboveeconomycaptainadvancebreadlogicpaddlecopperchangemazetonguesalonsadnesscannonfishdebrisneedmakepurposeusageworthvaultshrug"
The Hathor Headless Wallet API is now available onhttp://localhost:8000
There are two sample apps in this repository.
First, install Microsoft .Net 7 SDK fromhttps://dot.net, then run the following commands:
dotnetrestoredotnetbuild
Start the includedHathor.Client.Sample.ConsoleApp
sample app to get a quick demo of what's possible with this library.
dotnetrun--projectHathor.Client.Sample.ConsoleApp
Start the includedHathor.Client.Sample.WebApp
sample website get a visual look at the data.
dotnetrun--projectHathor.Client.Sample.WebApp
Create a new Hathor Client
stringwalletId="my-wallet";IHathorWalletApiclient=HathorClient.GetWalletClient("http://localhost:8000",walletId,"optional-api-key");
Start the wallet
//"default" refers to the seed key you used when starting the docker imagevarreq=newStartRequest(walletId,"default");varresponse=awaitclient.Start(req);
When the wallet is started, you can view transaction history, create new transactions etc
//Get balancevarbalance=awaitclient.GetBalance();//Tx historyvartxHistory=awaitclient.GetTxHistory();//Create a transactionvartransaction=newSendTransactionSimpleRequest("ADDRESS",1);varresponse=awaitclient.SendTransaction(transaction);
Check the sample apps and unit tests for more example usage.
Stop the wallet:
varresponse=awaitclient.Stop();
View theMULTISIG.md documentation to use the Multi Sig APIs from the Headless Wallet.
View theATOMICSWAP.md documentation to use the Atomic Swap APIs from the Headless Wallet.
There is partial support to use theHathor full node API
IHathorNodeApinodeClient=HathorClient.GetNodeClient("https://node2.mainnet.hathor.network/v1a/");//Get node version infovarversionInfo=awaitnodeClient.GetVersion();//Get balance of an addressvarbalanceInfo=awaitnodeClient.GetBalanceForAddress("ANY HATHOR ADDRESS")
Development has been made possible with a grant fromHathor.
https://docs.hathor.network/references/headless-wallet/http-api/