当前位置: 首页>>代码示例>>Java>>正文


Java DefaultBlockParameter类代码示例

本文整理汇总了Java中org.web3j.protocol.core.DefaultBlockParameter的典型用法代码示例。如果您正苦于以下问题:Java DefaultBlockParameter类的具体用法?Java DefaultBlockParameter怎么用?Java DefaultBlockParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultBlockParameter类属于org.web3j.protocol.core包,在下文中一共展示了DefaultBlockParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mintedEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<MintedEventResponse> mintedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Minted", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, MintedEventResponse>() {
        @Override
        public MintedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            MintedEventResponse typedResponse = new MintedEventResponse();
            typedResponse._addr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.tokens = (Uint256) eventValues.getNonIndexedValues().get(1);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:18,代码来源:ModumToken.java

示例2: transferEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse._from = (Address) eventValues.getIndexedValues().get(0);
            typedResponse._to = (Address) eventValues.getIndexedValues().get(1);
            typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例3: approvalEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Approval", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
        @Override
        public ApprovalEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ApprovalEventResponse typedResponse = new ApprovalEventResponse();
            typedResponse.owner = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.spender = (Address) eventValues.getIndexedValues().get(1);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例4: votedEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<VotedEventResponse> votedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Voted", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Bool>() {}, new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, VotedEventResponse>() {
        @Override
        public VotedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            VotedEventResponse typedResponse = new VotedEventResponse();
            typedResponse._addr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.option = (Bool) eventValues.getNonIndexedValues().get(1);
            typedResponse.votes = (Uint256) eventValues.getNonIndexedValues().get(2);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例5: payoutEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<PayoutEventResponse> payoutEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Payout", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, PayoutEventResponse>() {
        @Override
        public PayoutEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            PayoutEventResponse typedResponse = new PayoutEventResponse();
            typedResponse.weiPerToken = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:17,代码来源:ModumToken.java

示例6: approvalEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Approval", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
        @Override
        public ApprovalEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ApprovalEventResponse typedResponse = new ApprovalEventResponse();
            typedResponse._owner = (Address) eventValues.getIndexedValues().get(0);
            typedResponse._spender = (Address) eventValues.getIndexedValues().get(1);
            typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例7: newMessageEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<NewMessageEventResponse> newMessageEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NewMessage", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Utf8String>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NewMessageEventResponse>() {
        @Override
        public NewMessageEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NewMessageEventResponse typedResponse = new NewMessageEventResponse();
            typedResponse.from = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.message = (Utf8String) eventValues.getNonIndexedValues().get(1);
            return typedResponse;
        }
    });
}
 
开发者ID:CDCgov,项目名称:blockchain-collab,代码行数:18,代码来源:Echo_sol_Echo.java

示例8: findBlockByTimestamp

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
private long findBlockByTimestamp(long timestamp, long offset) throws IOException {
    long startBlock = 1L;
    long currentBlock = web3j.ethBlockNumber().send().getBlockNumber().longValue();

    if (currentBlock <= 1) {
        return currentBlock;
    }

    long low = startBlock;
    long high = currentBlock;
    long middle = low + (high - low) / 2;

    while(low <= high) {
        middle = low + (high - low) / 2;
        long ts = web3j.ethGetBlockByNumber(DefaultBlockParameter.valueOf(BigInteger.valueOf(middle)), false).send().getBlock().getTimestamp().longValue();

        if (ts < timestamp) {
            low = middle + 1;
        } else if (ts > timestamp) {
            high = middle - 1;
        } else {
            return middle;
        }
    }
    return middle + offset;
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:27,代码来源:EthereumMetadata.java

示例9: transferEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:quorum,代码行数:19,代码来源:HumanStandardToken.java

示例10: transferEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse.from = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.to = (Address) eventValues.getIndexedValues().get(1);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例11: issuanceEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<IssuanceEventResponse> issuanceEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Issuance", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, IssuanceEventResponse>() {
        @Override
        public IssuanceEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            IssuanceEventResponse typedResponse = new IssuanceEventResponse();
            typedResponse.to = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:18,代码来源:HumaniqToken.java

示例12: transferEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse.log = log;
            typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:web3j,代码行数:20,代码来源:HumanStandardToken.java

示例13: approvalEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Approval", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
        @Override
        public ApprovalEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ApprovalEventResponse typedResponse = new ApprovalEventResponse();
            typedResponse.log = log;
            typedResponse._owner = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse._spender = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:web3j,代码行数:20,代码来源:HumanStandardToken.java

示例14: notifyEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<NotifyEventResponse> notifyEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Notify", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NotifyEventResponse>() {
        @Override
        public NotifyEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NotifyEventResponse typedResponse = new NotifyEventResponse();
            typedResponse.log = log;
            typedResponse.input = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.result = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:web3j,代码行数:19,代码来源:Fibonacci.java

示例15: transferEventObservable

import org.web3j.protocol.core.DefaultBlockParameter; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:web3j,代码行数:19,代码来源:MetaCoin.java


注:本文中的org.web3j.protocol.core.DefaultBlockParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。