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>

    <select id="network">
      <option value="test" selected>Test</option>
      <option value="public">Public</option>
    <input id="memo" type="text" placeholder="28 chars max.">
    <input id="destination" type="text" placeholder="Pubkey / Federated address">
    <input id="amount" type="number" min="0" placeholder="Amount">
    <input id="submit" type="button" value="Open signing frame">
    <pre id="error"></pre>


### Description

This pen makes use of `cosmic-lib` to create a transfer request that you can sign with your wallet.

### Keypoints

- The payment request accepts a number of optional parameters, such as `memo`, `callback`, `source`, and `asset`.
- **#memo** accepts those type prefixes: `text:`, `base64:`, `id:`, `hash:` & `return:`.
- `asset` syntax is `{code}:{issuer}`, where issuer can be a federated address.
- It is possible to use a custom network by setting `network` to its passphrase and `horizon` to its horizon URL.
- `` can be set to any compatible service, such as _https://stellar-authenticator.org_ or _
- `` optionally accepts a **target** argument: `"frame"`, `"tab"`, `"current"`, or `"sep7"`.

### Challenges

- `[Easy]` Add a **#service** editable selectors with several default options.
- `[Hard]` Add a **#submitSep7** button that builds & transmit the request through the SEP-0007 protocol.

_Give it a try by editing the code!_

### Documentation

- <a href="" target="_blank">CosmicLink documentation</a>
- <a href="" target="_blank">CosmicLink specifications</a>
- <a href="" target="_blank">StellarSdk payment operation documentation</a>

### Social

- [Discuss that pen on GalacticTalk](





                // $ npm install cosmic-lib
// const cosmicLib = require("cosmic-lib")

const $ = document.querySelector.bind(document);
const service = "";

/* Core */
function makeTxRequest() {
  return new cosmicLib.CosmicLink({
    network: $("#network").value,
    memo: $("#memo").value || null
  }).addOperation("payment", {
    destination: $("#destination").value,
    amount: $("#amount").value

/* Interface */
function submitTxRequest() {
  const txRequest = makeTxRequest();

  if (!txRequest.status) { = service;;
  } else {
    const errors = JSON.stringify(txRequest.errors, null, 2);
    $("#error").textContent = errors;

/* Events */
$("#submit").onclick = submitTxRequest;