GetLit CLI
The GetLit CLI tool is currently incompatible with the latest version of the Lit SDK and must be updated before it can be used by developers building on any of the Lit 'Datil' networks. These updates are planned and the community will be notified as soon as they've been completed.
If you're new to Lit Actions and are looking for a place to start, please consult the quick start guide.
If you have a support request or would like to stay up to date with the latest updates, please join Lit's Ecosystem Builders channel on Telegram.
The GetLit CLI is a command-line tool designed to help developers manage their Lit Actions projects. The CLI provides a set of commands to create, build, test, and configure Lit Actions.
- GitHub repo: https://github.com/LIT-Protocol/getlit
- npm: https://www.npmjs.com/getlit
Installationβ
npm install -g getlit
// or
yarn add global getlit
Usageβ
To use the GetLit CLI, navigate to a directory or your existing project, and then simply run the desired command followed by any required or optional arguments. The CLI will execute the associated function and display the output accordingly.
Command | Usage | Description |
---|---|---|
action | init | getlit action | π Initialise a new Lit project |
build | getlit build | π Build your Lit Actions |
new | getlit new [<lit-action-name>] | π Create a new Lit Action |
test | getlit test [<lit-action-name>] | π§ͺ Test a Lit Action |
watch | getlit watch [<lit-action-name>] | π§ Simultaneously build and test a Lit Action |
setup | getlit setup | π Setup config for authSig and PKP |
deploy | getlit deploy | π Deploy your Lit Actions |
derive-pkp | getlit derive-pkp --userId --projectId --format | π Derive a public key from user and application IDs |
search | getlit search --get --format --publicKey --authMethodId --userId --appId | π Search for data related to PKPs |
docs | doc | getlit docs | π Open the Lit Protocol documentation |
help | show | getlit help | π Show the help menu |
getlit action
β
This command is used to initialize a new Lit project.
getlit action
Initialized Lit project directory looks like:
βββ README.md
βββ getlit.json
βββ globa.d.ts
βββ package-lock.json
βββ package.json
βββ src
βΒ Β βββ README.md
βΒ Β βββ foo.action.ts
βΒ Β βββ main.action.ts
βββ test
βΒ Β βββ README.md
βΒ Β βββ foo.t.action.mjs
βΒ Β βββ main.t.action.mjs
βββ tsconfig.json
βββ utils.mjs
In order to proceed, src/foo.action.ts
needs to be modified as βNA_Eβ to βNAMEβ:
/**
* NA_E: foo
*
* β¬οΈ Replace "_" with "M" to pass the schema validation
*
*/
const foo = () => {
return "bar";
};
You can start building your own Lit Action by modifying src/main.action.ts
, and test/main.t.action.mjs
accordingly.
getlit new
β
This command is used to create a new Lit Action in an existing project.
getlit new newAction
A new Lit Action called newAction
and the test are automatically created in the project directory:
βββ README.md
βββ getlit.json
βββ globa.d.ts
βββ package-lock.json
βββ package.json
βββ src
βΒ Β βββ README.md
βΒ Β βββ foo.action.ts
βΒ Β βββ main.action.ts
β βββ newAction.action.ts
βββ test
βΒ Β βββ README.md
βΒ Β βββ foo.t.action.mjs
βΒ Β βββ main.t.action.mjs
β βββ newAction.t.action.mjs
βββ tsconfig.json
βββ utils.mjs
getlit setup
β
Recall that in order to build a Lit project, an AuthSig and a PKP are needed. setup
Β command is used to mint the PKP and create the AuthSig.
getlit setup
getlit build
β
When the Lit Action is coded, and the PKP is created, final step is to build the project.
getlit build
getlit test
β
You can test your Lit Actions by using the test command with the Lit Action to be tested specified:
getlit test foo
getlit watch
β
This command executes the build
and test
commands simultaneously:
getlit watch
getlit deploy
β
Once the Lit Action code is ready, after building it, it can be deployed using the deploy
Β command:
getlit deploy
getlit search
β
This command is used to get PKP-related data by providing some data like public key or IDs:
getlit search --get --format --publicKey --authMethodId --userId --appId
getlit derive-pkp
β
Lit Protocol supports derived keys. Users are able to claim the key from the authentication method identifier:
getlit derive-pkp --userId --projectId --format
Not finding the answer you're looking for? Share your feedback on these docs by creating an issue in our GitHub Issues and Reports repository or get support by visiting our Support page.