Skip to content

Safeheron/safeheron-api-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java SDK for Safeheron API

Maven GitHub last commit GitHub top language

API Documentation

Usage

Download and build

$ git clone https://github.com/Safeheron/safeheron-api-sdk-java.git
$ cd safeheron-api-sdk-java
$ mvn install -Dmaven.test.skip=true

Test

Test Create Wallet Account

  • Before run the test code, modify src/test/resources/demo/api/account/config.yaml.example according to the comments

    # Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    apiKey: 080d****e06e60
    # Your private key
    privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
    # Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
    # Safeheron API url
    baseUrl: https://api.safeheron.vip
    # RequestTimeout (Millisecond), Default: 20000
    requestTimeout: 20000
  • Copy config to config.yaml file.

    $ cd src/test/resources/demo/api/account
    $ cp config.yaml.example config.yaml
  • JUnit

    Execute testCreateAccountAndAddCoin unit in /src/test/java/com/safeheron/demo/api/account/CreateAccountTest.java Java file.

Test Send A Transaction

  • Before run the test code, modify src/test/resources/demo/api/transaction/config.yaml.example according to the comments

    # Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    apiKey: 080d****e06e60
    # Your private key
    privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
    # Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
    # Safeheron API url
    baseUrl: https://api.safeheron.vip
    # RequestTimeout (Millisecond), Default: 20000
    requestTimeout: 20000
    # Wallet Account key
    accountKey: account****5ecad40
    # To address
    destinationAddress: "0x943****0BF95f5"
  • Copy config to config.yaml file.

    $ cd src/test/resources/demo/api/transaction
    $ cp config.yaml.example config.yaml
  • JUnit

    Execute testSendTransaction unit in /src/test/java/com/safeheron/demo/api/transaction/TransactionTest.java Java file.

Test MPC Sign

  • Before run the test code, modify src/test/resources/demo/api/mpcsign/config.yaml.example according to the comments

    # Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    apiKey: 080d****e06e60
    # Your private key
    privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
    # Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
    safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
    # Safeheron API url
    baseUrl: https://api.safeheron.vip
    # RequestTimeout (Millisecond), Default: 20000
    requestTimeout: 20000
    # Wallet Account key
    accountKey: account****5ecad40
    # Goerli testnet token address in wallet account
    accountTokenAddress: "0x970****4ffD59"
    # erc20 token contract address
    erc20ContractAddress: "0x078****Eaa37F"
    # address to receive token
    toAddress: "0x53B****321789"
    # Ethereum RPC API
    ethereumRpcApi: https://goerli.infura.io/v3/802******bc2fcb
  • Copy config to config.yaml file.

    $ cd src/test/resources/demo/api/mpcsign
    $ cp config.yaml.example config.yaml
  • JUnit

    Execute testSendToken unit in /src/test/java/com/safeheron/demo/api/mpcsign/MpcSignTest.java Java file.