Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
});
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