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

concordium-web-sdk-vite

v3.2.2

Published

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](https://github.com/Concordium/.github/blob/main/.github/CODE_OF_CONDUCT.md)

Downloads

4

Readme

concordium-web-sdk

Contributor Covenant

Wrappers for interacting with the Concordium node, for the web environment.

Note that this package contains and exports the functions from the common-sdk, check the readme of that package for an overview of those.

Table of Contents

JSON-RPC client

The SDK provides a JSON-RPC client, which can interact with the Concordium JSON-RPC server

Creating a client

To create a client, one needs a provider, which handles sending and receiving over a specific protocol. Currently the only one available is the HTTP provider. The HTTP provider needs the URL to the JSON-RPC server. The following example demonstrates how to create a client that connects to a local server on port 9095:

const client = new JsonRpcClient(new HttpProvider("http://localhost:9095"));

API Entrypoints

Currently the client only supports the following entrypoints, with the same interface as the node client:

Creating buffers

Some of the functions in the SDK expects buffers as input. For this purpose the SDK exports a toBuffer function, which is a polyfill of the buffer.from from the Nodejs API for strings.

const myBuffer = toBuffer('AB2C2D', 'hex');

Examples

A few simple webpages have been made, to showcase using the web-sdk. They can be found in the example folder. Note that the project should be built before running the examples, otherwise they won't work. The examples that use JSON-RPC expect a JSON-RPC server on running at http://localhost:9095.

SendTransaction.html

An example of how to send a transaction using the SDK to a JSON-RPC server.

GetInstanceInfo.html

An example of getting the info of a given smart contract instance using a JSON-RPC server.

Alias.html

A very minimal example of a webpage showing alias'es of a given address, using the bundled SDK.

GetTransactionStatus.html

A simple example that allows calling a JSON-RPC server for a given transaction's status and displays the status.

GetNonce.html

A simple example that allows calling a JSON-RPC server for a given account's next nonce and displays it.

InvokeContract.html

An simple example of how to invoke a given smart contract instance using a JSON-RPC server.

GetCryptographicParameters.html

An example of getting the crypgographic parameters of the chain using a JSON-RPC server.

GetAccountInfo.html

An example of getting the info of a given account using a JSON-RPC server.

GetModuleSource.html

An example of getting the source of a model on the chain using a JSON-RPC server.

Build

Building for a release

To build the package run

yarn build

This transpiles the project to Javascript, wherefter webpack is used to create a single pure Javascript file which is put in the lib directory.

Note that the dependent packages must already have been built. To easily do this, build from the package root instead.

Publishing a release

Before publishing a new release it is essential that it has been built first. So make sure that you have just built the up-to-date code you want to publish. To publish the release run

yarn npm publish

and step through the steps presented to you.