-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathERC721Token.java
More file actions
56 lines (46 loc) · 1.41 KB
/
Copy pathERC721Token.java
File metadata and controls
56 lines (46 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.alphawallet.ethereum;
import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.DynamicArray;
import org.web3j.abi.datatypes.DynamicBytes;
import org.web3j.abi.datatypes.Type;
import org.web3j.abi.datatypes.generated.Uint256;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
public class ERC721Token extends DynamicArray
{
public Address address;
public Uint256 tokenId;
public DynamicBytes auth;
public ERC721Token(Address address, Uint256 tokenId, DynamicBytes bytes)
{
super(address, tokenId, bytes);
this.address = address;
this.tokenId = tokenId;
this.auth = bytes;
}
public ERC721Token(String address, String tokenId, byte[] bytes)
{
super(new Address(address), new Uint256(new BigInteger(tokenId)), new DynamicBytes(bytes));
this.address = new Address(address);
this.tokenId = new Uint256(new BigInteger(tokenId));
this.auth = new DynamicBytes(bytes);
}
@Override
public List<Type> getValue()
{
List<Type> tList = new ArrayList<>();
tList.add(address);
tList.add(tokenId);
return tList;
}
@Override
public String toString()
{
return "Token: " + address.toString() + " ID: " + tokenId.getValue().toString();
}
@Override
public String getTypeAsString() {
return "ERC721Token";
}
}