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

sac-sdk

v0.3.4

Published

JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `sac-sdk` via Soroban RPC.

Downloads

451

Readme

sac-sdk JS

JS library for interacting with Soroban smart contract sac-sdk via Soroban RPC.

This library was automatically generated by Soroban CLI using a command similar to:

soroban contract bindings ts \
  --rpc-url https://soroban-testnet.stellar.org \
  --network-passphrase "Test SDF Network ; September 2015" \
  --contract-id CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC \
  --output-dir ./path/to/sac-sdk

The network passphrase and contract ID are exported from index.ts in the networks constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update networks with other valid options. This will help your contract consumers use this library more easily.

To publish or not to publish

This library is suitable for publishing to NPM. You can publish it to NPM using the npm publish command.

But you don't need to publish this library to NPM to use it. You can add it to your project's package.json using a file path:

"dependencies": {
  "sac-sdk": "./path/to/this/folder"
}

However, we've actually encountered frustration using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your node_modules folder automatically after each install by using a postinstall script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the install step, and then regenerate them when it gets to your postinstall step, which will keep the library up-to-date with your contract.

"scripts": {
  "postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org --network-passphrase \"Test SDF Network ; September 2015\" --id CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC --name sac-sdk"
}

Obviously you need to adjust the above command based on the actual command you used to generate the library.

Use it

Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods:

import { Contract, networks } from "sac-sdk"

const contract = new Contract({
  ...networks.futurenet, // for example; check which networks this library exports
  rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers
})

contract.|

As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that | to get a list of all exports and inline-documentation for each. It exports a separate async function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code.