클레이튼 개발자 문서 바로가기 함수 호출에 필요한 매개변수 또는 반환되는 데이터에 대해서는 REST API 개발자 문서를 참고해 주시길 바랍니다.
package main
import (
"fmt"
blocksdk "github.com/Block-Chen/blocksdk-go"
)
func main() {
klayClient := blocksdk.NewKlaytn("YOU_TOKEN", "https://testnet-api.blocksdk.com/")
}
package main
import (
"fmt"
blocksdk "github.com/Block-Chen/blocksdk-go"
)
func main() {
klayClient := blocksdk.NewKlaytn("YOU_TOKEN", "https://mainnet-api.blocksdk.com/")
}
GET /v3/klay/info
result, err := klayClient.GetBlockChainInfo()
GET /v3/klay/block/<block>
result, err := klayClient.GetBlock(map[string]interface{}{
"block" : "blockNumber 또는 blockHash",
});
GET /v3/klay/address
result, err := klayClient.GetAddresses(map[string]interface{}{
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/address/<address>/info
result, err := klayClient.GetAddressInfo(map[string]interface{}{
"address" : "주소",
"offset" : "0",
"limit" : "10",
});
POST /v3/klay/address
result, err := klayClient.CreateAddress(map[string]interface{}{
"name" : "test",
});
GET /v3/klay/address/<address>/balance
result, err := klayClient.GetAddressBalance(map[string]interface{}{
"address" : "주소",
});
POST /v3/klay/address/<from_address>/send
result, err := klayClient.Send(map[string]interface{}{
"from" : "주소",
"to" : "주소",
"amount" : "보낼 양",
"private_key" : "보내는 주소 키",
});
POST /v3/klay/transaction/send
result, err := klayClient.SendTransaction(map[string]interface{}{
"hex" : "서명된 트랜잭션 hex",
});
GET /v3/klay/transaction/<tx_hash>
result, err := klayClient.GetTransaction(map[string]interface{}{
"hash" : "트랜잭션 해쉬",
});
GET /v3/klay/token/<contract_address>/info
result, err := klayClient.GetTokenInfo(map[string]interface{}{
"contract_address" : "ERC20 토큰 컨트렉트 주소",
});
GET /v3/klay/token/<contract_address>/<from_address>/balance
result, err := klayClient.GetTokenBalance(map[string]interface{}{
"contract_address" : "ERC20 토큰 컨트렉트 주소",
"from_address" : "잔액을 조회할 주소",
});
POST /v3/klay/token/<contract_address>/<from_address>/transfer
result, err := klayClient.SendToken(map[string]interface{}{
"contract_address" : "ERC20 토큰 컨트렉트 주소",
"from_address" : "토큰을 전송할 주소",
"to" : "주소",
"amount" : "보낼 양",
"private_key" : "보내는 주소 키",
});
GET /v3/klay/token/<from_address>/transactions
result, err := klayClient.GetTokenTxs(map[string]interface{}{
"from_address" : "거래 내역을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/token/<contract_address>/<from_address>/transactions
result, err := klayClient.GetTokenContractTxs(map[string]interface{}{
"contract_address" : "ERC20 토큰 컨트렉트 주소",
"from_address" : "거래 내역을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/token/<from_address>/all-balance
result, err := klayClient.GetTokenAllBalance(map[string]interface{}{
"from_address" : "토큰 목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/nfts
result, err := klayClient.GetSingleNfts(map[string]interface{}{
"contract_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<owner_address>/owner-nfts
result, err := klayClient.GetSingleOwnerNfts(map[string]interface{}{
"owner_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<creator_address>/creator-nfts
result, err := klayClient.GetSingleCreatorNfts(map[string]interface{}{
"creator_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<from_address>/transactions
result, err := klayClient.GetSingleTxs(map[string]interface{}{
"from_address" : "토큰 목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/<owner_address>/owner-nfts
result, err := klayClient.GetSingleNftOwnerNfts(map[string]interface{}{
"contract_address" : "컨트렉트 주소",
"owner_address" : "월렛 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/<creator_address>/creator-nfts
result, err := klayClient.GetSingleNftCreatorNfts(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"creator_address" : "토큰 목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/<from_address>/from-transactions
result, err := klayClient.GetSingleNftTxs(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"from_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/<token_id>/nft-transactions
result, err := klayClient.GetSingleNftTokenTxs(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"token_id" : "NFT 토큰 ID",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/single-nft/<contract_address>/<token_id>/info
result, err := klayClient.GetSingleNftInfo(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"token_id" : "NFT 토큰 ID",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/nfts
result, err := klayClient.GetMultiNfts(map[string]interface{}{
"contract_address" :"NFT 컨트렉트 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<owner_address>/owner-nfts
result, err := klayClient.GetMultiOwnerNfts(map[string]interface{}{
"owner_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<creator_address>/creator-nfts
result, err := klayClient.GetMultiCreatorNfts(map[string]interface{}{
"creator_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<from_address>/transactions
result, err := klayClient.GetMultiTxs(map[string]interface{}{
"from_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/<owner_address>/owner-nfts
result, err := klayClient.GetMultiNftOwnerNfts(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"owner_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/<creator_address>/creator-nfts
result, err := klayClient.GetMultiNftCreatorNfts(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"creator_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/<from_address>/from-transactions
result, err := klayClient.GetMultiNftTxs(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"from_address" : "목록을 조회할 주소",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/<token_id>/info
result, err := klayClient.GetMultiNftInfo(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"token_id" : "NFT 토큰 ID",
"offset" : "0",
"limit" : "10",
});
GET /v3/klay/multi-nft/<contract_address>/<token_id>/nft-transactions
result, err := klayClient.GetMultiNftTokenTxs(map[string]interface{}{
"contract_address" : "NFT 컨트렉트 주소",
"token_id" : "NFT 토큰 ID",
"offset" : "0",
"limit" : "10",
});
POST /v3/klay/contract/<contract_address>/read
result, err := klayClient.ReadContract(map[string]interface{}{
"contract_address" : "컨트렉트 주소",
"method" : "실행할 함수 명",
"return_type" : "반환 데이터 타입",
"parameter_type" : []interface{}{"인풋 파라미터 타입"},
"parameter_data" : []interface{}{"인풋 파라미터 데이터"},
});
POST /v3/klay/contract/<contract_address>/write
result, err := klayClient.WriteContract(map[string]interface{}{
"contract_address" : "컨트렉트 주소",
"from" : "트랜잭션을 생성할 주소",
"private_key" : "from 의 프라이빗키",
"method" : "실행할 함수 명",
"parameter_type" : []interface{}{"인풋 파라미터 타입"},
"parameter_data" : []interface{}{"인풋 파라미터 데이터"},
});