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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gawallet-sdk

v0.9.0

Published

1.1 安装

Readme

授权 SDK 操作说明

1. es 模块调用方式

1.1 安装

npm install gawallet-sdk

yarn add gawallet-sdk

2.2 引入

import gawallet from "gawallet-sdk"
import "gawallet-sdk/dist/style.css";// 对话框内部系统不需要此行

2. SDK 方法说明

2.1 openAuth 打开新授权页,返回实例

2.1.1 接口说明
const authObj=gawallet.openAuth({
    success,// 成功的回调
     fail,//失败的回调
    options = {},//窗口配置说明
     config,//授权参数配置
 
    })
2.1.2 接口示例,常用使用方式
const authObj= gawallet.openAuth(
       {
      success: (data,ref) => {
        // ref 是窗口实例,有 open,与 close 方法
        console.log("获取成功的数据", data)
      },
      fail:(data,ref)=>{
        // ref 是窗口实例,有 open,与 close 方法
      console.log("获取失败的数据", data)
      }
      }
    )
2.1.3 接口示例 配置参数
const authObj=gawallet.openAuth(
       {
      success: (data,ref) => {
        console.log("获取成功的数据", data)
      },
      fail:(data,ref)=>{
      console.log("获取失败的数据", data)
      },
      config:{
          url: "https://oauth.kdk.fun/oauthLogin",//指定固定授权地址,权限最大
            args:{
              env:"test",// 指定环境,development 本地开发,test 测试环境,production 正式环境(默认)develop_build 开发部署环境
              redirect_uri: window.location.origin,//重定向地址
               client_id: "gaw",// 客户端 id
             auth_platform: "GAW",// 授权方式 GAW,Google
   }
      }
     }
    )
2.1.4 接口示例 调整宽高或者語言
const authObj=gawallet.openAuth(
       {
      success: (data,ref) => {
        console.log("获取成功的数据", data)
      },
      fail:(data,ref)=>{
      console.log("获取失败的数据", data)
      },
      // 控制样式
      options: {
        style: {
          width: 800,//宽度
          height: 800// 高度
        },
        language:"en-US"
       
      },
 
     }
    )

2.2 loginOut 登出

注意了:参数格式,登录一样,只是不需要成功与失败的回调


   gawallet.loginOut({
      config: {
        args: {
          env: "test",
        },
      },
    });

2.3 pay 调用支付 返回实例

2.3.1 接口说明
const authObj=await gawallet.pay({
     config,//环境配置参数,同上面的接口
     data// 支付的参数
    })

2.4 register 打開註冊 返回实例

2.4.1 接口说明 同註冊一樣的配置
const authObj=gawallet.register({
    success,// 成功的回调
     fail,//失败的回调
    options = {},//窗口配置说明
     config,//支付参数配置
 
    })

3 参数说明

3.1 success 成功的回调
  1. 内置两个参数(data,ref) data 代表传递的数据,ref 是授权对象引用 data:包含了 redirect_uri 参数及其他数据 ref 包含,open,与 close 方法可以打开与关闭窗口
3.2 fail 失败的回调
  1. 内置两个参数(data,ref) data 代表传递的数据,ref 是授权对象引用 ref 包含,open,与 close 方法可以打开与关闭窗口
3.2 options 窗口配置说明
 {
  container_className: '',//遮罩层的样式名
  container_style: {},//遮罩层的样式
  clasName:'',//中间窗口样式名
  style:{},//中间窗口样式

  language:"zh-CN",// 语言,目前支持 zh-CN en-US
    closed:false,//成功或失败回调后是否自动关闭,接收消息事件不会
   auto:false, //是否由 url 地址内部自行控制弹窗的显示与隐藏,
   ... // 及其他自定义参数,用于自定义,会传给第三方系统
}
3.3 config 授权参数说明

1.说明

{
   url,// 自定义授权地址
   // 自定义的授权参数
 args:  {
     env,//环境参数
     redirect_uri,//重定向地址
      client_id,// 客户端id
      auth_platform,// 授权方式 GAW,Google
  
   }
}

2.内置默认值

{
          url: "",// 自定义授权地址
            args:{
              env:"production",//环境参数,默认是正式环境
                redirect_uri: window.location.origin,//重定向地址
                client_id: "gaw",// 客户端id
                auth_platform: "GAW",// 授权方式 GAW,Google
               
   }
      }
3.4 env 环境参数说明

development://开发 production: // 正式

3.5 返回值 为窗口实例,以下是实例的方法

1.再次打开

authObj.open()

1.关闭,带一个参数,是否销毁,默认是真

authObj.close(true)

内部系统操作对话框

1. 引入方式

import { dialog } from "gawallet-sdk";

2.方法介绍

1.成功消息,自动关闭对话框

dialog.success(data)

2.失败消息,自动关闭对话框

dialog.fail(data)

3.普通消息,不关闭对话框

dialog.message(data)

4.打开 注意此方法在 auto 为 false,没有默认打开时才有效,关闭后就无法再调用

dialog.open()

5.关闭

dialog.clsoe()

钱包相关接口

钱包的接口的调用方式

  1. 引入
import gawallet from "gawallet-sdk"

2.调用方式

gawallet.payMethod.?()// 问号后面就是具体的方法名
  1. 方法说明
//// 是否安装了浏览器插件,用于 pc,移动端些方法无法
 const isinstall= await gawallet.payMethod.isInstalled();
// 连接钱包,连接成功则返回钱包地址,为数组,连接失败返回 false
 const account=await gawallet.payMethod.connect();
   /**
    * 签名
   
    */
   const sign= await gawallet.payMethod. send_personal_sign(
     message,//签名依靠字符
   address //钱包地址
   
   );
   /**
    * 钱包支付
    * 
    */
   const sign= await gawallet.payMethod.payMoney({
     chainId,//切换的网络id,可以不传
     address,// 錢包地址 
     txList//交易数据 数组  
             //[{ value,data,to }]
   });

/**
*  // 切换网络,
* chainId 网络 id
*/
const ischange= await gawallet.payMethod.toSwitch(chainId)

/**
* 检查是否打开最大额度设置
* chainId 网络 id
*/ 
 const isneed=await gawallet.payMethod.needApprove(
   chainId, //网络id
   from, // 自己的钱包
   to, // 交易的钱包地址
   data// 交易数据
 
   )
/**
 * 轮询检查是否交易成功
 * txHash 为交易后返回的 hash
 */
// 成功后返回 hash ,否则继续查
const tsHash= await gawallet.payMethod.checkTransactionconfirmation(txHash)
/**
* 添加代币
 */

const tsHash= await  gawallet.payMethod.addAsset(

 chainId,// 网络 id
 
 {
   address,// token地址
   symbol,// token 标识
   decimals,// 精确度,默认18
   image// 币的图片
}
)