> 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/sung-khuen/socios-wallet.md).

# รวม Socios.com Wallet เข้า dApp

โดยทั่วไป dApps จะมีปุ่ม "Connect Wallet" เพื่อเปิดหน้าต่าง pop-up ที่ให้ผู้ใช้เลือกผู้ให้บริการกระเป๋าเงินของตน จากนั้น pop-up จะส่งข้อความไปยังกระเป๋าเงินที่เลือกเพื่อยืนยันว่าผู้ใช้รายนั้นเป็นเจ้าของที่อยู่กระเป๋าเงินนั้นจริง

มีหลายวิธีในการรวม Socios Wallet เข้ากับ pop-up modal "Connect Wallet" ใน dApp ของคุณ การพึ่งพาเครื่องมือที่มีชื่อเสียงช่วยให้คุณมอบประสบการณ์ที่ปลอดภัยและราบรื่นที่รองรับผู้ให้บริการกระเป๋าเงินหลายราย (เช่น MetaMask และอื่น ๆ) และหลาย เครือข่าย รวมถึง Chiliz Chain (ทั้ง Spicy Testnet และ Chiliz Mainnet)

หน้านี้มีจุดประสงค์เพื่อนำเสนอตัวเลือกต่าง ๆ ให้คุณได้เลือก

{% hint style="info" %}
เนื่องจากคุณกำลังใช้งานบน Chiliz Chain ให้ระบุ `chainId` ที่ถูกต้องในการกำหนดค่าของคุณ:

* 88882: Spicy Testnet
* 88888: Chiliz Mainnet

เริ่มต้นด้วยการทดสอบการรวมของคุณบน Spicy Testnet (88882) ให้แน่ใจว่าทุกอย่างทำงานได้อย่างราบรื่น แล้วจึงย้ายไปยัง Chiliz Mainnet (88888)

