Skip to content

Commit

Permalink
build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Oct 16, 2023
1 parent 7cbdf52 commit 62de4c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
29 changes: 10 additions & 19 deletions src/cairo/migration/0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For models containing complex types, it's crucial to implement the `SchemaIntros

Consider the model below:

```rust
```rust,ignore
struct Card {
#[key]
Expand All @@ -40,7 +40,7 @@ struct Card {

For complex types, like `Roles` in the above example, you need to implement `SchemaIntrospection`. Here's how:

```rust
```rust,ignore
impl RolesSchemaIntrospectionImpl for SchemaIntrospection<Roles> {
#[inline(always)]
fn size() -> usize {
Expand Down Expand Up @@ -93,7 +93,7 @@ Important high level changes:

System management has been revamped. Start by defining an interface for each system, which specifies its implementation:

```rust
```rust,ignore
#[starknet::interface]
trait ICreateCard<TContractState> {
fn create_card(
Expand All @@ -120,7 +120,7 @@ To implement the interface:
1. Add `#[external(v0)]` before each method.
2. Ensure to reference the created interface in the module with `use super::ICreateCard;`.

```rust
```rust,ignore
#[external(v0)]
impl CreateCardImpl for ICreateCard<ContractState> {
fn create_card(
Expand All @@ -144,7 +144,7 @@ This then allows the `create_card` to be called just like a regular starknet fun

0.3.0 introduces a new optional decorator `#[dojo::contract]` which indicates to the compiler to inject imports and the world dispatcher. This allows for minimal boilerplate.

```rust
```rust,ignore
#[dojo::contract]
mod move {
....code TODO
Expand All @@ -156,7 +156,7 @@ mod move {
Events should now reside within the models. Here's an example of how to migrate your events:

**Previous Format**:
```rust
```rust,ignore
#[derive(Drop, starknet::Event, Copy)]
struct DeckCreated {
player: ContractAddress,
Expand All @@ -165,7 +165,7 @@ struct DeckCreated {
```

**New Format**:
```rust
```rust,ignore
#[event]
#[derive(Copy, Drop, starknet::Event)]
enum Event {
Expand All @@ -187,14 +187,14 @@ Testing has seen significant changes with the change to systems as Contracts. In

1. Import necessary modules and traits:

```rust
```rust,ignore
use dojo::test_utils::deploy_contract;
use tsubasa::systems::{ICreateCardDispatcher, ICreateCardDispatcherTrait};
```

2. Deploy the contract and instantiate the dispatcher:

```rust
```rust,ignore
let contract_create_card = deploy_contract(
create_card_system::TEST_CLASS_HASH, array![].span()
);
Expand All @@ -205,7 +205,7 @@ let create_card_system = ICreateCardDispatcher { contract_address: contract_crea

With the contract deployed and the dispatcher instantiated, proceed to test your functions:

```rust
```rust,ignore
// ... (previous setup code)
let result = create_card_system.create_card(
Expand All @@ -214,12 +214,3 @@ let result = create_card_system.create_card(
// Assert or validate the 'result' as per your test conditions
```

### NPM

With release of Dojo 0.3.0 also comes the release of 0.1.0 of the npm packages.

There has been sigficant bundle improvements over 0.0.* versions along with updates to align with the 0.3.0 core changes.

Only minor changes are needed to update, to this new version in js clients. See the examples in the packages repo.

4 changes: 2 additions & 2 deletions src/cairo/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ For models containing complex types, it's crucial to implement the `SchemaIntros

Consider the model below:

```rust
```rust,ignore
struct Card {
#[key]
token_id: u256,
Expand All @@ -127,7 +127,7 @@ struct Card {

For complex types, like `Roles` in the above example, you need to implement `SchemaIntrospection`. Here's how:

```rust
```rust,ignore
impl RolesSchemaIntrospectionImpl for SchemaIntrospection<Roles> {
#[inline(always)]
fn size() -> usize {
Expand Down
2 changes: 1 addition & 1 deletion src/cairo/systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ All StarkNet contracts are defined using the `#[starknet::contract]` decorator,

The `#[dojo::contract]` decorator allows developers to omit including `world: IWorldDispatcher` as a parameter. Behind the scenes, it injects the world into the contract and eliminates some imports, thereby streamlining the development process.

```rust
```rust,ignore
#[dojo::contract]
mod player_actions {
use starknet::{ContractAddress, get_caller_address};
Expand Down

0 comments on commit 62de4c4

Please sign in to comment.