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

Commit ea942c8

Browse files
committed
chore: docs
0 parents  commit ea942c8

File tree

297 files changed

+41108
-0
lines changed

Some content is hidden

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

297 files changed

+41108
-0
lines changed

.github/workflows/dev.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Injective Chain canonical docs deployment
2+
on:
3+
push:
4+
branches: [dev]
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
if: false
10+
env:
11+
SSH_USER: ${{ secrets.DEVNET_SSH_USER }}
12+
SSH_KEY: ${{ secrets.DEVNET_SSH_KEY }}
13+
SSH_HOST: ${{ secrets.DEVNET_SSH_HOST }}
14+
APP_GOOGLE_ANALYTICS_KEY: ${{ secrets.APP_DEVNET_GOOGLE_ANALYTICS_KEY }}
15+
steps:
16+
- name: Configure SSH
17+
run: |
18+
mkdir -p ~/.ssh/
19+
echo "$SSH_KEY" > ~/.ssh/devnet.key
20+
chmod 600 ~/.ssh/devnet.key
21+
22+
cat >>~/.ssh/config <<END
23+
Host injective-devnet
24+
HostName $SSH_HOST
25+
User $SSH_USER
26+
IdentityFile ~/.ssh/devnet.key
27+
StrictHostKeyChecking no
28+
END
29+
- name: Check out the source
30+
run: ssh injective-devnet 'cd ~/injective/injective-docs && git stash && git checkout dev -- && git pull origin dev'
31+
- name: Install Dependencies and generate module docs
32+
run: ssh injective-devnet 'export PATH=~/.nvm/versions/node/v16.15.0/bin/:$PATH && cd ~/injective/injective-docs && rm -rf node_modules && yarn install'
33+
- name: Build static site and copy the dist
34+
run: ssh injective-devnet 'export PATH=~/.nvm/versions/node/v16.15.0/bin/:$PATH && cd ~/injective/injective-docs && yarn build'

