Migration to Lit and AA
  • Overview
  • Getting Started
    • Installation
    • Deployment
    • FAQ
  • Reference
    • Onboarding and Wallet SDK
      • Concepts
      • Wagmi config
      • @tria-sdk/core
        • Auth Controller [INTERNAL]
        • User Controller
      • @tria-sdk/web [INTERNAL]
        • Lit Controller
        • Keyring Controller
        • Wallet Controller
        • Gas Abstraction Wallet Controller ⛽️
        • Fee Controller
        • Solana Wallet
        • WalletConnect Controller
        • 🚂Execution Engine Controller
      • @tria-sdk/connect
        • TriaProvider
        • Actions
        • Hooks
          • Internal hooks
        • Constants [Internal]
      • @tria-sdk/authenticate
        • Application
      • @tria-sdk/authenticate-web
    • Supported Networks
    • How to create Debridge Solana Calldata
    • New concepts [Internal]
    • Gas Abstraction Integrations [Internal]
  • EIP1193 - Provider (WIP)
Powered by GitBook
On this page
  • How it works?
  • About WalletController and FeeController
  1. Reference
  2. Onboarding and Wallet SDK
  3. @tria-sdk/web [INTERNAL]

Solana Wallet

Solana wallet controller for dapp side created any type of transactions

npm i @tria-sdk/web@4.2.27
Create an instance
const solanaWallet = new SolanaWallet({
    baseUrl: "https://dev.tria.so", // or staging for old infra
    walletType: {embedded: true},
    chainName: "SOLANA", // or "SOLANA-DEVNET" // can later add SOLANA-TESTNET too
});
signAndSendTransaction ⛽️
signAndSendTransaction({
    transaction: Transaction,
    gas: Gas
}): Promise<TxnResponse>;
export type TxnResponse = {
    success: boolean;
    data?: {
        txnId: string;
        viewInExplorer: string;
        wait: Function;
    };
    message?: string;
    error?: any;
};
getInstructions
getInstructions({ transaction: Transaction }): TxnInstruction[]
export type TxnInstruction = {
    name?: string;
    programId: string;
    data: string;
};
getEstimatedFee
getEstimatedFee({ transaction: Transaction }): Promise<FeeResponse>
export type FeeResponse = {
    success: boolean;
    fee?: {
        eth: string;
        usd?: string;
    };
    message?: string;
    error?: any;
};
estimateSolBalanceChange
estimateSolBalanceChange({ transaction: Transaction }): Promise<number | undefined> 

Note: This is only applicable in Tria's v2 internal infra, as in old infra.

How it works?

  • This can be used for any transaction created by the dapp on Solana, and wants to get signed via user's Tria wallet.

  • Passing the gas param in the signAndSendTxn function will cut the gas in any token, like USDC, SOL, etc., hence no dependency on SOL native tokens now to make txns

    • This was made possible because of Shyft Txn Relayer, which provides a feePayer to add to any Solana transactions

    • On the basis of the gas estimated, Tria's Solana feePayer will sponsor all that gas in SOL, and the user just has to pay in any token they prefer on Solana.

    • These transactions internally are partially signed by the user's key, as well as by the feePayer for paying the SOL fees.

About WalletController and FeeController

  • You can still keep using the WalletController and FeeController for Solana

    • for send, sendNft

    • for getSendFee, getSendNftFee

  • Only add the new popup for enabling any Solana transaction via SolanaWallet controller

PreviousFee ControllerNextWalletConnect Controller

Last updated 12 months ago