Skip to content

Commit

Permalink
add docs covering new views
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed May 1, 2024
1 parent a67eb6e commit 17a88ff
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/MetdataViews/MetadataViews.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ to find and load the image via an IPFS gateway.

---

### `URI`

```cadence
pub struct URI {
pub let baseURI: String?
access(self) let value: String
}
```
View to represent a generic URI. May be used to represent the URI of
the NFT where the type of URI is not able to be determined (i.e. HTTP,
IPFS, etc.).

[More...](MetadataViews_URI.md)

---

### `Edition`

```cadence
Expand Down Expand Up @@ -398,6 +416,30 @@ some contextualized data about each trait.

[More...](MetadataViews_Traits.md)

---

### `EVMBridgedMetadata`

```cadence
pub struct EVMBridgedMetadata {
pub let name: String
pub let symbol: String
pub let uri: {File}
}
```
This view may be used by Cadence-native projects to define their
contract- and token-level metadata according to EVM-compatible
formats. Several ERC standards (e.g. ERC20, ERC721, etc.) expose name
and symbol values to define assets as well as contract- & token-level
metadata view `tokenURI(uint256)` and `contractURI()` methods. This
view enables Cadence projects to define in their own contracts how
they would like their metadata to be defined when bridged to EVM.

[More...](MetadataViews_EVMBridgedMetadata.md)

---
## Functions

Expand Down
28 changes: 28 additions & 0 deletions docs/MetdataViews/MetadataViews_EVMBridgedMetadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Struct `EVMBridgedMetadata`

```cadence
pub struct EVMBridgedMetadata {
pub let name: String
pub let symbol: String
pub let uri: {File}
}
```

This view may be used by Cadence-native projects to define contract-
and token-level metadata according to EVM-compatible formats. Several
ERC standards (e.g. ERC20, ERC721, etc.) expose name and symbol values
to define assets as well as contract- & token-level metadata view
`tokenURI(uint256)` and `contractURI()` methods. This view enables
Cadence projects to define in their own contracts how they would like
their metadata to be defined when bridged to EVM.

### Initializer

```cadence
init(name: String, symbol: String, uri: {File})
```

---
40 changes: 40 additions & 0 deletions docs/MetdataViews/MetadataViews_URI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Struct `URI`

```cadence
pub struct URI {
pub let baseURI: String?
access(self) let value: String
}
```

View to represent a generic URI. May be used to represent the URI of
the NFT where the type of URI is not able to be determined (i.e. HTTP,
IPFS, etc.)

Implemented Interfaces:
- `File`


### Initializer

```cadence
init(baseURI: String?, value: String?)
```


## Functions

### `uri()`

```cadence
view fun uri(): String
```
This function returns the uri for this file. If the `baseURI` is set,
this will be a concatenation of the `baseURI` and the `value`. If the
`baseURI` is not set, this will return the `value`.

Returns: The string containing the file uri

---

0 comments on commit 17a88ff

Please sign in to comment.