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

@funded-labs/plug-mobile-sdk

v0.1.3

Published

![](https://plug-cdn.s3.amazonaws.com/dab-collections/mobile-connect-banner.png)

Downloads

115

Readme

Plug Mobile SDK

Introduction

Plug mobile SDK is a suite that allows you to have an authenticated session with you dApp withing mobile device browser, request token transfers or approve.

Installation

yarn add @funded-labs/plug-mobile-sdk

Integrating Plug Mobile with your dApp

As a secure exchange channel SDK uses WalletConnect, therefore you will have to create account and obtain Project ID from WalletConnect Cloud

  1. Check that your dApp is running in mobile environment - for that we provider helper method
import { PlugMobileProvider } from '@funded-labs/plug-mobile-sdk'

const isMobile = PlugMobileProvider.isMobileBrowser()
  1. Initialize provider if running in mobile environment
if (isMobile) {
  const provider = new PlugMobileProvider({
    debug: true, // If you want to see debug logs in console
    walletConnectProjectId: '', // Project ID from WalletConnect console
    window: window,
  })
  provider.initialize().catch(console.log)
}
  1. In order to esablish connection between dApp and Mobile app you need to pair.
if (!mobileProvider.isPaired()) {
  mobileProvider.pair().catch(console.log)
}

Creating agent

When creating actor using SDK, identity delegation request will be performed.

:information_source: Note that for security reasons Plug will restrict identity delegations to token and NFT canisters. Those canisters will be filtered out from the target array, when delegating identity

const createAgent = async () => {
  const agent = await mobileProvider.createAgent({
    host: 'https://icp0.io',
    targets: [], // List of canister you are planning to call
  })
  return agent
}

You can then use returned agent with delegated identity to create actors etc.

Mobile Provider available methods

Requesting ICP transfer

requestTransfer

| Key | Type | Required | Notes | | ---------- | ---------------------- | -------- | ----------------------- | | to | String | True | Principal or account ID | | amount | number | True | E8s | | subaccount | Uint8Array or number[] | False | | | fee | number | False | E8s |

Requesting Token transfer

requestTokenTransfer

| Key | Type | Required | Notes | | ---------- | ---------------------- | -------- | -------------------------- | | canisterId | String | True | | | standard | String | True | ICRC1, ICRC2, DIP20, DRC20 | | to | String | True | Principal | | amount | number | True | E8s | | subaccount | Uint8Array or number[] | False | | | fee | number | False | E8s |