Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Sep 16, 2024
1 parent 3f07587 commit 20825e0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"node": "wss://rpc.matrix.canary.enjin.io:443",
"relay_node": "wss://rpc.relay.canary.enjin.io:443",
"api": "https://platform.canary.enjin.io/graphql",
"node": "wss://rpc.matrix.blockchain.enjin.io:443",
"relay_node": "wss://rpc.relay.blockchain.enjin.io:443",
"api": "https://platform.enjin.io/graphql",
"master_key": "store"
}
3 changes: 2 additions & 1 deletion src/config_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ async fn get_keys(key_store_path: &Path, password: SecretString) -> Keypair {
}

pub async fn load_wallet(config: Configuration) -> (Keypair, String, String, String, String) {
let version = env!("CARGO_PKG_VERSION");
let password = get_password(KEY_PASS);
let signer = get_keys(&config.master_key, password).await;
let public_key = signer.public_key().0;
let account_id = sp_core::crypto::AccountId32::from(public_key);

println!("********** Enjin Wallet Daemon v2.0.0 - Loaded Wallet **********");
println!("******************* Enjin Wallet Daemon v{version} *******************");
println!(
"** Enjin Matrixchain (SS58): {}",
account_id.to_ss58check_with_version(Ss58AddressFormat::custom(1110))
Expand Down
19 changes: 13 additions & 6 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use backoff::exponential::ExponentialBackoff;
use backoff::SystemClock;
use subxt::backend::rpc::RpcClient;
use subxt::config::substrate::{BlakeTwo256, SubstrateHeader};
use subxt::config::DefaultExtrinsicParamsBuilder as Params;
use subxt::config::{DefaultExtrinsicParamsBuilder as Params, Header};
use subxt::tx::Signer;
use subxt::{tx::TxStatus, OnlineClient, PolkadotConfig};
use subxt::ext::codec::Encode;
Expand Down Expand Up @@ -280,16 +280,23 @@ impl TransactionProcessor {
let params = Params::new().nonce(correct_nonce).mortal(&block_header, 16).build();

// We probably need to try to create the tx (to check if it is valid before grabbing a nonce for it
let mut transaction = chain_client
let signed_tx = chain_client
.tx()
.create_signed(&Wrapper(payload), &keypair, params)
.await?
.submit_and_watch()
.await?;

// let encoded_tx = hex::encode(&transaction.);
// let mut sub = tx.submit_and_watch().await?;
let encoded_tx = hex::encode(&signed_tx.encoded());
tracing::info!("Request: #{} - Nonce: {} - BlockNumber: #{} - BlockHash: 0x{} - SpecVersion: {} - TxVersion: {} - Extrinsic: 0x{}",
request_id,
correct_nonce,
block_header.number,
hex::encode(block_header.hash().0),
chain_client.runtime_version().spec_version,
chain_client.runtime_version().transaction_version,
encoded_tx
);

let mut transaction = signed_tx.submit_and_watch().await?;
while let Some(status) = transaction.next().await {
match status? {
TxStatus::Validated => {
Expand Down

0 comments on commit 20825e0

Please sign in to comment.