public async Task Should_Send_Asset_via_Phone() { //fishing permit on mainnet const String ASSET_ID = "LaAXAraoJfPYRovBtR4DctaLsxiHEcAuBwMWGb"; using (Client client = new Client(HOST)) { var request = new Colu.Models.SendAsset.Request() { Id = Guid.NewGuid().ToString() }; request.param.From.Add("1DNjKtYCjrJJgQCkzYqSfrcd8ahzBZXPzR"); request.param.To.Add(new Colu.Models.To() { PhoneNumber = "61407928417", Amount = 1, AssetId = ASSET_ID }); var actual = await client.SendAssetAsync(request); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Result); Assert.IsNotNull(actual.Result.TxId); } }
public async Task Should_Raise_Key_Not_Found_Error() { const String TESTNET_ASSET_ID = "La7xWL4k6mr5h5Yi8p3YmN3oxaKPn7x8Ub3YUG"; const String TESTNET_ADDRESS = "mwcDHAuNMDkXhANEByVfJmKKTZ4G6V3tvh"; using (Client client = new Client(HOST, USERNAME, PASSWORD)) { var request = new Colu.Models.SendAsset.Request() { Id = Guid.NewGuid().ToString() }; request.param.From.Add(TESTNET_ADDRESS); request.param.To.Add(new Colu.Models.To() { Address = "mkK8GmN4q5TnPEZkJmY6LVa5i5kimxwNXB", Amount = 1, AssetId = TESTNET_ASSET_ID }); var actual = await client.SendAssetAsync(request); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Error); Assert.AreEqual("Address mwcDHAuNMDkXhANEByVfJmKKTZ4G6V3tvh privateKey not found.", actual.Error.Data); } }
public async Task Should_Send_Asset() { const String TESTNET_ASSET_ID = "La7xWL4k6mr5h5Yi8p3YmN3oxaKPn7x8Ub3YUG"; const String TESTNET_ADDRESS = "mftCzxjSGWRRXh5QDKaTpsCXWmGNEtHX3S"; using (Client client = new Client(HOST, USERNAME, PASSWORD)) { var request = new Colu.Models.SendAsset.Request() { Id = Guid.NewGuid().ToString() }; request.param.From.Add(TESTNET_ADDRESS); request.param.To.Add(new Colu.Models.To() { Address = "mkK8GmN4q5TnPEZkJmY6LVa5i5kimxwNXB", Amount = 1, AssetId = TESTNET_ASSET_ID }); var actual = await client.SendAssetAsync(request); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Result); Assert.IsNotNull(actual.Result.TxId); } }
static void Main(string[] args) { //const String HOST = "http://colunode.cloudapp.net"; const String HOST = "http://60.226.74.183:8081"; // "http://192.168.0.9:8081"; const String USERNAME = "******"; const String PASSWORD = "******"; const String VOUCHER_PUBLIC_KEY_HASH = "mqrRa9ETyDpS6jS91i6hEs6TsXhAwATzws"; const String VOUCHER_ASSET_ID = "Ua84c979MsqkHrfrN5ojy6meXNmzyij6XFoocH"; const String TEST_USER_ID = "mrtFz4tKAXSjBiN7mikE2CUWTerfR3cgMh"; using (IAddressClient addressClient = new Client(HOST)) { String id = Guid.NewGuid().ToString(); //var response = addressClient.GetAddressAsync(id).Result; //String address = response.Result; using (Client client = new Client(HOST)) { var nm = client.GetMnemonicAsync().Result; Colu.Models.SendAsset.Request request = new Colu.Models.SendAsset.Request() { Id = Guid.NewGuid().ToString() }; request.param.From.Add(TEST_USER_ID); request.param.To.Add(new Colu.Models.To() { Address = "n2T5RDM4kPLfd4mThzArHtdK9KN8mcDgxu", Amount = 1, AssetId = VOUCHER_ASSET_ID }); try { var sendResponse = client.SendAssetAsync(request).Result; //Models.RedeemResponseViewModel viewModel = new Models.RedeemResponseViewModel() //{ // TxId = response.Result.TxId //}; //return View(viewModel); } catch (Exception ex) { //ViewBag.Error = ex.Message; } //var request = new Colu.Models.IssueAsset.Request() //{ // Id = Guid.NewGuid().ToString() //}; //request.Param.Amount = 1000; //request.Param.Divisibility = 0; //request.Param.Reissueable = true; //request.Param.IssueAddress = address; //var actual = client.IssueAsync(request).Result; } } }