Difference between revisions of "Advanced Usage"
| Line 1: | Line 1: | ||
== Standard Metadata == | == Standard Metadata == | ||
| − | <p>Wallets, explorers, and exchanges will want to show your jigs. You can add special metadata to any jig to help these apps and services do so. Metadata is stored as an object called <code>metadata</code> on your jig, code, or berry, which contains various properties. The following common properties are called ''standard metadata'':</p><p>'''Presentation'''</p> | + | <p>Wallets, explorers, and exchanges will want to show your jigs. You can add special metadata to any jig to help these apps and services do so. Metadata is stored as an object called <code>metadata</code> on your jig, code, or berry, which contains various properties. The following common properties are called ''standard metadata'':</p> |
| − | {| style="height: 161px;" | + | |
| + | <p>'''Presentation'''''''''</p> | ||
| + | |||
| + | {| style="height: 161px;" < thead> | ||
|- style="height: 23px;" | |- style="height: 23px;" | ||
! style="height: 23px; width: 96.9034px;" | Property | ! style="height: 23px; width: 96.9034px;" | Property | ||
! style="height: 23px; width: 35.2131px;" | Type | ! style="height: 23px; width: 35.2131px;" | Type | ||
| − | ! style="height: 23px; width: 453.849px;" | Description | + | ! style="height: 23px; width: 453.849px;" | Description |
|- style="height: 23px;" | |- style="height: 23px;" | ||
| style="height: 23px; width: 96.9034px;" | <code>name</code> | | style="height: 23px; width: 96.9034px;" | <code>name</code> | ||
| Line 31: | Line 34: | ||
| style="height: 23px; width: 453.849px;" | Reference to GLB file representing a 3d model stored using B:// | | style="height: 23px; width: 453.849px;" | Reference to GLB file representing a 3d model stored using B:// | ||
|} | |} | ||
| − | <p>''' | + | |
| − | {| | + | |
| + | <p>''''''</p> | ||
| + | |||
| + | {| class="wikitable" style="border-collapse: collapse; width: 100%;" | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | '''Property''' | ||
| + | | style="width: 13.4419%;" | '''Type''' | ||
| + | | style="width: 69.3116%;" | '''Description''' | ||
|- | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >name</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | String name to use in place of the class or function name | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >description</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | Short sentence, less than 80 characters, that describes the jig for users | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >emoji</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | Single UTF-8 emoji character to represent the jig | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >image</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | Reference to an SVG or PNG image stored using B:// | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >audio</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | Reference to an audio file stored using B:// | ||
| + | |- | ||
| + | | style="width: 17.2464%;" | <code class="mwt-code" >glbModel</code> | ||
| + | | style="width: 13.4419%;" | string | ||
| + | | style="width: 69.3116%;" | Reference to GLB file representing a 3d model stored using B:// | ||
| + | |} | ||
| + | |||
| + | <p>''''''</p> | ||
| + | <p>'''Attribution and Licensing'''''''''</p> | ||
| + | |||
| + | {| < thead> | ||
| + | |- | ||
! Property | ! Property | ||
! Type | ! Type | ||
| − | ! Description | + | ! Description |
| − | |- | + | |- |
| − | | <code>author</code> | + | | <code>author</code> |
| string markdown | | string markdown | ||
| Name of the creator for the code or content | | Name of the creator for the code or content | ||
| − | |- | + | |- |
| − | | <code>title</code> | + | | <code>title</code> |
| string markdown | | string markdown | ||
| Title of the content | | Title of the content | ||
| − | |- | + | |- |
| − | | <code>source</code> | + | | <code>source</code> |
| string markdown | | string markdown | ||
| URL where the content was found | | URL where the content was found | ||
| − | |- | + | |- |
| − | | <code>license</code> | + | | <code>license</code> |
| string markdown | | string markdown | ||
| License for the code or content | | License for the code or content | ||
|} | |} | ||
| − | |||
| − | |||
| + | |||
| + | <p>Media stored on-chain using the [https://github.com/unwriter/B B://] protocol may be used as metadata for images, audio, or 3D models. To reference previously-uploaded data, use a string formatted either as <code>"b://<txid>"</code> or <code>"b://<txid>_o<vout>"</code>. If <code>vout</code> is present, it must be zero-indexed. If it is not present, the first B output in the transaction is used. To upload B data, you may use the [https://www.npmjs.com/package/@runonbitcoin/easy-b EasyB CLI tool]</p> | ||
| + | <p>.</p> | ||
| + | <p>You can start by setting these properties on your ''jig classes'', as seen to the right. By convention, jig instances will automatically use the metadata from their class. However, jig instances may also have their own metadata that overrides its class metadata. You can put any information in <code>metadata</code> you deem important, even properties that are not listed above.</p> | ||
| + | <span style="background-color: rgb(251, 238, 184);" >''' | ||
| + | <span style="color: rgb(186, 55, 42);" >Warning: For performance reasons, we recommended that B:// media metadata use a b:// uri string rather than the previously-recommended B berry objects.</span>'''</span><span style="background-color: rgb(186, 55, 42);"></span> | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
class DigitalPet extends Jig { } | class DigitalPet extends Jig { } | ||
Revision as of 04:15, 2 April 2023
Standard Metadata
Wallets, explorers, and exchanges will want to show your jigs. You can add special metadata to any jig to help these apps and services do so. Metadata is stored as an object called metadata on your jig, code, or berry, which contains various properties. The following common properties are called standard metadata:
Presentation''''
| Property | Type | Description |
|---|---|---|
name
|
string | String name to use in place of the class or function name |
description
|
string | Short sentence, less than 80 characters, that describes the jig for users |
emoji
|
string | Single UTF-8 emoji character to represent the jig |
image
|
string | Reference to an SVG or PNG image stored using B:// |
audio
|
string | Reference to an audio file stored using B:// |
glbModel
|
string | Reference to GLB file representing a 3d model stored using B:// |
'
| Property | Type | Description |
name
|
string | String name to use in place of the class or function name |
description
|
string | Short sentence, less than 80 characters, that describes the jig for users |
emoji
|
string | Single UTF-8 emoji character to represent the jig |
image
|
string | Reference to an SVG or PNG image stored using B:// |
audio
|
string | Reference to an audio file stored using B:// |
glbModel
|
string | Reference to GLB file representing a 3d model stored using B:// |
'
Attribution and Licensing''''
| Property | Type | Description |
|---|---|---|
author
|
string markdown | Name of the creator for the code or content |
title
|
string markdown | Title of the content |
source
|
string markdown | URL where the content was found |
license
|
string markdown | License for the code or content |
Media stored on-chain using the B:// protocol may be used as metadata for images, audio, or 3D models. To reference previously-uploaded data, use a string formatted either as "b://<txid>" or "b://<txid>_o<vout>". If vout is present, it must be zero-indexed. If it is not present, the first B output in the transaction is used. To upload B data, you may use the EasyB CLI tool
.
You can start by setting these properties on your jig classes, as seen to the right. By convention, jig instances will automatically use the metadata from their class. However, jig instances may also have their own metadata that overrides its class metadata. You can put any information in metadata you deem important, even properties that are not listed above.
Warning: For performance reasons, we recommended that B:// media metadata use a b:// uri string rather than the previously-recommended B berry objects.
class DigitalPet extends Jig { }
DigitalPet.metadata = {
author: 'Maximus',
license: 'MIT',
emoji: '🐉'
}
run.deploy(DigitalPet)