コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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);
        }
コード例 #6
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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);
        }
コード例 #7
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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));
        }
コード例 #8
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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));
        }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        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));
        }
コード例 #11
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
 public static KristAddress FromPassword(string password)
 {
     return(FromPrivateKey(KristUtils.GeneratePrivateKey(password)));
 }
コード例 #12
0
        // Name functions

        public static async Task <KristName> GetName(string name)
        {
            var result = await KristUtils.GET <KNameResult>("names/" + name);

            return(new KristName(result.name));
        }
コード例 #13
0
        public static async Task <int> GetBlockReward()
        {
            var result = await KristUtils.GET <KBlockRewardResult>("blocks/value");

            return(result.value);
        }
コード例 #14
0
        public static async Task <int[]> GetWorkPast24Hrs()
        {
            var result = await KristUtils.GET <KWork24HrResult>("work/day");

            return(result.work);
        }
コード例 #15
0
        public static async Task <long> GetSupply()
        {
            var result = await KristUtils.GET <KMoneySupplyResult>("supply");

            return(result.money_supply);
        }
コード例 #16
0
        public static async Task <KristMOTD> GetMOTD()
        {
            var result = await KristUtils.GET <KMOTDResult>("motd");

            return(new KristMOTD(result));
        }
コード例 #17
0
        public static async Task <int> GetWork()
        {
            var result = await KristUtils.GET <KWorkResult>("work");

            return(result.work);
        }
コード例 #18
0
        public static async Task <int> GetLatestWalletVersion()
        {
            var result = await KristUtils.GET <KWalletVersionResult>("walletversion");

            return(result.walletVersion);
        }
コード例 #19
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        public static KristAddress FromPrivateKey(string privatekey)
        {
            string address = KristUtils.GenerateV2Address(privatekey);

            return(new KristAddress(address, privatekey));
        }
コード例 #20
0
ファイル: KristAddress.cs プロジェクト: Jorch72/CS-KristSharp
        public async Task Update()
        {
            var result = await KristUtils.GET <KAddressResult>("addresses/" + Address);

            Parse(result.address);
        }
コード例 #21
0
        public static async Task <KristBlock> GetLastBlock()
        {
            var result = await KristUtils.GET <KBlockResult>("blocks/last");

            return(new KristBlock(result.block));
        }
コード例 #22
0
        public static async Task <int> GetNameBonus()
        {
            var result = await KristUtils.GET <KNameCostResult>("names/bonus");

            return(result.name_cost);
        }
コード例 #23
0
        public static async Task <KristBlock> GetBlock(int height)
        {
            var result = await KristUtils.GET <KBlockResult>("blocks/" + height.ToString());

            return(new KristBlock(result.block));
        }