Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit aacb0b7

Browse files
authored
lending: JavaScript / TypeScript client library (#1996)
1 parent 5022f8b commit aacb0b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3366
-3333
lines changed

ci/js-test-token-lending.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ cd token-lending/js
99
npm install
1010
npm run lint
1111
npm run build
12-
npm run start-with-test-validator

token-lending/js/.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
3+
docs
4+
lib
5+
types

token-lending/js/.eslintrc.json

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
{
2-
"root": true,
3-
"env": {
4-
"node": true,
5-
"browser": true
6-
},
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/eslint-recommended",
10-
"plugin:@typescript-eslint/recommended",
11-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
12-
"prettier",
13-
"prettier/@typescript-eslint"
14-
],
15-
"parser": "@typescript-eslint/parser",
16-
"parserOptions": {
17-
"ecmaVersion": 2020,
18-
"parser": "babel-eslint",
19-
"project": "./tsconfig.json",
20-
"sourceType": "module"
21-
},
22-
"plugins": [
23-
"@typescript-eslint",
24-
"prettier"
25-
],
26-
"rules": {
27-
"no-console": 0,
28-
"semi": 0,
29-
"template-curly-spacing": ["error", "never"],
30-
"@typescript-eslint/no-explicit-any": 0
31-
}
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"browser": true
6+
},
7+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": ["@typescript-eslint", "prettier"],
10+
"rules": {}
3211
}

token-lending/js/.gitignore

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
node_modules
2-
coverage
3-
.nyc_output
4-
.DS_Store
5-
*.log
6-
.vscode
7-
.idea
8-
dist
9-
compiled
10-
.awcache
11-
.rpt2_cache
2+
123
docs
134
lib
14-
test-ledger

token-lending/js/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docs
2+
lib

token-lending/js/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 120,
3+
"trailingComma": "es5",
4+
"tabWidth": 4,
5+
"semi": true,
6+
"singleQuote": true
7+
}

token-lending/js/README.md

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,23 @@
1-
# Token-lending JavaScript API
1+
# SPL Token Lending client library
22

3-
The Token-lending JavaScript library comprises:
3+
This is a JavaScript + TypeScript library for interacting with the [SPL Token Lending](https://github.com/solana-labs/solana-program-library/tree/master/token-lending) program.
44

5-
* A library to interact with the on-chain program
6-
* A test client that exercises the program
7-
* Scripts to facilitate building the program
5+
## Install
86

9-
## Getting Started
7+
Install the library and its peer dependencies in your app:
108

11-
First fetch the npm dependencies, including `@solana/web3.js`, by running:
12-
```sh
13-
$ npm install
9+
### Yarn
10+
```shell
11+
yarn add @solana/spl-token-lending @solana/spl-token @solana/web3.js
1412
```
1513

16-
### Select a Network
17-
18-
The client connects to a local Solana cluster by default.
19-
20-
To enable on-chain program logs, set the `RUST_LOG` environment variable:
21-
22-
```bash
23-
$ export RUST_LOG=solana_runtime::native_loader=trace,solana_runtime::system_instruction_processor=trace,solana_runtime::bank=debug,solana_bpf_loader=debug,solana_rbpf=debug
24-
```
25-
26-
To start a local Solana cluster run:
27-
```bash
28-
$ npm run localnet:update
29-
$ npm run localnet:up
14+
### NPM
15+
```shell
16+
npm install @solana/spl-token-lending @solana/spl-token @solana/web3.js
3017
```
3118

32-
Solana cluster logs are available with:
33-
```bash
34-
$ npm run localnet:logs
35-
```
36-
37-
For more details on working with a local cluster, see the [full
38-
instructions](https://github.com/solana-labs/solana-web3.js#local-network).
39-
40-
### Build the on-chain program
41-
42-
```bash
43-
$ npm run build:program
44-
```
19+
## Documentation
4520

46-
### Run the test client
47-
48-
```sh
49-
$ npm run start
50-
```
51-
52-
## Pointing to a public Solana cluster
53-
54-
Solana maintains three public clusters:
55-
- `devnet` - Development cluster
56-
- `testnet` - Tour De Sol test cluster
57-
- `mainnet-beta` - Main cluster
58-
59-
Use npm scripts to configure which cluster.
60-
61-
To point to `devnet`:
62-
```bash
63-
$ npm run cluster:devnet
64-
```
65-
66-
To point back to the local cluster:
67-
```bash
68-
$ npm run cluster:localnet
69-
```
21+
- [Client library docs](https://solana-labs.github.io/solana-program-library/token-lending/)
22+
- [Program docs](https://github.com/solana-labs/solana-program-library/tree/master/token-lending)
23+
- [CLI docs](https://github.com/solana-labs/solana-program-library/tree/master/token-lending/cli)

token-lending/js/cli/main.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

token-lending/js/cli/token-lending-test.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

token-lending/js/client/index.ts

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)