Skip to content
프로젝트

coinbase/coinbase-wallet-sdk

GitHub에서 보기

소개

사용자가 모바일 지갑을 여러분의 DApp에 연결할 수 있도록 하는 개방형 프로토콜입니다.

비즈니스 및 금융

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+1
in 7 days
+5
in 15 days
+8
in 1 month
+10

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Coinbase Wallet SDK

npm

Overview

The Coinbase Wallet SDK connects your app to Coinbase Wallet so it can interact with the Ethereum blockchain.

  1. Coinbase Wallet

Installing the SDK

# npm
npm install @coinbase/wallet-sdk

# yarn
yarn add @coinbase/wallet-sdk

SDK Setup and Usage

Upgrading the SDK

  1. Compare the installed version with the latest:

    # yarn
    yarn outdated @coinbase/wallet-sdk
    
    # npm
    npm outdated @coinbase/wallet-sdk
    
  2. Update to latest:

    # yarn
    yarn upgrade @coinbase/wallet-sdk --latest
    
    # npm
    npm update @coinbase/wallet-sdk
    

Basic SDK Usage

  1. Initialize the SDK

    const sdk = createCoinbaseWalletSDK({
      appName: 'SDK Playground',
    });
    
  2. Make Coinbase Wallet Provider

    const provider = sdk.evm.getProvider();
    
  3. Request accounts to initialize a connection to wallet

    const addresses = provider.request({
      method: 'eth_requestAccounts',
    });
    
  4. Make more requests

    provider.request('personal_sign', [
      `0x${Buffer.from('test message', 'utf8').toString('hex')}`,
      addresses[0],
    ]);
    
  5. Handle provider events

    provider.on('connect', (info) => {
      setConnect(info);
    });
    
    provider.on('disconnect', (error) => {
      setDisconnect({ code: error.code, message: error.message });
    });
    
    provider.on('accountsChanged', (accounts) => {
      setAccountsChanged(accounts);
    });
    
    provider.on('chainChanged', (chainId) => {
      setChainChanged(chainId);
    });
    
    provider.on('message', (message) => {
      setMessage(message);
    });
    

Developing locally and running the test app

관련 프로젝트 살펴보기

불러오는 중…