Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-pact

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-pact

TypeScript library for running and deploying Pact code.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

ts-pact

TypeScript library for running and deploying Pact code.

Getting started

Download the latest version of Pact. See the Pact README for instructions.

Usage

import pactLang from 'pact-lang-api'
import PactApi, { IKeyPair, pactUtils } from 'ts-pact'

const keyPair = pactLang.crypto.genKeyPair()
const args = [
  keyPair.publicKey, // Use public key as the account ID.
  pactUtils.keyset('account-keyset'),
]
const code = pactUtils.makeExpr('accounts.create-account', args)
const data = pactUtils.keysetData(keyPair.publicKey, 'account-keyset')
return this.pactApi.eval({
  code,
  data,
  keyPair,
})

Running scripts

This package comes with some utility scripts in src/scripts/. The scripts will look in the environmental variables for a Pact key and URL to use when sending transactions, falling back to defaults if these are not available. See src/scripts/config.ts for details.

Compile scripts:

yarn compile

Open a REPL to a Pact node:

node dist/src/scripts/pactRepl.js

Deploy a contract or run a Pact script:

node dist/src/scripts/runFile.js

Example: deploy and initialize a set of smart contracts:

node dist/src/scripts/deployContracts.js

FAQs

Package last updated on 21 Nov 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc