Skip to content

Commit fdc4dc7

Browse files
authored
Merge pull request #37 from coinbase-samples/nm/2025-12-update
Add 6 endpoints, 12 examples, version 1.6.1
2 parents 20d36e4 + 0e022f2 commit fdc4dc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2240
-32
lines changed

CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
# Changelog
22

3+
## [1.6.1] - 2025-12-18
4+
5+
### Added
6+
7+
#### New Endpoints
8+
- **Staking Service**
9+
- `previewUnstake` - Preview unstaking operation to get estimated amounts
10+
- `getUnstakingStatus` - Get unstaking status and estimated completion times for validators
11+
- **Futures Service**
12+
- `getFcmSettings` - Get FCM settings including target derivatives excess
13+
- `setFcmSettings` - Update FCM settings
14+
- **Financing Service**
15+
- `listTFObligations` - List trade finance obligations for an entity
16+
- `listFinancingEligibleAssets` - List assets eligible for trade finance
17+
18+
#### New Models
19+
- `ProcessRequirements` - Travel rule status requirements for transactions
20+
- `RewardMetadata` - Staking reward metadata
21+
- `TfAsset` - Trade finance asset with adjustment factors
22+
- `TFObligation` - Trade finance obligation details
23+
- `UnstakingStatus` - Unstaking status with estimated completion times
24+
- `ValidatorUnstakingInfo` - Validator-specific unstaking information
25+
26+
#### New Enums
27+
- `EstimateType` - Estimate confidence types for unstaking
28+
- `RewardSubtype` - Reward subtypes for staking
29+
- `TravelRuleStatus` - Travel rule submission status
30+
- `UnstakeType` - Unstaking operation types
31+
32+
#### New Examples
33+
- **Staking Examples** (8 new)
34+
- `PortfolioStakingInitiate.java`
35+
- `PortfolioStakingUnstake.java`
36+
- `CreateStake.java`
37+
- `CreateUnstake.java`
38+
- `ClaimRewards.java`
39+
- `ListTransactionValidators.java`
40+
- `PreviewUnstake.java`
41+
- `GetUnstakingStatus.java`
42+
- **Futures Examples** (2 new)
43+
- `GetFcmSettings.java`
44+
- `SetFcmSettings.java`
45+
- **Financing Examples** (2 new)
46+
- `ListTFObligations.java`
47+
- `ListFinancingEligibleAssets.java`
48+
49+
### Changed
50+
- Updated `Order` model with PEG order fields (pegOffsetType, offset, wigLevel)
51+
- Updated `Transaction` model with processRequirements field
52+
- Updated `TransactionMetadata` model with spec changes
53+
- Updated `UserRole`, `XmCallType`, `XmEntityCallStatus` enums with new values
54+
355
## [1.5.3] - 2025-11-05
456