.github/workflows/generate.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Injective Docs Generation
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
generate:
7+
runs-on: ubuntu-latest
8+
env:
9+
GH_CORE_USER: ${{ secrets.GH_CORE_USER }}
10+
GH_CORE_TOKEN: ${{ secrets.GH_CORE_TOKEN }}
11+
GH_DOCS_TOKEN: ${{ secrets.GH_DOCS_TOKEN }}
12+
steps:
13+
- name: Checkout injective-docs
14+
uses: actions/checkout@v1
15+
with:
16+
repository: InjectiveLabs/injective-docs
17+
ref: dev
18+
path: ./injective-docs
19+
20+
- name: Generate new docs from injective-core
21+
run: |
22+
export GH_CORE_USER=${{ secrets.GH_CORE_USER }}
23+
export GH_CORE_TOKEN=${{ secrets.GH_CORE_TOKEN }}
24+
export GH_DOCS_TOKEN=${{ secrets.GH_DOCS_TOKEN }}
25+
./scripts/setup.sh
26+
27+
- name: Set up Git user
28+
run: |
29+
git config user.name "${{ github.actor }}"
30+
git config user.email "${{ github.actor }}@users.noreply.github.com"
31+
32+
- name: Commit the changes to injective-docs
33+
run: |
34+
git add .
35+
git commit -m "chore: docs regenerated" || echo "No changes to commit"
36+
git remote set-url origin https://${{ secrets.GH_CORE_USER }}:${{ secrets.GH_DOCS_TOKEN }}@github.com/InjectiveLabs/injective-docs.git
37+
git push || echo "No changes to push"

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependencies
2+
/node_modules
3+
/temp
4+
5+
# Production
6+
/build
7+
8+
# Generated files
9+
.docusaurus
10+
.cache-loader
11+
12+
# Misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🌟 Injective Docs
2+
3+
[The main documentation for Injective](https://docs.injective.network)
4+
5+
---
6+
7+
## 📚 Getting Started
8+
9+
1. Clone the repository and install dependencies
10+
11+
```bash
12+
$ git clone [email protected]:InjectiveLabs/injective-docs.git
13+
$ cd injective-docs
14+
$ yarn
15+
```
16+
17+
2. Regenerate documentation based on the desired branches for `injective-core` and `cosmos-sdk`
18+
_Note: you can change the branches/tags in the `scripts/setup.sh` file_
19+
20+
```bash
21+
$ yarn generate
22+
```
23+
24+
You can now either run the documentation locally OR build it for deployment and deploy it to the desired hosting service.
25+
26+
## 📚 Local Development
27+
28+
```
29+
$ yarn start
30+
```
31+
32+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
33+
34+
## 📚 Build
35+
36+
```
37+
$ yarn build
38+
```
39+
40+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
41+
42+
## 📚 Deployment
43+
44+
Using SSH:
45+
46+
```
47+
$ USE_SSH=true yarn deploy
48+
```
49+
50+
Not using SSH:
51+
52+
```
53+
$ GIT_USER=<Your GitHub username> yarn deploy
54+
```
55+
56+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
57+
58+
---
59+
60+
## 🔓 License
61+
62+
Copyright © 2021 - 2024 Injective Foundation (https://injective.com/)
63+
64+
<a href="https://iili.io/mNneZN.md.png"><img src="https://iili.io/mNneZN.md.png" style="width: 300px; max-width: 100%; height: auto" />
65+
66+
Originally released by Injective Foundation under: <br />
67+
Apache License <br />
68+
Version 2.0, January 2004 <br />
69+
http://www.apache.org/licenses/
70+
71+
<p>&nbsp;</p>
72+
<div align="center">
73+
<sub><em>Powering the future of decentralized finance.</em></sub>
74+
</div>

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

docs/develop/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Develop",
3+
"position": 3,
4+
"link": {
5+
"type": "doc",
6+
"id":"index"
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"label": "Injective Cheat Sheet",
3+
"position": 4,
4+
"link": {
5+
"type": "doc",
6+
"id":"index"
7+
}
8+
}
9+

docs/develop/cheat-sheet/index.mdx

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: Injective Cheat Sheet
3+
---
4+
5+
# Injective Cheat Sheet
6+
7+
This page contains helpful helpful tips, best practices, and other general information that either does not fit into a general category, or is worth repeating here.
8+
9+
## Contributing to the Burn Auction Pool
10+
11+
Every week, 60% of the accumulated trading fees transform into a pool of assets that's up for auction.
12+
13+
Members of the Injective community can participate in these auctions. Here's how it happens:
14+
15+
- Members place their bids on the asset basket using INJ.
16+
- Once the auction concludes, the highest bid wins the assets.
17+
- This winning bid is not re-circulated. Instead, it's burned, ensuring the value of INJ is maintained.
18+
19+
Beyond the fees, there's another way the auction pool can grow: direct contributions from community members. If you wish to boost the auction pool, you can directly send funds to the Auction subaccount.
20+
21+
:::info
22+
23+
When ready to contribute, send funds to the following subaccount via [MsgExternalTransfer](../modules/injective/exchange/messages#msgexternaltransfer):
24+
25+
`0x1111111111111111111111111111111111111111111111111111111111111111`
26+
27+
Be aware that any funds you send will be reflected in the next auction, not the current one.
28+
29+
:::
30+
31+
For additional help:
32+
33+
- Follow this guide in the [Injective Python SDK example](https://github.com/InjectiveLabs/sdk-python/blob/master/examples/chain_client/30_ExternalTransfer.py) to get a comprehensive understanding.
34+
35+
- Alternatively, refer to the following simplified code snippet:
36+
37+
```python MsgExternalTransfer example
38+
import asyncio
39+
import logging
40+
41+
from pyinjective.composer import Composer as ProtoMsgComposer
42+
from pyinjective.async_client import AsyncClient
43+
from pyinjective.transaction import Transaction
44+
from pyinjective.constant import Network
45+
from pyinjective.wallet import PrivateKey
46+
47+
async def main() -> None:
48+
# select network: local, testnet, mainnet
49+
network = Network.mainnet()
50+
composer = ProtoMsgComposer(network=network.string())
51+
52+
# initialize grpc client
53+
# client = AsyncClient(network, insecure=False)
54+
client = AsyncClient(network, insecure=True)
55+
56+
await client.sync_timeout_height()
57+
58+
# load account
59+
priv_key = PrivateKey.from_hex("Your PK")
60+
pub_key = priv_key.to_public_key()
61+
62+
address = pub_key.to_address()
63+
account = await client.get_account(address.to_acc_bech32())
64+
print(f" pubkey {address.to_acc_bech32()}")
65+
subaccount_id = address.get_subaccount_id(index=1)
66+
dest_subaccount_id = "0x1111111111111111111111111111111111111111111111111111111111111111"
67+
68+
# prepare tx msg
69+
msg = composer.MsgExternalTransfer(
70+
sender=address.to_acc_bech32(),
71+
source_subaccount_id=subaccount_id,
72+
destination_subaccount_id=dest_subaccount_id,
73+
amount=0.123123123,
74+
denom="INJ"
75+
)
76+
77+
tx = (
78+
Transaction()
79+
.with_messages(msg)
80+
.with_sequence(client.get_sequence())
81+
.with_account_num(client.get_number())
82+
.with_chain_id(network.chain_id)
83+
)
84+
85+
# build tx
86+
gas_price = 500000000
87+
gas_limit = 90000 + 20000 # add 20k for gas, fee computation
88+
gas_fee = '{:.18f}'.format((gas_price * gas_limit) / pow(10, 18)).rstrip('0')
89+
fee = [composer.Coin(
90+
amount=gas_price * gas_limit,
91+
denom=network.fee_denom,
92+
)]
93+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo('').with_timeout_height(client.timeout_height)
94+
sign_doc = tx.get_sign_doc(pub_key)
95+
sig = priv_key.sign(sign_doc.SerializeToString())
96+
tx_raw_bytes = tx.get_tx_data(sig, pub_key)
97+
98+
# broadcast tx: send_tx_async_mode, send_tx_sync_mode, send_tx_block_mode
99+
res = await client.send_tx_sync_mode(tx_raw_bytes)
100+
print(res)
101+
print("gas wanted: {}".format(gas_limit))
102+
print("gas fee: {} INJ".format(gas_fee))
103+
104+
if __name__ == "__main__":
105+
asyncio.get_event_loop().run_until_complete(main())
106+
```
107+
108+
### Burner Address
109+
110+
If you would like to burn tokens directly, send funds to the following address:
111+
112+
```
113+
inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49
114+
```
115+
116+
This is effectively the Injective `0x0...` address converted into `bech32`.
117+
118+
## Creating Transactions
119+
120+
### Via APIs
121+
122+
See the [Injective API Docs](https://api.injective.exchange/#chain-api) for examples of generating, signing, and broadcasting transactions using the [Python](https://github.com/InjectiveLabs/sdk-python), [Go](https://github.com/InjectiveLabs/sdk-go/), and [TypeScript](https://github.com/InjectiveLabs/injective-ts) SDKs.
123+
124+
### Via Ledger
125+
126+
For Ledger support, transactions should be created and signed with the TypeScript SDK. See [here](https://docs.ts.injective.network/transactions) for transactions in TypeScript and [here](https://docs.ts.injective.network/transactions/ethereum/ethereum-ledger) for signing with Ledger.
127+
128+
### Via `injectived`
129+
130+
Transactions can also be generated, signed, and broadcasted through the `injectived` CLI. See [Using `injectived`](../tools/injectived/02_using.md) for an overview of the process, or the full [commands](../tools/injectived/commands#tx) for documentation on possible transactions types.

0 commit comments

Comments
 (0)