Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgeorgiev committed Oct 7, 2022
2 parents 2ba83af + 2f20666 commit 339fd49
Show file tree
Hide file tree
Showing 82 changed files with 1,898 additions and 104 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ tests&build_for_maven_central:
script:
- cat $we_maven_central_gpg | base64 --decode > "$(pwd)/we_maven_central.gpg"
- ./gradlew --no-parallel -PsonaTypeMavenUser=$SONATYPE_USER -PsonaTypeMavenPassword=$SONATYPE_PASSWORD -Psigning.keyId=$SIGN_KEY_ID -Psigning.password=$SIGN_PASSWORD -Psigning.secretKeyRingFile="$(pwd)/we_maven_central.gpg" version check build publish
- ./gradlew -PsonaTypeMavenUser=$SONATYPE_USER -PsonaTypeMavenPassword=$SONATYPE_PASSWORD closeAndReleaseRepository
only:
- master
<<: *artifacts
Expand Down
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ val protobufVersion: String by project
val junitPlatformLauncherVersion: String by project
val mockkVersion: String by project
val springMockkVersion: String by project
val wireMockVersion: String by project

val ktorVersion: String by project

Expand All @@ -35,6 +36,9 @@ val sonaTypeBasePath = "https://s01.oss.sonatype.org"
val gitHubProject = "waves-enterprise/we-node-client"
val githubUrl = "https://github.com/$gitHubProject"

val feignVersion: String by project
val jacksonModuleKotlin: String by project

plugins {
kotlin("jvm") apply false
`maven-publish`
Expand Down Expand Up @@ -255,9 +259,14 @@ subprojects {
dependency("io.ktor:ktor-client-content-negotiation:$ktorVersion")
dependency("io.ktor:ktor-serialization-jackson:$ktorVersion")

dependency("io.github.openfeign:feign-core:$feignVersion")
dependency("io.github.openfeign:feign-jackson:$feignVersion")
dependency("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlin")

dependency("org.junit.platform:junit-platform-launcher:$junitPlatformLauncherVersion")
dependency("io.mockk:mockk:$mockkVersion")
dependency("com.ninja-squad:springmockk:$springMockkVersion")
dependency("com.github.tomakehurst:wiremock-jre8:$wireMockVersion")
}
}

Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ ktorVersion=2.0.1
logbackVersion=1.2.11
javaxAnnotationApiVersion=1.3.2

# http
feignVersion=11.9
jacksonModuleKotlin=2.13.3

# Grpc
protobufPluginVersion=0.8.18
ioGrpcVersion=1.16.0
Expand All @@ -35,3 +39,4 @@ protobufVersion=3.20.1
junitPlatformLauncherVersion=1.6.2
mockkVersion=1.12.3
springMockkVersion=3.1.1
wireMockVersion=2.33.2
8 changes: 7 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ include(

"we-node-client-http:we-node-client-http-dto",
"we-node-client-http:we-node-client-ktor-client",

"we-node-client-http:we-node-client-feign-client",

"we-node-client-grpc:we-node-client-grpc-mapper",
"we-node-client-grpc:we-node-client-grpc-java",
"we-node-client-grpc:we-node-client-grpc-kotlin",
"we-node-client-grpc:we-node-client-grpc-coroutines-client",
"we-node-client-grpc:we-node-client-grpc-blocking-client",

"we-node-domain-test",

"we-tx-signer:we-tx-signer-api",
"we-tx-signer:we-tx-signer-node",
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import com.wavesenterprise.sdk.node.domain.contract.ExecutionErrorRequest
import com.wavesenterprise.sdk.node.domain.contract.ExecutionSuccessRequest
import com.wavesenterprise.sdk.node.domain.contract.keys.ContractKeyRequest
import com.wavesenterprise.sdk.node.domain.contract.keys.ContractKeysRequest
import java.util.Optional

interface ContractService {
fun connect(connectionRequest: ConnectionRequest): Sequence<ContractTransactionResponse>
fun commitExecutionSuccess(executionSuccessRequest: ExecutionSuccessRequest)
fun commitExecutionError(executionErrorRequest: ExecutionErrorRequest)
fun getContractKeys(contractKeysRequest: ContractKeysRequest): List<DataEntry>
fun getContractKey(contractKeyRequest: ContractKeyRequest): DataEntry?
fun getContractKey(contractKeyRequest: ContractKeyRequest): Optional<DataEntry>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.wavesenterprise.sdk.node.domain.blocking.node

import com.wavesenterprise.sdk.node.domain.blocking.contract.ContractService
import com.wavesenterprise.sdk.node.domain.blocking.tx.TxService

interface NodeBlockingServiceFactory {
fun txService(): TxService
fun contractService(): ContractService
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import com.wavesenterprise.sdk.node.domain.sign.SignRequest
import com.wavesenterprise.sdk.node.domain.tx.Tx
import com.wavesenterprise.sdk.node.domain.tx.TxInfo
import com.wavesenterprise.sdk.node.domain.tx.UtxSize
import java.util.Optional

interface TxService {
fun <T : Tx> sign(request: SignRequest<T>): T
fun <T : Tx> signAndBroadcast(request: SignRequest<T>): Tx
fun <T : Tx> signAndBroadcast(request: SignRequest<T>): T
fun <T : Tx> broadcast(tx: T): T
fun utxInfo(): UtxSize
fun txInfo(txId: TxId): TxInfo
fun txInfo(txId: TxId): Optional<TxInfo>
}
4 changes: 4 additions & 0 deletions we-node-client-domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
dependencies {
implementation(kotlin("stdlib"))

testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ sealed interface ContractTransaction {
val params: List<DataEntry>
val fee: Fee
val version: TxVersion
val proof: Signature
val proof: Signature?
val timestamp: Timestamp
val feeAssetId: AssetId
val feeAssetId: AssetId?
}

data class CreateContractTransaction(
Expand All @@ -34,9 +34,9 @@ data class CreateContractTransaction(
override val params: List<DataEntry>,
override val fee: Fee,
override val version: TxVersion,
override val proof: Signature,
override val proof: Signature?,
override val timestamp: Timestamp,
override val feeAssetId: AssetId,
override val feeAssetId: AssetId?,
val image: ContractImage,
val imageHash: ContractImageHash,
val contractName: ContractName,
Expand All @@ -51,8 +51,8 @@ data class CallContractTransaction(
override val params: List<DataEntry>,
override val fee: Fee,
override val version: TxVersion,
override val proof: Signature,
override val proof: Signature?,
override val timestamp: Timestamp,
override val feeAssetId: AssetId,
override val feeAssetId: AssetId?,
val contractVersion: ContractVersion,
) : ContractTransaction
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.wavesenterprise.sdk.node.domain.contract
data class ContractVersion(val value: Int) {
companion object {
@JvmStatic
fun fromInt(value: Int): ContractVersion =
fun fromInt(value: Int):
ContractVersion =
ContractVersion(value)

inline val Int.contractVersion: ContractVersion get() = ContractVersion(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.wavesenterprise.sdk.node.domain.converter

import com.wavesenterprise.sdk.node.domain.AssetId
import com.wavesenterprise.sdk.node.domain.FeeAssetId
import com.wavesenterprise.sdk.node.domain.Hash
import com.wavesenterprise.sdk.node.domain.TxType
import com.wavesenterprise.sdk.node.domain.contract.CallContractTransaction
import com.wavesenterprise.sdk.node.domain.contract.ContractId
import com.wavesenterprise.sdk.node.domain.contract.ContractImageHash
import com.wavesenterprise.sdk.node.domain.contract.CreateContractTransaction
import com.wavesenterprise.sdk.node.domain.tx.CallContractTx
import com.wavesenterprise.sdk.node.domain.tx.ContractTx
import com.wavesenterprise.sdk.node.domain.tx.CreateContractTx

fun ContractTx.toContractTransaction() = when (this) {
is CreateContractTx -> CreateContractTransaction(
id = id,
type = TxType.CREATE_CONTRACT,
sender = senderAddress,
senderPublicKey = senderPublicKey,
contractId = ContractId(id),
params = params,
fee = fee,
version = version,
proof = proofs?.first(),
timestamp = timestamp,
feeAssetId = feeAssetId?.toContractTransaction(),
image = image,
imageHash = imageHash.toContractTransaction(),
contractName = contractName
)
is CallContractTx -> CallContractTransaction(
id = id,
type = TxType.CALL_CONTRACT,
sender = senderAddress,
senderPublicKey = senderPublicKey,
contractId = contractId,
params = params,
fee = fee,
version = version,
proof = proofs?.first(),
timestamp = timestamp,
feeAssetId = feeAssetId?.toContractTransaction(),
contractVersion = contractVersion,
)
}

fun FeeAssetId.toContractTransaction() = AssetId(
bytes = this.txId.bytes,
)

fun Hash.toContractTransaction() = ContractImageHash(
imageHash = this.asHexString()
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import com.wavesenterprise.sdk.node.domain.tx.AtomicTx

data class AtomicSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val txs: List<AtomicSignInnerTx<*>>,
) : SignRequest<AtomicTx>
) : SignRequest<AtomicTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ import com.wavesenterprise.sdk.node.domain.tx.BurnTx

data class BurnSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val assetId: AssetId? = null,
val quantity: Quantity,
val attachment: Attachment? = null,
) : SignRequest<BurnTx>
) : SignRequest<BurnTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ import com.wavesenterprise.sdk.node.domain.Password
import com.wavesenterprise.sdk.node.domain.TxVersion
import com.wavesenterprise.sdk.node.domain.atomic.AtomicBadge
import com.wavesenterprise.sdk.node.domain.contract.ContractId
import com.wavesenterprise.sdk.node.domain.contract.ContractVersion
import com.wavesenterprise.sdk.node.domain.tx.CallContractTx

data class CallContractSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val feeAssetId: FeeAssetId? = null,
val contractVersion: ContractVersion,
val contractId: ContractId,
val params: List<DataEntry>,
val atomicBadge: AtomicBadge? = null,
) : SignRequest<CallContractTx>
) : ContractSignRequest<CallContractTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wavesenterprise.sdk.node.domain.sign

import com.wavesenterprise.sdk.node.domain.tx.ContractTx

sealed interface ContractSignRequest<T : ContractTx> : SignRequest<T>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ import com.wavesenterprise.sdk.node.domain.tx.CreateAliasTx

data class CreateAliasSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val feeAssetId: FeeAssetId? = null,
val alias: Alias,
) : SignRequest<CreateAliasTx>
) : SignRequest<CreateAliasTx> {

override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import com.wavesenterprise.sdk.node.domain.tx.CreateContractTx

data class CreateContractSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val feeAssetId: FeeAssetId? = null,
val image: ContractImage,
Expand All @@ -27,4 +27,9 @@ data class CreateContractSignRequest(
val apiVersion: ContractApiVersion? = null,
val validationPolicy: ValidationPolicy? = null,
val atomicBadge: AtomicBadge? = null,
) : SignRequest<CreateContractTx>
) : ContractSignRequest<CreateContractTx> {

override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import com.wavesenterprise.sdk.node.domain.tx.CreatePolicyTx

data class CreatePolicySignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val feeAssetId: FeeAssetId? = null,
val policyName: PolicyName,
val recipients: List<Address>,
val owners: List<Address>,
val description: PolicyDescription,
val atomicBadge: AtomicBadge? = null,
) : SignRequest<CreatePolicyTx>
) : SignRequest<CreatePolicyTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import com.wavesenterprise.sdk.node.domain.tx.DataTx

data class DataSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val feeAssetId: FeeAssetId? = null,
val author: Address,
val data: List<PermitDataEntry>,
) : SignRequest<DataTx>
) : SignRequest<DataTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ import com.wavesenterprise.sdk.node.domain.tx.DisableContractTx

data class DisableContractSignRequest(
val version: TxVersion? = null,
val senderAddress: Address,
val password: Password? = null,
override val senderAddress: Address,
override val password: Password? = null,
val fee: Fee,
val contractId: ContractId,
val feeAssetId: FeeAssetId? = null,
val atomicBadge: AtomicBadge? = null,
) : SignRequest<DisableContractTx>
) : SignRequest<DisableContractTx> {
override fun withAddress(address: Address) = copy(senderAddress = address)

override fun withPassword(password: Password) = copy(password = password)
}
Loading

0 comments on commit 339fd49

Please sign in to comment.