Skip to content

Commit

Permalink
Merge pull request #18 from AElfProject/dev
Browse files Browse the repository at this point in the history
Release v1.2.3
  • Loading branch information
jason-aelf authored Mar 9, 2023
2 parents 9510f8d + 6fd0708 commit 3bafe34
Show file tree
Hide file tree
Showing 108 changed files with 12,426 additions and 6,975 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN /bin/bash build.sh
43 changes: 30 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@

This is a Golang client library, used to communicate with the [AElf](https://github.com/AElfProject/AElf) API.

### Getting Started

You should build the "AElf_SDK" project
### Requirement

- Protobuff 3.7.1
- Go 1.13.7
- VsCode

### Basic usage

Example.go is provided to show how to use AElfClient.

``` Golang
private const string BaseUrl = "Http://127.0.0.1:8000";
import ("github.com/AElfProject/aelf-sdk.go/client")
// get client instance
AElfClient aelf = client.AElfClient{Host:BaseUrl}
var height = aelf.GetBlockHeight();
var aelf = client.AElfClient
{
Host: "http://127.0.0.1:8000",
Version: "1.0",
PrivateKey: "680afd630d82ae5c97942c4141d60b8a9fedfa5b2864fca84072c17ee1f72d9d",
}
height, err := aelf.GetBlockHeight()
```


Expand Down Expand Up @@ -92,39 +101,47 @@ func (a *AElfClient) SendTransactions(rawTransactions string) ([]string, error);

func (a *AElfClient) GetAddressFromPubKey(pubkey string) string;

func (a *AElfClient) GetAddressFromPrivateKey(privateKey string, compress = false bool) string;
func (a *AElfClient) GetAddressFromPrivateKey(privateKey string) string;

func (a *AElfClient) GetGenesisContractAddress() (string, error);

func (a *AElfClient) GetContractAddressByName(contractName []byte) (string, error);

func (a *AElfClient) GenerateKeyPairInfo() *model.KeyPairInfo;

func GetSignatureWithPrivateKey(privateKey string, txData []byte) (string, error)
```

### Test

This module contains tests for all services provided by AElfClient. You can see how to properly use services provided by AElfClient here.
This module contains tests for all services provided by AElfClient. You can learn how to properly use services provided by AElfClient here.

You need to firstly set necessary parameters to make sure tests can run successfully.

1. Set baseUrl to your target url.

```Golang
string BaseUrl = "Http://127.0.0.1:8000";
Host: "http://127.0.0.1:8000"
```

2. Give a valid privateKey of a node.

```Golang
string PrivateKey = "680afd630d82ae5c97942c4141d60b8a9fedfa5b2864fca84072c17ee1f72d9d";
PrivateKey: "680afd630d82ae5c97942c4141d60b8a9fedfa5b2864fca84072c17ee1f72d9d"
```

3. You can optionally run a test case by specifying the name of a test case.

```Golang
cd test/
go test -v -run TestGetChainStatus
```

### ProtoBuff Build
Compile protobuff before secondary development.
You need to go to the resource directory.

Linxu Or Mac ./protobuff.sh
Default classes defined in the "protobuf/proto" are available in the directory named "protobuf/generated".

You can add new proto files and generate types by using the script `./protobuff.sh`.

### Note

Expand Down
14 changes: 0 additions & 14 deletions aelf_sdk/dto/blockHeaderDto.go

This file was deleted.

15 changes: 0 additions & 15 deletions aelf_sdk/dto/transactionResultDto.go

This file was deleted.

212 changes: 0 additions & 212 deletions aelf_sdk/protobuf/generated/aedposContract.pb.go

This file was deleted.

Loading

0 comments on commit 3bafe34

Please sign in to comment.