Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
49cfa5d
update
eval-exec Feb 5, 2025
71c0b4d
update
eval-exec Feb 5, 2025
22a4199
Fix ./gradlew javadoc
eval-exec Feb 5, 2025
cc5ed33
update
eval-exec Feb 5, 2025
fb33231
update
eval-exec Feb 5, 2025
d987f5e
update
eval-exec Feb 5, 2025
0a4e368
update
eval-exec Feb 5, 2025
a9cb38e
update
eval-exec Feb 5, 2025
57c3bba
update
eval-exec Feb 5, 2025
47a3730
update
eval-exec Feb 5, 2025
b3e57e3
update
eval-exec Feb 5, 2025
e21473b
no sign
eval-exec Feb 5, 2025
f579c27
update
eval-exec Feb 5, 2025
365837f
update
eval-exec Feb 5, 2025
620072b
update
eval-exec Feb 5, 2025
761af35
update
eval-exec Feb 5, 2025
3adb02d
update
eval-exec Feb 5, 2025
787c226
update
eval-exec Feb 5, 2025
e6b2f06
update
eval-exec Feb 5, 2025
bd4af11
update
eval-exec Feb 5, 2025
6a9084a
update
eval-exec Feb 5, 2025
c84ebba
update
eval-exec Feb 5, 2025
d1b8d9c
update
eval-exec Feb 5, 2025
06e88cd
update
eval-exec Feb 5, 2025
a747b90
update
eval-exec Feb 5, 2025
5acbe09
update
eval-exec Feb 5, 2025
bda16fe
update
eval-exec Feb 5, 2025
4e4d8c9
update
eval-exec Feb 5, 2025
1888b10
update
eval-exec Feb 5, 2025
7bc2805
update
eval-exec Feb 5, 2025
5e9c612
update
eval-exec Feb 5, 2025
713b3b2
update
eval-exec Feb 5, 2025
f30fcdc
update
eval-exec Feb 5, 2025
710ffab
update
eval-exec Feb 5, 2025
f98695b
update
eval-exec Feb 5, 2025
541e26f
update
eval-exec Feb 5, 2025
047e19a
update
eval-exec Feb 5, 2025
395f142
update
eval-exec Feb 5, 2025
8ab0f8c
update
eval-exec Feb 5, 2025
6d6262e
update
eval-exec Feb 5, 2025
70cbcf6
update
eval-exec Feb 5, 2025
c8f9da2
update
eval-exec Feb 5, 2025
930aaea
update
eval-exec Feb 5, 2025
13c35ee
update
eval-exec Feb 5, 2025
07cebde
update
eval-exec Feb 5, 2025
70f0576
update
eval-exec Feb 5, 2025
b7eb9af
update
eval-exec Feb 5, 2025
c9ad458
update
eval-exec Feb 5, 2025
8caa0eb
update
eval-exec Feb 5, 2025
66e0498
update
eval-exec Feb 5, 2025
89f54cf
update
eval-exec Feb 5, 2025
549a04c
update
eval-exec Feb 5, 2025
2bd6f94
update
eval-exec Feb 5, 2025
797505b
update
eval-exec Feb 5, 2025
29c990e
update
eval-exec Feb 5, 2025
b627386
update
eval-exec Feb 5, 2025
5c7ac89
update
eval-exec Feb 5, 2025
a6e575f
update
eval-exec Feb 5, 2025
ec77379
update
eval-exec Feb 5, 2025
17a31c4
update
eval-exec Feb 5, 2025
5656079
update
eval-exec Feb 5, 2025
95091d6
update
eval-exec Feb 5, 2025
c78bcc3
update
eval-exec Feb 5, 2025
865b7cf
update
eval-exec Feb 5, 2025
eb6f47c
update
eval-exec Feb 5, 2025
429cacf
update
eval-exec Feb 5, 2025
99ec6ee
update
eval-exec Feb 5, 2025
3b3d9c7
update
eval-exec Feb 5, 2025
1375e98
update
eval-exec Feb 5, 2025
9f43c34
update
eval-exec Feb 5, 2025
ceb7b5e
update
eval-exec Feb 5, 2025
7369607
update
eval-exec Feb 5, 2025
453c94d
update
eval-exec Feb 5, 2025
dd701b0
update
eval-exec Feb 5, 2025
2d94b20
update
eval-exec Feb 5, 2025
d08cdbc
update
eval-exec Feb 5, 2025
a994eb9
update
eval-exec Feb 5, 2025
b174d68
update
eval-exec Feb 5, 2025
3219a33
update
eval-exec Feb 5, 2025
30047ef
update
eval-exec Feb 5, 2025
29e3717
update
eval-exec Feb 5, 2025
4880b0e
update
eval-exec Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Continuous delivery in GitHub and Maven Central Repository

