Saros
  • SAROS
  • SAROS DLMM
  • SAROS AMM
  • SAROS PERPS
  • SAROS MOBILE APP
  • SAROS DLMM
    • Onboarding and Guides
      • Saros DLMM: Introduction
      • Liquidity Lifecycle: Deployment, Management & Rebalancing
      • Permissionless Saros DLMM Pools
      • Understanding Your Risks as a Liquidity Provider on Saros DLMM
    • Shapes and Strategies
      • Liquidity Shapes
      • Getting Started with Basic Liquidity Strategies
      • Advanced Liquidity Strategies on Saros
      • Managing Out-of-Range Liquidity on Saros
      • Single-Sided Liquidity Strategies on Saros
    • Rewards
      • Concentrated Incentives (CI) on Saros
    • Technical Design
    • Technical Guides
      • Add liquidity
      • Create a pair
      • User Position
      • Swap tokens
      • Removing Liquidity
  • SAROS AMM
    • SarosSwap
      • How To Swap on SarosSwap
    • SarosFarm
      • How to Add Liquidity
      • How to Remove Liquidity
      • How to Farm on SarosFarm
      • How to Claim the Reward
    • SarosStake
      • How to stake
      • How to unstake
      • How to harvest
    • SarosSnapShot
    • FAQs
      • Is Saros safe? Has Saros been audited?
      • Why did my transaction fail?
      • How to resolve the "No wallet" error when connecting wallet to Saros Finance
      • What is the difference between APY and APR?
      • How to get farming pool Txid
      • What are liquidity provider tokens?
      • When will you open more pools?
      • What wallets can I use with Saros? How do I connect my wallet to Saros?
      • My LP tokens aren’t showing up on the site or in my wallet?
      • How do I get airdrops?
      • Can I use Saros on my phone?
      • What is price impact?
      • What is slippage tolerance? How can I adjust it when swapping?
      • What fees do I pay when I exchange tokens?
      • Are there any fees associated with the SarosFarm?
      • How to calculate and distribute the reward on SarosFarm?
      • Can I withdraw my liquidity anytime?
      • Where can I check Saros Analytics?
      • I can't find an answer for my question. Where do I find an answer?
      • How could I report a bug?
      • How to check wallet information on Saros
    • Go to DEX
  • SAROS PERP DEX
    • Trading Basics
    • Getting Started
    • Deposit/Withdraw
    • Order Management
  • SAROS GARDEN
    • Introduction
    • How to stake on Saros Garden
    • How to unstake from Saros Garden
    • How to redeem BERRY
  • ALL ABOUT $SAROS
    • Saros Token ($SAROS)
  • SAROS MOBILE APP
    • Mobile App
      • How to install Saros Super App
      • How to set up Saros Super App
      • How to add a new Hot Wallet
      • How to add View-only wallet
      • How to log in to Social Account
      • How to manage wallets
      • How to send or receive a token
      • How to send or receive NFTs
      • How to send multiple NFTs to an address
      • How to swap tokens
      • How to add a custom token
      • How to manage tokens
      • General Settings
      • How to use DApp browser
      • How to turn on Biometric and change Passcode
      • Migrate Ramper V2 on Super App
      • How to use Discover
      • How to buy crypto
    • Extension
      • How to install Saros Wallet Extension
      • How to set up Saros Extension Wallet
      • How to add a new Hot Wallet on Saros Extension
      • How to Add view-only wallet
      • How to manage wallets
      • How to send or receive a token
      • How to send or receive NFTs
      • How to add a custom token?
      • How to manage tokens
      • General settings
      • How to change the password?
      • Migrate Ramper V2 on Extension
      • How to log in to Social Account
      • How to use Discover
      • How to buy crypto
      • How to send multiple NFTs in one transaction with Multisend
      • How to Manage Notifications
      • How to swap on Saros Extension
      • Action on X
    • FAQs
  • INTEGRATION
    • Saros Super App
    • Saros DEX
  • Saros DLMM
  • LEGAL
    • TERMS OF SERVICE
    • Privacy Policy
  • AUDITS
    • SarosSwap
    • SarosFarm & SarosStake
    • Saros DLMM
  • OFFICIAL LINKS
    • Saros Community
    • Brand Assets
