Skip to content

Commit ceba5a0

Browse files
authored
Merge pull request #16 from coinbase-samples/jc-a-dev
update to new asset structure
2 parents 155c91e + f427fd6 commit ceba5a0

File tree

4 files changed

+239
-1
lines changed

4 files changed

+239
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<description>Sample Java SDK for the Coinbase Prime REST APIs</description>
2222
<groupId>com.coinbase.prime</groupId>
2323
<url>https://github.com/coinbase-samples/prime-sdk-java</url>
24-
<version>1.2.0</version>
24+
<version>1.2.1</version>
2525
<licenses>
2626
<license>
2727
<name>Apache License, Version 2.0</name>

src/main/java/com/coinbase/prime/model/assets/Asset.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.coinbase.prime.model.assets;
1818

1919
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import java.util.List;
2021

2122
public class Asset {
2223
private String name;
@@ -27,6 +28,7 @@ public class Asset {
2728
private boolean tradingSupported;
2829
@JsonProperty("explorer_url")
2930
private String explorerUrl;
31+
private List<Network> networks;
3032

3133
public Asset() {}
3234

@@ -36,6 +38,7 @@ public Asset(Builder builder) {
3638
this.decimalPrecision = builder.decimalPrecision;
3739
this.tradingSupported = builder.tradingSupported;
3840
this.explorerUrl = builder.explorerUrl;
41+
this.networks = builder.networks;
3942
}
4043

4144
public String getName() {
@@ -78,12 +81,21 @@ public void setExplorerUrl(String explorerUrl) {
7881
this.explorerUrl = explorerUrl;
7982
}
8083

84+
public List<Network> getNetworks() {
85+
return networks;
86+
}
87+
88+
public void setNetworks(List<Network> networks) {
89+
this.networks = networks;
90+
}
91+
8192
public static class Builder {
8293
private String name;
8394
private String symbol;
8495
private String decimalPrecision;
8596
private boolean tradingSupported;
8697
private String explorerUrl;
98+
private List<Network> networks;
8799

88100
public Builder() {}
89101

@@ -112,6 +124,11 @@ public Builder explorerUrl(String explorerUrl) {
112124
return this;
113125
}
114126

127+
public Builder networks(List<Network> networks) {
128+
this.networks = networks;
129+
return this;
130+
}
131+
115132
public Asset build() {
116133
return new Asset(this);
117134
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
package com.coinbase.prime.model.assets;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
public class Network {
6+
private NetworkDetails network;
7+
private String name;
8+
@JsonProperty("max_decimals")
9+
private String maxDecimals;
10+
@JsonProperty("default")
11+
private boolean isDefault;
12+
@JsonProperty("trading_supported")
13+
private boolean tradingSupported;
14+
@JsonProperty("vault_supported")
15+
private boolean vaultSupported;
16+
@JsonProperty("prime_custody_supported")
17+
private boolean primeCustodySupported;
18+
@JsonProperty("destination_tag_required")
19+
private boolean destinationTagRequired;
20+
@JsonProperty("network_link")
21+
private String networkLink;
22+
23+
public Network() {}
24+
25+
public Network(Builder builder) {
26+
this.network = builder.network;
27+
this.name = builder.name;
28+
this.maxDecimals = builder.maxDecimals;
29+
this.isDefault = builder.isDefault;
30+
this.tradingSupported = builder.tradingSupported;
31+
this.vaultSupported = builder.vaultSupported;
32+
this.primeCustodySupported = builder.primeCustodySupported;
33+
this.destinationTagRequired = builder.destinationTagRequired;
34+
this.networkLink = builder.networkLink;
35+
}
36+
37+
public NetworkDetails getNetwork() {
38+
return network;
39+
}
40+
41+
public void setNetwork(NetworkDetails network) {
42+
this.network = network;
43+
}
44+
45+
public String getName() {
46+
return name;
47+
}
48+
49+
public void setName(String name) {
50+
this.name = name;
51+
}
52+
53+
public String getMaxDecimals() {
54+
return maxDecimals;
55+
}
56+
57+
public void setMaxDecimals(String maxDecimals) {
58+
this.maxDecimals = maxDecimals;
59+
}
60+
61+
public boolean isDefault() {
62+
return isDefault;
63+
}
64+
65+
public void setDefault(boolean isDefault) {
66+
this.isDefault = isDefault;
67+
}
68+
69+
public boolean isTradingSupported() {
70+
return tradingSupported;
71+
}
72+
73+
public void setTradingSupported(boolean tradingSupported) {
74+
this.tradingSupported = tradingSupported;
75+
}
76+
77+
public boolean isVaultSupported() {
78+
return vaultSupported;
79+
}
80+
81+
public void setVaultSupported(boolean vaultSupported) {
82+
this.vaultSupported = vaultSupported;
83+
}
84+
85+
public boolean isPrimeCustodySupported() {
86+
return primeCustodySupported;
87+
}
88+
89+
public void setPrimeCustodySupported(boolean primeCustodySupported) {
90+
this.primeCustodySupported = primeCustodySupported;
91+
}
92+
93+
public boolean isDestinationTagRequired() {
94+
return destinationTagRequired;
95+
}
96+
97+
public void setDestinationTagRequired(boolean destinationTagRequired) {
98+
this.destinationTagRequired = destinationTagRequired;
99+
}
100+
101+
public String getNetworkLink() {
102+
return networkLink;
103+
}
104+
105+
public void setNetworkLink(String networkLink) {
106+
this.networkLink = networkLink;
107+
}
108+
109+
public static class Builder {
110+
private NetworkDetails network;
111+
private String name;
112+
private String maxDecimals;
113+
private boolean isDefault;
114+
private boolean tradingSupported;
115+
private boolean vaultSupported;
116+
private boolean primeCustodySupported;
117+
private boolean destinationTagRequired;
118+
private String networkLink;
119+
120+
public Builder() {}
121+
122+
public Builder network(NetworkDetails network) {
123+
this.network = network;
124+
return this;
125+
}
126+
127+
public Builder name(String name) {
128+
this.name = name;
129+
return this;
130+
}
131+
132+
public Builder maxDecimals(String maxDecimals) {
133+
this.maxDecimals = maxDecimals;
134+
return this;
135+
}
136+
137+
public Builder isDefault(boolean isDefault) {
138+
this.isDefault = isDefault;
139+
return this;
140+
}
141+
142+
public Builder tradingSupported(boolean tradingSupported) {
143+
this.tradingSupported = tradingSupported;
144+
return this;
145+
}
146+
147+
public Builder vaultSupported(boolean vaultSupported) {
148+
this.vaultSupported = vaultSupported;
149+
return this;
150+
}
151+
152+
public Builder primeCustodySupported(boolean primeCustodySupported) {
153+
this.primeCustodySupported = primeCustodySupported;
154+
return this;
155+
}
156+
157+
public Builder destinationTagRequired(boolean destinationTagRequired) {
158+
this.destinationTagRequired = destinationTagRequired;
159+
return this;
160+
}
161+
162+
public Builder networkLink(String networkLink) {
163+
this.networkLink = networkLink;
164+
return this;
165+
}
166+
167+
public Network build() {
168+
return new Network(this);
169+
}
170+
}
171+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.coinbase.prime.model.assets;
2+
3+
public class NetworkDetails {
4+
private String id;
5+
private String type;
6+
7+
public NetworkDetails() {}
8+
9+
public NetworkDetails(Builder builder) {
10+
this.id = builder.id;
11+
this.type = builder.type;
12+
}
13+
14+
public String getId() {
15+
return id;
16+
}
17+
18+
public void setId(String id) {
19+
this.id = id;
20+
}
21+
22+
public String getType() {
23+
return type;
24+
}
25+
26+
public void setType(String type) {
27+
this.type = type;
28+
}
29+
30+
public static class Builder {
31+
private String id;
32+
private String type;
33+
34+
public Builder() {}
35+
36+
public Builder id(String id) {
37+
this.id = id;
38+
return this;
39+
}
40+
41+
public Builder type(String type) {
42+
this.type = type;
43+
return this;
44+
}
45+
46+
public NetworkDetails build() {
47+
return new NetworkDetails(this);
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)