on:
push:
tags:
- 'rc/v*'
branch:
- 'rc-test/v*'

jobs:
create_release_draft:
Expand Down Expand Up @@ -34,20 +34,27 @@ jobs:
with:
java-version: 1.8
- name: Prepare signing secret key ring file
run: echo "${{ secrets.NEXUS_SIGNING_SECRET_KEY_BASE64 }}" | base64 --decode > ./secret_key.gpg
run: |
echo "${{ secrets.NEXUS_SIGNING_SECRET_KEY_BASE64 }}" | base64 --decode > /tmp/secret_key.gpg
echo signing.keyId="${{ secrets.NEXUS_SIGNING_KEYID }}" >> gradle.properties
echo signing.secretKeyRingFile=/tmp/secret_key.gpg >> gradle.properties
echo signing.password="${{ secrets.NEXUS_SIGNING_PASSWORD }}" >> gradle.properties

- name: Build project
run: |
chmod +x ./gradlew
./gradlew shadowJar

- name: Upload artifact to Nexus
env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.NEXUS_OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.NEXUS_OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signing.keyId: ${{ secrets.NEXUS_SIGNING_KEYID }}
ORG_GRADLE_PROJECT_signing.password: ${{ secrets.NEXUS_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signing.secretKeyRingFile: ./secret_key.gpg
# ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.NEXUS_SIGNING_KEYID }}
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.NEXUS_SIGNING_PASSWORD }}
# ORG_GRADLE_PROJECT_signingKey: "/tmp/secret_key.gpg"
run: |
./gradlew uploadArchives

