Skip to content

Commit

Permalink
fix: u128 serialization (#258)
Browse files Browse the repository at this point in the history
* fix: u128 serialization

* fix: u128 serialization using near-sdk
  • Loading branch information
frolvanya authored Feb 14, 2025
1 parent c6c3dd7 commit 13ebfa3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
32 changes: 13 additions & 19 deletions omni-relayer/Cargo.lock

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

3 changes: 2 additions & 1 deletion omni-relayer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "omni-relayer"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
resolver = "2"
repository = "https://github.com/Near-One/omni-bridge"
Expand Down Expand Up @@ -36,6 +36,7 @@ near-jsonrpc-client = "0.15.1"
near-jsonrpc-primitives = "0.28.0"
near-primitives = "0.28.0"
near-crypto = "0.28.0"
near-sdk = "5.8.0"

hex = "0.4.3"
alloy = { version = "0.9", features = ["node-bindings", "providers", "rpc-types", "sol-types", "provider-ws", "signers", "signer-local"] }
Expand Down
4 changes: 2 additions & 2 deletions omni-relayer/src/utils/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ async fn decode_instruction(
utils::redis::EVENTS,
signature.to_string(),
Transfer::Solana {
amount: payload.amount,
amount: payload.amount.into(),
token: token.clone(),
sender: sender.clone(),
recipient: payload.recipient.clone(),
fee: payload.fee,
fee: payload.fee.into(),
native_fee: payload.native_fee,
message: payload.message.clone(),
emitter: emitter.clone(),
Expand Down
9 changes: 5 additions & 4 deletions omni-relayer/src/workers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use ethereum_types::H256;
use near_bridge_client::TransactionOptions;
use near_jsonrpc_client::JsonRpcClient;
use near_primitives::{hash::CryptoHash, types::AccountId, views::TxExecutionStatus};
use near_sdk::json_types::U128;
use solana_client::rpc_request::RpcResponseErrorData;
use solana_rpc_client_api::{client_error::ErrorKind, request::RpcError};
use solana_sdk::{instruction::InstructionError, pubkey::Pubkey, transaction::TransactionError};
Expand Down Expand Up @@ -52,11 +53,11 @@ pub enum Transfer {
expected_finalization_time: i64,
},
Solana {
amount: u128,
amount: U128,
token: String,
sender: String,
recipient: String,
fee: u128,
fee: U128,
native_fee: u64,
message: String,
emitter: String,
Expand Down Expand Up @@ -960,7 +961,7 @@ async fn process_solana_init_transfer_event(
match utils::fee::is_fee_sufficient(
&config,
Fee {
fee: fee.into(),
fee,
native_fee: u128::from(native_fee).into(),
},
&sender,
Expand Down Expand Up @@ -994,7 +995,7 @@ async fn process_solana_init_transfer_event(
ChainKind::Sol,
&recipient,
token,
fee,
fee.0,
u128::from(native_fee),
)
.await
Expand Down

0 comments on commit 13ebfa3

Please sign in to comment.