搜尋套件、儲存庫與 APP 分類

wallet_connect 封面
套件詳情v1.0.4

wallet_connect

用 Dart 愛意打造的 Wallet Connect 客戶端。

AndroidiOSmacOSWindowsLinux
近 30 天下載
116
喜歡數
68
Pub 分數
110

安裝套件

flutter pub add wallet_connect

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Wallet Connect 是一個基於 Dart 的客戶端,用於將區塊鏈錢包連接功能整合到 Flutter 應用程式中。精心打造,它可讓多個平台上的 dApps 與加密貨幣錢包之間實現安全的點對點通訊。該套件支援無縫錢包配對、會話管理與交易簽署,非常適合 Web3 應用開發。它原生支援 Android、iOS、macOS、Windows 及 Linux,確保廣泛相容性。憑藉其簡潔的 API 與活躍的開源社群,Wallet Connect 簡化了去中心化身分與支付工作流程的整合。

適用情境

  • 連接用戶與加密錢包
  • 在應用程式中啟用區塊鏈交易
  • 支援 dApp 身分驗證
  • 促進跨平台錢包互動
  • 建構支援 Web3 的行動與桌面應用程式

主要特色

  • 跨平台支援(Android、iOS、macOS、Windows、Linux)
  • 安全的點對點連接
  • 會話管理與恢復
  • 透過錢包進行交易簽署
  • 開源且持續維護

適合對象

  • Flutter 開發人員建構 dApps
  • Web3 應用程式創建者
  • 加密錢包整合商
  • 移動和桌面區塊鏈應用
  • 需要安全錢包配對的項目

使用建議

  • 需要理解 Web3 概念
  • 依賴外部錢包提供者
  • 配對流程可能需要額外的使用者介面
  • 不適用於非區塊鏈使用案例
  • 除了基本範例之外,文件內容有限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Wallet Connect Logo

Wallet Connect

Wallet Connect client in dart highly inspired from wallet-connect-kotlin by Trust Wallet.

Usage

    import 'package:wallet_connect/wallet_connect.dart';
  1. Create instance of Wallet connect client and define callbacks.
    final wcClient = WCClient(
      onConnect: () {
        // Respond to connect callback
      },
      onDisconnect: (code, reason) {
        // Respond to disconnect callback
      },
      onFailure: (error) {
        // Respond to connection failure callback
      },
      onSessionRequest: (id, peerMeta) {
        // Respond to connection request callback
      },
      onEthSign: (id, message) {
        // Respond to personal_sign or eth_sign or eth_signTypedData request callback
      },
      onEthSendTransaction: (id, tx) {
        // Respond to eth_sendTransaction request callback
      },
      onEthSignTransaction: (id, tx) {
        // Respond to eth_signTransaction request callback
      },
    );
  1. Create WCSession object from wc: uri.
    final session = WCSession.from(wcUri);
  1. Create WCPeerMeta object containing metadata for your app.
    final peerMeta = WCPeerMeta(
        name: 'Example Wallet',
        url: 'https://example.wallet',
        description: 'Example Wallet',
        icons: [],
    );
  1. Connect to a new session.
    wcClient.connectNewSession(session: session, peerMeta: peerMeta);
  1. Or connect to a saved session (from step 8).
    wcClient.connectFromSessionStore(sessionStore);
  1. Approve a session connection request.
    wcClient.approveSession(
        accounts: [], // account addresses
        chainId: 1, // chain id
    );
  1. Or reject a session connection request.
    wcClient.rejectSession();
  1. Get active session from sessionStore getter to save for later use.
    final sessionStore = wcClient.sessionStore;
  1. Approve a sign transaction request by signing the transaction and sending the signed hex data.
    wcClient.approveRequest<String>(
        id: id,
        result: signedDataAsHex,
    );
  1. Approve a send transaction request by sending the transaction hash generated from sending the transaction.
    wcClient.approveRequest<String>(
        id: id,
        result: transactionHash,
    );
  1. Approve a sign request by sending the signed data hex generated.
    wcClient.approveRequest<String>(
        id: id,
        result: signedDataAsHex,
    );
  1. Or reject any of the requests above by specifying request id.
    wcClient.rejectRequest(id: id);
  1. Disconnect from a connected session locally.
    wcClient.disconnect();
  1. Permanently close a connected session.
    wcClient.killSession();

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。