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

@kadena/create-kadena-app

v0.2.0

Published

CLI tool to create a starter project with @kadena/client integration

Downloads

9

Readme

@kadena/create-kadena-app

CLI tool to create a starter project with @kadena/client integration

Create Kadena App

The create-kadena-app CLI tool enables you to quickly start a new application that has Kadena Blockchain integration set up and ready to go. The application supports Typescript and makes use of @kadena/client and @kadena/pactjs-cli.

The application is backed by a smart contract written in Pact that is included for convenience and also deployed on the Kadena Blockchain, so you have a working application from the start.

The two most common blockchain use cases are covered in this starter app:

  • Reading a message from the chain (requires no transaction).
  • Writing a message on the chain, which includes signing and sending a transaction on chain and waiting for it to be mined.

Chainweaver is used for signing transactions, since it's the Official Kadena wallet for advanced blockchain usage and smart contract development.

Supported Templates

Create Kadena App supports a number of well known and widely used frameworks to choose from when starting a new project. The following project templates are currently available:

Usage

The recommended way of using Create Kadena App is through npx.

npx @kadena/create-kadena-app

Create Kadena app allows you to pass command line arguments to set up a new project non-interactively. While we might further expand functionality in the future currently there's one command available, generate-project. See create-kadena-app generate --help:

Usage: create-kadena-app generate-project [options]

Generate starter project

Options:
  -n, --name <value>      Project name
  -t, --template <value>  Project template to use
  -h, --help              display help for command

Options:

  • name determines the name of the project but also the folder on the filesystem that will contain the project. The same general operating system folder name rules apply and are being validated.
  • template determines the template being used for the project that is being created. Valid values are:
    • nextjs
    • vuejs
    • angular
  • help displays the help menu

The Pact smart contract

The smart contract is called cka-message-store and can be found here. The folder contains two files message-store.pact which is the smart contract written in Pact but also message-store.repl which contains a supporting test suite. The contract is also deployed on testnet chain 0 as free.cka-message-store.

The two main functions of the contract are read-message and write-message which are shown below:

(defun read-message (account:string)
  "Read a message for a specific account"

  (with-default-read messages account
    { "message": "You haven't written any message yet" }
    { "message" := message }
    message
  )
)

Reading a message is unrestricted, so everyone can access the smart contract and read the message a user has written, given the account is provided.

(defun write-message (account:string message:string)
  "Write a message"

  (enforce (<= (length message) 150) "Message can be a maximum of 150 characters long")

  ;; Try to acquire the `ACCOUNT-OWNER` capability which checks
  ;; that the transaction owner is also the owner of the KDA account provided as parameter to our `write-messages` function.
  (with-capability (ACCOUNT-OWNER account)
    (write messages account { "message" : message })
  )
)

Writing a message is guarded by a capability ACCOUNT-OWNER, so only the account owner kan write a message.

The contract contains a single table messages that stores the messages for all users.

This readme doesn't aim to be a tutorial for Pact therefore we aren't going into the complete details of the contract nor the Pact language. For more detailed info on Pact development visit the Build section on docs.kadena.io.