Skip to content

Commit

Permalink
fix: ensure abigen is correctly generated with derives
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Aug 30, 2024
1 parent 92b7b79 commit 9d41ea4
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 44 deletions.
126 changes: 105 additions & 21 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ inherits = "release"
lto = "fat"

[workspace.dependencies]
cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "fb91215", features = [ "abigen-rs" ] }
cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "0d29bb0", features = [ "abigen-rs" ] }
dojo-utils = { path = "crates/dojo-utils" }

# metrics
Expand Down
3 changes: 2 additions & 1 deletion crates/dojo-world/abigen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ fn get_bindings_file_content(contract_name: &str, contract_class: ContractClass)
"// AUTOGENERATED FILE, DO NOT EDIT.\n// To generate the bindings, please run `cargo run \
--bin dojo-world-abigen` instead.\nuse cainome::rs::abigen;\n\nabigen!(\n {},\n \
r#\"{}\"#,\ntype_aliases {{\ndojo::world::config::Config::Event as \
DojoConfigEvent;\n}}\n);",
DojoConfigEvent;\n}},\nderives(Debug, serde::Serialize, serde::Deserialize, PartialEq, \
Eq, Clone)\n);",
contract_name,
serde_json::to_string_pretty(&contract_class.abi).unwrap()
)
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-world/src/contracts/abi/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,5 @@ abigen!(
type_aliases {
dojo::world::config::Config::Event as DojoConfigEvent;
},
derives(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)
derives(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)
);
3 changes: 2 additions & 1 deletion crates/dojo-world/src/contracts/abi/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,5 +1232,6 @@ abigen!(
]"#,
type_aliases {
dojo::world::config::Config::Event as DojoConfigEvent;
}
},
derives(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)
);
17 changes: 4 additions & 13 deletions crates/katana/rpc/rpc/tests/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,18 @@ use common::split_felt;
use dojo_test_utils::sequencer::{get_default_test_starknet_config, TestSequencer};
use indexmap::IndexSet;
use katana_core::sequencer::SequencerConfig;
<<<<<<< HEAD
use katana_rpc_types::receipt::ReceiptBlock;
use starknet::accounts::{Account, ConnectedAccount};
use starknet::core::types::contract::legacy::LegacyContractClass;
use starknet::core::types::{
BlockId, BlockTag, Call, DeclareTransactionReceipt, Felt, TransactionFinalityStatus,
TransactionReceipt,
=======
use katana_primitives::genesis::constant::{
DEFAULT_FEE_TOKEN_ADDRESS, DEFAULT_OZ_ACCOUNT_CONTRACT_CLASS_HASH,
DEFAULT_PREFUNDED_ACCOUNT_BALANCE, DEFAULT_UDC_ADDRESS,
};
use starknet::accounts::{
Account, AccountError, AccountFactory, Call, ConnectedAccount, ExecutionEncoding,
Account, AccountError, AccountFactory, ConnectedAccount, ExecutionEncoding,
OpenZeppelinAccountFactory, SingleOwnerAccount,
};
use starknet::core::types::contract::legacy::LegacyContractClass;
use starknet::core::types::{
BlockId, BlockTag, DeclareTransactionReceipt, DeployAccountTransactionReceipt, ExecutionResult,
Felt, StarknetError, TransactionFinalityStatus, TransactionReceipt,
>>>>>>> dojo/main
BlockId, BlockTag, Call, DeclareTransactionReceipt, DeployAccountTransactionReceipt,
ExecutionResult, Felt, StarknetError, TransactionFinalityStatus, TransactionReceipt,
};
use starknet::core::utils::get_contract_address;
use starknet::macros::{felt, selector};
Expand Down Expand Up @@ -263,7 +254,7 @@ async fn concurrent_transactions_submissions(
let account = Arc::new(sequencer.account());

// setup test contract to interact with.
abigen_legacy!(Contract, "crates/katana/rpc/rpc/tests/test_data/erc20.json");
abigen_legacy!(Contract, "crates/katana/rpc/rpc/tests/test_data/erc20.json", derives(Clone));

// function call params
let recipient = Felt::ONE;
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/core/src/sql_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use katana_runner::{KatanaRunner, KatanaRunnerConfig};
use scarb::compiler::Profile;
use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions};
use starknet::accounts::{Account, ConnectedAccount};
use starknet::core::types::{BlockId, BlockTag, Call, Felt};
use starknet::core::types::{Call, Felt};
use starknet::core::utils::{get_contract_address, get_selector_from_name};
use starknet::providers::Provider;
use starknet_crypto::poseidon_hash_many;
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/grpc/src/server/tests/entities_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use scarb::compiler::Profile;
use scarb::ops;
use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions};
use starknet::accounts::Account;
use starknet::core::types::{BlockId, BlockTag, Call};
use starknet::core::types::Call;
use starknet::core::utils::{get_contract_address, get_selector_from_name};
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::JsonRpcClient;
Expand Down
4 changes: 2 additions & 2 deletions examples/spawn-and-move/dojo_dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ default = "dojo_examples"
mappings = { "armory-Flatbow" = "dojo_examples_weapons", "bestiary" = "dojo_examples_foes" }

[env]
# rpc_url = "http://localhost:5050/"
rpc_url = "https://api.cartridge.gg/x/kari-test/katana"
rpc_url = "http://localhost:5050/"
#rpc_url = "https://api.cartridge.gg/x/kari-test/katana"

# Default account for katana with seed = 0
account_address = "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
"seed": "dojo_examples",
"metadata": {
"profile_name": "dev",
"rpc_url": "https://api.cartridge.gg/x/kari-test/katana"
"rpc_url": "http://localhost:5050/"
},
"manifest_name": "dojo-world"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ manifest_name = "dojo-world"

[world.metadata]
profile_name = "dev"
rpc_url = "https://api.cartridge.gg/x/kari-test/katana"
rpc_url = "http://localhost:5050/"

[base]
kind = "Class"
Expand Down
Binary file modified spawn-and-move-db.tar.gz
Binary file not shown.
Binary file modified types-test-db.tar.gz
Binary file not shown.

0 comments on commit 9d41ea4

Please sign in to comment.