public async Task <InProgress <bool> > ExtendAsync(ulong fee = Constants.BaseConstants.FEE, ulong extendTtl = Constants.BaseConstants.ORACLE_RESPONSE_TTL_VALUE, CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); Account.Nonce++; await SignAndSendAsync(Account.Client.CreateOracleExtendTransaction(OracleId, extendTtl, fee, Account.Nonce, Account.Ttl), token).ConfigureAwait(false); return(new InProgress <bool>(new WaitForHash(this))); }
public async Task <InProgress <S> > AskAsync(T query, ulong fee = Constants.BaseConstants.ORACLE_QUERY_FEE, TTLType queryTtlType = TTLType.Delta, ulong queryTtl = Constants.BaseConstants.ORACLE_QUERY_TTL_VALUE, ulong responseRelativeTtl = Constants.BaseConstants.ORACLE_RESPONSE_TTL_VALUE, CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); Account.Nonce++; await SignAndSendAsync(Account.Client.CreateOracleQueryTransaction(SophiaMapper.SerializeOracleClass(query), Account.KeyPair.PublicKey, Id, QueryFee, fee, queryTtlType, queryTtl, responseRelativeTtl, Account.Nonce, Account.Ttl), token).ConfigureAwait(false); QueryId = Encoding.EncodeQueryId(Account.KeyPair.PublicKey, Id, Account.Nonce); return(new InProgress <S>(new WaitForHash(this), new WaitForQueryId <T, S>())); }
public async Task <InProgress <Claim> > ClaimDomainAsync(CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); Account.Nonce++; Claim cl = new Claim(Domain, Account); await cl.SignAndSendAsync(Account.Client.CreateNameClaimTransaction(Account.KeyPair.PublicKey, Domain, Salt, Account.Nonce, Account.Ttl), token).ConfigureAwait(false); return(new InProgress <Claim>(new WaitForHash(cl), new GetNameClaim())); }
public async Task <InProgress <bool> > RespondAsync(S answer, ulong respondTtl = Constants.BaseConstants.ORACLE_RESPONSE_TTL_VALUE, CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); Account.Nonce++; string response = SophiaMapper.SerializeOracleClass(answer); await SignAndSendAsync(Account.Client.CreateOracleRespondTransaction(response, OracleId, Id, respondTtl, Fee, Account.Nonce, Account.Ttl), token).ConfigureAwait(false); return(new InProgress <bool>(new WaitForHash(this))); }
public async Task <List <OracleQuestion <T, S> > > QueryAsync(ushort?limit, string lastQueryId = null, CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); OracleQueries queries = await Account.Client.GetOracleQueriesAsync(OracleId, lastQueryId, limit, Type.Open, token).ConfigureAwait(false); if (queries.OracleQueriesCollection == null || queries.OracleQueriesCollection.Count == 0) { return(new List <OracleQuestion <T, S> >()); } return(queries.OracleQueriesCollection.Select(a => new OracleQuestion <T, S>(Account, a)).ToList()); }
public async Task <InProgress <Claim> > ClaimDomainAsync(ulong bid_fee = Constants.BaseConstants.NAME_FEE, ulong fee = Constants.BaseConstants.FEE, ulong name_ttl = 0, CancellationToken token = default(CancellationToken)) { Account.ValidatePrivateKey(); Account.Nonce++; Claim cl = new Claim(Domain, Account); if (bid_fee == Constants.BaseConstants.NAME_FEE) { bid_fee = (ulong)NameServiceBiding.GetDefaultBidFee(Domain); } //NameClaimTransaction t = Account.Client.CreateNameClaimTransaction(Account.KeyPair.PublicKey, Domain, Salt, bid_fee, fee, name_ttl); //UnsignedTx tx=t.CreateUnsignedTransaction(false,Account.Client.Configuration.MinimalGasPrice); //UnsignedTx tr2 = t.CreateUnsignedTransaction(true, Account.Client.Configuration.MinimalGasPrice); await cl.SignAndSendAsync(Account.Client.CreateNameClaimTransaction(Account.KeyPair.PublicKey, Domain, Salt, bid_fee, fee, Account.Nonce, name_ttl), token).ConfigureAwait(false); return(new InProgress <Claim>(new WaitForHash(cl))); }