Widget

The other side of the Ownable package will contain the visual elements: HTML, and media files like images and videos.

HTML

The index.html file will be rendered as widget in the wallet. It should have a structure resembling the following:

<html>
  <head>
    <style>
      // all the styles for your ownable
    </style>
  </head>
  <body>
    <div>
      // your ownable html
    </div>
    <script>
      // any necessary functions
    </script>
  </body>

Styling

The styling should be responsive on all devices. As the wallet will render your provided template, you are in complete control of how it will be displayed.

The widgets in which the Ownables will be placed always have a 1:1 aspect ratio (square). Use the viewport units vh and vw, and/or aspect-ratio to ensure the content of the widget properly scales.

Javascript

Ownable templates communicate with the wallet via messages.

An execute message can be sent to the window parent, which will be forwarded to the CosmWasm smart contract and stored on the event chain.

The widget will receive a message from the parent window after the state of the smart contract changes.

Example

If we consider the potion example which you can find in our demo repository, the script part of our HTML template may contain methods like this:

Last updated