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)); }