Skip to content

The qn-marketplace-cli is a command line interface for the QuickNode Marketplace.

License

Notifications You must be signed in to change notification settings

quiknode-labs/qn-marketplace-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qn-marketplace-cli

The qn-marketplace-cli is a command line interface for the QuickNode Marketplace.

It provides:

  • A set of commands to test an add-on's provisioning implementation
  • A command to test your an add-on's SSO implementation
  • A command to test your an add-on's RPC methods

The CLI is designed to allow you to test your QuickNode Marketplace add-ons directly on your localhost environment as your a developing them.

Getting Started & Installation

To install qn-marketplace-cli to your machine, you can download a pre-built binary for your operating system from the bin directory of this repo.

You can also download this repository and build the code on your local machine. See the Development section below for more information on how to do that.

Commands

Help

To get more information about how to use the CLI, use the following command:

qn-marketplace-cli help

Please note that if you are debugging and want to see more information, you can use the --verbose flag for every command.

PUDD Testing

QuickNode Marketplace add-ons must implement four provisioning API endpoints:

  • Provision (POST): called when a QuickNode customers installs the add-on on an endpoint.
  • Update (PUT): called when a previously provisioned endpoint gets updated.
  • Deactivate Endpoint (DELETE): called when a previously provisioned endpoint gets discarded.
  • Deprovision (DELETE): called when the add-on is uninstalled for a customer account (for all endpoints)

The qn-marketplace-cli has 4 different commands that allows you to test each one of these actions in isolation:

PROVISION:

qn-marketplace-cli provision --url=http://localhost:3000/provision --basic-auth=q24rqaergser --chain=ethereum --network=mainnet --plan=your-plan-slug --quicknode-id=abcdef --endpoint-id=foobar --endpoint-url=https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/ --wss-url=wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/

UPDATE:

qn-marketplace-cli update --url=http://localhost:3000/update --basic-auth=q24rqaergser --chain=ethereum --network=mainnet --plan=your-plan-slug --quicknode-id=abcdef --endpoint-id=foobar --endpoint-url=https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/ --wss-url=wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/

DEACTIVATE ENDPOINT:

qn-marketplace-cli deactivate --url=http://localhost:3000/deactivate_endpoint --basic-auth=q24rqaergser --endpoint-id=foobar

DEPROVISION:

qn-marketplace-cli deprovision --url=http://localhost:3000/deprovision --basic-auth=q24rqaergser --quicknode-id=abcdef

It also has one command that allows you to test all four actions at once:

qn-marketplace-cli pudd --base-url=http://localhost:3000/ --basic-auth=q24rqaergser --chain=ethereum --network=mainnet --plan=your-plan-slug --endpoint-url=https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/ --wss-url=wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/

JSON-RPC Testing

QuickNode Marketplace add-ons extends our capabilities by adding new JSON-RPC methods to QuickNode's existing endpoints. Please read this guide for more information.

If your add-on has RPC methods, the qn-marketplace-cli allows you to test your implementation by making some JSON-RPC calls to your application.

qn-marketplace-cli rpc  --url=http://localhost:3000/rpc --method=your_addOnMethod --rpc-params='[9, "f"]' --chain=solana --network=mainnet --endpoint-url=https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/ --wss-url=wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/

Development

qn-marketplace-cli is developed using Go and Cobra and released under an MIT License.

We welcome contributions to this repository to help us improve the CLI.

To fetch, build and install from the Github source:

go install github.com/quiknode-labs/qn-marketplace-cli@latest

To build the project:

go build -o bin/qn-marketplace-cli

Then:

bin/qn-marketplace-cli

Testing on your localhost/development environment

You can use the following commands to test locally if you have an application that is hosted at http://localhost:3030.

For example, if you are using our marketplace-starter-js repo, which is a sample add-on built with node.js, then you can use the following commands, assuming you have set the username and password to username and password respectively.

go build

Testing Provisioning

You can test the 4 provision actions:

./qn-marketplace-cli provision --url http://localhost:3030/provisioning/provision --chain ethereum --network mainnet --plan test --quicknode-id foobar --endpoint-id bazbaz --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

./qn-marketplace-cli update --url http://localhost:3030/provisioning/update --chain ethereum --network mainnet --plan test --quicknode-id foobar --endpoint-id bazbaz --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

./qn-marketplace-cli deactivate --url http://localhost:3030/provisioning/deactivate_endpoint  --quicknode-id foobar --endpoint-id bazbaz --chain ethereum --network mainnet --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

./qn-marketplace-cli deprovision --url http://localhost:3030/provisioning/deprovision  --quicknode-id foobar --endpoint-id bazbaz --chain ethereum --network mainnet --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

Or you can test them all at once with PUDD:

./qn-marketplace-cli pudd --base-url http://localhost:3030/provisioning  --quicknode-id foobar --endpoint-id bazbaz --chain ethereum --network mainnet --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

Testing Single Sign On (SSO)

QuickNode Marketplace add-ons can provide a user-interface or dashboard that QuickNode customers can access from a link on their quicknode.com account. In order to seamlessly these customers from quicknode.com to Marketplace add-ons, an add-on can implement SSO. You can read this guide for more information on how SSO works with the QuickNode Marketplace.

Provide the provision url which should return a dashboard-url in the response. This will open a browser pointing to the dashboard url with the provisioned information.

./qn-marketplace-cli sso --url http://localhost:3030/provisioning/provision --email [email protected] --name Luc --org QN --jwt-secret jwt-secret --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ= --endpoint-url=https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/ --wss-url=wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/

Testing RPC calls

./qn-marketplace-cli rpc --url http://localhost:3030/provisioning/provision --rpc-url http://localhost:3030/rpc --rpc-method qn_fetchStuff --rpc-params "[\"abc\",123,\"zoo\"]" --basic-auth dXNlcm5hbWU6cGFzc3dvcmQ=

Testing Healthcheck URL

./qn-marketplace-cli healthcheck --url http://localhost:3030/healthcheck

Integrating into your CI workflows

You can easily integrate qn-marketplace-cli into your CI workflows so that your add-on is automatically tested by the CLI on every new pull request.

To see how to accomplish this, check out our Github Workflow for marketplace-starter-go

License

MIT

About

The qn-marketplace-cli is a command line interface for the QuickNode Marketplace.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages