Skip to content

Commit

Permalink
chore: rename package 'ln.v2' -> 'sdk' (#6)
Browse files Browse the repository at this point in the history
* chore: rename package 'ln.v2' -> 'sdk'
* chore: update submodule for finschia
  • Loading branch information
jaeseung-bae committed Apr 19, 2023
1 parent 9868374 commit c0331b3
Show file tree
Hide file tree
Showing 73 changed files with 160 additions and 161 deletions.
16 changes: 8 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "lbm-sdk"]
path = protobuf/repositories/lbm-sdk
url = https://github.com/line/lbm-sdk.git
[submodule "wasmd"]
path = protobuf/repositories/wasmd
url = https://github.com/line/wasmd.git
[submodule "ibc-go"]
[submodule "protobuf/repositories/finschia-sdk"]
path = protobuf/repositories/finschia-sdk
url = https://github.com/Finschia/finschia-sdk
[submodule "protobuf/repositories/ibc-go"]
path = protobuf/repositories/ibc-go
url = https://github.com/line/ibc-go.git
url = https://github.com/Finschia/ibc-go
[submodule "protobuf/repositories/wasmd"]
path = protobuf/repositories/wasmd
url = https://github.com/Finschia/wasmd
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Added

### Changed
* [\#6](https://github.com/Finschia/finschia-kt/pull/6) Rename package 'ln.v2' -> 'sdk'

### Deprecated

Expand All @@ -52,9 +53,9 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Build, CI

* (build) [\#4](https://github.com/line/finschia-kt/pull/4) Add gradle `updateSubmodule` task and `checkoutSubModule` task to run `git submodule update --init --remote` with specific version before `build task`
* (build) [\#4](https://github.com/Finschia/finschia-kt/pull/4) Add gradle `updateSubmodule` task and `checkoutSubModule` task to run `git submodule update --init --remote` with specific version before `build task`

### Document Updates

<!-- Release links -->
[Unreleased]: https://github.com/line/finschia-kt/compare/8aa2005...HEAD
[Unreleased]: https://github.com/Finschia/finschia-kt/compare/8aa2005...HEAD
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# finschia-kt

gRPC client library in kotlin for finschia (https://github.com/line/finschia).
gRPC client library in kotlin for finschia (https://github.com/Finschia/finschia).

Requires [lbm-sdk v0.47.0-alpha1](https://github.com/line/lbm-sdk/tree/v0.47.0-alpha1)
Requires [finschia-sdk v0.47.0-alpha1](https://github.com/Finschia/finschia-sdk/tree/v0.47.0-alpha1)

Current lbm-sdk version applied to finschia-kt/protobuf is [lbm-sdk v0.47.0-alpha1](https://github.com/line/lbm-sdk/tree/v0.47.0-alpha1)
Current finschia-sdk version applied to finschia-kt/protobuf is [finschia-sdk v0.47.0-alpha1](https://github.com/Finschia/finschia-sdk/tree/v0.47.0-alpha1)

## Build

Expand All @@ -15,20 +15,20 @@ $ git submodule update --init
$ ./gradlew build
```

Note that any version of finschia-kt is only compatible with a certain lbm-sdk version. The corresponding lbm-sdk
version that the current repository supports can be found in the tag or commit hash of `proto/repositories/lbm-sdk`
Note that any version of finschia-kt is only compatible with a certain finschia-sdk version. The corresponding finschia-sdk
version that the current repository supports can be found in the tag or commit hash of `proto/repositories/finschia-sdk`
submodule, using the following command.

```shell
$ cd protobuf/repositories/lbm-sdk && git describe --always && cd -
$ cd protobuf/repositories/finschia-sdk && git describe --always && cd -
```

If you are a finschia-kt developer or contributor and trying to use another version of lbm-sdk, `git checkout`
the appropriate version in the lbm-sdk submodule before building this repository. The following command is an example
of using lbm-sdk `v0.47.0-alpha1`.
If you are a finschia-kt developer or contributor and trying to use another version of finschia-sdk, `git checkout`
the appropriate version in the finschia-sdk submodule before building this repository. The following command is an example
of using finschia-sdk `v0.47.0-alpha1`.

```shell
$ cd protobuf/repositories/lbm-sdk && git checkout v0.47.0-alpha1 && cd -
$ cd protobuf/repositories/finschia-sdk && git checkout v0.47.0-alpha1 && cd -
```

## How to use
Expand Down Expand Up @@ -88,9 +88,9 @@ The former is using the tx wrapper, while the latter does not use the wrapper.

## How to run `without-tx-wrapper-example`

### 1. Run lbm-sdk simapp
### 1. Run finschia-sdk simapp

Build with reference to [Quick Start build](https://github.com/line/lbm-sdk/tree/v0.47.0-alpha1#quick-start).
Build with reference to [Quick Start build](https://github.com/Finschia/finschia-sdk/tree/v0.47.0-alpha1#quick-start).

Initialize and configure simapp.

Expand All @@ -114,7 +114,7 @@ $ simd start --home ~/simapp
### 2. Replace hard-coded arguments

To confirm it's possible to send transactions to the chain created above using finschia-kt, replace the following
three parts of the [without-tx-wrapper-example/src/main/kotlin/network/link/ln/v2/example/Client.kt](https://github.com/line/finschia-kt/blob/main/examples/without-tx-wrapper-example/src/main/kotlin/network/link/ln/v2/example/Client.kt).
three parts of the [without-tx-wrapper-example/src/main/kotlin/network/link/sdk/example/Client.kt](https://github.com/Finschia/finschia-kt/blob/main/examples/without-tx-wrapper-example/src/main/kotlin/network/link/sdk/example/Client.kt).

1. **Chain ID**: constant of the name `CHAIN_ID` in `ConcreteScenarios`
```go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id("network.finschia.ln.v2.kotlin-common-conventions")
id("network.finschia.sdk.kotlin-common-conventions")

// Apply the application plugin to add support for building a CLI application in Java.
application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id("network.finschia.ln.v2.kotlin-common-conventions")
id("network.finschia.sdk.kotlin-common-conventions")

// Apply the java-library plugin for API and implementation separation.
`java-library`
Expand Down
2 changes: 1 addition & 1 deletion crypto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("network.finschia.ln.v2.kotlin-library-conventions")
id("network.finschia.sdk.kotlin-library-conventions")
}

val guavaVersion = "28.1-jre"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.io.ByteArrayOutputStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import static network.finschia.ln.v2.crypto.LinkKeys.PRIVATE_KEY_SIZE;
import static network.finschia.ln.v2.crypto.SecureRandomUtils.secureRandom;
import static org.web3j.crypto.Bip32ECKeyPair.HARDENED_BIT;

import org.bouncycastle.util.BigIntegers;
Expand All @@ -19,15 +17,15 @@ private Bip44WalletUtils() {}

public static String generateMnemonic() {
final byte[] initialEntropy = new byte[16];
secureRandom().nextBytes(initialEntropy);
SecureRandomUtils.secureRandom().nextBytes(initialEntropy);
return MnemonicUtils.generateMnemonic(initialEntropy);
}

public static byte[] generatePrivateKey(String mnemonic, int accountNumber, int index) {
final byte[] seed = MnemonicUtils.generateSeed(mnemonic, null);
final Bip32ECKeyPair masterKeypair = Bip32ECKeyPair.generateKeyPair(seed);
final Bip32ECKeyPair bip44Keypair = generateBip44KeyPair(masterKeypair, accountNumber, index);
return BigIntegers.asUnsignedByteArray(PRIVATE_KEY_SIZE, bip44Keypair.getPrivateKey());
return BigIntegers.asUnsignedByteArray(LinkKeys.PRIVATE_KEY_SIZE, bip44Keypair.getPrivateKey());
}

static Bip32ECKeyPair generateBip44KeyPair(Bip32ECKeyPair master, int accountNumber, int index) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.math.BigInteger;
import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import static network.finschia.ln.v2.crypto.Amino.addAminoPrefix;
import static network.finschia.ln.v2.crypto.Amino.removeAminoPrefix;
import static network.finschia.ln.v2.crypto.SecureRandomUtils.secureRandom;
import static network.finschia.sdk.crypto.Amino.addAminoPrefix;
import static network.finschia.sdk.crypto.Amino.removeAminoPrefix;
import static network.finschia.sdk.crypto.SecureRandomUtils.secureRandom;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import static network.finschia.ln.v2.crypto.SecureRandomUtils.secureRandom;
import static network.finschia.sdk.crypto.SecureRandomUtils.secureRandom;

import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.security.SecureRandom;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.crypto;
package network.finschia.sdk.crypto;

import java.util.Arrays;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account
package network.finschia.sdk.account

/**
* Account interface represents the account information such as address, account number, sequence number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account
package network.finschia.sdk.account

import network.finschia.ln.v2.account.Type.ACCOUNT
import network.finschia.ln.v2.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import network.finschia.ln.v2.account.Type.Companion.toHrpPrefix
import network.finschia.ln.v2.crypto.Bech32Utils
import network.finschia.sdk.account.Type.ACCOUNT
import network.finschia.sdk.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import network.finschia.sdk.account.Type.Companion.toHrpPrefix
import network.finschia.sdk.crypto.Bech32Utils
import org.bitcoinj.core.Bech32
import org.bouncycastle.jcajce.provider.digest.RIPEMD160
import org.bouncycastle.jcajce.provider.digest.SHA256
Expand Down Expand Up @@ -118,7 +118,8 @@ class Address private constructor(val type: Type, val body: ByteArray) {
*/
@JvmStatic
@JvmName("of")
operator fun invoke(body: ByteArray): Address = invoke(ACCOUNT, body)
operator fun invoke(body: ByteArray): Address =
invoke(ACCOUNT, body)

/**
* initiates an address from [bech32Address]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package network.finschia.ln.v2.account
package network.finschia.sdk.account

import java.math.BigInteger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account
package network.finschia.sdk.account

import network.finschia.ln.v2.crypto.Bip44WalletUtils.generateMnemonic
import network.finschia.ln.v2.crypto.Bip44WalletUtils.generatePrivateKey
import network.finschia.sdk.crypto.Bip44WalletUtils.generateMnemonic
import network.finschia.sdk.crypto.Bip44WalletUtils.generatePrivateKey
import java.security.InvalidAlgorithmParameterException
import java.security.NoSuchAlgorithmException
import java.security.NoSuchProviderException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account
package network.finschia.sdk.account

import network.finschia.ln.v2.account.PubKey.Companion.createFromPrivateKey
import network.finschia.ln.v2.crypto.ECDSASignature
import network.finschia.ln.v2.crypto.KeyStore
import network.finschia.ln.v2.crypto.LinkKeys
import network.finschia.sdk.account.PubKey.Companion.createFromPrivateKey
import network.finschia.sdk.crypto.ECDSASignature
import network.finschia.sdk.crypto.KeyStore
import network.finschia.sdk.crypto.LinkKeys
import java.io.InputStream
import java.io.OutputStream
import java.io.Reader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account

import network.finschia.ln.v2.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import network.finschia.ln.v2.account.Type.Companion.toHrpPrefix
import network.finschia.ln.v2.common.TypedValue
import network.finschia.ln.v2.crypto.Amino
import network.finschia.ln.v2.crypto.Bech32Utils
import network.finschia.ln.v2.crypto.LinkKeys
package network.finschia.sdk.account

import network.finschia.sdk.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import network.finschia.sdk.account.Type.Companion.toHrpPrefix
import network.finschia.sdk.common.TypedValue
import network.finschia.sdk.crypto.Amino
import network.finschia.sdk.crypto.Bech32Utils
import network.finschia.sdk.crypto.LinkKeys
import org.bitcoinj.core.Bech32
import org.bouncycastle.util.encoders.Hex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.finschia.ln.v2.account
package network.finschia.sdk.account

/**
* Defines the types of Addresses and PubKeys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.account
package network.finschia.sdk.account

/**
* Wallet class signs the message using own keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.common
package network.finschia.sdk.common

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.JsonSerializer
import com.fasterxml.jackson.databind.PropertyNamingStrategy
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.module.kotlin.KotlinModule
import network.finschia.ln.v2.account.Type
import network.finschia.sdk.account.Type

/**
* Predefined basic JSON serializing and deserializing rules for Jackson-databind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package network.finschia.ln.v2.common
package network.finschia.sdk.common

/**
* An interface of converter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package network.finschia.ln.v2.common
package network.finschia.sdk.common

import org.bouncycastle.util.encoders.Hex

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package network.finschia.ln.v2.common
package network.finschia.sdk.common

/**
* Container to ease passing around a key and value pair
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package network.finschia.ln.v2.common
package network.finschia.sdk.common

import network.finschia.ln.v2.account.Address
import network.finschia.ln.v2.account.PubKey
import network.finschia.ln.v2.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import network.finschia.sdk.account.Address
import network.finschia.sdk.account.PubKey
import network.finschia.sdk.account.Type.Companion.DEFAULT_BECH32_HRP_PREFIX
import java.lang.reflect.Type
import java.math.BigInteger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package network.finschia.ln.v2.common
package network.finschia.sdk.common

/**
* Wraps an object with type to recognize struct to unmarshal.
Expand Down
Loading

0 comments on commit c0331b3

Please sign in to comment.