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

@citizenwallet/sdk

v2.0.35

Published

An sdk to easily work with citizen wallet.

Downloads

2,665

Readme

🚧 Alpha

An easy-to-use SDK for building frontend interfaces that interact with a community server and any related smart contracts that we use. This SDK is frontend framework agnostic and includes types, API calls, and state management.

Introduction

Welcome to the official SDK for our platform.

We hope you find this SDK useful, and we're excited to see what you build with it!

Installation

To install the SDK, run the following command in your terminal:

Deno add jsr:@citizenwallet/sdk

Installation (npm)

To install the SDK, run the following command in your terminal:

npm install --save @citizenwallet/sdk

Vouchers

A voucher is actually simply a random private key which is used to generate a Smart Account that we top up and send to someone with some metadata.

You are effectively creating an account, topping it up, describing what it is and sending that over to the other person.

Create a voucher

const communityAlias = 'bread'; // config.community.alias

const voucherName = 'Voucher for X tokens';

const creatorAddress = '0x59D17ec3d96C52d4539eed43f33492679ae4aCf7'; // since the user who is redeeming will only see a transaction from the voucher to them, this allows displaying the original creator on the UI.

const signer = ethers.Wallet.createRandom(); // generate a random account which will be used for the voucher.

const voucher = await createVoucher(
communityAlias,
voucherName,
creatorAddress,
signer
);

Example:

{
    "voucherLink": "https://app.citizenwallet.xyz/#/?voucher=H4sIAEFF7WYAAw3JyQ3AMAgEwIoiLeYy5YDBJaT-5D3vemZEhHHS83INkWm5G4uo6MJkN4f_jFiEuhZnI3sHyJkaH_18VYRDAAAA&params=H4sIAEFF7WYAAw3LsRLCIAwA0L_p4qIkEDIwSC3_kUI4vdNyR6nn59vlbU_eL9nD2lXKlE9H6-H6s_y4kWYo7GZrClpg1YJQAZCNIxZFmStNknM7tnEWMItjghRNrQ6i95YpMSzI0Zv7SmhIgFOZNvloGLqPy7cd-an9D-Zqgw6DAAAA",
    "voucherAccountAddress": "0x32E6973FB2ff63B88597F93E49B82Ab7427a39Fd"
}

Parse a voucher

const parsed = parseVoucher(voucher.voucherLink);

Example:

{
    "voucher": {
        "alias": "bread",
        "creator": "0x59D17ec3d96C52d4539eed43f33492679ae4aCf7",
        "account": "0x32E6973FB2ff63B88597F93E49B82Ab7427a39Fd",
        "name": "test voucher"
    },
    "signer": {
        "provider": null,
        "address": "0x60fab84316061E5c7C2eD09a2c4Be454B6B1fC69"
    }
}

signer = type ethers.Wallet

Config

Every community and their currency has a configuration in a json format.

The SDK provides types for accessing properties as well as a class with helper functions.

Building (npm)

To build the SDK, run the following command in your terminal:

npm run build

This will compile the TypeScript code to JavaScript.

Watching for Changes (npm)

To automatically recompile the SDK when a file changes, run the following command in your terminal:

npm run watch

Contributing

We welcome contributions! Please see our contributing guidelines for more details.

License

This project is licensed under the MIT license.