diff --git a/Cargo.lock b/Cargo.lock index dfbe0ea..91be343 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5233,9 +5233,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zeropool-bn" diff --git a/src/config.rs b/src/config.rs index 2c3c1c3..8903897 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,6 +40,12 @@ pub struct Opts { /// Receiver account id #[clap(long, env)] pub receiver_id: AccountId, + /// wrap.near account id (different for testnet) + #[clap(long, env)] + pub wrap_near_id: AccountId, + /// FT account id + #[clap(long, env)] + pub ft_account_id: AccountId, /// Transaction kind #[clap(long, env, value_enum, default_value = "token-transfer-default")] pub transaction_kind: TransactionKind, diff --git a/src/transaction/fungible_token_transfer.rs b/src/transaction/fungible_token_transfer.rs index 6ff212a..74d6363 100644 --- a/src/transaction/fungible_token_transfer.rs +++ b/src/transaction/fungible_token_transfer.rs @@ -33,7 +33,7 @@ impl TransactionSample for FungibleTokenTransfer { signer_id: signer.account_id.clone(), public_key: signer.public_key.clone(), nonce: nonce + 1, - receiver_id: "usdt.tether-token.near".parse().unwrap(), + receiver_id: opts.ft_account_id, block_hash, actions: vec![Action::FunctionCall(Box::new(FunctionCallAction { method_name: "ft_transfer".to_string(), diff --git a/src/transaction/swap.rs b/src/transaction/swap.rs index 75c0dd9..3ada0ee 100644 --- a/src/transaction/swap.rs +++ b/src/transaction/swap.rs @@ -25,15 +25,16 @@ impl TransactionSample for Swap { fn get_transaction_request( &self, signer: &InMemorySigner, - _opts: Opts, + opts: Opts, nonce: Nonce, block_hash: CryptoHash, ) -> RpcSendTransactionRequest { + let msg = format!("{{\"actions\":[{{\"pool_id\":3879,\"token_in\":\"{}\",\"token_out\":\"{}\",\"amount_in\":\"1000000000000000000000\",\"min_amount_out\":\"1\"}}]}}", opts.wrap_near_id, opts.ft_account_id); let transaction = Transaction { signer_id: signer.account_id.clone(), public_key: signer.public_key.clone(), nonce: nonce + 1, - receiver_id: "wrap.near".parse().unwrap(), + receiver_id: opts.wrap_near_id, block_hash, actions: vec![ Action::FunctionCall(Box::new(FunctionCallAction { @@ -44,7 +45,8 @@ impl TransactionSample for Swap { })), Action::FunctionCall(Box::new(FunctionCallAction { method_name: "ft_transfer_call".to_string(), - args: serde_json::json!({"msg": "{\"actions\":[{\"pool_id\":3879,\"token_in\":\"wrap.near\",\"token_out\":\"usdt.tether-token.near\",\"amount_in\":\"1000000000000000000000\",\"min_amount_out\":\"1\"}]}","amount": "1000000000000000000000","receiver_id": "v2.ref-finance.near"}).to_string().into_bytes(), + args: serde_json::json!( + {"msg": msg,"amount": "1000000000000000000000","receiver_id": "v2.ref-finance.near"}).to_string().into_bytes(), gas: 100_000_000_000_000, // 100 TeraGas deposit: 1, })),