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,
connection.sendTransaction
)
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
},
...
})