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

cool-connect

v1.0.4

Published

Welcome to Cool-Connect! This package, developed by Aukfa Inc., allows seamless integration with the Paycool+ wallet.

Downloads

9

Readme

Cool-Connect

Welcome to Cool-Connect! This package, developed by Aukfa Inc., allows seamless integration with the Paycool+ wallet.

Description

Cool-Connect enables developers to easily connect to the Paycool+ wallet, facilitating various interactions and transaction signing.

Features

  • Create and close socket connections
  • Retrieve wallet information
  • Check connection status
  • Send signing data to the wallet

Installation

To install the Cool-Connect package, use the following command:

npm install cool-connect

Usage

Integrating with the Paycool+ wallet involves three main steps:

  1. URL Initialization Extract language and device information from the URL provided by Paycool. Here's an example of how to do this in your dApp:

URL Example: http://domain.com/?locale=en&utm_source=paycool&deviceId=C1F19DF6-F224-4B73-B82A-247CCBD8BE4D

private initializeUrlParams(): void {
  const urllang = window.location.pathname.split('/')[1];
  this.urllang = urllang || 'en';
  const queryString = window.location.href.split('?')[1];
  if (queryString) {
    const params = new URLSearchParams(queryString);
    this.device_id = params.get('deviceId') ? decodeURIComponent(params.get('deviceId')!) : '';
    this.urllang = params.get('locale') ? decodeURIComponent(params.get('locale')!) : this.urllang;
  }
}
  1. Event Handling Set up an event listener to handle wallet information from Paycool. Define the event name and handle the received data accordingly:
private readonly PAYCOOL_EVENT_NAME = 'Paycool-Data';

// Event listener implementation
window.addEventListener(this.PAYCOOL_EVENT_NAME, (event: CustomEvent) => {
  // Handle wallet information
  const walletInfo = event.detail;
  console.log('Received wallet information:', walletInfo);
});
  1. Using the Cool-Connect Package

Connection Management Establish a connection with the Paycool system using the createConnection function:

import { createConnection, closeConnection } from 'cool-connect';

const connection = createConnection(deviceId);

// Listen for responses
connection.subscribe((response) => {
  switch (response.source) {
    case 'paycool-result':
      const txId = response.data;
      console.log('Transaction ID:', txId);
      break;
    case 'paycool-connect':
      const walletInfo = response.data;
      console.log('Wallet information:', walletInfo);
      break;
  }
});

// Close the connection when needed
closeConnection();

Wallet Interaction Retrieve wallet information using the getWalletAddress function if required:

const walletAddress = connection.getWalletAddress();
console.log('Wallet Address:', walletAddress);

Transaction Signing Sign transactions using the send function, providing the necessary data structure:

const transaction = {
  source: 'appName-appFunction',
  chain: 'ETH',
  data: [
    {
      // Transaction data
    },
  ],
};

connection.send(transaction);

Contributing

We welcome contributions! Please follow these guidelines when contributing to the project:

Report issues via the GitHub issue tracker. Submit pull requests with clear descriptions of changes.

Contact

For any inquiries, please contact us at [email protected].

This updated README.md provides a comprehensive guide to integrating the cool-connect package with a focus on Paycool+ wallet interactions. Let me know if you need any more changes or additional details!