Skip to content

Commit

Permalink
use pubkey!; turned out to be a bit more complicated
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 committed Oct 25, 2024
1 parent 3d76e1e commit 57ee361
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions solana/solana-ibc/programs/solana-ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ primitive-types.workspace = true
prost.workspace = true
serde.workspace = true
serde_json.workspace = true
# We normally access solana_program via anchor_lang but to support
# pubkey! macro we need to have solana_program as direct dependency.
# TODO(mina86): Remove this once we upgrade Anchor to version with its
# own pubkey! macro.
solana-program.workspace = true
spl-associated-token-account.workspace = true
spl-token.workspace = true
strum.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions solana/solana-ibc/programs/solana-ibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub const WSOL_ADDRESS: &str = "So11111111111111111111111111111111111111112";
pub const MINIMUM_FEE_ACCOUNT_BALANCE: u64 =
solana_program::native_token::LAMPORTS_PER_SOL;

pub const BRIDGE_ESCROW_PROGRAM_ID: &str =
"AhfoGVmS19tvkEG2hBuZJ1D6qYEjyFmXZ1qPoFD6H4Mj";
pub const BRIDGE_ESCROW_PROGRAM_ID: Pubkey =
solana_program::pubkey!("AhfoGVmS19tvkEG2hBuZJ1D6qYEjyFmXZ1qPoFD6H4Mj");
pub const HOOK_TOKEN_ADDRESS: &str =
"0x36dd1bfe89d409f869fabbe72c3cf72ea8b460f6";

Expand Down
7 changes: 2 additions & 5 deletions solana/solana-ibc/programs/solana-ibc/src/transfer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::result::Result;
use std::str::{self, FromStr};
use std::str;

use anchor_lang::prelude::*;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -215,9 +215,6 @@ impl ibc::Module for IbcStorage<'_, '_> {
instruction_data.extend_from_slice(intent_id.as_bytes());
instruction_data.extend_from_slice(memo.as_bytes());

let bridge_escrow_program_id =
Pubkey::from_str(BRIDGE_ESCROW_PROGRAM_ID).unwrap();

let account_metas = accounts
.iter()
.map(|account| AccountMeta {
Expand All @@ -227,7 +224,7 @@ impl ibc::Module for IbcStorage<'_, '_> {
})
.collect::<Vec<AccountMeta>>();
let instruction = Instruction::new_with_bytes(
bridge_escrow_program_id,
BRIDGE_ESCROW_PROGRAM_ID,
&instruction_data,
account_metas,
);
Expand Down

0 comments on commit 57ee361

Please sign in to comment.