Exemplo n.º 1
0
 public static InProgress <S> Ask <T, S>(this OracleClient <T, S> oracle, 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) => oracle.AskAsync(query, fee, queryTtlType, queryTtl, responseRelativeTtl).RunAndUnwrap();
Exemplo n.º 2
0
        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>()));
        }
Exemplo n.º 3
0
 public OracleRegisterTransaction CreateOracleRegisterTransaction(string queryFormat, string responseFormat, string accountId, BigInteger queryFee, BigInteger fee, TTLType oracleTtlType, ulong oraclTtl, ushort abiVersion, ulong nonce, ulong ttl)
 {
     return(new OracleRegisterTransaction(_factory, this)
     {
         Model = new OracleRegisterTx
         {
             AccountId = accountId,
             QueryFee = fee,
             Fee = fee,
             AbiVersion = abiVersion,
             OracleTtl = new TTL {
                 Type = oracleTtlType, Value = oraclTtl
             },
             Nonce = nonce,
             QueryFormat = queryFormat,
             ResponseFormat = responseFormat,
             Ttl = ttl,
         },
         FeeModel = new OracleFee(oraclTtl)
     });
 }
Exemplo n.º 4
0
 public OracleQueryTransaction CreateOracleQueryTransaction(string query, string accountId, string oracleid, BigInteger queryFee, BigInteger fee, TTLType queryTtlType, ulong queryTtl, ulong responseRelativeTtl, ulong nonce, ulong ttl)
 {
     return(new OracleQueryTransaction(_factory, this)
     {
         Model = new OracleQueryTx
         {
             Query = query,
             SenderId = accountId,
             OracleId = oracleid,
             QueryFee = queryFee,
             Fee = fee,
             QueryTtl = new TTL {
                 Type = queryTtlType, Value = queryTtl
             },
             ResponseTtl = new RelativeTTL {
                 Type = RelativeTTLType.Delta, Value = responseRelativeTtl
             },
             Nonce = nonce,
             Ttl = ttl,
         },
         FeeModel = new OracleFee(queryTtl)
     });
 }
Exemplo n.º 5
0
 public Ttl(TTLType type, ulong value)
 {
     Type  = type;
     Value = value;
 }