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

cellar-js-sdk

v1.2.44

Published

晒啦第三方授权工具

Downloads

200

Readme

晒啦 js sdk 说明文档

安装

npm i cellar-js-sdk

引入

ESM

import { Cellar, CellarEnv } from "cellar-js-sdk";

UMD

<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cellar-js-sdk.umd.min.js"
/>;

调用方法

/**
 * 初始化
 * @appId 应用id
 * @env   插件执行环境目前支持 CellarEnv.PRE(测试环境) 与 CellarEnv.PRO(正式环境)
 * @walletList   是否展示钱包列表,false:默认钱包授权,true:从钱包列表中选择钱包授权 
 */
let cellar = new Cellar({
  appId: "#appId",
  env: CellarEnv.PRE,
  walletList: false,
});

/**
 * 初始化后, 所有方法都通过如下方式调用
 */
cellar.request({
  method: "方法名",
  params: [{
    /**
     * 调用的方法不同, 参数也不同
     */
  }],
}).then((result) => {
  /**
   * 所有方法正常执行完成后都会执行该回调函数
   */
  console.log(result);
}).catch((errorMsg) => {
  /**
   * 所有方法执行出错就会执行该回调函数
   */
  console.log(errorMsg);
});

目前支持的方法 method

| method | 说明 | | :------------------ | :--------------------- | | cellar_version | 获取版本号 | | cellar_loginState | 检查登录授权状态 | | cellar_loginOut | 退出当前登录授权的账户 | | cfx_accounts | 登录授权 | | cfx_sendTransaction | 调用合约 |


cfx_sendTransaction 调用链上合约

参数

| 键名 | 类型 | 说明 | | :--: | :----: | :----------------------------------------- | | from | string | 调用方地址 | | to | string | 合约地址 | | data | string | 十六进制调用数据(通过Conflux JS SDK生成) |

返回值

| 键名 | 类型 | 说明 | | :--: | :----: | :------- | | - | string | 交易hash |


cfx_accounts 登录授权

参数

| 键名 | 类型 | 说明 | | :--: | :--: | :----- | | - | - | 无参数 |

返回值

| 键名 | 类型 | 说明 | | :-----------: | :----: | :------------------- | | userCode | string | 登录账户code | | userWallet | string | 授权登录账户钱包地址 | | authorityCode | string | 授权码 |


cellar_loginState 检查登录授权状态

参数

| 键名 | 类型 | 说明 | | :--: | :--: | :----- | | - | - | 无参数 |

返回值

| 键名 | 类型 | 说明 | | :-----------: | :----: | :------------------- | | userCode | string | 登录账户code | | userWallet | string | 授权登录账户钱包地址 | | authorityCode | string | 授权码 |

如果未登录授权, 则会进入 catch() 回调


cellar_loginOut 退出当前登录账户

参数

| 键名 | 类型 | 说明 | | :--: | :--: | :----- | | - | - | 无参数 |

返回值

| 键名 | 类型 | 说明 | | :--: | :--: | :---------------------------------- | | - | - | 无返回值,只要回到 then() 就代表成功 |


cellar_version 获取晒啦js sdk 的版本号

参数

| 键名 | 类型 | 说明 | | :--: | :--: | :----- | | - | - | 无参数 |

返回值

| 键名 | 类型 | 说明 | | :--: | :----: | :------------------------------------- | | - | string | 晒啦 js-sdk 的版本号 以及 当前运行环境 |