Powered by GitBook
On this page
  • Solana DApps Integration
  • The easiest way to detect to Saros Wallet
  • To connect Saros Extension Wallet
  • To disconnect Saros Extension Wallet
  • To experience functions
  • To handle events
  1. INTEGRATION

Saros Super App

Integrate Saros Super App easily through our developer guide down here

Solana DApps Integration

Welcome to Saros Wallet Developer Guide. This documentation contains guides for developers to get started developing on Saros Wallet

The easiest way to detect to Saros Wallet

Check if the provider is window.saros, if not, please replace it with the exclusive Saros Wallet provider window.saros.

if(window.saros){
    console.log('Saros Extension is installed!');
}
function getProvider() {
  const provider = window.saros;
  if (!provider) {
    return window.open('');
  }
  return provider;
}

To connect Saros Extension Wallet

To connect Saros Extension means to access the user's account(s).

// Connect & get accounts
window.saros.request({method: 'sol_accounts'});

// Alias for connection
window.saros.request({method: 'sol_requestAccounts'});​

//Check if dapp connected
window.saros.isConnected();

To disconnect Saros Extension Wallet

To disconnect Saros Extension, please use:

window.saros.disconnect()

To experience functions

Once your account is connected, let's start experiencing more functions.‌

Get Current Account

return Promise<Array[String]>

  • If wallet can not be found, return [] instead of throw Error

window.saros.request({ method: 'sol_accounts' }).then(accounts => {
  if (accounts[0]) {
    // Do something with accounts
  } else {
    // Wallet not found
  }
})

Check wallet whether exists or not

return Promise<{data: Boolean}>

window.saros.request({ method: 'has_wallet', params: ['solana'] })
// Example
window.saros.request({ method: 'has_wallet', params: ['solana'] }).then(() => {
  // Wallet Exists
}).catch(e => { 
  // Wallet not found
})

Sign Transaction

In order to send a message for the user to sign, a web application must:

  1. Provide a hex or UTF-8 encoded string as a Uint8Array.

return: `Promise<({signature: base58, publicKey: PublicKey})>

// Example Sign Transaction
const signature = window.saros.request({
    method: 'sol_sign',
    params: [<Transaction>]
}).then(({publicKey, signature}) => {
	//Do something with publicKey and signature
});

Signing and Sending Multiple Transactions

const solSignAllTransaction = async () => {
  try {
    const pubKey = new PublicKey(solanaAccount)
    const txs = new Transaction().add(SystemProgram.transfer({
      fromPubkey: pubKey,
      toPubkey: pubKey,
      lamports: LAMPORTS_PER_SOL / 100
    }))

    txs.recentBlockhash = (await cnn.getLatestBlockhash()).blockhash
    txs.feePayer = pubKey

    const transactions = [txs, txs, txs]

    const result = await window.saros.request({
      method: 'sol_signAllTransactions',
      params: [transactions]
    })
    return result
  } catch (err) {
    console.log({ err })
  }
}

Verify Signature

return Promise<boolean>

window.saros.request({
  method: 'sol_verify',
  params: [signature, msg]
})

To handle events

List of events

Currently we only support some action event from wallet extension

window.saros.on('event_name', callback);
​//Example
window.saros.on('close', () => window.location.reload());
window.saros.on('accountsChanged', () => window.location.reload());

Events

Trigger

disconnect

Receive when disconnect from Extension

Method

Description

on(event, callback)

Add event listener

off(event, callback)

Remove event listener

PreviousFAQsNextSaros DEX

Last updated 11 months ago