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

@trilitech-umami/umami-embed

v0.3.1

Published

[WIP - not ready for production use] A simple embeddable Umami wallet

Downloads

4,017

Readme

Umami Embed - WIP, not ready for production use

Umami-Embed is a component designed to integrate an instance of Umami Wallet into a webpage through an iFrame. It securely encapsulates user details and offers an API for the host application to interact with the Tezos blockchain.

Umami-Embed allows users to engage with decentralized applications (dApps) directly, eliminating the requirement for a separate wallet application.

For the demo implementation and more information, please visit the Umami-Embed Github repository.

Network Access

  • ghostnet - available for anyone to use.
  • mainnet - requires allowlisting. Please contact us at [email protected] to get your domain added to the allowlist for mainnet access.

Supported Features

Methods are expected to be called in a synchronized manner. Each operation must be completed before another can be initiated.

Each method returns a promise that resolves upon successful completion or fails with error details if something goes wrong.

Public user data is stored in local storage to prevent the need for unnecessary re-logins. Logout removes the stored data.

Workflow

Initialization / Deinitialization

Set up or tear down the Umami-Embed environment.

The initialization step is required before any other method can be called.

If the user has logged in previously and their data is saved in local storage, it will be retrieved at this step.

On init, UmamiEmbedConfig can be applied. It includes the following parameters:

  • network - required, either mainnet or ghostnet.
  • iframeParent - optional HTMLElement to attach the iFrame to. Defaults to document.body.
  • useLocalEmbedIframe - false by default. When true, it looks for an iframe at http://localhost:5173/ (works on ghostnet only).
  • loginOptions - defaults to including all login types. You can specify an array with any of these options: google, reddit, twitter, facebook.
  • theme - light by default. Supports light and dark options.
  • logsLevel - none by default. Can be set to none, info, warn, error.

Check types.ts for more information about supported values.

Example
const umami = new UmamiEmbed();

const config: UmamiEmbedConfig = { network: 'ghostnet' };
await umami.init(config);

// prints true
console.log(umami.isInitialized);

// prints user data if saved in local storage
if (umami.isLoggedIn) {
    console.log(umami.user);
}

umami.destroy();

Login / Logout

Authenticate users through selected supported social logins.

login() returns user information upon successful execution.

If user data is present in local storage, it can be accessed by calling user property. The property will be null otherwise.

Example
const umami = new UmamiEmbed();
await umami.init({ network: 'ghostnet' });

if (umami.isLoggedIn) {
    const userData = umami.user;
    await umami.logout();
} else {
    const userData = await umami.login();
    console.log(userData);
}

Sending Tezos Operations

Send a list of Tezos operations for user approval. If user is not logged in, this method will throw an error.

Before displaying the confirmation modal, Umami Embed validates the operation and precomputes the fee. If the computation fails, the promise will resolve with an error. Otherwise, the confirmation modal will be displayed to the user.

Please note that the computation process may take some time. It is recommended to provide feedback to the user indicating that the operation has started, as nothing will be shown on our side until the computation completes.

Operations must be provided in PartialTezosOperation format. Refer to @airgap/beacon-sdk and the operation request doc for more details.

send() returns operation hash if the operation submission is successful.

Example
const umami = new UmamiEmbed();
await umami.init({ network: 'ghostnet' });
await umami.login();

umamiEmbed.send([ { "kind" : "transaction", "destination" : "tz1...", "amount" : "1000" } ]);

Signing Payload

Send a payload for user to sign. If user is not logged in, this method will throw an error.

This method allows users to approve and sign arbitrary data from a decentralized application.

sign() returns the signature of the payload after the user approves it through the confirmation modal. If user declines singing, the method will throw an error.

The payload can be signed using different signing types, such as RAW, OPERATION, or MICHELINE.

Example
const umami = new UmamiEmbed();
await umami.init({ network: 'ghostnet' });
await umami.login();

const payload = 'some-payload-data';  // This could be any payload you want to sign
const signature = await umami.sign(SigningType.RAW, payload);

License

This project is licensed under the MIT License. For more details, please visit the LICENSE file.