Skip to content

Commit

Permalink
feat: update examples to generic standard string
Browse files Browse the repository at this point in the history
  • Loading branch information
esaminu committed Nov 10, 2022
1 parent 5bdc3db commit a54f6b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions neps/nep-0330.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ The metadata will include two optional fields:
- `link`: a string that references the link to the open-source code. This can be anything such as Github or a CID to somewhere on IPFS.

```ts
type NEP {
NEP: number, // NEP number e.g. 0141 for NEP-0141
version: string // semantic version number of the NEP e.g. "1.0.0"
type Standard {
standard: string, // standard name e.g. "nep141"
version: string // semantic version number of the Standard e.g. "1.0.0"
}

type ContractSourceMetadata = {
version: string|null, // optional, commit hash being used for the currently deployed wasm. If the contract is not open-sourced, this could also be a numbering system for internal organization / tracking such as "1.0.0" and "2.1.0".
link: string|null, //optional, link to open source code such as a Github repository or a CID to somewhere on IPFS.,
standards: NEP[]|null //optional, standards and extensions implemented in the currently deployed wasm e.g. [{NEP: 0141, version: "1.0.0"},{NEP: 0148, version: "1.0.0"}].
link: string|null, //optional, link to open source code such as a Github repository or a CID to somewhere on IPFS.
standards: Standard[]|null //optional, standards and extensions implemented in the currently deployed wasm e.g. [{standard: "nep141", version: "1.0.0"},{standard: "nep148", version: "1.0.0"}].
}
```
Expand All @@ -62,11 +62,11 @@ type ContractSourceMetadata = {
link: "https://github.com/near-examples/nft-tutorial",
standards: [
{
NEP: 0171,
standard: "nep171",
version: "1.0.2"
},
{
NEP: 0177,
standard: "nep177",
version: "2.0.1"
}
]
Expand All @@ -81,11 +81,11 @@ If someone were to call the view function `contract_metadata`, the contract woul
link: "https://github.com/near-examples/nft-tutorial",
standards: [
{
NEP: 0171,
standard: "nep171",
version: "1.0.2"
},
{
NEP: 0177,
standard: "nep177",
version: "2.0.1"
}
]
Expand All @@ -101,7 +101,7 @@ pub struct Contract {
pub contract_metadata: ContractSourceMetadata
}

// NEP structure
// Standard structure
pub struct Standard {
pub standard: String,
pub version: String
Expand All @@ -111,7 +111,7 @@ pub struct Standard {
pub struct ContractSourceMetadata {
pub version: String,
pub link: String,
pub standards: [NEP; 2]
pub standards: Vec<Standard>
}

/// Minimum Viable Interface
Expand Down
26 changes: 13 additions & 13 deletions specs/Standards/SourceMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ The metadata will include two optional fields:
- `link`: a string that references the link to the open-source code. This can be anything such as Github or a CID to somewhere on IPFS.

```ts
type NEP {
NEP: number, // NEP number e.g. 0141 for NEP-0141
version: string // semantic version number of the NEP e.g. "1.0.0"
type Standard {
standard: string, // standard name e.g. "nep141"
version: string // semantic version number of the Standard e.g. "1.0.0"
}

type ContractSourceMetadata = {
version: string|null, // optional, commit hash being used for the currently deployed wasm. If the contract is not open-sourced, this could also be a numbering system for internal organization / tracking such as "1.0.0" and "2.1.0".
link: string|null, //optional, link to open source code such as a Github repository or a CID to somewhere on IPFS.
standards: NEP[]|null //optional, standards and extensions implemented in the currently deployed wasm e.g. [{NEP: 0141, version: "1.0.0"},{NEP: 0148, version: "1.0.0"}].
standards: Standard[]|null //optional, standards and extensions implemented in the currently deployed wasm e.g. [{standard: "nep141", version: "1.0.0"},{standard: "nep148", version: "1.0.0"}].
}
```
Expand All @@ -61,11 +61,11 @@ type ContractSourceMetadata = {
link: "https://github.com/near-examples/nft-tutorial",
standards: [
{
NEP: 0171,
standard: "nep171",
version: "1.0.2"
},
{
NEP: 0177,
standard: "nep177",
version: "2.0.1"
}
]
Expand All @@ -80,11 +80,11 @@ If someone were to call the view function `contract_metadata`, the contract woul
link: "https://github.com/near-examples/nft-tutorial",
standards: [
{
NEP: 0171,
standard: "nep171",
version: "1.0.2"
},
{
NEP: 0177,
standard: "nep177",
version: "2.0.1"
}
]
Expand All @@ -100,17 +100,17 @@ pub struct Contract {
pub contract_metadata: ContractSourceMetadata
}

// NEP structure
pub struct NEP {
pub NEP: u16,
pub version: String
// Standard structure
type Standard {
standard: string, // standard name e.g. "nep141"
version: string // semantic version number of the Standard e.g. "1.0.0"
}

/// Contract metadata structure
pub struct ContractSourceMetadata {
pub version: String,
pub link: String,
pub standards: [NEP; 2]
pub standards: Vec<Standard>
}

/// Minimum Viable Interface
Expand Down

0 comments on commit a54f6b1

Please sign in to comment.