Skip to content
Permalink
Browse files

Address PR feedbacks

  • Loading branch information...
stringray55 committed May 8, 2019
1 parent de531f3 commit 2a522c0355ccdcd1f89ebce0e5e8ff508e124672
@@ -1,37 +1,103 @@
package org.web3j.crypto;

import java.util.HashMap;
import java.util.Vector;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.generated.Uint256;

public class StructuredData {
static class Entry {
public String name;
public String type;
private final String name;
private final String type;

@JsonCreator
public Entry(
@JsonProperty(value = "name") String name,
@JsonProperty(value = "type") String type) {
this.name = name;
this.type = type;
}

public Entry() {
public String getName() {
return name;
}

public String getType() {
return type;
}
}

static class EIP712Domain {
public String name;
public String version;
public Uint256 chainId;
public Address verifyingContract;
private final String name;
private final String version;
private final Uint256 chainId;
private final Address verifyingContract;

@JsonCreator
public EIP712Domain(
@JsonProperty(value = "name") String name,
@JsonProperty(value = "version") String version,
@JsonProperty(value = "chainId") Uint256 chainId,
@JsonProperty(value = "verifyingContract") Address verifyingContract) {
this.name = name;
this.version = version;
this.chainId = chainId;
this.verifyingContract = verifyingContract;
}

public String getName() {
return name;
}

public String getVersion() {
return version;
}

public EIP712Domain() {
public Uint256 getChainId() {
return chainId;
}

public Address getVerifyingContract() {
return verifyingContract;
}
}

static class EIP712Message {
public HashMap<String, Vector<Entry>> types;
public String primaryType;
public Object message;
public EIP712Domain domain;
private final HashMap<String, List<Entry>> types;
private final String primaryType;
private final Object message;
private final EIP712Domain domain;

@JsonCreator
public EIP712Message(
@JsonProperty(value = "types") HashMap<String, List<Entry>> types,
@JsonProperty(value = "primaryType") String primaryType,
@JsonProperty(value = "message") Object message,
@JsonProperty(value = "domain") EIP712Domain domain) {
this.types = types;
this.primaryType = primaryType;
this.message = message;
this.domain = domain;
}

public HashMap<String, List<Entry>> getTypes() {
return types;
}

public String getPrimaryType() {
return primaryType;
}

public Object getMessage() {
return message;
}

public EIP712Message() {
public EIP712Domain getDomain() {
return domain;
}

@Override

0 comments on commit 2a522c0

Please sign in to comment.
You can’t perform that action at this time.