> 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/th/phatthana/phuenthan/how-tos/prawat-krapao.md).

# ดูประวัติกระเป๋าเงิน

ดึงประวัติธุรกรรมทั้งหมดของกระเป๋าเงินบน Chiliz Chain โดยใช้ Moralis Wallet API พร้อมตัวอย่างโค้ดสำหรับบันทึกธุรกรรมเครดิตและเดบิต

## ประวัติของกระเป๋าเงินคืออะไร?

ประวัติของกระเป๋าเงินหมายถึงบันทึกครบถ้วนของธุรกรรมทั้งหมด ทั้งเครดิตและเดบิต ที่เชื่อมโยงกับกระเป๋าเงิน crypto ของคุณ

## วิธีทำด้วย Moralis

Moralis มี Wallet API ที่คุณสามารถใช้งานได้ และยังมีตัวอย่างโค้ดสำหรับกรณีการใช้งานประวัติกระเป๋าเงินด้วย:

* [Get wallet history](https://docs.moralis.io/web3-data-api/evm/reference/wallet-api/get-wallet-history)

เพื่อปรับตัวอย่างโค้ดของพวกเขา ให้แทนที่การอ้างอิง Ethereum ด้วย ID ของ Chiliz Chain คือ `0x15b38`:

```typescript
import Moralis from 'moralis';

try {
  await Moralis.start({
    apiKey: "YOUR_API_KEY"
  });

  const response = await Moralis.EvmApi.wallets.getWalletHistory({
    "chain": "0x15b38", // This is for Chiliz Chain Mainnet.
                        // For Spicy Testnet, use "0x15b32".
    "order": "DESC",
    "address": "0xYourWalletAddress"
  });

  console.log(response.raw);
} catch (e) {
  console.error(e);
}
```

## วิธีทำด้วย Tatum

Tatum มี Data API ที่ครอบคลุมซึ่งคุณสามารถใช้งานได้ และยังมีตัวอย่างโค้ดสำหรับกรณีการใช้งานประวัติกระเป๋าเงินด้วย:

* [Get all transactions of a wallet](https://docs.tatum.io/docs/get-all-transactions-on-the-wallet)

เพื่อปรับตัวอย่างโค้ดของพวกเขา ให้แทนที่การอ้างอิง Ethereum ด้วย Chiliz Chain:

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

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

const txs: ResponseDto<AddressTransaction[]> = await tatum.address.getTransactions({
  address: '0xYourWalletAddress', // replace with your address
})

console.log(txs.data)
```

## วิธีทำด้วย thirdweb

thirdweb มีตัวอย่างโค้ดสั้น ๆ หลายรายการในเว็บไซต์เอกสารของพวกเขา ซึ่งเราสามารถใช้เป็นแรงบันดาลใจได้

น่าเสียดายที่ดูเหมือนพวกเขาจะไม่มีฟังก์ชันเฉพาะสำหรับธุรกรรม ดังนั้นเราจึงใช้ [Chiliz Scan API](https://scan.chiliz.com/api-docs) แทน

```typescript
const { ThirdwebSDK } = require("@thirdweb-dev/sdk");
const axios = require("axios");

const sdk = new ThirdwebSDK("https://rpc.ankr.com/chiliz");
const walletAddress = "0xYourWalletAddress";

// ChilizScan API URL and your API key (required)
const CHILIZ_SCAN_API_URL = "https://api.chilizscan.com/api";
const API_KEY = "YourChilizScanAPIKey"; // Optional, if the API requires authentication

async function getTransactionHistory() {
  try {
    const response = await axios.get(`${CHILIZ_SCAN_API_URL}?module=account&action=txlist&address=${walletAddress}&apikey=${API_KEY}`);
    const transactions = response.data.result;

    console.log(`Transaction history of wallet ${walletAddress}:`, transactions);
  } catch (error) {
    console.error("Error fetching transaction history:", error);
  }
}

getTransactionHistory();
```

## วิธีทำด้วย Nodit

Nodit ให้ตัวอย่างโค้ดต่อไปนี้ [ในเอกสารของพวกเขา](https://developer.nodit.io/reference/chiliz-gettransactionsbyaccount):

```typescript
const url = 'https://web3.nodit.io/v1/chiliz/mainnet/blockchain/getTransactionsByAccount';
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    'X-API-KEY': 'nodit-demo'
  },
  body: JSON.stringify({
    accountAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    relation: 'both',
    fromDate: '2025-01-01T00:00:00+00:00',
    toDate: '2025-01-31T00:00:00+00:00',
    withCount: false,
    withLogs: false,
    withDecode: false
  })
};

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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chiliz.com/th/phatthana/phuenthan/how-tos/prawat-krapao.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
