Skip to content

Commit

Permalink
Make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski committed Jan 8, 2025
1 parent 28cfb58 commit 073633b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cw-storage-plus = { version = "2.0.0" }
cw-utils = { version = "2.0.0" }

# cw-multi-test = { package = "abstract-cw-multi-test", version = "2.0.2", features = ["cosmwasm_1_2"] }
cw-multi-test = { package = "abstract-cw-multi-test", git = "https://github.com/abstractsdk/cw-multi-test-fork", branch = "token-factory-integration", version = "2.0.2", features = ["cosmwasm_1_2"] }
cw-multi-test = { package = "abstract-cw-multi-test", git = "https://github.com/abstractsdk/cw-multi-test-fork", branch = "token-factory-integration", version = "2.0.2", features = ["cosmwasm_1_2", "tokenfactory"] }
cw20 = { version = "2.0.0" }
cw20-base = { version = "2.0.0" }

Expand Down
3 changes: 2 additions & 1 deletion packages/cw-orch-mock/src/bech32.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc};

use cosmwasm_std::{testing::MockApi, Addr, Coin, Uint128};
use cw_multi_test::{AppBuilder, MockApiBech32};
use cw_multi_test::{AppBuilder, MockApiBech32, TokenFactoryStargate};
use cw_orch_core::{
environment::{BankQuerier, BankSetter, DefaultQueriers, StateInterface, TxHandler},
CwEnvError,
Expand Down Expand Up @@ -74,6 +74,7 @@ impl<S: StateInterface> MockBase<MockApiBech32, S> {
let app = Rc::new(RefCell::new(
AppBuilder::new_custom()
.with_api(MockApiBech32::new(prefix))
.with_stargate(TokenFactoryStargate)
.build(|_, _, _| {}),
));

Expand Down
5 changes: 3 additions & 2 deletions packages/cw-orch-mock/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use cosmwasm_std::{
};
use cw_multi_test::{
ibc::IbcSimpleModule, App, AppResponse, BankKeeper, Contract, DistributionKeeper, Executor,
FailingModule, GovFailingModule, MockApiBech32, StakeKeeper, StargateFailing, WasmKeeper,
FailingModule, GovFailingModule, MockApiBech32, StakeKeeper, StargateFailing,

Check failure on line 9 in packages/cw-orch-mock/src/core.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `StargateFailing`

error: unused import: `StargateFailing` --> packages/cw-orch-mock/src/core.rs:9:66 | 9 | FailingModule, GovFailingModule, MockApiBech32, StakeKeeper, StargateFailing, | ^^^^^^^^^^^^^^^ | = note: `-D unused-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_imports)]`
TokenFactoryStargate, WasmKeeper,
};
use serde::Serialize;

Expand All @@ -27,7 +28,7 @@ pub type MockApp<A = MockApi> = App<
DistributionKeeper,
IbcSimpleModule,
GovFailingModule,
StargateFailing,
TokenFactoryStargate,
>;

/// Wrapper around a cw-multi-test [`App`](cw_multi_test::App) backend.
Expand Down
6 changes: 4 additions & 2 deletions packages/cw-orch-mock/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::rc::Rc;

use cosmwasm_std::testing::MockApi;
use cosmwasm_std::{Addr, Coin, Uint128};
use cw_multi_test::AppBuilder;
use cw_multi_test::{AppBuilder, TokenFactoryStargate};
use cw_orch_core::environment::{BankQuerier, BankSetter, TxHandler};
use cw_orch_core::{
environment::{DefaultQueriers, StateInterface},
Expand Down Expand Up @@ -105,7 +105,9 @@ impl<S: StateInterface> Mock<S> {
/// The state is customizable by implementing the `StateInterface` trait on a custom struct and providing it on the custom constructor.
pub fn new_custom(sender: impl Into<String>, custom_state: S) -> Self {
let state = Rc::new(RefCell::new(custom_state));
let app = AppBuilder::new_custom().build(|_, _, _| {});
let app = AppBuilder::new_custom()
.with_stargate(TokenFactoryStargate)
.build(|_, _, _| {});
let sender: String = sender.into();
let sender = app.api().addr_make(&sender);
let app = Rc::new(RefCell::new(app));
Expand Down

0 comments on commit 073633b

Please sign in to comment.