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

<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="">

    <p id="cosmiclink_description"></p>

    <input id="submit" type="button" value="Open in Wallet">

### Description

This pen shows how to use `cosmic-lib` to pass an arbitrary transaction request to a compatible user wallet.

### Keypoints

- `#cosmiclink_description` gets automatically updated with the latest _CosmicLink_ description.
- `txParams` accepts the usual StellarSdk transaction parameters, with `source` and `sequence` being optional.
- `txParams` also accepts the following meta parameters: `network`, `callback` and `horizon` (for custom networks only).
- Operations use the same syntax than StellarSdk. For convenience, those syntaxes are also accepted:
  - Memo: `{ type, value }`
  - Asset: `{ code, issuer }`
  - Signer: `{ weight, type, value }`
- You can sign testnet transactions using **Stellar Authenticator guest mode**.

### Challenges

- `[easy]` Edit the transaction request to one that opens a trustline to GILS.
- `[hard]` Edit the code to transmit a payment request to the Lobster wallet using SEP-0007.

_Give it a try by editing the code!_

### Documentation

- <a href="" target="_blank">CosmicLink specifications</a>
- <a href="" target="_blank">StellarSdk Operations specification</a>
- [Lobster SEP-0007 support announcement](

### Social

- [Discuss that pen on GalacticTalk](




                // $ npm install cosmic-lib
// const cosmicLib = require("cosmic-lib")
const $ = document.querySelector.bind(document)

/* CosmicLink handler (default) */ = ""

/* Core */

const txParams = {
  network: "test",
  memo: "CosmicLink Demo",
  maxTime: "+3" // Valid for 3 mins

const txRequest = new cosmicLib.CosmicLink(txParams)
  .addOperation("setOptions", {
    homeDomain: ""

/* Events */

$("#submit").onclick = () =>