LiNEAR Protocol is a liquid staking solution built on the NEAR Protocol. LiNEAR unlocks liquidity of the staked NEAR by creating a staking derivative to be engaged with various DeFi protocols on NEAR and Aurora, while also enjoying over 10% APY staking rewards of the underlying base tokens. LiNEAR is the cornerstone piece of the NEAR-Aurora DeFi ecosystem.
This repository holds LiNEAR BOS components hosted on NEAR BOS (Blockchain Operating System), to interact with LiNEAR smart contract.
We use BOS Loader to enable instant preview in local environment, so you don't have to deploy all your components to mainnet to preview and test your changes.
Linux / Mac: Install prebuilt binaries via shell script
# WARNING: this installer is experimental curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mpeterdev/bos-loader/releases/download/v0.6.0/bos-loader-v0.6.0-installer.sh | shWindows: Install prebuilt binaries via powershell script
# WARNING: this installer is experimental irm https://github.com/mpeterdev/bos-loader/releases/download/v0.6.0/bos-loader-v0.6.0-installer.ps1 | iex
- Open https://test.near.org/flags, and set the loader URL to http://127.0.0.1:3030
- Clone repository:
git clone https://github.com/linear-protocol/linear-bos-components
- Install dependencies:
cd linear-bos-components && yarn
- Launch testnet preview page and BOS loader:
yarn dev
- Modify LiNEAR components code, and refresh preview page to view the latest change. Please notice that because hot reload is not ready in BOS loader, you need to refresh the preview page in browser after code change.
prettier
is configured in Git pre-commit hook with husky and lint-staged to automatically format the modified components code.
The source code of LiNEAR components are available in the src
folder, and organized by sub-folders. For example, the linearprotocol.near/widget/LiNEAR.Element.Button
component is available in src/LiNEAR/Element/Button.jsx
. BOS Loader and BOS CLI both use .
delimiter when converting local file path to component name, and vice versa.
We use BOS CLI and its GitHub actions for continuous integration and delivery.
- We have set up one testnet GitHub action to deploy latest commit in pull request to testnet for preview and testing once the PR is submitted. (However, since now we have only configured on
TESTNET_DEPLOY_ACCOUNT
, if you have multiple open PRs, they may conflict with each other. This will be fixed later.) - We have another mainnet GitHub action to deploy the latest
main branch
components code to mainnet.
To make the CI workflow work, we need to create function call keys for testnet and mainnet deployment, following the instructions in BOS CLI, and set up below GitHub actions variables and secrets.
TESTNET_DEPLOY_ACCOUNT
/TESTNET_SIGNER_PUBLIC_KEY
/TESTNET_SIGNER_PRIVATE_KEY
MAINNET_DEPLOY_ACCOUNT
/MAINNET_SIGNER_PUBLIC_KEY
/MAINNET_SIGNER_PRIVATE_KEY
- We recommend testing locally with BOS Loader first, before submit pull request for code review and testnet testing.
- Once a PR is submitted, it will be automatically deployed to testnet, which makes it easy for others to test and provide feedback.
- Only after a PR is well tested and reviewed, it will be merged and the latest
main branch
commit will be deployed to mainnet.
MIT License