Socket
Socket
Sign inDemoInstall

@ambire/login-sdk-core

Package Overview
Dependencies
0
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ambire/login-sdk-core

Ambire Wallet Login SDK core module


Version published
Maintainers
5
Install size
329 kB
Created

Readme

Source

@ambire/login-sdk-core

SDK for integrating Ambire Wallet Login to DApps.

Install

npm install @ambire/login-sdk-core

Usage

import { AmbireLoginSDK } from '@ambire/login-sdk-core'

const ambireLoginSDK = new AmbireLoginSDK({
    dappName: 'Your DApp name',
    dappIconPath: '<url-to-DApp-icon>',       // optional, but needed for DApp icon to be shown in Ambire Login modal
})

// open modal for login / create account
ambireLoginSDK.openLogin()

// trigger logout
ambireLoginSDK.openLogout()

// open modal for sending a transaction
ambireLoginSDK.openSendTransaction(to, value, data)

// open modal for signing a message
// supported types: eth_sign, personal_sign, eth_signTypedData, eth_signTypedData_v4
ambireLoginSDK.openSignMessage(type, message)

// add DApp-specific logic by
// subscribing to SDK listeners
ambireLoginSDK.onLoginSuccess((data) => {
    // data: {
    //  address: string   
    //  chainId: number
    //  providerUrl: string
    // }

    // DApp logic
})
ambireLoginSDK.onRegistrationSuccess((data) => {
    // data: {
    //  address: string   
    //  chainId: number
    //  providerUrl: string
    // }

    // DApp logic
})
ambireLoginSDK.onAlreadyLoggedIn((data) => {
    // data: {
    //  address: string   
    //  chainId: number
    //  providerUrl: string
    // }

    // DApp logic
})
ambireLoginSDK.onLogoutSuccess(() => {
    // DApp logic
})
ambireLoginSDK.onTxnSent((data) => {
    // data: {
    //  hash: string
    // }

    // DApp logic
})
ambireLoginSDK.onTxnRejected(() => {
    // DApp logic
})
ambireLoginSDK.onMsgSigned((data) => {
    // data: {
    //  signature: string
    // }

    // DApp logic
})
ambireLoginSDK.onMsgRejected((data) => {
    // DApp logic
})
ambireLoginSDK.onActionRejected((data) => {
    // DApp logic
})

FAQs

Last updated on 29 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc