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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to the searcher sdks will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Added

- For swap opportunities, the searcher sdks will now add a memo instruction to the bid transaction if the quote requester so desires. This allows the quote requester to track which on-chain transactions correspond to quotes they requested. [458](https://github.com/pyth-network/per/pull/458)

## [Rust: 0.7.0, Python 0.22.0, Javascript 0.23.0] - 2025-03-25

### Changed
Expand Down
25 changes: 25 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ litesvm = "0.6.0"
borsh = "1.5.1"
spl-associated-token-account = "6.0.0"
spl-token = "7.0.0"
spl-memo-client = "0.1.0"
spl-token-2022 = "7.0.0"

# This patch disables debugging features in litesvm runtime_environments
Expand Down
1 change: 1 addition & 0 deletions auction-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ strum.workspace = true
spl-associated-token-account = { workspace = true }
spl-token = { workspace = true }
mockall_double = "0.3.1"
spl-memo-client = { workspace = true }
spl-token-2022 = { workspace = true }

[dev-dependencies]
Expand Down
15 changes: 15 additions & 0 deletions auction-server/api-types/src/opportunity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ pub enum OpportunityParamsV1ProgramSvm {

/// Details about which token accounts need to be initialized and by whom
token_account_initialization_configs: TokenAccountInitializationConfigs,

/// If provided, this memo must be included in the bid transaction as a Memo program instruction.
#[schema(example = "memo")]
memo: Option<String>,
},
}

Expand Down Expand Up @@ -575,6 +579,9 @@ pub struct QuoteCreateV1SvmParams {
/// The chain id for creating the quote.
#[schema(example = "solana", value_type = String)]
pub chain_id: ChainId,
/// Optional memo to be included in the transaction
#[schema(example = "memo")]
pub memo: Option<String>,
}

#[serde_as]
Expand Down Expand Up @@ -627,6 +634,14 @@ impl QuoteCreate {
QuoteCreate::Svm(QuoteCreateSvm::V1(params)) => params.user_wallet_address,
}
}

pub fn get_memo_length(&self) -> Option<usize> {
match self {
QuoteCreate::Svm(QuoteCreateSvm::V1(params)) => {
params.memo.as_ref().map(|memo| memo.len())
}
}
}
}

#[derive(Serialize, Deserialize, ToSchema, Clone, PartialEq, Debug)]
Expand Down
16 changes: 16 additions & 0 deletions auction-server/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ pub enum InstructionError {
InvalidTokenProgramInCreateAtaInstruction { expected: Pubkey, found: Pubkey },
InvalidSystemProgramInCreateAtaInstruction(Pubkey),
MissingCreateAtaInstruction(Pubkey),
InvalidMemoInstructionCount { expected: usize, found: usize },
InvalidMemoString { expected: String, found: String },
}

impl std::fmt::Display for InstructionError {
Expand Down Expand Up @@ -258,6 +260,20 @@ impl std::fmt::Display for InstructionError {
ata
)
}
InstructionError::InvalidMemoInstructionCount { expected, found } => {
write!(
f,
"Invalid memo instruction count. Expected: {:?} found: {:?}",
expected, found
)
}
InstructionError::InvalidMemoString { expected, found } => {
write!(
f,
"Invalid memo string in memo instruction. Expected: {:?} found: {:?}",
expected, found
)
}
}
}
}
Expand Down
Loading
Loading