Tweed Docs
  • Welcome to Tweed
    • What Can Tweed Do?
  • Getting Started
    • Embedded Wallets | WaaS
    • Token Checkout | Payments
      • Flow of Funds: Purchase to Settlement
      • Token Checkout
      • Legacy Token Checkout
        • Basic Checkout Integration
        • Checkout + WaaS + Auth
        • Features
          • Payment links
          • Whitelist
          • Flow of Funds
          • Apple & Google Pay
          • AML & KYC Policy Overview
  • Developer Tools
    • Tweed SDKs
      • core-react
        • useAuth
        • useWallet
        • useTweed
        • usePayments
        • useWeb3
      • core-js
      • core-vue
      • Payments SDKs (v1)
        • Frontend SDKs (Payments)
        • Backend SDK (Payments)
        • How to set up your smart contract for Tweed
        • Tezos chain considerations
    • Management Dashboard
      • Create platform
      • Create application
        • UI Customization
    • Webhooks
      • Checkout Webhooks
    • API
      • API (V1)
      • API (V2)
        • Authorization
        • API reference
          • Contracts
            • Add
            • Add contract function
            • Contract
          • Payouts
            • Add
            • Payout
          • Items
            • Add
            • All
              • Contract
                • Count
              • Payout
                • Count
          • Assets
            • Blockchain
            • All
              • Blockchains
          • Blockchains
            • Multiple
            • Native asset
          • Audit event mappings
          • Platform webhooks
            • Set active
          • Tickets
        • Specification
    • External Integrations
      • Wagmi connector
      • Onramp to Crypto
    • Example Projects
    • Supported Blockchains
    • Pricing
  • Products
    • WaaS
    • Payments
Powered by GitBook
On this page
  • Install
  • Setup
  • Connect Users
  • Logout users
  • Ethereum Provider | EIP-1193
  • Export Mnemonic
  • Set palette mode
  1. Developer Tools
  2. Tweed SDKs

core-js

tweed javascript SDK

PrevioususeWeb3Nextcore-vue

Last updated 4 months ago

Fully compatible with JavaScript and TypeScript

Install

npm i @paytweed/core-js

Setup

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

TweedClient.create()
import { Network, TweedClient } from "@paytweed/core-js";

const chains = [Network.ETHEREUM, Network.POLYGON];
const appId = "07a0835b-3c76-4572-8eae-66f347c1b77c";

const tweed = await TweedClient.create(appId, { chains });

Method parameters

  • REQUIRED string

  • options optional object optional array optional string optional object


Returns

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

Connect Users

tweed.connect()
const accessToken = await client.connect();

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.

tweed.logout()
await client.logout()
tweed.getEthereumProvider()
tweedProvider = await tweed.getEthereumProvider(Network.ETHEREUM_SEPOLIA);

Method parameters

  • 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.

getPrivateKey()
await client.getPrivateKey()

Set palette mode

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

tweed.setPaletteMode()
client.setPaletteMode((mode) =>
    mode === "light" ? "dark" : "light",
  );

Method parameters

  • paletteMode REQUIRED "dark" | "light"

Install by package manager, install the from the .

Ensure you have an application set up on the tweed

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 .

Ethereum Provider |

The Ethereum Provider acts as a bridge for Web3 libraries designed for EVM chains, such as and . 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.

paytweed/core-js
npm public registry
dashboard
dashboard
EIP-1193
EthersJS
Web3JS
npm: @paytweed/core-jsnpm
Logo
js logo