import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk";
import { adaptSolanaWallet } from '@relayprotocol/relay-solana-wallet-adapter'
import { Connection, Keypair, clusterApiUrl, SystemProgram, Transaction } from '@solana/web3.js';
...
//In this example we are loading a keypair as the wallet, but if you have a connector like dynamic you can just fetch the connection from that library
const wallet = Keypair.generate();
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed');
const walletAddress = wallet.publicKey.toString()
const adaptedWallet = adaptSolanaWallet(
walletAddress,
792703809, // Chain ID that Relay uses to identify Solana
connection, // The Solana web3.js Connection instance for interacting with the network
connection.sendTransaction // Function to sign and send a transaction, returning a promise with a base58 encoded transaction signature
)
const options = ... // define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({steps, fees, breakdown, currentStep, currentStepItem, txHashes, details}) => {
// custom handling
},
...
})