npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cube3/sdk-ui

v1.1.3

Published

SDK-UI is used your DAPP's frontend. For you to do any transaction validations, you need to create an abstraction of that transaction. This SDK allows you to do so on the frontend level.

Downloads

48

Readme

sdk-data

SDK-UI is used your DAPP's frontend. For you to do any transaction validations, you need to create an abstraction of that transaction. This SDK allows you to do so on the frontend level.

Example

  1. In the DApp frontend, initialize a contract and connect it to a signer
import { ethers } from "ethers";

const signer = provider.getSigner();

const yourTokenContract = new ethers.Contract(
yourContractAddress,
yourContractAbi,
signer
);

const connectedTokenContract = yourTokenContract.connect(signer);
  1. Let’s populate transaction with a transfer method for validation. First, import our CUBE3 frontend library and create CUBE3 validation object. For that - use constructCube3Validation method that takes in two parameters - populatedTransaction object (Make sure to set chainId and value field, where value field is amount of ether being interacted with in the blockchain) and a boolean trackNonce used to determine whether to track nonce. But before pas

import {constructCube3Validation} from '@cube-web3/sdk-ui'

//Our previous code <...>

const txData = await connectedTokenContract.populateTransaction.transfer("to", amount)

//make sure to have your chainId and value defined inside this object
txData.chainId = 5;
txData.value = BigNumber.from(0);

const cube3TransactionData = await constructCube3Validation(txData, true);
  1. Send CUBE3 data to the DApp (your) backend with cube3TransactionData in the request body.
const requestParams = {
  method: "POST",
  body: JSON.stringify(cube3TransactionData)
}

const validationFetch = await fetch('<...>/api/validation', requestParams)```

Now to do the actual validation in your backend, use https://www.npmjs.com/package/@cube3/sdk-nodejs.