public static async Task <KristAddress[]> GetRichestAddresses(int limit = 50, int offset = 0) { var result = await KristUtils.GET <KAddressesResult>("addresses/rich?limit=" + limit.ToString() + "&offset=" + offset.ToString()); var addresses = new KristAddress[result.addresses.Length]; for (int i = 0; i < result.addresses.Length; i++) { addresses[i] = new KristAddress(result.addresses[i]); } return(addresses); }
public async Task <KristTransaction[]> GetRecentTransactions(int limit = 50, int offset = 0) { var result = await KristUtils.GET <KTransactionsResult>("addresses/" + Address + "/transactions?limit=" + limit.ToString() + "&offset=" + offset.ToString()); var transactions = new KristTransaction[result.transactions.Length]; for (int i = 0; i < result.transactions.Length; i++) { transactions[i] = new KristTransaction(result.transactions[i]); } return(transactions); }
public static async Task <KristBlock[]> GetLatestBlocks(int limit = 50, int offset = 0) { var result = await KristUtils.GET <KBlocksResult>("blocks/latest?limit=" + limit.ToString() + "&offset=" + offset.ToString()); var blocks = new KristBlock[result.blocks.Length]; for (int i = 0; i < blocks.Length; i++) { blocks[i] = new KristBlock(result.blocks[i]); } return(blocks); }
public static async Task <KristTransaction[]> GetLatestTransactions(int limit = 50, int offset = 0, bool excludemined = false) { var result = await KristUtils.GET <KTransactionsResult>("transactions/latest?limit=" + limit.ToString() + "&offset=" + offset.ToString() + (excludemined ? "&excludeMined" : "")); var transactions = new KristTransaction[result.transactions.Length]; for (int i = 0; i < transactions.Length; i++) { transactions[i] = new KristTransaction(result.transactions[i]); } return(transactions); }
public async Task <KristName[]> GetAllNames(int limit = 50, int offset = 0) { var result = await KristUtils.GET <KNamesResult>("addresses/" + Address + "/names?limit=" + limit.ToString() + "&offset=" + offset.ToString()); var names = new KristName[result.names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = new KristName(result.names[i]); } return(names); }
public async Task <bool> Authenticate() { if (PrivateKey == null) { throw new KristPrivateKeyMissingException(); } var table = new Dictionary <string, string>(); table["privatekey"] = PrivateKey; var result = await KristUtils.POST <KAuthenticateAddressResult>("login", table); return(result.authed); }
public async Task <KristName> RegisterName(string name) { if (PrivateKey == null) { throw new KristPrivateKeyMissingException(); } var table = new Dictionary <string, string>(); table["privatekey"] = PrivateKey; await KristUtils.POST <KResult>("names/" + name, table); return(await Krist.GetName(name)); }
public async Task <KristName> UpdateNameARecord(string name, string arecord) { if (PrivateKey == null) { throw new KristPrivateKeyMissingException(); } var table = new Dictionary <string, string>(); table["privatekey"] = PrivateKey; table["a"] = arecord; await KristUtils.POST <KResult>("names/" + name + "/transfer", table); return(await Krist.GetName(name)); }
public static async Task <KristBlock> SubmitBlock(long nonce) { var table = new Dictionary <string, string>() { ["nonce"] = nonce.ToString() }; var result = await KristUtils.POST <KBlockSubmitResult>("submit", table); if (result.success) { return(new KristBlock(result.block)); } return(null); }
public async Task <KristTransaction> MakeTransaction(string recipient, int amount, string metadata = null) { if (PrivateKey == null) { throw new KristPrivateKeyMissingException(); } Dictionary <string, string> table = new Dictionary <string, string>(); table["privatekey"] = PrivateKey; table["to"] = recipient; table["amount"] = amount.ToString(); if (metadata != null) { table["metadata"] = metadata; } KTransactionResult result = await KristUtils.POST <KTransactionResult>("transactions/", table); return(new KristTransaction(result.transaction)); }
public static KristAddress FromPassword(string password) { return(FromPrivateKey(KristUtils.GeneratePrivateKey(password))); }
// Name functions public static async Task <KristName> GetName(string name) { var result = await KristUtils.GET <KNameResult>("names/" + name); return(new KristName(result.name)); }
public static async Task <int> GetBlockReward() { var result = await KristUtils.GET <KBlockRewardResult>("blocks/value"); return(result.value); }
public static async Task <int[]> GetWorkPast24Hrs() { var result = await KristUtils.GET <KWork24HrResult>("work/day"); return(result.work); }
public static async Task <long> GetSupply() { var result = await KristUtils.GET <KMoneySupplyResult>("supply"); return(result.money_supply); }
public static async Task <KristMOTD> GetMOTD() { var result = await KristUtils.GET <KMOTDResult>("motd"); return(new KristMOTD(result)); }
public static async Task <int> GetWork() { var result = await KristUtils.GET <KWorkResult>("work"); return(result.work); }
public static async Task <int> GetLatestWalletVersion() { var result = await KristUtils.GET <KWalletVersionResult>("walletversion"); return(result.walletVersion); }
public static KristAddress FromPrivateKey(string privatekey) { string address = KristUtils.GenerateV2Address(privatekey); return(new KristAddress(address, privatekey)); }
public async Task Update() { var result = await KristUtils.GET <KAddressResult>("addresses/" + Address); Parse(result.address); }
public static async Task <KristBlock> GetLastBlock() { var result = await KristUtils.GET <KBlockResult>("blocks/last"); return(new KristBlock(result.block)); }
public static async Task <int> GetNameBonus() { var result = await KristUtils.GET <KNameCostResult>("names/bonus"); return(result.name_cost); }
public static async Task <KristBlock> GetBlock(int height) { var result = await KristUtils.GET <KBlockResult>("blocks/" + height.ToString()); return(new KristBlock(result.block)); }