Installation

add dependency

go get github.com/CoboGlobal/[email protected]

Test

cd cobo_custody
go test -env develop/prod -secret <yourApiSecret>

Usage

Initialize

Generate Key Pair

import "github.com/CoboGlobal/cobo-go-api/cobo_custody"

apiSecret, apiKey := cobo_custody.GenerateKeyPair()
println("API_SECRET:", apiSecret)
println("API_KEY:", apiKey)

Please refer to the link for how to use apiKey

Initialize RestClient

import "github.com/CoboGlobal/cobo-go-api/cobo_custody"
var client = cobo_custody.Client{
  Signer:  localSigner,
  Env: cobo.Develop(),
}

Initialize ApiSigner

ApiSigner can be instantiated through

import "github.com/CoboGlobal/cobo-go-api/cobo_custody"

var localSigner = cobo_custody.LocalSigner{
		PrivateKey: "apiSecret",
	}

In some cases, your private key cannot be exported, for example, your private key is in aws kms, you should pass in your own implementation by implements ApiSigner interface

Account

Check Account Details

client.GetAccountInfo()

Get Coin Details

client.GetCoinInfo("ETH")

Get New Deposit Address

client.NewDepositAddress("BTC", false)

Batch New Deposit Address

client.BatchNewDepositAddress("ETH", 3, false)

Verify Deposit Address

client.VerifyDepositAddress("BTC", "3Qd8ZV4DWxMPK1HfitxccZXV2H8mCST3kM")

Batch Verify Deposit Address

client.BatchVerifyDepositAddress("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee,0x05325e6f9d1f0437bd78a72c2ae084fbb8c039e1")

Verify Valid Address

client.VerifyValidAddress("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee")

Get Address History List

client.GetAddressHistory("ETH")

Get Address History List With Page

client.GetAddressHistoryWithPage(map[string]string{})

Loop Alliance

Check Loop Address Details

client.CheckLoopAddressDetails("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee","")

Verify Loop Address List

client.VerifyLoopAddressList("ETH", "0xe7ebdc5bbb6c99cc8f7f2c1c83ff38aa6647f38a,0xe7ebdc5bbb6c99cc8f7f2c1c83ff38aa6647f38a")

Loop Transaction Explorer

To help your user to check the Loop transaction, we offer you an explorer, you may insert the following URL in your platform:https://loop.top/tx/[Loop_ID] e.g. https://loop.top/tx/L456e5cb652dcfe557a43fd9d8e48627

Transactions

Get Transaction Details

client.GetTransactionDetails("20210422193807000343569000002370")

Get Transactions By Txid

client.GetTransactionsByTxid("0x5d5396c3992ed524bf68a22a7ab6ae503f0349354ad69bc5204d5214085d4e9f")

Obtain the list of confirmed transactions through ID query(deposit&withdraw)

client.GetTransactionsById(map[string]string{})

Obtain the list of confirmed transactions through time query(deposit&withdraw)

client.GetTransactionsByTime(map[string]string{})

Get Pending Transactions

client.GetPendingTransactions(map[string]string{})

Get Pending Deposit Details

client.GetPendingTransaction("20200604171238000354106000006405")

Get Transaction History

client.GetTransactionHistory(map[string]string{})

Withdrawal

Submit Withdraw Request

client.Withdraw("TETH",
"",
"0xb744adc8d75e115eec8e582eb5e8d60eb0972037",
big.NewInt(1),
map[string]string{})

Get Withdraw Information

client.QueryWithdrawInfo("teth29374893624")

Staking

Get a Staking Product Details

client.GetStakingProductDetails("159328", "zh")

Get All Staking Product List

client.GetStakingProductList()

Stake

client.Stake("159328", big.NewInt(1000000))

Unstake

client.Unstake("159328", big.NewInt(1000000))

Get Staking Data

client.GetStakings("IOST","en")

Get Unstaking Data

client.GetUnstakings("DASH")

Get All Staking History

client.GetStakingHistory()