Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/cyan-cougars-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@reservoir0x/relay-svm-wallet-adapter': patch
'@reservoir0x/relay-sdk': patch
---

Expose instructions in signature function
21 changes: 16 additions & 5 deletions packages/relay-svm-wallet-adapter/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@ import {
AddressLookupTableAccount,
Connection,
PublicKey,
Transaction,
TransactionInstruction,
TransactionMessage,
VersionedTransaction,
type SendOptions,
type TransactionSignature
} from '@solana/web3.js'
import { LogLevel, getClient, type AdaptedWallet } from '@reservoir0x/relay-sdk'
import {
LogLevel,
getClient,
type AdaptedWallet,
type TransactionStepItem
} from '@reservoir0x/relay-sdk'

export const adaptSolanaWallet = (
walletAddress: string,
chainId: number,
connection: Connection,
signAndSendTransaction: (
transaction: Transaction | VersionedTransaction,
options?: SendOptions
transaction: VersionedTransaction,
options?: SendOptions,
instructions?: TransactionInstruction[],
rawInstructions?: TransactionStepItem['data']['instructions']
) => Promise<{
signature: TransactionSignature
}>
Expand Down Expand Up @@ -71,7 +77,12 @@ export const adaptSolanaWallet = (
)

const transaction = new VersionedTransaction(messageV0)
const signature = await signAndSendTransaction(transaction)
const signature = await signAndSendTransaction(
transaction,
undefined,
instructions,
stepItem.data.instructions
)

client.log(
['Transaction Signature obtained', signature],
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/actions/getQuote.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AxiosRequestConfig } from 'axios'
import { axios } from '../utils/axios.js'
import { zeroAddress, type Address, type WalletClient } from 'viem'
import { zeroAddress, type WalletClient } from 'viem'
import prepareCallTransaction from '../utils/prepareCallTransaction.js'
import {
isSimulateContractRequest,
Expand Down Expand Up @@ -33,7 +33,7 @@ export type GetQuoteParameters = {
tradeType: QuoteBodyOptions['tradeType']
wallet?: AdaptedWallet | WalletClient
amount?: string
recipient?: Address
recipient?: string
options?: Omit<QuoteBodyOptions, 'user' | 'source' | 'txs' | 'tradeType'>
txs?: (NonNullable<QuoteBody['txs']>[0] | SimulateContractRequest)[]
}
Expand Down
Loading