Skip to content

Commit

Permalink
Merge pull request #3 from heliaxdev/bengt/update-v0.23
Browse files Browse the repository at this point in the history
Update namada sdk to 0.23.0
  • Loading branch information
Fraccaman authored Sep 27, 2023
2 parents 279c10d + ed8b2b7 commit eab8aa0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rand_chacha = "0.3.1"
dotenvy = "0.15.7"
hex = "0.4.3"
# TODO: set back to a specific version of Namada when the PR is merged
namada = { git = "https://github.com/anoma/namada", branch = "grarco/sdk-async-traits-send", default-features = false, features = ["abciplus", "namada-sdk"] }
namada = { git = "https://github.com/anoma/namada", rev = "v0.23.0", default-features = false, features = ["abciplus", "namada-sdk", "async-send"] }
borsh = "0.9.4"
orion = "0.17.5"
data-encoding = "2.4.0"
Expand Down
6 changes: 3 additions & 3 deletions scripts/faucet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from requests import get, post
from hashlib import sha256

URL = "http://0.0.0.0:5000/api/v1/faucet"
URL = "http://0.0.0.0:5001/api/v1/faucet"

def request_challenge():
return get(URL).json()
Expand Down Expand Up @@ -38,9 +38,9 @@ def compute_pow_solution(challenge, difficulty):
'tag': response['tag'],
'challenge': response['challenge'],
'transfer': {
'target': 'atest1v4ehgw36g4rrsw2pxezyzsfjx3zrv3f4gfzrvdf5g3pnydf4gcm5vs3jgfprzs33g9zrgdfsp7hful',
'target': 'atest1d9khqw36gscrxdenggu5yw2ygsc5zwf3g9p5gde3xgc5z335gs6rjvpnx5erw33s8yuyxwfhu3xktm',
'token': 'atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5',
'amount': 100
'amount': 100 * 10**6
}
})

Expand Down
2 changes: 1 addition & 1 deletion src/dto/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Transfer {
pub token: String,
#[validate(length(min = 1, max = 50, message = "Invalid target address"))]
pub target: String,
#[validate(range(min = 1, max = 1000))]
#[validate(range(min = 1, max = 1_000_000_000))]
pub amount: u64,
}

Expand Down
4 changes: 2 additions & 2 deletions src/handler/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ pub async fn request_transfer(
drop(locked_sdk);

let transfer_result = match process_tx_response {
namada::ledger::tx::ProcessTxResponse::Applied(r) => r.code.eq(&"0"),
namada::ledger::tx::ProcessTxResponse::Broadcast(r) => r.code.eq(&Code::Ok),
namada::sdk::tx::ProcessTxResponse::Applied(r) => r.code.eq(&"0"),
namada::sdk::tx::ProcessTxResponse::Broadcast(r) => r.code.eq(&Code::Ok),
_ => false,
};

Expand Down
2 changes: 1 addition & 1 deletion src/sdk/masp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use borsh::{BorshDeserialize, BorshSerialize};
use masp_proofs::prover::LocalTxProver;
use namada::ledger::masp::{ShieldedContext, ShieldedUtils};
use namada::sdk::masp::{ShieldedContext, ShieldedUtils};

#[derive(Default)]
pub struct SdkShieldedCtx {
Expand Down
12 changes: 6 additions & 6 deletions src/sdk/namada.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::PathBuf;

use namada::{
ledger::{
sdk::{
args::{self, InputAmount},
signing::{self, SigningTxData},
tx::ProcessTxResponse,
Expand All @@ -13,7 +13,7 @@ use namada::{
key::common::{self, SecretKey},
masp::{TransferSource, TransferTarget},
token::{self, DenominatedAmount, NATIVE_MAX_DECIMAL_PLACES},
transaction::GasLimit,
transaction::GasLimit, io::DefaultIo,
},
};

Expand Down Expand Up @@ -84,11 +84,11 @@ impl NamadaSdk {
default_signer: Option<Address>,
args: &args::Tx,
) -> SigningTxData {
signing::aux_signing_data(
signing::aux_signing_data::<_, _, DefaultIo>(
&self.http_client,
&mut self.wallet.wallet,
args,
&owner,
owner,
default_signer,
)
.await
Expand All @@ -100,7 +100,7 @@ impl NamadaSdk {
}

pub async fn process_tx(&mut self, tx: Tx, args: &args::Tx) -> ProcessTxResponse {
namada::ledger::tx::process_tx(&self.http_client, &mut self.wallet.wallet, args, tx)
namada::sdk::tx::process_tx::<_,_,DefaultIo>(&self.http_client, &mut self.wallet.wallet, args, tx)
.await
.unwrap()
}
Expand Down Expand Up @@ -133,7 +133,7 @@ impl NamadaSdk {
args: args::TxTransfer,
fee_payer: common::PublicKey,
) -> Tx {
let (tx, _) = namada::ledger::tx::build_transfer(
let (tx, _) = namada::sdk::tx::build_transfer::<_,_,_,DefaultIo>(
&self.http_client,
&mut self.wallet.wallet,
&mut self.shielded_ctx.shielded_context,
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/wallet.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::PathBuf;

use namada::{
ledger::wallet::{
sdk::wallet::{
alias::Alias, ConfirmationResponse, GenRestoreKeyError, Store, StoredKeypair, Wallet,
WalletUtils,
},
Expand Down Expand Up @@ -59,7 +59,7 @@ impl WalletUtils for SdkWalletUtils {
fn show_overwrite_confirmation(
_alias: &Alias,
_alias_for: &str,
) -> namada::ledger::wallet::store::ConfirmationResponse {
) -> namada::sdk::wallet::store::ConfirmationResponse {
// Automatically replace aliases in non-interactive mode
ConfirmationResponse::Replace
}
Expand Down

0 comments on commit eab8aa0

Please sign in to comment.