Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.


                <h4>In this demo, it helps you to understand how to request user to login and enforce address to buy an item</h4>

<pre id="loggedIn">Please login</pre>

<button id="loginBtn" onclick="login()">Login</button>

<button id="logoutBtn" onclick="logout()">Logout</button>


<div id="item" style="display: none;">

  <fieldset style="width:40%">
    <legend>Item #1</legend>
    <img src="" width=100px height=100px></img>
    <label>Skill stats: connex skill +2: <br>It helps you to understand how to get the user address and enforced(designated) the address to proceed purchase</label><br><br>
    <input onclick="buy()" type="submit" value="Buy">

  <pre id="txidLabel"></pre>
  <caption>brain icons PNG Designed By syedhassan from <a href=""></a></caption>




                const vendor = new Connex.Vendor("test");
var addressLabel = document.getElementById("loggedIn");
var address = "";

var itemDiv = document.getElementById("item");

function login() {
    .sign("cert", {
      purpose: "identification",
      payload: {
        type: "text",
        content: "Please sign the certificate to continue purchase"
    // .accepted(() => alert("accepted"))
    .then((r) => {
      address = r.annex.signer;
      addressLabel.innerText = "Logged In: " + address; = "inline-block";
    .catch((e) => console.log("error:" + e.message));

function logout() {
  addressLabel.innerText = "Please login"; = "none";
  address = "";

function buy() {
  var txIdLabel = document.getElementById("txidLabel");
    .sign("tx", [
        to: "0x70aE85A2fF6030366F512DbcD60Be3828139b498",
        value: 1 * 1e18, //unit in wei
        data: "0x"
  //enforce signer
    //a link that can redirect user to visit
    .comment("buy skill stats: connex skill +2")
    // .accepted(() => alert("accepted"))
    .then((r) => (txIdLabel.innerText = "TxId: " + r.txid))
    .catch((e) => console.log("error:" + e.message));