> 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/joukyu/socios-wallet-rentai.md).

# Socios.com Wallet を dApp に統合する

dApp には通常、ポップアップウィンドウを表示するための「Connect Wallet」ボタンがあり、ユーザーはそこで wallet プロバイダーを選択できます。ポップアップは選択された wallet にメッセージを送信し、そのユーザーがこの wallet アドレスを実際に所有していることを verify します。

dApp の「Connect Wallet」ポップアップモーダルに Socios Wallet を統合する方法はいくつかあります。定評のあるツールを利用することで、複数の wallet プロバイダー (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) に移行してください。

すべてのパラメーターはこちらを参照してください: [Chiliz Chain に接続する](/jp/kaihatsu/kihon/chiliz-chain-setsuzoku.md)
{% endhint %}

## ライブラリとフレームワークを選ぶ

さまざまな外部ツールを活用して、wallet 接続、マルチチェーン対応、高度な機能を効率化できます。プロジェクトの技術スタックに応じてツールを選んでください。

### Reown (旧 WalletConnect)

{% hint style="info" %}
[Reown](https://reown.com/) は 2024 年以降の WalletConnect Inc. の[名称](https://reown.com/blog/walletconnect-is-now-reown)です。\
よく知られた WalletConnect の wallet 接続ツールキットは、現在 [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 は `erecover()` の代わりに `isValidSignature()` メソッドを実装しています。

したがって、あなたの dApp は ERC-1271 をサポートし、`isValidSignature()` への呼び出しを実装する必要があります。

詳しくは [Reown のドキュメント](https://docs.reown.com/advanced/api/sign/smart-contract-wallet-usage#messages)を参照してください。
{% endhint %}

### RainbowKit

[RainbowKit](https://rainbowkit.com/) は、wallet 接続機能を追加するための React ライブラリです。[viem](https://viem.sh/) と [Wagmi](https://wagmi.sh/) に依存しており、モダンでユーザーフレンドリーな統合フローのための事前構築コンポーネントを提供します。

詳しくは[公式の紹介](https://rainbowkit.com/docs/introduction)を参照してください。

### Moralis

[Moralis](https://docs.moralis.com/) は、EVM 互換チェーン (適切に設定されていれば Chiliz Chain を含む) 向けのすぐに使える認証フローと、ユーザーセッションを検証・管理するためのサーバーサイドメソッドを提供します。

すでに Moralis を使用している場合は、いくつかのメソッド/ツールを使って dApp の「Connect Wallet」ボタンを作成できます:

* [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 を推奨する

ポップアップモーダルの表示をカスタマイズして、Socios.com Wallet を目立たせることができます:

* Reown/WalletConnect の場合: [`explorerRecommendedWalletIds`](https://docs.reown.com/advanced/walletconnectmodal/options#explorerrecommendedwalletids-optional) オプションを使用して、モーダルの「Recommended Wallet」セクションをカスタマイズします。
* RainbowKit の場合: [`connectorsForWallets`](https://www.rainbowkit.com/docs/custom-wallet-list) オプションを使用して、独自の wallet リストを構築できます。

## ユーザーに最適な体験を提供する

より良いユーザー体験のために、ユーザーの wallet アドレスを dApp のセッションストレージまたはユーザープロフィールに保存することをお勧めします。こうすることで、ユーザーはプラットフォームに来るたびに wallet アドレスへ接続する必要がなくなります。

## サポートされているメソッド

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 が通常の EOA wallet ではなく SCA wallet であることに注意してください。\
\&#xNAN;*Ethereum のエコシステムには、主に 2 つのアカウントタイプがあります: Smart Contract Accounts (SCA) と Externally Owned Accounts (EOA) です。*

EOA wallet の署名は `ecrecover` (例: `ethers.utils.verifyMessage` を使用) で検証できますが、EIP-1271 標準 (Socios.com Wallet が使用するもの) では、署名を検証するためにコントラクトの `isValidSignature` メソッドを呼び出す必要があります。

そのため、アカウントを認証する際には、まずアドレスがコントラクトであるかどうかを確認し、それに応じて適切な検証メソッドを選択する必要があります。


---

# 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/joukyu/socios-wallet-rentai.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.