ดูพารามิเตอร์ทั้งหมดได้ที่นี่: [https://github.com/chiliz-chain/docs/blob/master/th/phatthana/basics/connect-to-chiliz-chain/README.md](https://github.com/chiliz-chain/docs/blob/master/th/phatthana/basics/connect-to-chiliz-chain/README.md "mention")
{% endhint %}

## เลือก libraries และ frameworks ของคุณ

คุณสามารถใช้ประโยชน์จากเครื่องมือภายนอกต่าง ๆ เพื่อปรับปรุงการเชื่อมต่อกระเป๋าเงิน การรองรับหลาย เครือข่าย และฟีเจอร์ขั้นสูง เลือกเครื่องมือตาม tech stack ของโปรเจกต์ของคุณ

### Reown (เดิมคือ WalletConnect)

{% hint style="info" %}
[Reown](https://reown.com/) คือ[ชื่อ](https://reown.com/blog/walletconnect-is-now-reown)ของ WalletConnect Inc. ตั้งแต่ปี 2024\
ชุดเครื่องมือเชื่อมต่อกระเป๋าเงิน WalletConnect ที่เป็นที่รู้จักกันดีปัจจุบันเรียกว่า [Reown SDK](https://reown.com/reown-sdk) (หรือ AppKit) ซึ่งเดิมรู้จักกันในชื่อ Web3Modal
{% endhint %}

Reown มี[คู่มือทีละขั้นตอนสำหรับการใช้ AppKit](https://docs.reown.com/appkit/networks/evm#get-started) และคุณควรอ่าน[เอกสารฉบับเต็ม](https://docs.reown.com/appkit/overview)ของพวกเขาด้วย

{% hint style="warning" %}
**จำเป็น**

Socios.com Wallet ใช้มาตรฐาน [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) ซึ่งหมายความว่า smart contract ที่อยู่เบื้องหลังได้ใช้งานเมธอด `isValidSignature()` แทน `erecover()`

ดังนั้น dApp ของคุณ **ต้องรองรับ** ERC-1271 และใช้งานการเรียก `isValidSignature()`

ดู[เอกสาร Reown](https://docs.reown.com/advanced/api/sign/smart-contract-wallet-usage#messages)สำหรับข้อมูลเพิ่มเติม
{% endhint %}

### RainbowKit

[RainbowKit](https://rainbowkit.com/) คือ React library สำหรับเพิ่มฟีเจอร์การเชื่อมต่อกระเป๋าเงิน โดยอาศัย [viem](https://viem.sh/) และ [Wagmi](https://wagmi.sh/) และมีคอมโพเนนต์สำเร็จรูปสำหรับขั้นตอนการรวมที่ทันสมัยและใช้งานง่าย

ดู[บทนำของพวกเขาเอง](https://rainbowkit.com/docs/introduction)เพื่อเรียนรู้เพิ่มเติม

### Moralis

[Moralis](https://docs.moralis.com/) นำเสนอขั้นตอนการยืนยันตัวตนสำเร็จรูปสำหรับ chain ที่เข้ากันได้กับ EVM (รวมถึง Chiliz Chain หากกำหนดค่าอย่างถูกต้อง) รวมถึงเมธอดฝั่งเซิร์ฟเวอร์สำหรับตรวจสอบและจัดการเซสชันผู้ใช้

หากคุณใช้ Moralis อยู่แล้ว คุณสามารถใช้มันเพื่อสร้างปุ่ม "Connect Wallet" ใน dApps ของคุณด้วยเมธอด/เครื่องมือหลายอย่าง:

* [วิธียืนยันตัวตนผู้ใช้ด้วย WalletConnect](https://docs.moralis.com/get-started/tutorials/auth-api/authenticate-users-with-wallet-connect)
* [วิธียืนยันตัวตนผู้ใช้ด้วย RainbowKit](https://docs.moralis.com/get-started/tutorials/auth-api/authenticate-users-with-rainbow-kit)
* [วิธียืนยันตัวตนผู้ใช้ด้วย Magic.Link](https://docs.moralis.com/get-started/tutorials/auth-api/authenticate-users-with-magic-link)
* ฯลฯ

พวกเขายังมีบทความยาวเกี่ยวกับแต่ละรายการ:

* [WalletConnect Integration – How to Integrate WalletConnect](https://developers.moralis.com/walletconnect-integration-how-to-integrate-walletconnect/)
* [How to Add a Sign In with RainbowKit to Your Project in 5 Steps](https://developers.moralis.com/how-to-add-a-sign-in-with-rainbowkit-to-your-project-in-5-steps/)

### thirdweb

[thirdweb](https://portal.thirdweb.com/) นำเสนอ [Connect](https://thirdweb.com/learn/guides/thirdweb-connect-explained) ซึ่งเป็นขั้นตอนการลงทะเบียนที่ยืดหยุ่นซึ่งรองรับความต้องการที่แตกต่างกัน ซึ่งเป็นสิ่งสำคัญในการเริ่มต้นใช้งานสำหรับผู้ใช้

คุณสามารถอ้างอิง[เอกสาร Wallets](https://portal.thirdweb.com/connect/wallet/sign-in-methods/external-wallets) ของพวกเขา และลองเล่นกับ[ConnectButton playground](https://playground.thirdweb.com/connect/sign-in/button) ของพวกเขาได้เลย

## แนะนำ Socios.com Wallet ใน pop-up modal

คุณสามารถปรับแต่งการแสดงผลของ pop-up modal เพื่อนำเสนอ Socios.com Wallet:

* ด้วย Reown/WalletConnect: ปรับแต่งส่วน "Recommended Wallet" ของ modal โดยใช้ตัวเลือก [`explorerRecommendedWalletIds`](https://docs.reown.com/advanced/walletconnectmodal/options#explorerrecommendedwalletids-optional)
* ด้วย RainbowKit: คุณสามารถสร้างรายการกระเป๋าเงินของคุณเองโดยใช้ตัวเลือก [`connectorsForWallets`](https://www.rainbowkit.com/docs/custom-wallet-list)

## มอบประสบการณ์ที่ดีที่สุดให้กับผู้ใช้ของคุณ

เพื่อประสบการณ์ผู้ใช้ที่ดีขึ้น เราแนะนำให้คุณจัดเก็บที่อยู่กระเป๋าเงินของผู้ใช้ไว้ใน session storage บน dApp ของคุณ หรือในโปรไฟล์ผู้ใช้ วิธีนี้จะทำให้ผู้ใช้ไม่ต้องเชื่อมต่อกับที่อยู่กระเป๋าเงินของตนทุกครั้งที่เข้ามาใช้งานแพลตฟอร์มของคุณ

## เมธอดที่รองรับ

Socios.com Wallet รองรับเมธอดต่อไปนี้:

* `eth_sendTransaction`
* `eth_signTransaction`
* `personal_sign`

เราวางแผนที่จะรองรับเมธอดต่อไปนี้ในเร็ว ๆ นี้:

* `eth_signTypedData`
* `eth_signTypedData_v4`

## การยืนยัน SIWE

หากคุณต้องการใช้ Socios.com Wallet เพื่อยืนยันตัวตนโดยใช้ [SWIE](https://eips.ethereum.org/EIPS/eip-4361) โปรดทราบว่า Socios.com Wallet เป็นกระเป๋าเงินแบบ SCA ไม่ใช่กระเป๋าเงิน EOA ทั่วไป\
\&#xNAN;*ระบบนิเวศของ Ethereum มีบัญชีหลักสองประเภท: Smart Contract Accounts (SCAs) และ Externally Owned Accounts (EOAs)*

แม้ว่าลายเซ็นสำหรับกระเป๋าเงิน EOA สามารถยืนยันได้ด้วย `ecrecover` (เช่น การใช้ `ethers.utils.verifyMessage`) แต่มาตรฐาน EIP-1271 (ซึ่ง Socios.com Wallet ใช้) จำเป็นต้องเรียกเมธอด `isValidSignature` ของ smart contract เพื่อยืนยัน

ดังนั้นเมื่อยืนยันตัวตนของบัญชี คุณต้องตรวจสอบก่อนว่าที่อยู่นั้นเป็น smart contract หรือไม่ และขึ้นอยู่กับผลลัพธ์นั้น ให้เลือกวิธีการยืนยันที่เหมาะสม


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.chiliz.com/th/phatthana/sung-khuen/socios-wallet.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
