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

@demox-labs/solreq

v0.0.5

Published

A js client to interact with the solreq program

Downloads

3

Readme

solreq

An Oracle on Solana based on the Demox Protocol.

This repository implements the Solana program and provides some utilities to make interacting with it easier.

This repository creates the:

  • solreq crate (Rust): https://crates.io/crates/solreq
  • solreq package on npm (JS): https://www.npmjs.com/package/@demox-labs/solreq

Installation

  1. Ensure that Anchor and all of its dependencies are installed: https://project-serum.github.io/anchor/getting-started/introduction.html
  2. yarn install
  3. Start the solana-test-validator in a separate shell;
  4. Create a solana wallet:
    • solana-keygen new -o ~/.config/solana/id.json
    • Optionally, see also: https://docs.solana.com/wallet-guide/file-system-wallet#generate-a-file-system-wallet-keypair
  5. Copy the Anchor.example.toml to Anchor.toml and update the wallet = to your solana pubkey;
  6. Run solana airdrop --url localhost 1001
  7. Run anchor build
  8. Run anchor deploy --provider.wallet ~/.config/solana/id.json --provider.cluster localnet
  9. Use the Program Id found from the deployment log. Replace 6DeKhrczNofy2fhDhJXnyZpMnRnS4oA4q3NicngF7fzT in all files at your clone of this repository with your new Program Id.
  10. Run the tests: anchor test --provider.wallet ~/.config/solana/id.json --provider.cluster localnet

Install the crate:

Add solreq = { version = "0.1.5", features = ["cpi"] } to your Cargo.toml

Install the js client library:

npm i @demox-labs/solreq --save

Usage

For CPI Calls

If you're writing a Solana program to interact with this one, we recommend:

  1. Installing & running the solana-test-validator
  2. Clone & Install this repository with the instructions above.
  3. Run anchor build
  4. Run anchor deploy --provider.wallet <wallet_pathname.json> or anchor test --skip-local-validator to deploy the program to test validator. You'll need to redo this if you ever reset the solana-test-validator for example by running it with -r.

Now you can run your program using for example:

  • anchor build && anchor deploy && node my-script.js
  • anchor test --skip-test-validator

You could alternatively copy the state of devnet and load it locally but full installation is recommended as described. Any CPI call should test all error states & full installation makes development much easier if you can update the program to force them.

Examples

On chain

The best resource for understanding how to interact with solreq is through the P2P Coin Flip is the example here: https://github.com/evanmarshall/cross-pile

Client

The tests, tests/solreq.ts, provide examples in how to use our client library.

Security Considerations

  1. This code has not been audited by a third party. If you find issues, please submit them. We plan get an audit as soon as we can.
  2. Error handling for hanging responses should be a consideration.
  3. The Demox Protocol is in its beginning stages and at this point, still requires trust in Demox Labs as a third party. With the launch of our dVPN, no third party need be trusted but for this, it requires trusting that we're not fabricating packet captures and tls sessions.

Troubleshooting

Problems with Anchor

  • The most common problem with anchor is using the right version of nodejs. We recommend install NodeJS through NVM:
    • Install the NVM, and
    • then:
nvm install 16.11.1
nvm use 16.11.1
  • Anchor may and has introduced breaking changes. The current version is 0.22.0. I recommend installing Anchor Version Manager (AVM) to compile with different versions of Anchor. cargo install --git https://github.com/project-serum/anchor avm --locked --force

License

We use the GNU Affero General Public License v3.0 or later license to ensure the community will always have access to all original and derivations of this program. Full text here: https://spdx.org/licenses/AGPL-3.0-or-later.html