# - name: upload artifact ckb.jar to GitHub release page
# uses: actions/upload-release-asset@v1
# env:
Expand Down
39 changes: 25 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buildscript {

repositories {
mavenCentral()
maven { url 'https://nexus.web.cern.ch/nexus/content/repositories/public/' }
}

dependencies {
Expand All @@ -25,6 +26,7 @@ buildscript {
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
id 'signing'
}

apply plugin: 'com.github.johnrengelman.shadow'
Expand All @@ -42,7 +44,7 @@ allprojects {
targetCompatibility = 1.8

group 'org.nervos.ckb'
version '3.0.0'
version '0.0.11'
apply plugin: 'java'

repositories {
Expand All @@ -59,11 +61,10 @@ allprojects {
useJUnitPlatform()
}
apply from: rootProject.file('gradle/checkstyle.gradle')

}

configure(subprojects.findAll { it.name != 'tests' }) {
// Required for Maven Nexus repository
apply plugin: 'signing'

// Required for JFrog Artifactory repository
apply plugin: 'maven-publish'
Expand All @@ -87,11 +88,19 @@ configure(subprojects.findAll { it.name != 'tests' }) {
archives sourcesJar, javadocJar, testJar
}

// Required for Maven Nexus repository
apply plugin: 'signing'

ext {
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
// signingKeyId
signingKeyId = project.hasProperty('signingKeyId') ? project.property('signingKeyId') : ''
signingPassword = project.hasProperty('signingPassword') ? project.property('signingPassword') : ''
signingKey = project.hasProperty('signingKey') ? project.property('signingKey') : ''
}


publishing {
repositories {
maven {
Expand All @@ -105,12 +114,15 @@ configure(subprojects.findAll { it.name != 'tests' }) {
publications {
mavenJava(MavenPublication) {
groupId 'org.nervos.ckb'
version '3.0.0'
from components.java
version '0.0.11'
from components.java

artifact javadocJar
artifact sourcesJar

pom {
name = 'ckb-sdk-java'
description = project.description
description = "ckb java sdk"
url = 'https://github.com/nervosnetwork/ckb-sdk-java.git'
scm {
connection = 'scm:git@github.com:nervosnetwork/ckb-sdk-java.git'
Expand All @@ -131,21 +143,20 @@ configure(subprojects.findAll { it.name != 'tests' }) {
}
}
}
}
}
}
}
}
}

signing {
sign publishing.publications
}


tasks.register('uploadArchives') {
println "start publish ${project.name} ${it.name}"
dependsOn publish
}

signing {
required { gradle.taskGraph.hasTask('uploadArchives') }
// only execute as part of this task
sign configurations.archives
}

tasks.register('release') {
println("release ${it.name}")
Expand Down
2 changes: 1 addition & 1 deletion ckb/src/main/java/org/nervos/ckb/CkbRpcApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ default TransactionWithStatus getTransaction(@Nonnull byte[] transactionHash) th
*
* @param transactionHash the transaction hash
* @return the RPC does not return the transaction content and the field transaction must be null.
* @throws IOException
* @throws IOException Error occurs while communicating with the RPC server or if the transaction hash is invalid
*/
default TransactionWithStatus getTransactionStatus(@Nonnull byte[] transactionHash) throws IOException {
return getTransactionStatus(transactionHash, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public abstract class AbstractTransactionBuilder {
*
* @param configuration This is the bundle of configuration for builder,
* such as fee rate and registerred {@link org.nervos.ckb.transaction.handler.ScriptHandler}.
* @param availableInputs The available inputs for the transaction.
*/
public AbstractTransactionBuilder(TransactionBuilderConfiguration configuration, Iterator<TransactionInput> availableInputs) {
this.configuration = configuration;
Expand Down Expand Up @@ -101,6 +102,7 @@ protected static long calculateTxFee(Transaction transaction, long feeRate) {
* default context null. Use {@link #build(Object...)} to pass custom contexts.
*
* @see org.nervos.ckb.transaction.handler.ScriptHandler#buildTransaction(AbstractTransactionBuilder, ScriptGroup, Object)
* @return The built transaction with script groups.
*/
public TransactionWithScriptGroups build() {
return build((Object) null);
Expand Down Expand Up @@ -149,6 +151,8 @@ public Map<Script, ScriptGroup> rebuildScriptGroups(Map<Script, ScriptGroup> scr
* The contexts will be passed to the registered script handlers in the same order.
*
* @see org.nervos.ckb.transaction.handler.ScriptHandler#buildTransaction(AbstractTransactionBuilder, ScriptGroup, Object)
* @param contexts The custom contexts for script handlers.
* @return The built transaction with script groups.
*/
abstract TransactionWithScriptGroups build(Object... contexts);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public CkbTransactionBuilder(TransactionBuilderConfiguration configuration, Iter
* Add a potential input for the transaction.
* <p>
* The input may not be actually used if there's already enough capacity for the outputs.
* @param transactionInput The input.
* @return The builder.
*/
public CkbTransactionBuilder addInput(TransactionInput transactionInput) {
transactionInputs.add(transactionInput);
Expand All @@ -45,6 +47,9 @@ public CkbTransactionBuilder addHeaderDep(String headerDep) {

/**
* Add outputs and data. The two parameters should have the same size.
* @param outputs The outputs.
* @param outputsData The data of the outputs.
* @return The builder.
*/
public CkbTransactionBuilder setOutputs(List<CellOutput> outputs, List<byte[]> outputsData) {
tx.outputs.addAll(outputs);
Expand Down Expand Up @@ -75,6 +80,9 @@ public CkbTransactionBuilder addDaoDepositOutput(String address, long capacity)
* Set possible change output. Its capacity must be 0.
* <p>
* Change output should be set only once.
* @param output The change output.
* @param data The data of the change output.
* @return The builder.
*/
public CkbTransactionBuilder setChangeOutput(@Nonnull CellOutput output, @Nonnull byte[] data) {
if (changeOutput != null) {
Expand All @@ -92,6 +100,8 @@ public CkbTransactionBuilder setChangeOutput(@Nonnull CellOutput output, @Nonnul
* Set possible change output address.
* <p>
* Change output should be set only once.
* @param address The address of the change output.
* @return The builder.
*/
public CkbTransactionBuilder setChangeOutput(@Nonnull String address) {
CellOutput output = new CellOutput(0, Address.decode(address).getScript());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public interface ScriptHandler {
*
* <p>For example:</p>
*
* <pre>{@code
* @Override
* <pre>
* <code>
* \@Override
* boolean buildTransaction(AbstractTransactionBuilder txBuilder, ScriptGroup scriptGroup, Object context) {
* // Only change the transaction when the script is used.
* if (scriptGroup == null || !isMatched(scriptGroup.getScript())) {
Expand All @@ -45,8 +46,8 @@ public interface ScriptHandler {
* txBuilder.setWitness(witnessIndex, WitnessArgs.Type.LOCK, dummyWitness);
*
* return true;
* }
* }</pre>
* </code>
* </pre>
*
* @param txBuilder The transaction in building.
* @param scriptGroup Transaction builder calls this callback for each script group found in the transaction.
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/nervos/ckb/sign/ScriptSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public interface ScriptSigner {
* @param context This is passed from {@code TransactionSigner.signTransaction}
* @return {@code true} when the script handler has modified the transaction.
*
* @see TransactionSigner#signTransaction(TransactionWithScriptGroups, Context...)
* @see TransactionSigner#signTransaction(TransactionWithScriptGroups, Set<Context>)
* @see TransactionSigner#signTransaction(TransactionWithScriptGroups, String...)
* @see "TransactionSigner#signTransaction(TransactionWithScriptGroups, Context...)"
* @see "TransactionSigner#signTransaction(TransactionWithScriptGroups, Set<Context>)"
* @see "TransactionSigner#signTransaction(TransactionWithScriptGroups, String...)"
*/
boolean signTransaction(Transaction transaction, ScriptGroup scriptGroup, Context context);
}
Loading