Skip to content

Commit

Permalink
Merge pull request #15 from dojoengine/fix-and-burner
Browse files Browse the repository at this point in the history
fix: bump rustc version for simd instructions and deploy burner w/o rpc
  • Loading branch information
Larkooo authored Jan 10, 2024
2 parents 1e0b53a + 7af05c0 commit c7744ca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.70.0
RUST_VERSION: 1.72.0

jobs:
prepare:
Expand Down
3 changes: 1 addition & 2 deletions dojo.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ struct ResultAccount account_new(struct CJsonRpcClient *rpc,
struct FieldElement private_key,
const char *address);

struct ResultAccount account_deploy_burner(struct CJsonRpcClient *rpc,
struct Account *master_account);
struct ResultAccount account_deploy_burner(struct Account *master_account);

struct FieldElement account_address(struct Account *account);

Expand Down
9 changes: 5 additions & 4 deletions example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ int main()

const char *playerKey = "0x028cd7ee02d7f6ec9810e75b930e8e607793b302445abbdee0ac88143f18da20";
const char *playerAddress = "0x0517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973";
const char *world = "0x033ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e";
const char *world = "0x028f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a";
const char *actions = "0x03e274b7d85fd0415bec56a5d831c3854f7308bbb26d486993cfc49e5a5fb788";
// Initialize world.data here...

KeysClause entities[1] = {};
Expand Down Expand Up @@ -91,7 +92,7 @@ int main()
}
Account *master_account = resAccount.ok;

ResultAccount resBurner = account_deploy_burner(provider, master_account);
ResultAccount resBurner = account_deploy_burner(master_account);
if (resBurner.tag == ErrAccount)
{
printf("Failed to create burner: %s\n", resBurner.err.message);
Expand Down Expand Up @@ -194,12 +195,12 @@ int main()
}

Call spawn = {
.to = "0x0152dcff993befafe5001975149d2c50bd9621da7cbaed74f68e7d5e54e65abc",
.to = actions,
.selector = "spawn",
};

Call move = {
.to = "0x0152dcff993befafe5001975149d2c50bd9621da7cbaed74f68e7d5e54e65abc",
.to = actions,
.selector = "move",
.calldata = {
.data = malloc(sizeof(FieldElement)),
Expand Down
9 changes: 6 additions & 3 deletions src/libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::types::{
Query, Result, Signature, ToriiClient, Ty, WorldMetadata,
};
use crate::utils::watch_tx;
use starknet::accounts::ConnectedAccount;
use starknet::accounts::{Account as StarknetAccount, ExecutionEncoding, SingleOwnerAccount};
use starknet::core::utils::{
cairo_short_string_to_felt, get_contract_address, get_selector_from_name,
Expand Down Expand Up @@ -385,7 +386,6 @@ pub unsafe extern "C" fn account_new(
#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn account_deploy_burner(
rpc: *mut CJsonRpcClient,
master_account: *mut Account<'static>,
) -> Result<*mut Account<'static>> {
let signing_key = SigningKey::from_random();
Expand All @@ -401,7 +401,7 @@ pub unsafe extern "C" fn account_deploy_burner(
let chain_id = (*master_account).0.chain_id();

let account = SingleOwnerAccount::new(
&(*rpc).0,
*(*master_account).0.provider(),
signer,
address,
chain_id,
Expand Down Expand Up @@ -435,7 +435,10 @@ pub unsafe extern "C" fn account_deploy_burner(

tokio::runtime::Runtime::new()
.unwrap()
.block_on(watch_tx(&(*rpc).0, result.transaction_hash))
.block_on(watch_tx(
(*master_account).0.provider(),
result.transaction_hash,
))
.unwrap();

Result::Ok(Box::into_raw(Box::new(Account(account))))
Expand Down

0 comments on commit c7744ca

Please sign in to comment.