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