Difference between revisions of "Advanced Usage"

From RunWiki
Jump to: navigation, search
(Created page with "== 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. Metada...")
 
Line 56: Line 56:
 
<p>Media stored on-chain using the&nbsp;</p>[https://github.com/unwriter/B B://]<p>&nbsp;protocol may be used as metadata for images, audio, or 3D models. To reference previously-uploaded data, use a string formatted either as&nbsp;<code>"b://&lt;txid&gt;"</code>&nbsp;or&nbsp;<code>"b://&lt;txid&gt;_o&lt;vout&gt;"</code>. If&nbsp;<code>vout</code>&nbsp;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&nbsp;</p>[https://www.npmjs.com/package/@runonbitcoin/easy-b EasyB CLI tool]<p>.</p><p>You can start by setting these properties on your&nbsp;''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&nbsp;<code>metadata</code>&nbsp;you deem important, even properties that are not listed above.</p>
 
<p>Media stored on-chain using the&nbsp;</p>[https://github.com/unwriter/B B://]<p>&nbsp;protocol may be used as metadata for images, audio, or 3D models. To reference previously-uploaded data, use a string formatted either as&nbsp;<code>"b://&lt;txid&gt;"</code>&nbsp;or&nbsp;<code>"b://&lt;txid&gt;_o&lt;vout&gt;"</code>. If&nbsp;<code>vout</code>&nbsp;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&nbsp;</p>[https://www.npmjs.com/package/@runonbitcoin/easy-b EasyB CLI tool]<p>.</p><p>You can start by setting these properties on your&nbsp;''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&nbsp;<code>metadata</code>&nbsp;you deem important, even properties that are not listed above.</p>
 
  <span style="color: rgb(186, 55, 42);" >'''Warning:'''&nbsp;For performance reasons, we recommended that B:// media metadata use a b:// uri string rather than the previously-recommended B berry objects.</span><span style="background-color: rgb(186, 55, 42);" ></span>
 
  <span style="color: rgb(186, 55, 42);" >'''Warning:'''&nbsp;For performance reasons, we recommended that B:// media metadata use a b:// uri string rather than the previously-recommended B berry objects.</span><span style="background-color: rgb(186, 55, 42);" ></span>
<aside class="warning"><pre class="highlight javascript tab-javascript"><code><span class="kd">class</span> <span class="nx">DigitalPet</span> <span class="kd">extends</span> <span class="nx">Jig</span> <span class="p">{</span> <span class="p">}</span>
 
  
<span class="nx">DigitalPet</span><span class="p">.</span><span class="nx">metadata</span> <span class="o">=</span> <span class="p">{</span>
+
class DigitalPet extends Jig { }
  <span class="na">author</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Maximus</span><span class="dl">'</span><span class="p">,</span>
 
  <span class="na">license</span><span class="p">:</span> <span class="dl">'</span><span class="s1">MIT</span><span class="dl">'</span><span class="p">,</span>
 
  <span class="na">emoji</span><span class="p">:</span> <span class="dl">'</span><span class="s1">🐉</span><span class="dl">'</span>
 
<span class="p">}</span>
 
  
<span class="nx">run</span><span class="p">.</span><span class="nx">deploy</span><span class="p">(</span><span class="nx">DigitalPet</span><span class="p">)</span></code></pre></aside>
+
DigitalPet.metadata = {
 +
  author: 'Maximus',
 +
  license: 'MIT',
 +
  emoji: '🐉'
 +
}
 +
 
 +
run.deploy(DigitalPet)

Revision as of 04:10, 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</thead>
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</thead>
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)