org.web3j.utils.Numeric.decodeQuantity()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.web3j.utils.Numeric.decodeQuantity()方法的一些代码示例,展示了Numeric.decodeQuantity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Numeric.decodeQuantity()方法的具体详情如下:
包路径:org.web3j.utils.Numeric
类名称:Numeric
方法名:decodeQuantity

Numeric.decodeQuantity介绍

暂无

代码示例

代码示例来源:origin: web3j/web3j

  1. private BigInteger convert(String value) {
  2. if (value != null) {
  3. return Numeric.decodeQuantity(value);
  4. } else {
  5. return null;
  6. }
  7. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getSent() {
  2. return Numeric.decodeQuantity(sent);
  3. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getBlockNumber() {
  2. return Numeric.decodeQuantity(blockNumber);
  3. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getGasUsed() {
  2. return Numeric.decodeQuantity(gasUsed);
  3. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getGasUsed() {
  2. return Numeric.decodeQuantity(gasUsed);
  3. }

代码示例来源:origin: web3j/web3j

  1. public boolean isStatusOK() {
  2. if (null == status) {
  3. return true;
  4. }
  5. BigInteger statusQuantity = Numeric.decodeQuantity(status);
  6. return BigInteger.ONE.equals(statusQuantity);
  7. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getTransactionCount() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getTransactionCount() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getQuantity() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getUncleCount() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getGasPrice() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getUncleCount() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getAmountUsed() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getFilterId() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getBlockNumber() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. public BigInteger getFilterId() {
  2. return Numeric.decodeQuantity(getResult());
  3. }
  4. }

代码示例来源:origin: web3j/web3j

  1. @Test
  2. public void testQuantityDecode() {
  3. assertThat(Numeric.decodeQuantity("0x0"), equalTo(BigInteger.valueOf(0L)));
  4. assertThat(Numeric.decodeQuantity("0x400"), equalTo(BigInteger.valueOf((1024L))));
  5. assertThat(Numeric.decodeQuantity("0x0"), equalTo(BigInteger.valueOf((0L))));
  6. assertThat(Numeric.decodeQuantity(
  7. "0x7fffffffffffffff"), equalTo(BigInteger.valueOf((Long.MAX_VALUE))));
  8. assertThat(Numeric.decodeQuantity("0x99dc848b94efc27edfad28def049810f"),
  9. equalTo(new BigInteger("204516877000845695339750056077105398031")));
  10. }

代码示例来源:origin: web3j/web3j

  1. @Test
  2. public void testQuantityDecodeLeadingZero() {
  3. assertThat(Numeric.decodeQuantity("0x0400"), equalTo(BigInteger.valueOf(1024L)));
  4. assertThat(Numeric.decodeQuantity("0x001"), equalTo(BigInteger.valueOf(1L)));
  5. }

代码示例来源:origin: web3j/web3j

  1. @Test(expected = MessageDecodingException.class)
  2. public void testQuantityDecodeMissingPrefix() {
  3. Numeric.decodeQuantity("ff");
  4. }

代码示例来源:origin: web3j/web3j

  1. @Ignore
  2. @Test(expected = MessageDecodingException.class)
  3. public void testQuantityDecodeLeadingZeroException() {
  4. Numeric.decodeQuantity("0x0400");
  5. }

相关文章