Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                ### Interaction

<form action="">
  <input name="type" type="hidden" value="manageBuyOffer">
    <input name="network" value="test" readonly>
    <input name="buying" value="GILS:gils*" readonly>
    <input name="price" value="20" readonly>
    <input name="buyAmount" type="number" min="0" step="1" required>
    <input id="submit" type="submit" value="Submit">


### Description

This pen shows how to make an HTML-only widget that buys a token on the distributed exchange. It uses the CosmicLink protocol.

### Concepts

- [Distributed Exchange]( The decentralized currency exchange embedded into the Stellar protocol.
- [CosmicLink]( A protocol that encodes Stellar transactions into URIs.
- [GILS]( An asset that rewards people who solve Pen of the Week challenges.

### Keypoints

- The CosmicLink protocol has initially been designed for this exact purpose.
- `GILS:gils*` means the asset `GILS` emitted by the account `gils*`.
- You can validate the transaction on testnet by clicking on "Submit" => "Go to Stellar Authenticator" => "Guest Mode" => "Sign & Send".
- For the transaction to succeed, you'll need to [open a trustline]( first.

### Challenges

- **easy/** Edit this pen to let the user select a network and an asset among a predefined list. Let her pick the price as well.
- **hard/** Add buy-sell radio buttons to let the user choose the trade direction. Make sure to update #price when switching. You'll need to use JavaScript.

_Give it a try by editing the code, and be the first to post a solution on GalacticTalk!_

### Documentation

- [CosmicLink Specifications](
- [List of Operations](
- [Stellar Laboratory account viewer](

### Social

- [Discuss that pen on GalacticTalk](




                // Helpers for the hard challenge
const $ = document.querySelector.bind(document)