Skip to content

BinanceSmart SDK

blockchen-admin edited this page Jun 5, 2022 · 1 revision

๋ฐ”์ด๋‚ธ์Šค ์Šค๋งˆํŠธ ์ฒด์ธ V3 REST API ๋ฌธ์„œ

๋ฐ”์ด๋‚ธ์Šค ์Šค๋งˆํŠธ ์ฒด์ธ ๊ฐœ๋ฐœ์ž ๋ฌธ์„œ ๋ฐ”๋กœ๊ฐ€๊ธฐ ํ•จ์ˆ˜ ํ˜ธ์ถœ์— ํ•„์š”ํ•œ ๋งค๊ฐœ๋ณ€์ˆ˜ ๋˜๋Š” ๋ฐ˜ํ™˜๋˜๋Š” ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•ด์„œ๋Š” REST API ๊ฐœ๋ฐœ์ž ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•ด ์ฃผ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค.

ํด๋ผ์ด์–ธํŠธ ์ƒ์„ฑ (ํ…Œ์ŠคํŠธ๋„ท)

<?php
use BlockSDK;

$blockSDK = new BlockSDK("YOU_TOKEN");
$bscClient = $blockSDK->createBinanceSmart();

//or

$bscClient = BlockSDK::createBinanceSmart("YOU_TOKEN");

ํด๋ผ์ด์–ธํŠธ ์ƒ์„ฑ (๋ฉ”์ธ๋„ท)

์—”๋“œ ํฌ์ธํŠธ๋ฅผ ์ง€์ •ํ•ด์ฃผ์ง€ ์•Š๋Š”๊ฒฝ์šฐ ํ…Œ์ŠคํŠธ๋„ท์œผ๋กœ ๊ธฐ๋ณธ ์„ค์ •๋˜์–ด ํ˜ธ์ถœ ๋ฉ๋‹ˆ๋‹ค ๋ฉ”์ธ๋„ท์€ ์•„๋ž˜ ์˜ˆ์‹œ์™€ ๊ฐ™์ด ํด๋ผ์ด์–ธํŠธ ์ƒ์„ฑ์‹œ ๋‘๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋ฉ”์ธ๋„ท์œผ๋กœ ์ง€์ •ํ•ด ์ฃผ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค.

<?php
use BlockSDK;

$blockSDK = new BlockSDK("YOU_TOKEN","https://mainnet-api.blocksdk.com");
$bscClient = $blockSDK->createBinanceSmart();

//or

$bscClient = BlockSDK::createBinanceSmart("YOU_TOKEN","https://mainnet-api.blocksdk.com");

๊ทœ์•ฝ

๋ชจ๋“  URL,Query,Body ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ๋ชจ๋“  ํ•จ์ˆ˜๋Š” ์ฒซ๋ฒˆ์จฐ ์ธ์ˆ˜๋ฅผ Array ํ˜• ์œผ๋กœ key = ๋งค๊ฐœ๋ณ€์ˆ˜๋ช… value = ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ’ ํ˜•ํƒœ๋กœ ํ˜ธ์ถœํ•˜์‹ค์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

<?php
$nfts = $bscClient->GetSingleNfts([
    "contract_address" => "0xf5de760f2e916647fd766b4ad9e85ff943ce3a2b",
    "includeMetadata" => true,
    "offset" => 0,
    "limit" => 10
]);

๋ธ”๋ก์ฒด์ธ ์ •๋ณด

GET /v3/bsc/info
$result = $bscClient->GetBlockChainInfo();

๋ธ”๋ก ์ •๋ณด

GET /v3/bsc/block/<block>
$result = $bscClient->GetBlock([
    'block' => "blockNumber ๋˜๋Š” blockHash"
]);

์ฃผ์†Œ ๋ชฉ๋ก

GET /v3/bsc/address
$result = $bscClient->GetAddresses([
    'offset' => 0,
    'limit' => 10
]);

์ฃผ์†Œ ์ •๋ณด

