This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: use dynamic namespaces * fix: port the new testing suite with dynamic namespaces * fix: ensure events namespace permission is correctly checked * fmt and remove ci since dojo-core is only for archiving * add cairo fmt back
- Loading branch information
Showing
70 changed files
with
2,625 additions
and
2,558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[starknet::interface] | ||
pub trait IContract<T> { | ||
fn dojo_name(self: @T) -> ByteArray; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,23 @@ | ||
use dojo::meta::Layout; | ||
use dojo::meta::introspect::Ty; | ||
use dojo::world::IWorldDispatcher; | ||
|
||
#[derive(Drop, Serde, Debug, PartialEq)] | ||
pub struct EventDefinition { | ||
pub name: ByteArray, | ||
pub namespace: ByteArray, | ||
pub namespace_selector: felt252, | ||
pub version: u8, | ||
pub layout: Layout, | ||
pub schema: Ty | ||
} | ||
|
||
pub trait Event<T> { | ||
fn emit(self: @T, world: IWorldDispatcher); | ||
|
||
fn name() -> ByteArray; | ||
fn namespace() -> ByteArray; | ||
fn tag() -> ByteArray; | ||
|
||
fn version() -> u8; | ||
|
||
fn selector() -> felt252; | ||
fn instance_selector(self: @T) -> felt252; | ||
|
||
fn name_hash() -> felt252; | ||
fn namespace_hash() -> felt252; | ||
|
||
fn definition() -> EventDefinition; | ||
|
||
fn layout() -> Layout; | ||
fn schema() -> Ty; | ||
|
||
fn historical() -> bool; | ||
fn keys(self: @T) -> Span<felt252>; | ||
fn values(self: @T) -> Span<felt252>; | ||
} | ||
|
||
#[starknet::interface] | ||
pub trait IEvent<T> { | ||
fn name(self: @T) -> ByteArray; | ||
fn namespace(self: @T) -> ByteArray; | ||
fn tag(self: @T) -> ByteArray; | ||
|
||
fn version(self: @T) -> u8; | ||
|
||
fn selector(self: @T) -> felt252; | ||
fn name_hash(self: @T) -> felt252; | ||
fn namespace_hash(self: @T) -> felt252; | ||
|
||
fn definition(self: @T) -> EventDefinition; | ||
|
||
fn layout(self: @T) -> Layout; | ||
fn schema(self: @T) -> Ty; | ||
} | ||
|
||
#[cfg(target: "test")] | ||
pub trait EventTest<T> { | ||
fn emit_test(self: @T, world: IWorldDispatcher); | ||
/// Returns the selector of the model computed for the given namespace hash. | ||
fn selector(namespace_hash: felt252) -> felt252; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use dojo::meta::Layout; | ||
use dojo::meta::introspect::Ty; | ||
|
||
use super::EventDefinition; | ||
|
||
#[starknet::interface] | ||
pub trait IEvent<T> { | ||
fn dojo_name(self: @T) -> ByteArray; | ||
fn version(self: @T) -> u8; | ||
fn definition(self: @T) -> EventDefinition; | ||
fn layout(self: @T) -> Layout; | ||
fn schema(self: @T) -> Ty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/// A `EventStorage` trait that abstracts where the storage is and how events are emitted. | ||
pub trait EventStorage<S, E> { | ||
fn emit_event(ref self: S, event: @E); | ||
} | ||
|
||
pub trait EventStorageTest<S, E> { | ||
fn emit_event_test(ref self: S, event: @E); | ||
} |
Oops, something went wrong.