https://github.com/parallel-finance/parallel-js
This library provides necessary types and JSON-RPC information for user to access Parallel Finance backend
https://github.com/parallel-finance/parallel-js
Last synced: 6 months ago
JSON representation
This library provides necessary types and JSON-RPC information for user to access Parallel Finance backend
- Host: GitHub
- URL: https://github.com/parallel-finance/parallel-js
- Owner: parallel-finance
- License: apache-2.0
- Created: 2021-06-01T05:00:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T07:46:29.000Z (over 2 years ago)
- Last Synced: 2024-11-13T21:05:14.785Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 4.88 MB
- Stars: 2
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parallel-js
This library provides necessary types and JSON-RPC information for user to access Parallel Finance backend by using [polkadot.js](https://github.com/polkadot-js/api).
## Usage
1. Add this repo as dependencies
```bash
yarn add @parallel-finance/api
```
2. Import the `ApiPromise` from this package
```typescript
import { ApiPromise, options, WsProvider, Keyring } from "@parallel-finance/api"
const main = async () => {
const api = await ApiPromise.create(options({
provider: new WsProvider()
}))
const keyring = new Keyring({ type: "sr25519" });
const signer = keyring.addFromUri("//Alice")
await api.tx.system.remark("hello").signAndSend(signer);
const [route, amount] = await api.rpc.router.getBestRoute("10000000", 100, 1, true);
}
```
## Maintenance
- [api](./packages/api)
- Contains necessary options to create a polkadot.js API instance
- [types](./packages/types)
- Polkadot.js types for Parallel Fanance
- [types-definitions](./packages/types-definitions)
- Polkadot.js type definitions for Parallel Fanance
## Update metadata
Start a local node service on ws://localhost:9948
```
yarn
ENDPOINT=ws://localhost:9948 yarn update-metadata
```
## Build
```
yarn
yarn generate:defs
yarn generate:meta
yarn build
```
## Bump Version
```
# For patch update(eg: 0.0.1 -> 0.0.2)
yarn bump patch
# For minor update(eg: 0.1.0 -> 0.2.0)
yarn bump minor
# For major update(eg: 1.0.0 -> 2.0.0)
yarn bump major
```
## Open Source Credits
We would like to thank the following projects.
- [polkadot-js/api](https://github.com/polkadot-js/api)
- [open-web3.js](https://github.com/open-web3-stack/open-web3.js)
- [acala.js](https://github.com/AcalaNetwork/acala.js)