
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@kadena/create-kadena-app
Advanced tools
CLI tool to create a starter project with @kadena/client integration
CLI tool to create a starter project with @kadena/client integration
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:
Chainweaver is used for signing transactions, since it's the Official Kadena wallet for advanced blockchain usage and smart contract development.
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:
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
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:
help
displays the help menuThe 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.
FAQs
CLI tool to create a starter project with @kadena/client integration
We found that @kadena/create-kadena-app demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.