GET /v3/bsc/address/<address>/info
$result = $bscClient->GetAddressInfo([
    'address' => "์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

์ฃผ์†Œ ์ƒ์„ฑ

POST /v3/bsc/address
$result = $bscClient->CreateAddress([
    'name' => "test"
]);

์ฃผ์†Œ ์ž”์•ก

GET /v3/bsc/address/<address>/balance
$result = $bscClient->GetAddressBalance([
    'address' => "์ฃผ์†Œ"
]);

์ฃผ์†Œ ๊ฑฐ๋ž˜ ์ „์†ก

POST /v3/bsc/address/<from_address>/send
$result = $bscClient->Send([
    'from_address' => "์ฃผ์†Œ",
    'to' => "์ฃผ์†Œ",
    'amount' => "๋ณด๋‚ผ ์–‘",
    'private_key' => "๋ณด๋‚ด๋Š” ์ฃผ์†Œ ํ‚ค"
]);

๊ฑฐ๋ž˜ ์ „์†ก

POST /v3/bsc/transaction/send
$result = $bscClient->SendTransaction([
    'hex' => "์„œ๋ช…๋œ ํŠธ๋žœ์žญ์…˜ hex"
]);

๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/transaction/<tx_hash>
$result = $bscClient->GetTransaction([
    'tx_hash' => "ํŠธ๋žœ์žญ์…˜ ํ•ด์‰ฌ"
]);

ERC20 ํ† ํฐ ์ •๋ณด

GET /v3/bsc/token/<contract_address>/info
$result = $bscClient->GetTokenInfo([
    'contract_address' => "ERC20 ํ† ํฐ ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ"
]);

ERC20 ํ† ํฐ ์ž”์•ก

GET /v3/bsc/token/<contract_address>/<from_address>/balance
$result = $bscClient->GetTokenInfo([
    'contract_address' => "ERC20 ํ† ํฐ ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from_address' => "์ž”์•ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ"
]);

ERC20 ํ† ํฐ ์ „์†ก

POST /v3/bsc/token/<contract_address>/<from_address>/transfer
$result = $bscClient->GetTokenInfo([
    'contract_address' => "ERC20 ํ† ํฐ ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from_address' => "ํ† ํฐ์„ ์ „์†กํ•  ์ฃผ์†Œ",
    'to' => "์ฃผ์†Œ",
    'amount' => "๋ณด๋‚ผ ์–‘",
    'private_key' => "๋ณด๋‚ด๋Š” ์ฃผ์†Œ ํ‚ค"
]);

ERC20 ํŠน์ • ์ฃผ์†Œ ๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/token/<from_address>/transactions
$result = $bscClient->GetTokenTxs([
    'from_address' => "๊ฑฐ๋ž˜ ๋‚ด์—ญ์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC20 ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ ๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/token/<contract_address>/<from_address>/transactions
$result = $bscClient->GetTokenContractTxs([
    'contract_address' => "ERC20 ํ† ํฐ ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from_address' => "๊ฑฐ๋ž˜ ๋‚ด์—ญ์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC20 ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ ๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/token/<from_address>/all-balance
$result = $bscClient->GetTokenAllBalance([
    'from_address' => "ํ† ํฐ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ NFT ๋ชฉ๋ก

GET /v3/bsc/single-nft/<contract_address>/nfts
$result = $bscClient->GetSingleNfts([
    'contract_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์›”๋ › ์†Œ์œ ์ค‘์ธ NFT ์กฐํšŒ

GET /v3/bsc/single-nft/<owner_address>/owner-nfts
$result = $bscClient->GetSingleOwnerNfts([
    'owner_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์›”๋ › ์ƒ์„ฑํ•œ NFT ์กฐํšŒ

GET /v3/bsc/single-nft/<creator_address>/creator-nfts
$result = $bscClient->GetSingleCreatorNfts([
    'creator_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์›”๋ › NFT ๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/single-nft/<from_address>/transactions
$result = $bscClient->GetSingleTxs([
    'from_address' => "ํ† ํฐ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ › ์˜ ์†Œ์œ ์ค‘์ธ NFT ์กฐํšŒ

GET /v3/bsc/single-nft/<contract_address>/<owner_address>/owner-nfts
$result = $bscClient->GetSingleNftOwnerNfts([
    'contract_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ ›์˜ ์ƒ์„ฑํ•œ NFT ์กฐํšŒ

GET /v3/bsc/single-nft/<contract_address>/<creator_address>/creator-nfts
$result = $bscClient->GetSingleNftCreatorNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'creator_address' => "ํ† ํฐ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ ›์˜ NFT ๊ฑฐ๋ž˜ ์กฐํšŒ

GET /v3/bsc/single-nft/<contract_address>/<from_address>/from-transactions
$result = $bscClient->GetSingleNftTxs([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • NFT ๊ฑฐ๋ž˜๋‚ด์—ญ ์กฐํšŒ

GET /v3/bsc/single-nft/<contract_address>/<token_id>/nft-transactions
$result = $bscClient->GetSingleNftTokenTxs([
    'contract_address' =>  "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'token_id' =>  "NFT ํ† ํฐ ID",
    'offset' => 0,
    'limit' => 10
]);

ERC721(NFT) ํŠน์ • NFT ์ •๋ณด ์กฐํšŒ

GET /v3/bsc/single-nft/<contract_address>/<token_id>/info
$result = $bscClient->GetSingleNftInfo([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'token_id' =>  "NFT ํ† ํฐ ID",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ NFT ๋ชฉ๋ก ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/nfts
$result = $bscClient->GetMultiNfts([
    'contract_address' =>"NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์›”๋ › ์†Œ์œ ํ•˜๊ณ  ์žˆ๋Š” NFT ๋ชฉ๋ก ์กฐํšŒ

GET /v3/bsc/multi-nft/<owner_address>/owner-nfts
$result = $bscClient->GetMultiOwnerNfts([
    'owner_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์›”๋ › ์ƒ์„ฑํ•œ NFT ๋ชฉ๋ก ์กฐํšŒ

GET /v3/bsc/multi-nft/<creator_address>/creator-nfts
$result = $bscClient->GetMultiCreatorNfts([
    'creator_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์›”๋ › NFT ๊ฑฐ๋ž˜ ๋‚ด์—ญ ์กฐํšŒ

GET /v3/bsc/multi-nft/<from_address>/transactions
$result = $bscClient->GetMultiTxs([
    'from_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ ›์ด ์†Œ์œ ํ•œ NFT ๋ชฉ๋ก ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/<owner_address>/owner-nfts
$result = $bscClient->GetMultiNftOwnerNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'owner_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ ›์ด ์ƒ์„ฑํ•œ NFT ๋ชฉ๋ก ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/<creator_address>/creator-nfts
$result = $bscClient->GetMultiNftCreatorNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'creator_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • ์ปจํŠธ๋ ‰ํŠธ,์›”๋ ›์˜ NFT ๊ฑฐ๋ž˜ ๋‚ด์—ญ ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/<from_address>/from-transactions
$result = $bscClient->GetMultiNftTxs([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from_address' => "๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • NFT ์ •๋ณด&์†Œ์œ ์ž ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/<token_id>/info
$result = $bscClient->GetMultiNftInfo([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'token_id' =>  "NFT ํ† ํฐ ID",
    'offset' => 0,
    'limit' => 10
]);

ERC1155(NFT) ํŠน์ • NFT ๊ฑฐ๋ž˜๋‚ด์—ญ ์กฐํšŒ

GET /v3/bsc/multi-nft/<contract_address>/<token_id>/nft-transactions
$result = $bscClient->GetMultiNftTokenTxs([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'token_id' =>  "NFT ํ† ํฐ ID",
    'offset' => 0,
    'limit' => 10
]);

์Šค๋งˆํŠธ ๊ณ„์•ฝ ํ•จ์ˆ˜ํ˜ธ์ถœ(์ฝ๊ธฐ)

POST /v3/bsc/contract/<contract_address>/read
$result = $bscClient->ReadContract([
    'contract_address' => "์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'mbscod' => "ownerOf",
    'parameter_type' => ["uint256"],
    'parameter_data' => [1]
]);

์Šค๋งˆํŠธ ๊ณ„์•ฝ ํ•จ์ˆ˜ํ˜ธ์ถœ(์“ฐ๊ธฐ)

POST /v3/bsc/contract/<contract_address>/write
$result = $bscClient->WriteContract([
    'contract_address' => "์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'from' => "ํŠธ๋žœ์žญ์…˜์„ ์ƒ์„ฑํ•  ์ฃผ์†Œ",
    'private_key' => "from ์˜ ํ”„๋ผ์ด๋น—ํ‚ค",
    'mbscod' => "transfer",
    'parameter_type' => ["uint256"],
    'parameter_data' => [1]
]);

NFT ๋งˆ์ผ“ ERC721 ๊ฒฝ๋งค ์ง„ํ–‰์ค‘์ธ NFT ๋ชฉ๋ก

GET /v3/bsc/single-nft/<contract_address>/auction-nfts
$result = $bscClient->GetSingleNftAuctionNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

NFT ๋งˆ์ผ“ ERC721 ํŠน์ • ์›”๋ › ํŒ๋งค ๋“ฑ๋กํ•œ NFT ๋ชฉ๋ก

GET /v3/bsc/single-nft/<contract_address>/<seller_address>/sale-nfts
$result = $bscClient->GetSingleNftSellerNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'seller_address' => "ํ† ํฐ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);

NFT ๋งˆ์ผ“ ERC721 ํŠน์ • NFT ์ž…์ฐฐ ๊ฑฐ๋ž˜ ๋‚ด์—ญ

GET /v3/bsc/single-nft/<contract_address>/<token_id>/nft-bids
$result = $bscClient->GetSingleNftTokenBids([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'token_id' =>  "NFT ํ† ํฐ ID",
    'offset' => 0,
    'limit' => 10
]);

NFT ๋งˆ์ผ“ ERC1155 ํŠน์ • ์›”๋ › ํŒ๋งค ๋“ฑ๋กํ•œ NFT ๋ชฉ๋ก

GET /v3/bsc/multi-nft/<contract_address>/<seller_address>/seller-nfts
$result = $bscClient->GetMultiNftSellerNfts([
    'contract_address' => "NFT ์ปจํŠธ๋ ‰ํŠธ ์ฃผ์†Œ",
    'seller_address' => "ํ† ํฐ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ฃผ์†Œ",
    'offset' => 0,
    'limit' => 10
]);
Clone this wiki locally