How to use the wampy.Wampy function in wampy

To help you get started, we’ve selected a few wampy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gammazero / nexus / examples / interop / wampy-nodejs / client.ts View on Github external
this.connectP = new Promise((resolve, reject) => {
                this.log("connecting...");
                let w3cws = require("websocket").w3cwebsocket;
                this.ws = new Wampy("ws://127.0.0.1:"+this.options.port+"/", {
                    ws: w3cws,
                    realm: this.options.realm||"nexus.example",
                    onConnect: () => {
                        this.log("connection - connect success");
                        resolve(this.ws);
                    },
                    onError: err => {
                        this.log("connection - error!");
                        reject(err);
                    },
                    onClose: () => {
                        this.log("connection - closed");
                    },
                    debug: false,
                    autoReconnect: true
                });
github nearprotocol / near-wallet / src / utils / explorer-api.js View on Github external
import { Wampy } from 'wampy'

const WAMP_NEAR_EXPLORER_URL = process.env.WAMP_NEAR_EXPLORER_URL || 'wss://near-explorer-wamp.onrender.com/ws'

const wamp = new Wampy(WAMP_NEAR_EXPLORER_URL, { realm: 'near-explorer' })

export async function getTransactions(accountId = '') {
    if (!this.accountId) return null
    if (!accountId) accountId = this.accountId

    const tx = await new Promise((resolve, reject) => wamp.call(
        'com.nearprotocol.testnet.explorer.select',
        [
            `
               SELECT 
                  transactions.hash,
                  transactions.signer_id, 
                  transactions.receiver_id, 
                  transactions.actions, 
                  transactions.block_hash, 
                  blocks.timestamp as blockTimestamp

wampy

Simple WAMP (WebSocket Application Messaging Protocol) Javascript implementation

MIT
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis