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

mixin-node

v2.7.2

Published

The Node.js SDK for mixin.one

Downloads

23

Readme

mixin-node

The nodejs SDK for mixin.one

  • This project is a pure ES6 module since version 2.
  • This project requires Node.js v18 or above since version 2.5.
  • This project now fully supports the new Ed25519 session.
  1. Following mixin developers documentation https://developers.mixin.one/guides create your mixin app.
  2. Click the button "Ed25519 session". Now you will have the bot session secrets.
  3. Save the session object and config it in your code.
  4. Please see the transfer example in examples/test.js. Or here for reference:
npm install mixin-node --save
import mixinjs from 'mixin-node';

const opts = {
  pin         : "854423",
  client_id   : "**********095-4960-8dd1-edf6e583a2a9",
  session_id  : "a335e1e3-eb33-4112-b30a-2ae287dfbe32",
  pin_token   : "*****DEN7P3k172oBLW3g/TUZa6Xa5MrgOOzKfXdv5A=",
  private_key : "*****-*******************************************************",
};

const mixin = new mixinjs(opts);
const asset_id = "965e5c6e-434c-3fa9-b780-c50f43cd955c"; //CNB
const recipient_id = "*************-4152-9c5a-839d286f7e4f"; //User Account ID
const amount = "100";
const memo ="test transfer"

mixin.transferFromBot(asset_id, recipient_id, amount, memo).then(console.log).catch(console.error);

API

websocket API

mixin.onMessage = (data) => {
  mixin.decode(data).then(function(msgobj){
    return processing(msgobj);
  }).then(function(msgobj){
    mixin.sendMsg("LIST_PENDING_MESSAGES").then(function(receipt_id){
      console.log("list receipt_id:"+receipt_id);
    });
    mixin.sendText("my text",msgobj).then(function(receipt_id){
      console.log("text message receipt_id:"+receipt_id);
    });
    let authLink = "https://mixin.one/oauth/authorize?client_id=" + config.mixin.client_id + "&scope=PROFILE:READ";
    let btn = '[{"label":"auth","action":"' + authLink+ '","color":"#ff0033"}]'
    mixin.sendButton(btn, msgobj).then(function(result){
      console.log(result);
    });
  });
});

RESTful API

mixin.requestAccessToken(code).then(console.log);

  1. 按照 mixin 开发者手册指引,建立app. https://developers.mixin.one/guides
  2. 在 Dashboard 点击 "Ed25519 session",记录下全部生成的信息。
  3. 保存 session 對像並配置到你的代码中。
  4. 通过机器人转账的例子代码
npm install mixin-node --save
import mixinjs from 'mixin-node';

const opts = {
  pin         : "854423",
  client_id   : "**********095-4960-8dd1-edf6e583a2a9",
  session_id  : "a335e1e3-eb33-4112-b30a-2ae287dfbe32",
  pin_token   : "*****DEN7P3k172oBLW3g/TUZa6Xa5MrgOOzKfXdv5A=",
  private_key : "*****-*******************************************************",
};

const mixin = new mixinjs(opts);
const asset_id = "965e5c6e-434c-3fa9-b780-c50f43cd955c"; //CNB
const recipient_id = "*************-4152-9c5a-839d286f7e4f"; //User Account ID
const amount = "100";
const memo ="test transfer"

mixin.transferFromBot(asset_id, recipient_id, amount, memo).then(console.log).catch(console.error);