-
Notifications
You must be signed in to change notification settings - Fork 2
BinanceSmart SDK
blockchen-admin edited this page Jun 5, 2022
·
1 revision
๋ฐ์ด๋ธ์ค ์ค๋งํธ ์ฒด์ธ ๊ฐ๋ฐ์ ๋ฌธ์ ๋ฐ๋ก๊ฐ๊ธฐ ํจ์ ํธ์ถ์ ํ์ํ ๋งค๊ฐ๋ณ์ ๋๋ ๋ฐํ๋๋ ๋ฐ์ดํฐ์ ๋ํด์๋ 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' => "ํธ๋์ญ์
ํด์ฌ"
]);
GET /v3/bsc/token/<contract_address>/info
$result = $bscClient->GetTokenInfo([
'contract_address' => "ERC20 ํ ํฐ ์ปจํธ๋ ํธ ์ฃผ์"
]);
GET /v3/bsc/token/<contract_address>/<from_address>/balance
$result = $bscClient->GetTokenInfo([
'contract_address' => "ERC20 ํ ํฐ ์ปจํธ๋ ํธ ์ฃผ์",
'from_address' => "์์ก์ ์กฐํํ ์ฃผ์"
]);
POST /v3/bsc/token/<contract_address>/<from_address>/transfer
$result = $bscClient->GetTokenInfo([
'contract_address' => "ERC20 ํ ํฐ ์ปจํธ๋ ํธ ์ฃผ์",
'from_address' => "ํ ํฐ์ ์ ์กํ ์ฃผ์",
'to' => "์ฃผ์",
'amount' => "๋ณด๋ผ ์",
'private_key' => "๋ณด๋ด๋ ์ฃผ์ ํค"
]);
GET /v3/bsc/token/<from_address>/transactions
$result = $bscClient->GetTokenTxs([
'from_address' => "๊ฑฐ๋ ๋ด์ญ์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/token/<contract_address>/<from_address>/transactions
$result = $bscClient->GetTokenContractTxs([
'contract_address' => "ERC20 ํ ํฐ ์ปจํธ๋ ํธ ์ฃผ์",
'from_address' => "๊ฑฐ๋ ๋ด์ญ์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/token/<from_address>/all-balance
$result = $bscClient->GetTokenAllBalance([
'from_address' => "ํ ํฐ ๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<contract_address>/nfts
$result = $bscClient->GetSingleNfts([
'contract_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<owner_address>/owner-nfts
$result = $bscClient->GetSingleOwnerNfts([
'owner_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<creator_address>/creator-nfts
$result = $bscClient->GetSingleCreatorNfts([
'creator_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<from_address>/transactions
$result = $bscClient->GetSingleTxs([
'from_address' => "ํ ํฐ ๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<contract_address>/<owner_address>/owner-nfts
$result = $bscClient->GetSingleNftOwnerNfts([
'contract_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<contract_address>/<creator_address>/creator-nfts
$result = $bscClient->GetSingleNftCreatorNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'creator_address' => "ํ ํฐ ๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<contract_address>/<from_address>/from-transactions
$result = $bscClient->GetSingleNftTxs([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'from_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
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
]);
GET /v3/bsc/single-nft/<contract_address>/<token_id>/info
$result = $bscClient->GetSingleNftInfo([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'token_id' => "NFT ํ ํฐ ID",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<contract_address>/nfts
$result = $bscClient->GetMultiNfts([
'contract_address' =>"NFT ์ปจํธ๋ ํธ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<owner_address>/owner-nfts
$result = $bscClient->GetMultiOwnerNfts([
'owner_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<creator_address>/creator-nfts
$result = $bscClient->GetMultiCreatorNfts([
'creator_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<from_address>/transactions
$result = $bscClient->GetMultiTxs([
'from_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<contract_address>/<owner_address>/owner-nfts
$result = $bscClient->GetMultiNftOwnerNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'owner_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<contract_address>/<creator_address>/creator-nfts
$result = $bscClient->GetMultiNftCreatorNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'creator_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<contract_address>/<from_address>/from-transactions
$result = $bscClient->GetMultiNftTxs([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'from_address' => "๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/multi-nft/<contract_address>/<token_id>/info
$result = $bscClient->GetMultiNftInfo([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'token_id' => "NFT ํ ํฐ ID",
'offset' => 0,
'limit' => 10
]);
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]
]);
GET /v3/bsc/single-nft/<contract_address>/auction-nfts
$result = $bscClient->GetSingleNftAuctionNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
GET /v3/bsc/single-nft/<contract_address>/<seller_address>/sale-nfts
$result = $bscClient->GetSingleNftSellerNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'seller_address' => "ํ ํฐ ๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);
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
]);
GET /v3/bsc/multi-nft/<contract_address>/<seller_address>/seller-nfts
$result = $bscClient->GetMultiNftSellerNfts([
'contract_address' => "NFT ์ปจํธ๋ ํธ ์ฃผ์",
'seller_address' => "ํ ํฐ ๋ชฉ๋ก์ ์กฐํํ ์ฃผ์",
'offset' => 0,
'limit' => 10
]);