Skip to content

Commit f8399aa

Browse files
committed
chore: update recv-message accounts response type
1 parent d16656a commit f8399aa

File tree

4 files changed

+7
-82
lines changed

4 files changed

+7
-82
lines changed

contracts/solana/programs/intent/src/instructions/query_accounts.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ pub fn query_recv_message_accounts(
1414
ctx: Context<QueryAccountCtx>,
1515
src_network: String,
1616
conn_sn: u128,
17-
msg: Vec<u8>,
18-
page: u8,
19-
limit: u8,
20-
) -> Result<QueryAccountsPaginateResponse> {
17+
msg: Vec<u8>
18+
) -> Result<QueryAccountsResponse> {
2119
let config = &ctx.accounts.config;
2220

2321
let (receipt_pda, _) = Pubkey::find_program_address(
@@ -124,11 +122,9 @@ pub fn query_recv_message_accounts(
124122
}
125123
}
126124

127-
Ok(QueryAccountsPaginateResponse::new(
128-
account_metas,
129-
page,
130-
limit,
131-
))
125+
Ok(QueryAccountsResponse {
126+
accounts: account_metas
127+
})
132128
}
133129

134130
#[derive(Accounts)]

contracts/solana/programs/intent/src/lib.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ pub mod intent {
100100
src_network: String,
101101
conn_sn: u128,
102102
msg: Vec<u8>,
103-
page: u8,
104-
limit: u8,
105-
) -> Result<QueryAccountsPaginateResponse> {
106-
instructions::query_recv_message_accounts(ctx, src_network, conn_sn, msg, page, limit)
103+
) -> Result<QueryAccountsResponse> {
104+
instructions::query_recv_message_accounts(ctx, src_network, conn_sn, msg)
107105
}
108106
}

contracts/solana/programs/intent/src/types/misc.rs

-36
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ use super::{order_cancel::Cancel, order_fill::OrderFill, swap_order::SwapOrder};
55
pub const RESOLVE_FILL_IX: &str = "resolve_fill";
66
pub const RESOLVE_CANCEL_IX: &str = "resolve_cancel";
77

8-
pub const QUERY_SWAP_ACCOUNTS_IX: &str = "query_swap_accounts";
9-
pub const QUERY_FILL_ACCOUNTS_IX: &str = "query_fill_accounts";
10-
pub const QUERY_CANCEL_ACCOUNTS_IX: &str = "query_cancel_accounts";
118
pub const QUERY_RECV_MESSAGE_ACCOUNTS_IX: &str = "query_recv_message_accounts";
129

1310
#[derive(Debug, Clone)]
@@ -60,36 +57,3 @@ pub struct QueryAccountsResponse {
6057
pub accounts: Vec<AccountMetadata>,
6158
}
6259

63-
#[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize)]
64-
pub struct QueryAccountsPaginateResponse {
65-
pub accounts: Vec<AccountMetadata>,
66-
pub total_accounts: u8,
67-
pub limit: u8,
68-
pub page: u8,
69-
pub has_next_page: bool,
70-
}
71-
72-
impl QueryAccountsPaginateResponse {
73-
pub fn new(accounts: Vec<AccountMetadata>, page: u8, limit: u8) -> Self {
74-
let offset = ((page - 1) * limit) as usize;
75-
let total = accounts.len();
76-
77-
let to_index = if offset + limit as usize > total {
78-
total
79-
} else {
80-
offset + limit as usize
81-
};
82-
83-
let accounts = accounts[offset..to_index].to_vec();
84-
let total_accounts = total as u8;
85-
let has_next_page = total > to_index;
86-
87-
QueryAccountsPaginateResponse {
88-
accounts,
89-
total_accounts,
90-
limit,
91-
page,
92-
has_next_page,
93-
}
94-
}
95-
}

contracts/solana/scripts/recv-message.ts

-33
This file was deleted.

0 commit comments

Comments
 (0)