SSP Wallet
  • Welcome to SSP Wallet
  • Getting Started with SSP Wallet
    • Change Language
    • Switch Chain
    • Wallet
      • Retrieve SSP Wallet Seed Phrase
      • Create a New Wallet
      • Restore Wallet Using Seed Phrase
      • Create Multiple Wallet
      • Delete a Wallet
      • Retrieving Your Wallet Address
    • Transaction
      • Buy / Sell
      • Swap
      • Send
      • Receive
      • Export Transactions
      • View Transactions
    • Token
      • Add Token to Main Screen
      • Remove Token from Main Screen
    • Custom Tokens
      • Add Custom Token
      • Delete Custom Token
    • Contacts
      • Create New Contact
      • Edit Contact
      • Delete Contact
    • Logout Your SSP Wallet
  • GETTING STARTED WITH SSP KEY
    • Install SSP Key
    • Create a New Key and Syncing to SSP Wallet
    • Restore Key Using Seed Phrase and Syncing to SSP Wallet
    • Retrieving Your SSP Key Seed Phrase
    • Using Your SSP Key For Syncing
  • GETTING STARTED WITH SSP RELAY DEVELOPMENT
    • Overview
    • Environment Requirements
    • Project Installation
    • Project Structure 0verview
    • Project Folders
      • Config
      • Helpers
      • Logs
      • Src
        • apiServices
        • lib
        • services
        • routes.ts
          • GET /v1/sync
          • GET /v1/action
          • POST /v1/sync
          • POST /v1/token
          • POST /v1/action
          • GET /v1/rates
          • GET /v1/networkfees
          • POST /v1/ticket
          • GET /v1/tokeninfo
          • GET /v1/services
          • POST /v1/sign
      • Tests
        • unit
  • GETTING STARTED WITH SSP WALLET DEVELOPMENT
    • Overview
    • Environment Requirements
    • Project Installation
    • SSP Wallet API
    • Project Structure Overview
    • Project Folders
      • Public
        • scripts
      • Patches
      • Src
        • assets
        • components
        • contexts
        • hooks
        • lib
        • pages
        • storage
        • store
        • translations
      • Tests
        • lib
  • GETTING STARTED WITH SSP KEY DEVELOPMENT
    • Overview
    • Environment Requirements
      • For Mac Users Only
    • Project Installation
    • Project Structure Overview
    • Project Folders
      • Types
      • Src
        • assets
        • components
        • contexts
        • hooks
        • lib
        • navigators
        • screens
        • storage
        • store
        • themes
        • translations
      • Tests
        • lib
Powered by GitBook
On this page

SSP Wallet JavaScript API

The SSP Wallet injects a window.ssp object into the website, enabling communication between web pages and the SSP Wallet Chrome extension.

API Method: window.ssp.request(method, parameters)

This function takes two parameters:

  • method: A string specifying the method to be called.

  • parameters: An object containing additional parameters specific to the method.

Implemented Methods

1. Pay Request

  • Method: 'pay'

  • Description: Requests SSP to perform payment actions (sending assets).

  • Parameters:

    • message (string): A message to include in the transaction (e.g., 'Hello SSP').

    • amount (string): The amount to send in whole units (e.g., '4.124').

    • address (string): The recipient's address (e.g., 't1eabPBaLCqNgttQMnAoohPaQM6u2vFwTNJ').

    • chain (string): The chain ID identifier of SSP (e.g., 'flux').

    • contract? (string): For networks that support tokens, the token contract to send from, not needed for ETH itself (e.g., '0xdac17f958d2ee523a2206206994597c13d831ec7' to send 'USDT').

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • txid? (string): Transaction ID in case of a successful payment.

Example:

2. Sign Message with SSP Wallet ID (FluxID)

  • Method: 'sspwid_sign_message'

  • Description: Requests SSP to sign a message using SSP Wallet Identity.

  • Parameters:

    • message (string): The message to be signed by SSP Wallet Identity (e.g., 'Hello SSP, please sign this message').

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • signature? (string): Signature of the signed message.

    • address? (string): Address that signed the message.

    • message? (string): The message that was signed.

Example:

3. SSP Chains Info

  • Method: 'chains_info'

  • Description: Requests SSP to get the list of supported chains.

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • chains? (array of objects): List of all supported chains.

      • id (string): Chain ID.

      • name (string): Chain name.

      • symbol (string): Chain symbol.

      • decimals (number): Chain decimals.

      • chainId? (string): Chain ID (for EVM chains) of the chain.

Example:

4. Chain Tokens

  • Method: 'chain_tokens'

  • Description: Requests SSP to get the list of tokens for a given chain.

  • Parameters:

    • chain (string): Chain ID as SSP identifier.

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • tokens? (array of objects): List of tokens for the given chain.

      • contract (string): Token contract.

      • name (string): Token name.

      • symbol (string): Token symbol.

      • decimals (number): Token decimals.

Example:

5. User Synced Chains Info

  • Method: 'user_chains_info'

  • Description: Requests SSP to get the list of chains that the user has synchronised. Those are the chains that can be immediately used and have addresses. Other chains will require the user to synchronise the chain first.

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • chains? (array of objects): List of user synced chains.

      • id (string): Chain ID.

      • name (string): Chain name.

      • symbol (string): Chain symbol.

      • decimals (number): Chain decimals.

      • chainId? (string): Chain ID (for EVM chains) of the chain.

Example:

6. User Addresses

  • Method: 'user_addresses'

  • Description: Requests SSP to get the list of addresses for a given chain.

  • Parameters:

    • chain (string): Chain ID as SSP identifier.

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • addresses? (array of strings): List of user approved addresses for the given chain.

Example:

7. User Addresses All Chains

  • Method: 'user_chains_addresses_all'

  • Description: Requests SSP to get the list of addresses for a all chains. User can select what addresses are shared for what chain. Also provides information about particular chain

  • Response:

    • status (string): Indicates success or error.

    • result? (string): Explanation of error (if any).

    • data? (string): Explanation of success (if any).

    • chains? (array of objects): List of user approved chains with addresses

      • id (string): Chain ID.

      • name (string): Chain name.

      • symbol (string): Chain symbol.

      • decimals (number): Chain decimals.

      • chainId? (string): Chain ID (for EVM chains) of the chain.

      • addresses (array of strings): List of user addresses

Example:

Last updated 2 months ago

window.ssp.request('pay', {
  message: 'Hello SSP',
  amount: '4.124',
  address: 't1eabPBaLCqNgttQMnAoohPaQM6u2vFwTNJ',
  chain: 'flux'
}).then(response => {
  console.log(response);
});
window.ssp.request('sspwid_sign_message', {
  message: 'Hello SSP, please sign this message'
}).then(response => {
  console.log(response);
});
window.ssp.request('chains_info').then(response => {
  console.log(response);
});
window.ssp.request('chain_tokens', {
  chain: 'eth'
}).then(response => {
  console.log(response);
});
window.ssp.request('user_chains_info').then(response => {
  console.log(response);
});
window.ssp.request('user_addresses', {
  chain: 'btc'
}).then(response => {
  console.log(response);
});
window.ssp.request('user_chains_addresses_all').then(response => {
  console.log(response);
});
  1. GETTING STARTED WITH SSP WALLET DEVELOPMENT

SSP Wallet API

PreviousProject InstallationNextProject Structure Overview
  • SSP Wallet JavaScript API
  • API Method: window.ssp.request(method, parameters)