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

@coinjinja/coinview-sdk

v1.1.2

Published

> Client side JS SDK for creating CoinView DApps.

Downloads

27

Readme

Coinview SDK

Client side JS SDK for creating CoinView DApps.

Install

Get from CDN:

https://unpkg.com/@coinjinja/[email protected]/dist/coinview.min.js

Get from NPM:

npm install @coinjinja/coinview-sdk --save

Guide

Make sure you have installed the coinview-sdk. If you installed the SDK via npm, you can import it:

import coinview from '@coinjinja/coinview-sdk'

// or with common js require
const coinview = require('@coinjinja/coinview-sdk')

If you are using the SDK via CDN, it is available on window:

<script src="https://unpkg.com/@coinjinja/[email protected]/dist/coinview.min.js"></script>
const coinview = window.coinview

Initialize

To use the CoinView SDK, an APP ID is required, you can find or create your App [TODO]. Then, use .init to initialize the CoinView SDK:

coinview.init(YOUR_APP_ID)

Note, the .init method should be called before using any other methods.

Example

Here is a full example of how to use the CoinView SDK:

import coinview from '@coinjinja/coinview-sdk'

coinview.init(YOUR_APP_ID).then(() => {

  coinview.app().then(app => {
    console.log(app)
  })

  coinview.user.profile().then(profile => {
    console.log(profile)
  })

})

async and await

Hint on using async and await:

import coinview from '@coinjinja/coinview-sdk'
coinview.init(YOUR_APP_ID)

async function fetchUserProfile () {
  const profile = await coinview.user.profile()
  return profile
}

Modules

Modules and functions in coinview. You need to call .init before using any of the below methods:

coinview.init(YOUR_APP_ID)

coinview.app()

It returns the information of your DApps:

coinview.app().then(app => {
  console.log(app)
})

/*
{
  name: 'Demo App',
  iconUrl: 'https://...',
  locale: 'ja',
  currency: 'JPY'
  params: 'customParam1=xxx&customParam2=xxx',
}
*/

coinview.user.profile()

It returns the current user's profile information:

coinview.user.profile().then(profile => {
  console.log(profile)
})

/*
{
  nickname: 'coinjinja',
  userId: '123'
}
*/

coinview.user.assets()

It returns a list of the current user's assets information:

coinview.user.assets().then(assets => {
  console.log(assets)
})

/*
[
  {
    assetId: string
    name: string
    symbol: string
    iconUrl: string
    balance: string
  }
]
*/

coinview.user.address(assetId)

It returns the address information of an asset:

coinview.user.address(assetId).then(address => {
  console.log(address)
})

/*
{
  assetId: string
  address: string
}
*/

coinview.payment.create(PaymentPayload)

It creates a payment:

/*
const payload = {
  traceId?: string
  assetId: string
  amount: number
  memo?: string
  description: string
}
*/

coinview.payment.create(payload).then(payment => {
  console.log(payment)
})

/*
{
  snapshotId: string
  traceId: string
  assetId: string
  mixinId: string
  amount: number
}
*/

coinview.navigate.back()

Navigation back.

coinview.navigate.close()

Navigation close.

coinview.ui.notice(payload)

It shows an alert message:

/*
const payload = {
  title: string
  content: string
  button: string
}
*/

const payload = {
  title: 'Notice',
  content: 'You have done something wrong',
  button: 'Ok'
}
coinview.ui.notice(payload)

coinview.ui.confirm(payload)

It shows a confirm message:

/*
const payload = {
  title: string
  content: string
  confirmButton: string
  cancelButton: string
}
*/

const payload = {
  title: 'Alert',
  content: 'Are you sure you want to delete it?',
  confirmButton: 'Sure',
  cancelButton: 'Cancel'
}
const answer = await coinview.ui.confirm(payload)
// true or false

coinview.utils.scanQR()

coinview.utils.setClipboard(text)