557
### Fixed

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.6.0</version>
24+
<version>1.6.1</version>
2525
<licenses>
2626
<license>
2727
<name>Apache License, Version 2.0</name>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.financing;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.financing.FinancingService;
23+
import com.coinbase.prime.financing.ListFinancingEligibleAssetsRequest;
24+
import com.coinbase.prime.financing.ListFinancingEligibleAssetsResponse;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
public class ListFinancingEligibleAssets {
28+
public static void main(String[] args) {
29+
try {
30+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
31+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
32+
33+
FinancingService service = PrimeServiceFactory.createFinancingService(client);
34+
ListFinancingEligibleAssetsResponse response = service.listFinancingEligibleAssets(
35+
new ListFinancingEligibleAssetsRequest.Builder()
36+
.build());
37+
38+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
39+
} catch (Exception e) {
40+
e.printStackTrace();
41+
}
42+
}
43+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.financing;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.financing.FinancingService;
23+
import com.coinbase.prime.financing.ListTfObligationsRequest;
24+
import com.coinbase.prime.financing.ListTfObligationsResponse;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
public class ListTfObligations {
28+
public static void main(String[] args) {
29+
try {
30+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
31+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
32+
String entityId = System.getenv("COINBASE_PRIME_ENTITY_ID");
33+
34+
FinancingService service = PrimeServiceFactory.createFinancingService(client);
35+
ListTfObligationsResponse response = service.listTfObligations(
36+
new ListTfObligationsRequest.Builder()
37+
.entityId(entityId)
38+
.build());
39+
40+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
41+
} catch (Exception e) {
42+
e.printStackTrace();
43+
}
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.futures;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.futures.FuturesService;
23+
import com.coinbase.prime.futures.GetFcmSettingsRequest;
24+
import com.coinbase.prime.futures.GetFcmSettingsResponse;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
public class GetFcmSettings {
28+
public static void main(String[] args) {
29+
try {
30+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
31+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
32+
String entityId = System.getenv("COINBASE_PRIME_ENTITY_ID");
33+
34+
FuturesService service = PrimeServiceFactory.createFuturesService(client);
35+
GetFcmSettingsResponse response = service.getFcmSettings(
36+
new GetFcmSettingsRequest.Builder()
37+
.entityId(entityId)
38+
.build());
39+
40+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
41+
} catch (Exception e) {
42+
e.printStackTrace();
43+
}
44+
}
45+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.futures;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.futures.FuturesService;
23+
import com.coinbase.prime.futures.SetFcmSettingsRequest;
24+
import com.coinbase.prime.futures.SetFcmSettingsResponse;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
public class SetFcmSettings {
28+
public static void main(String[] args) {
29+
try {
30+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
31+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
32+
String entityId = System.getenv("COINBASE_PRIME_ENTITY_ID");
33+
34+
FuturesService service = PrimeServiceFactory.createFuturesService(client);
35+
SetFcmSettingsResponse response = service.setFcmSettings(
36+
new SetFcmSettingsRequest.Builder()
37+
.entityId(entityId)
38+
.targetDerivativesExcess("1000.00")
39+
.build());
40+
41+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
42+
} catch (Exception e) {
43+
e.printStackTrace();
44+
}
45+
}
46+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.staking;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.staking.ClaimRewardsRequest;
23+
import com.coinbase.prime.staking.ClaimRewardsResponse;
24+
import com.coinbase.prime.staking.StakingService;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
import java.util.UUID;
28+
29+
public class ClaimRewards {
30+
public static void main(String[] args) {
31+
try {
32+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
33+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
34+
String portfolioId = System.getenv("COINBASE_PRIME_PORTFOLIO_ID");
35+
String walletId = args.length > 0 ? args[0] : System.getenv("COINBASE_PRIME_WALLET_ID");
36+
37+
StakingService service = PrimeServiceFactory.createStakingService(client);
38+
ClaimRewardsResponse response = service.claimRewards(
39+
new ClaimRewardsRequest.Builder()
40+
.portfolioId(portfolioId)
41+
.walletId(walletId)
42+
.idempotencyKey(UUID.randomUUID().toString())
43+
.build());
44+
45+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
46+
} catch (Exception e) {
47+
e.printStackTrace();
48+
}
49+
}
50+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2025-present Coinbase Global, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.coinbase.examples.staking;
18+
19+
import com.coinbase.prime.client.CoinbasePrimeClient;
20+
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
21+
import com.coinbase.prime.factory.PrimeServiceFactory;
22+
import com.coinbase.prime.staking.CreateStakeRequest;
23+
import com.coinbase.prime.staking.CreateStakeResponse;
24+
import com.coinbase.prime.staking.StakingService;
25+
import com.fasterxml.jackson.databind.ObjectMapper;
26+
27+
import java.util.UUID;
28+
29+
public class CreateStake {
30+
public static void main(String[] args) {
31+
try {
32+
CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(System.getenv("COINBASE_PRIME_CREDENTIALS"));
33+
CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
34+
String portfolioId = System.getenv("COINBASE_PRIME_PORTFOLIO_ID");
35+
String walletId = args.length > 0 ? args[0] : System.getenv("COINBASE_PRIME_WALLET_ID");
36+
37+
StakingService service = PrimeServiceFactory.createStakingService(client);
38+
CreateStakeResponse response = service.createStake(
39+
new CreateStakeRequest.Builder()
40+
.portfolioId(portfolioId)
41+
.walletId(walletId)
42+
.idempotencyKey(UUID.randomUUID().toString())
43+
.build());
44+
45+
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(response));
46+
} catch (Exception e) {
47+
e.printStackTrace();
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)