Skip to content

Commit

Permalink
feat: update metadata page
Browse files Browse the repository at this point in the history
Update the Metadata page according to dojoengine/dojo#2691.
  • Loading branch information
remybar committed Nov 17, 2024
1 parent 556814e commit be10911
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions docs/pages/framework/world/metadata.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
# Metadata

Dojo supports associating offchain metadata with the world contract and other deployed contracts. This can provide additional context about the world, such as it's name, description, social links and other media. Enabling external services to easily index and distribute worlds and experiences built on them.
Dojo supports associating offchain metadata with the world and its resources. This can provide additional context about the world and their resources, such as their name, description, icon URI, ... Enabling external services to easily index and distribute worlds and experiences built on them.

## World Metadata
During migration, `sozo` will automatically manage metadata for you, uploading them to IPFS in `JSON` format and registering them in the world contract through the `ResourceMetadata` Dojo model. `sozo` does so by parsing the metadata defined in the Dojo profile configuration `dojo_<PROFILE>.toml`.

During migration, `sozo` will automatically manage the worlds metadata for you, uploading it to IPFS and setting it in the world contract. It does so by parsing the metadata defined in the projects `Scarb.toml`.
## World Metadata

To set a world metadata, create the following section in your `Scarb.toml`:
To set world metadata, create the following section in your `dojo_<PROFILE>.toml`:

```toml
[tool.dojo.world]
[world]
name = "example"
seed = "dojo_examples"
description = "example world"
icon_uri = "file://assets/icon.png"
cover_uri = "file://assets/cover.png"
website = "https://dojoengine.org"
socials.x = "https://twitter.com/dojostarknet"
```

The toolchain supports the `name`, `description`, `icon_uri`, `cover_uri`, `website` and `socials` attributes by default. `*_uri` attributes can point to an asset in the repo using the `file://` schema or to remote resouces using either `ipfs://` or `https://`. Arbitrary social links can be set by setting a key value on the `socials` attribute. For example, we could add a `socials.github = "..."`.
The toolchain supports the `name`, `description`, `icon_uri`, `cover_uri`, `website` and `socials` attributes by default.

`*_uri` attributes can point to an asset in the repo using the `file://` schema or to remote resouces using either `ipfs://` or `https://`. For local assets, `sozo` wil upload them to IPFS and replace the corresponding URIs by a IPFS URI.

Arbitrary social links can be set by setting a key value on the `socials` attribute. For example, we could add a `socials.github = "..."`.

## Resource Metadata

To set resource metadata, create the following section in your `dojo_<PROFILE>.toml`, using `[[models]]`, `[[contracts]]` or `[[events]]` depending on the type of the resource:

```toml
[[models]]
tag = "ns-Position"
description = "Position of the player in the world"
icon_uri = "file://assets/position_icon.png"

[[events]]
tag = "ns-Moved"
description = "emit when a player has moved"
icon_uri = "file://assets/moved_icon.png"

[[contracts]]
tag = "ns-actions"
description = "Available actions for a player in the world"
icon_uri = "file://assets/actions_icon.png"
```

During migration, `sozo` will upload any local assets to IPFS, replace the corresponding URIs, upload the metadata JSON to IPFS, and set the `metadata_uri` for the world (resource `0`).
For each type of resource, the toolchain supports the `description` and `icon_uri` attributes by default. The `name` of the resource, retrieved from its `tag`, is also stored in the resource metadata.

## Contract and Model Metadata
`*_uri` attributes can point to an asset in the repo using the `file://` schema or to remote resouces using either `ipfs://` or `https://`. For local assets, `sozo` wil upload them to IPFS and replace the corresponding URIs by a IPFS URI.

It is possible for contract/model owners to set a `metadata_uri` for any contract. However, this specification has not yet been defined and it is not supported by the toolchain at this time.

0 comments on commit be10911

Please sign in to comment.