Пример #1
0
        public InProgress <OracleServer <T, S> > CreateOracleQueryProgressFromTx <T, S>(string txhash)
        {
            OracleServer <T, S> c = new OracleServer <T, S>(this);

            c.TxHash = txhash;
            return(new InProgress <OracleServer <T, S> >(new WaitForHash(c)));
        }
Пример #2
0
        public async Task <InProgress <OracleServer <T, S> > > RegisterOracleAsync <T, S>(ulong queryFee = Constants.BaseConstants.ORACLE_QUERY_FEE, ulong fee = Constants.BaseConstants.FEE, Ttl ttl = default(Ttl), ushort abiVersion = Constants.BaseConstants.ORACLE_VM_VERSION, CancellationToken token = default(CancellationToken))
        {
            ValidatePrivateKey();
            string queryformat    = SophiaMapper.ClassToOracleFormat <T>();
            string responseformat = SophiaMapper.ClassToOracleFormat <S>();
            OracleServer <T, S> c = new OracleServer <T, S>(this);

            Nonce++;
            await c.SignAndSendAsync(Client.CreateOracleRegisterTransaction(queryformat, responseformat, KeyPair.PublicKey, queryFee, fee, ttl?.Type ?? TTLType.Delta, ttl?.Value ?? Constants.BaseConstants.ORACLE_TTL_VALUE, abiVersion, Nonce, Ttl), token).ConfigureAwait(false);

            return(new InProgress <OracleServer <T, S> >(new WaitForHash(c), new GetOracle <T, S>()));
        }
Пример #3
0
        public async Task <OracleServer <T, S> > GetOwnOracleAsync <T, S>(CancellationToken token = default(CancellationToken))
        {
            ValidatePrivateKey();
            OracleServer <T, S> c      = new OracleServer <T, S>(this);
            RegisteredOracle    oracle = await Client.GetRegisteredOracleAsync(c.OracleId, token).ConfigureAwait(false);

            c.AbiVersion     = oracle.AbiVersion;
            c.QueryFee       = oracle.QueryFee;
            c.QueryFormat    = oracle.QueryFormat;
            c.ResponseFormat = oracle.ResponseFormat;
            c.Ttl            = oracle.Ttl;
            return(c);
        }