core-js

tweed javascript SDK

circle-check
js logo

Install

Install by package manager, install the paytweed/core-jsarrow-up-right from the npm public registryarrow-up-right.

Setup

circle-info

Ensure you have an application set up on the tweed dashboardarrow-up-right

Import the TweedClient from the tweed core-js SDK initial using create() function. Use the applicationId from the management console.

chevron-rightTweedClient.create()hashtag

Method parameters

  • applicationId REQUIRED string

  • options optional object chains optional array mode optional string rpcMap optional object


Returns

This method returns a Promise that resolves with a string representing oAuth access token

Connect Users

Use the connect() function to handle user sign-ups and sign-ins. When a user signs up, a wallet is created for them behind the scenes and becomes immediately available upon completion of the sign-up process. To modify the login options, simply visit the tweed dashboard.

chevron-righttweed.connect()hashtag

Returns

This method returns a Promise that resolves with a string representing oAuth access token

Logout users

To logout users from the application, call the logout function.

chevron-righttweed.logout()hashtag

Ethereum Provider | EIP-1193arrow-up-right

The Ethereum Provider acts as a bridge for Web3 libraries designed for EVM chains, such as EthersJSarrow-up-right and Web3JSarrow-up-right. For example, integrating Tweed with a dApp built using EthersJS is straightforward and requires only three lines of code. implements the chainChanged functionality to support the EVMs that are supported by the tweed infrastructure.

chevron-righttweed.getEthereumProvider()hashtag

Method parameters

  • chain REQUIRED string

Export Mnemonic

A mnemonic is a sequence of words that securely represents the user's wallet private key, allowing them to back up and restore access to their wallet. Use the getPrivateKey() function to display a widget where the user can retrieve the mnemonic for their wallet.

chevron-rightgetPrivateKey()hashtag

Set palette mode

The tweed widgets SDK offers both dark and light modes. You can select which one to use with this function.

chevron-righttweed.setPaletteMode()hashtag

Method parameters

  • paletteMode REQUIRED "dark" | "light"

Last updated