Extensions syntax is still WIP.
This is the latest proposition. The goal is to make sure it is pure edn (no reliance on @
), easy to follow and that the same concepts share the same syntax.
{:meta {:name "Collectibles"
:description "Demonstration of collectible command"
:documentation ""}
:views {
:preview
(let [{{{symbol :symbol token :token tx-hash :tx-hash} :params} :content outgoing :outgoing timestamp-str :timestamp-str} properties]
(let [collectible-token (listen :status/get-collectible-token {:symbol symbol :token token}]]
[:view {:flex-direction :column
:align-items :flex-start}
[:status/nft-token collectible-token]
[:view {:color (if outgoing "#707caf" "#939ba1")
:margin-top 6
:font-size 12
:flex-direction :row}
[:text {} "Sent at "] [:text {} timestamp-str]]
[:status/send-status tx-hash outgoing]]))
:short-preview
(let [{{{symbol :symbol} :params} :content outgoing :outgoing} properties]
[:view {:flex-direction :row
:align-items :flex-start}
[:text {} (if outgoing "Sent " "Received ")]
[:text {} symbol]])}
:events {
:send-nft-tokens
(event :status/ethereum.send-transaction {:from "" :params {}})
}
:hooks {
:commands.collectible
{:description "Collectible"
:scope #{:personal-chats :public-chats}
:preview (ref :view preview)
:short-preview (ref :view :short-preview)
:on-send (ref :event :send-nft-tokens)
:parameters [{:id :symbol
:type :text
:placeholder "Collectible symbol"
:suggestions (ref :view :status/asset-selector)}
{:id :token
:type :number
:placeholder "Collectible token"
:suggestions (ref :view :status/token-selector)}]}}}