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

@trustwallet/wizard-sdk

v0.2.5

Published

typescript sdk to visualize EIP-712 various protocols, simulate and decode transactions

Downloads

19

Readme

Overview

When users comprehend the content they are signing, their susceptibility to phishing scams decreases.

Wizard-SDK, a TypeScript software development kit, is designed to visualize diverse protocol EIP-712 messages and simulate transactions that users sign daily in the web3.0 environment.

The primary goal of the visualization process is to convert EIP-712 payloads into an easily understandable format. Rather than returning a textual description of the message, the SDK provides structured data that outlines the potential impact on the user's assets if the EIP-712 transaction is signed and submitted on the blockchain.

In addition to visualization, the SDK also includes a separate, independent module for simulating transactions. Utilizing the Ethereum Virtual Machine (EVM) debug API (various providers), the simulation extracts information about asset movements from logs and internal calls.

By combining the visualization of the EIP-712 payload and the Transaction simulation, Wizard-SDK provides Developers with a one-in-place tool aims that helps empower users to make informed decisions before signing and submitting transactions.

Rather than returning a textual description of the message, the SDK offers a clear picture of the potential consequences, ensuring a better understanding of the transaction's implications.

step-by-step Guide

To use the SDK you must install it using your preferred package manager npm

npm install @trustwallet/wizard-sdk

or

yarn add @trustwallet/wizard-sdk

after installing the sdk, import the visualize function

import { visualize } from '@trustwallet/wizard-sdk';

The visualize is an async function that accepts two parameters, the message as an arbitrary object and domain as a strongly typed object aligned with EIP-712 domain structure and returns VisualizationResult promise or can throw if the protocol is not handled or wrong message or domain content for example.

/**
 * @param {T} message EIP-712 message
 * @param {Domain} domain EIP-712 domain
 * @returns {VisualizationResult} assets impact and message liveness
 * @throws {Error}
 */
async function visualize<T extends object>(
  message: T,
  domain: Domain
): Promise<VisualizationResult>;

type Domain = {
  verifyingContract: string;
  name: string;
  chainId: string;
  version: string;
};

The returned VisualizationResult will contain some important fields like:

  • assetsIn, an array of of assets that user should receive.
  • assetsOut, an array of the assets that are leaving user wallet.
  • approvals, an array of assets that user is granting an operator approvals for.
  • liviness, an optional object that highlight from and till which timestamp the above information is considered valid by the protocol

Features

  • Simplified EIP-712 message visualization
  • Transaction simulation for human-readable display (in-progress)
  • Supports various protocols and EIP-712 schemas

Visualization

The EIP-712 is a standard for structured data signatures that are widely used in the blockchain industry. However, each protocol uses a different schema, making it difficult for end-users to understand what they are signing. Also, this poses a significant challenge for wallets, who must manually add support for each protocol, making it hard to keep up with the pace of development (Discussed in the #Beyond-SDK section).

To overcome this challenge, our team has developed an SDK that visualizes EIP-712 messages in a human-readable format. Our goal is to simplify the user experience, enabling end-users to easily understand and engage with EIP-712 messages, without needing a technical background or specialized knowledge.

Supported Protocols

If you are a project that uses EIP-712 and wants to add your project to the SDK please create a PR with the implementation, here's an example of adding blur.io support

To know upcoming support, please refer to the github issues tracker

Simulation

The SDK will simulate a transaction through a node that exposes EVM debug API (you must provide the node endpoint), dry run it and extract and decode minimum required details from internal calls and emitted logs to track user assets(Native, ERC20, ERC721, ERC1155) impact and movement (ins, outs, approvals)

How the Wizard-SDK integration in Wallets Helps Crypto

Simplifying the signing process and making it more accessible, improve the overall user experience in the crypto space. also, This helps to attract more users and increase the adoption of cryptocurrencies.

Furthermore, This will enhance security in the crypto space by reducing the risk of phishing attacks. When users can understand what they are signing, they are less likely to fall for phishing scams.

Beyond SDK

In addition to the SDK, we are also drafting an EIP to address the issue of EIP-712 message visualization. We believe that a solution that can be adopted by the entire crypto community (Dapps and Wallets) will make it easier for wallets to provide a better UX with fewer efforts and maintainability burden, and higher and faster coverage.

This will result at least in users understanding what they are signing, increase security, and improve the overall user experience in the crypto space. This is not about Dapps or Wallets, It's all about users, it's our duty as a community to provide the best we can and it's for our own sake to react now before it's too late (the more the Dapps and Users, the harder to keep up)

Currently, we are experimenting with various approaches to find the most effective solution. We are open to collaborating with other projects and community members to help make this solution a reality. If you are interested in contributing, please reach out to us directly.