> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/jp/kaihatsu/kihon/how-tos/wallet-zandaka-shutoku.md).

# wallet の残高を取得する

## wallet の CHZ 残高とは何か？

wallet の残高とは、その wallet が保有している特定の暗号通貨の総量を指します。プロジェクトによっては、単一の暗号通貨の残高を表示する必要がある場合もあれば、wallet が保有するすべての暗号通貨の残高を表示する必要がある場合もあります。

同様に、wallet のアセットとは、暗号通貨 wallet 内に保管・管理されているあらゆる形態の暗号通貨、トークン、デジタルアセットを指します。

## Moralis で行う方法

Moralis には利用可能な [Wallet API](https://moralis.com/api/wallet/) があり、wallet 残高のユースケース向けのコードサンプルも提供されています。

* [How to get the native balance of an address](https://docs.moralis.io/web3-data-api/evm/wallet-api/how-to-get-the-balance-of-a-wallet)

このコードサンプルを適応させるには、Ethereum への参照を Chiliz Chain の ID である `0x15b38` に置き換える必要があります。

```typescript
import Moralis from "moralis";

const runApp = async() => {
  await Moralis.start({
    apiKey: "YOUR_API_KEY",
    // ...and any other configuration
  });

  const address = "0xYourWalletAddress";

  const chain = "0x15b38", // This is for Chiliz Chain Mainnet.
                           // For Spicy Testnet, use "0x15b32".

  const response = await Moralis.EvmApi.balance.getNativeBalance({
    address,
    chain,
  });

  console.log(response.toJSON());
};

runApp();
```

## Tatum で行う方法

Tatum には利用可能な包括的な [Data API](https://tatum.io/blockchain-api) があり、アセット取得のユースケース向けのコードサンプルも提供されています。

* [Get all assets the wallet holds](https://docs.tatum.io/docs/get-all-assets-the-wallet-holds)

このコードサンプルを適応させるには、Ethereum への参照を Chiliz Chain に置き換える必要があります。

```typescript
import {TatumSDK, Network, Chiliz, ResponseDto, AddressBalance} from '@@tatumio/tatum'

const tatum = await TatumSDK.init<Chiliz>({network: Network.CHILIZ})

const balance: ResponseDto<AddressBalance[]> = await tatum.address.getBalance({
  addresses: ['0xYourWalletAddress'], // replace with your address
})

console.log(balance.data)
```

## thirdweb で行う方法

thirdweb はドキュメントサイト上にいくつかの短いコードサンプルを掲載しており、それらを参考にすることができます。

* [Get wallet balance](https://portal.thirdweb.com/connect/in-app-wallet/how-to/interact-with-wallets#get-wallet-balance)

こちらが [Chiliz に適応させた](https://thirdweb.com/chiliz-chain) コードです。

```typescript
const sdk = new ThirdwebSDK("https://88888.rpc.thirdweb.com");
const walletAddress = "0xYourWalletAddress";

async function getWalletBalance() {
  try {
    const balance = await sdk.getBalance(walletAddress);
    console.log(`Balance of wallet ${walletAddress}: ${balance.displayValue} ${balance.symbol}`);
  } catch (error) {
    console.error("Error fetching wallet balance:", error);
  }
}

getWalletBalance();
```

## Nodit を使って行う方法

Nodit は[ドキュメント内](https://developer.nodit.io/reference/chiliz-getnativebalancebyaccount)で以下のコードサンプルを提供しています。

```typescript
const url = 'https://web3.nodit.io/v1/chiliz/mainnet/native/getNativeBalanceByAccount';
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    'X-API-KEY': 'nodit-demo'
  },
  body: JSON.stringify({accountAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chiliz.com/jp/kaihatsu/kihon/how-tos/wallet-zandaka-shutoku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
