Skip to content

Commit 6c0ac4c

Browse files
authored
Merge pull request #168 from tronprotocol/release_0.9.2
Merge release 0.9.2 to main
2 parents efac9cc + 6520d2b commit 6c0ac4c

297 files changed

Lines changed: 16199 additions & 171143 deletions

File tree

Some content is hidden

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

README.md

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,115 @@
1-
# trident
1+
# Trident - TRON Java SDK
22

3-
trident is a SDK that includes libraries for working with TRON, it makes it easy to build TRON applications with multi-language.
3+
## Overview
44

5-
## Contribution
5+
Trident is a lightweight Java SDK for interacting with the TRON blockchain. It provides a simple and efficient way to integrate TRON functionality into your Java applications.
6+
7+
## Features
8+
9+
- Complete implementation of TRON's gRPC interfaces
10+
- Smart contract deployment and interaction
11+
- Wallet key management and address utilities
12+
- Transaction building and signing
13+
- TRC10/TRC20/TRC721 token support
14+
15+
## Adding Trident to your build
16+
17+
Trident-java is compiled with java version 1.8 and gradle 7.6.
18+
19+
### Gradle
20+
21+
```groovy
22+
implementation("io.github.tronprotocol:trident:0.9.2")
23+
```
24+
25+
### Maven
26+
27+
Add repo setting:
28+
29+
```xml
30+
<dependency>
31+
<groupId>io.github.tronprotocol</groupId>
32+
<artifactId>trident</artifactId>
33+
<version>0.9.2</version>
34+
</dependency>
35+
```
36+
37+
### Using local build
638

7-
We're very glad and appreciate to have contributions from the community.
39+
You can use locally built packages by follow steps:
840

9-
Refer to our [contributing guide](./CONTRIBUTING.md) for more information.
41+
1. Copy the compiled jar file to your project's `libs` directory
42+
2. Add the following to your project's `build.gradle`:
43+
```groovy
44+
dependencies {
45+
implementation files('libs/trident-0.9.2.jar')
46+
implementation "com.google.guava:guava:33.0.0-jre"
47+
implementation "io.grpc:grpc-netty-shaded:1.60.0"
48+
implementation "io.grpc:grpc-netty:1.60.0"
49+
implementation "io.grpc:grpc-okhttp:1.60.0"
50+
implementation "io.grpc:grpc-protobuf:1.60.0"
51+
implementation "io.grpc:grpc-stub:1.60.0"
52+
implementation "com.google.protobuf:protobuf-java-util:3.25.5"
53+
implementation "org.bouncycastle:bcprov-jdk18on:1.78.1"
54+
implementation "io.vertx:vertx-core:4.5.10"
55+
implementation "io.netty:netty-all:4.1.118.Final"
56+
implementation "com.alibaba.fastjson2:fastjson2:2.0.55"
57+
}
58+
```
1059

