Demos Network Specifications
  • Introduction
    • What is Demos Network
    • Demos Network Architecture
  • FAQ
  • Cookbook
    • Project setup
      • Run the project (MacOS)
      • Run the project (Windows)
        • WSL 2 Setup on Windows (10 and 11 only)
        • Issue Troubleshooting
      • Run the project (Ubuntu)
  • SDK
    • Getting Started
    • WebSDK
      • Authentication
        • FIDO2 Passkeys
          • Under the Hood: FIDO2 Passkeys
      • NodeCalls
      • Transactions
        • Creating a transaction
        • Signing a transaction
        • Broadcasting a transaction
      • L2PS SDK
        • The l2ps module
        • Interacting with the L2PS
        • L2PS Messaging System
      • Instant Messaging
        • What is the Instant Messaging Protocol?
        • Architecture Overview
        • Encryption
        • Quickstart
        • Message Types
        • API Reference
        • FAQ
    • Cross Chain
      • General layout of the XM SDKs
      • EVM
      • BTC
      • Solana
      • MultiversX (EGLD)
      • NEAR
      • IBC
      • TON
      • XRPL
      • The XMScript
      • Identities
    • Demoswork
    • Cookbook
      • Demoswork
        • Creating work steps
        • Conditional Operation
        • Base Operation
        • Signing and broadcasting
      • Transactions
        • Crosschain Transaction
        • Native Transactions
      • SWAP
        • Crosschain SWAP
    • Web2
      • Quick Start
      • DAHR API Reference
        • Types
      • Making Requests
      • Identities
        • Twitter
        • GitHub
    • API Reference
    • Bridges
      • Rubic Bridge Test
    • Post Quantum Cryptography
  • Backend
    • Internal Mechanisms
      • Network Time Synchronization
      • Cross Context Identities
    • Global Change Registry
      • GCR Structure
      • How is GCR Synced?
    • Consensus Mechanism
      • Unparalleled Scalability
      • Decentralization in PoR-BFT
      • Enhanced Security
      • Comparative Advantage
      • Addressing Potential Criticisms
      • Conclusion
    • Communications Stack
    • L2PS (Subnet) Framework
      • How are L2PS transactions handled?
    • Miscellaneous
      • Browsing the Postgres DB via psql
    • Bridges
      • Rubic Bridge
    • Developers Testbed
      • Setting up the environment
      • Setting up the repository
      • Installing dependencies
      • Node Configuration
      • Running the node
  • Frontend
    • Demos Providers Discovery Mechanism
Powered by GitBook
On this page
  • Creating a web2 workstep
  • Creating a XM workstep
  1. SDK
  2. Cookbook
  3. Demoswork

Creating work steps

Creating a web2 workstep

You can create a web2 workstep to performa a GET request to https://icanhazip.com using the prepareWeb2Step function.

import { prepareWeb2Step } from "@kynesyslabs/demosdk/demoswork"

const getIP = prepareWeb2Step({
    action: "GET",
    url: "https://icanhazip.com",
})

Creating a XM workstep

THe process of creating a cross chain workstep to send some ETH to an address can be described as follows:

  1. Generating a payload to send ETH

  2. Create a XMScript with the payload

  3. Create an XM step with the XMScript

import { XMScript } from "@kynesyslabs/demosdk/types"
import { EVM } from "@kynesyslabs/demosdk/multichain/websdk"
import { prepareXMStep } from "@kynesyslabs/demosdk/demoswork"
import { prepareXMScript } from "@kynesyslabs/demosdk/websdk/XMTransactions"


// 1. Getting EVM payload
const evm_rpc = "https://rpc.ankr.com/eth_sepolia"
const evm_key = process.env.EVM_KEY

const evm = await EVM.create(evm_rpc)
await evm.connectWallet(evm_key)

const payload = await evm.prepareTransfer(
    "0x8A6575025DE23CB2DcB0fE679E588da9fE62f3B6",
    "0.25",
)

// 2. Creating a XMScript
const xmscript = prepareXMScript({
    chain: "eth",
    subchain: "sepolia",
    type: "pay",
    signedPayload: payload,
})

// 3. Creating a XM step
const sendEth = prepareXMStep(xmscript)
PreviousDemosworkNextConditional Operation

Last updated 8 months ago