Skip to content

circlefin/w3s-pw-web-sdk

Repository files navigation

Circle Programmable Wallets Web SDK

Table of Contents


Overview

Programmable Wallets Web SDK empowers developers to build web3 wallets on web apps with ease. It’s a non-custodial wallet solution that brings seamless onboarding & transaction experience for end-users and utilizes industry standard MPC cryptographic technology to ensure the security of private key as well as the safety of user assets.

Installation

$ npm install @circle-fin/w3s-pw-web-sdk

Usage

Prerequisites

Sign up for Circle's Dev Console to obtain an APP ID.

Initiating the SDK

A minimal example for initiating the SDK is as follows:

import { W3SSdk } from '@circle-fin/w3s-pw-web-sdk'

const sdk = new W3SSdk({
  appSettings: {
    appId: '<Your App Id>'
  },
})

sdk.setAuthentication({
  userToken: '<Your user token>',
  encryptionKey: '<Your encryption key>',
})

sdk.execute(challengeId, (error, result) => {
  if (error) {
    console.log(
      `${error?.code?.toString() || 'Unknown code'}: ${
        error?.message ?? 'Error!'
      }`
    )

    return
  }

  console.log(`Challenge: ${result.type}`)
  console.log(`status: ${result.status}`)

  if (result.data) {
    console.log(`signature: ${result.data?.signature}`)
  }
})

Documentation

Check out the developer documentations below for an easy-breezy setup and smoother usage experience.

Examples

We provide 3 frontend examples for you to try out:

Please follow the steps below to start building:

  1. Clone this repo.
  2. Obtain the APP ID from Circle Developer Console.
  3. Running the script. please follow the README.md in the example folder to execute the sample app.