11-
[Join our Telegram group](https://t.me/TronOfficialDevelopersGroupEn)
60+
## Quick Start
1261

13-
## trident-java
62+
**Initialize client**
63+
```java
64+
// Initialize with TronGrid mainnet
65+
ApiWrapper client = ApiWrapper.ofMainnet("private_key", "api_key"); //api_key from TronGrid
1466

15-
trident-java is a lightweight SDK that includes libraries for working with TRON network.
67+
//Or Shasta test net
68+
ApiWrapper client = ApiWrapper.ofShasta("private key");
1669

17-
Functions include:
70+
// Or nile testnet
71+
ApiWrapper client = ApiWrapper.ofNile("private_key");
1872

19-
- Offline address generation
73+
//Initialize with special grpc endpoint
74+
ApiWrapper client = new ApiWrapper("grpc endpoint", "solidity grpc endpoint", "private_key");
75+
76+
// Send TRX
77+
TransactionExtention transactionExtention = client.transfer("fromAddress", "toAddress", 100_000_000L); //100TRX
78+
// Sign
79+
Transaction signedTxn = client.signTransaction(transactionExtention);
80+
// Broadcast
81+
String txId = client.broadcastTransaction(signedTxn);
82+
System.out.println("txId is " + txId);
83+
```
84+
85+
## Documentation
86+
87+
- [Official Documentation](https://developers.tron.network/docs/trident-java)
88+
89+
90+
## Build instructions
91+
Trident includes integration tests for running on the Nile testnet. If you want to run test cases involving write operations on the blockchain, such as transfer or deploy contract and so on, please follow the steps:
92+
93+
1. Uncomment the Disabled function in the unit test cases.
94+
```
95+
//@Disabled("add private key to enable this case")
96+
```
97+
2. Set the tron.private-key and tron.tokenId in the test configuration file in the core directory [here](trident-java/core/src/test/resources/application-test.properties).
98+
99+
100+
```
101+
tron.private-key=xxx
102+
tron.tokenId=1000587
103+
```
104+
105+
**Note:** The account should have at least 1000 TRX, 100 USDT, and 1000 TRC10 token on the Nile testnet. you can get testCoin from [nileex.io](https://nileex.io/join/getJoinPage).
106+
107+
## Contribution
20108

21-
- Offline transaction construct
109+
We're very glad and appreciate to have contributions from the community.
22110

23-
- Offline transaction signature
111+
Refer to our [contributing guide ](CONTRIBUTING.md)for more information.
24112

25-
- java-tron full node API support
113+
## Licence
26114

27-
For more informations refer to : [trident-java document](https://developers.tron.network/docs/trident-java)
115+
Trident is distributed under a MIT licence.

trident-java/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ build/
2626
.idea
2727
.vscode
2828
demo/
29+
30+
# proto gen file
31+
/core/src/main/java/org/tron/trident/proto/
32+
/core/src/main/java/org/tron/trident/api/

trident-java/README.md

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,23 @@ Trident-Java makes it easy to build TRON applications with java.
66

77
[Trident-Java document](https://developers.tron.network/docs/trident-java)
88

9-
Due to safety concerns, trident-java will no longer upload packaged files to maven. Please clone the code from GitHub and do the packaging.
10-
11-
Trident-java is compiled with java version 1.8.0_231 and gradle 5.6.4.
9+
Trident-java is compiled with java version 1.8 and gradle 7.6.
1210

1311
## How to use
1412

1513
### Gradle Setting
1614

17-
Add repo setting:
18-
1915
```groovy
20-
repositories {
21-
mavenCentral()
22-
}
16+
implementation("io.github.tronprotocol:trident:0.9.2")
2317
```
2418

25-
Then add required packages as dependencies. Please add dependencies locally.
26-
27-
```groovy
28-
dependencies {
29-
// protobuf & grpc
30-
implementation 'com.google.protobuf:protobuf-java:3.25.5'
31-
32-
implementation fileTree(dir:'../core')
33-
implementation fileTree(dir:'../utils')
34-
implementation fileTree(dir:'../abi')
35-
36-
implementation 'com.google.guava:guava:28.0-jre'
37-
}
38-
```
19+
### Maven Setting
3920

40-
Or if you are using the jar files as your dependencies:
41-
42-
```groovy
43-
dependencies {
44-
implementation fileTree(dir:'your path', include: '*.jar')
45-
}
46-
```
47-
48-
### Maven Settings
4921

5022
```xml
5123
<dependency>
52-
<groupId>org.tron.trident</groupId>
53-
<artifactId>abi</artifactId>
54-
<version>0.9.1</version>
55-
<scope>system</scope>
56-
<systemPath>your path</systemPath>
57-
</dependency>
58-
<dependency>
59-
<groupId>org.tron.trident</groupId>
60-
<artifactId>utils</artifactId>
61-
<version>0.9.1</version>
62-
<scope>system</scope>
63-
<systemPath>your path</systemPath>
64-
</dependency>
65-
<dependency>
66-
<groupId>org.tron.trident</groupId>
67-
<artifactId>core</artifactId>
68-
<version>0.9.1</version>
69-
<scope>system</scope>
70-
<systemPath>your path</systemPath>
24+
<groupId>io.github.tronprotocol</groupId>
25+
<artifactId>trident</artifactId>
26+
<version>0.9.2</version>
7127
</dependency>
7228
```

trident-java/abi/build.gradle

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
plugins {
2-
2+
id 'java-library'
33
}
44

55
description 'TRON Application Binary Interface (ABI) for working with smart contracts'
66

77
dependencies {
88
implementation project(':utils')
99
}
10-
11-
tasks.create('buildLib', Jar) {
12-
baseName = 'trident'
13-
version = null
14-
from(sourceSets.main.output) {
15-
include '/**'
16-
}
17-
18-
from {
19-
configurations.compile.collect {
20-
it.isDirectory() ? it : zipTree(it)
21-
}
22-
}
23-
}
-54.3 KB
Binary file not shown.

trident-java/abi/gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)