Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Oct 7, 2024
0 parents commit ea942c8
Show file tree
Hide file tree
Showing 297 changed files with 41,108 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Injective Chain canonical docs deployment
on:
push:
branches: [dev]

jobs:
release:
runs-on: ubuntu-latest
if: false
env:
SSH_USER: ${{ secrets.DEVNET_SSH_USER }}
SSH_KEY: ${{ secrets.DEVNET_SSH_KEY }}
SSH_HOST: ${{ secrets.DEVNET_SSH_HOST }}
APP_GOOGLE_ANALYTICS_KEY: ${{ secrets.APP_DEVNET_GOOGLE_ANALYTICS_KEY }}
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/devnet.key
chmod 600 ~/.ssh/devnet.key
cat >>~/.ssh/config <<END
Host injective-devnet
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/devnet.key
StrictHostKeyChecking no
END
- name: Check out the source
run: ssh injective-devnet 'cd ~/injective/injective-docs && git stash && git checkout dev -- && git pull origin dev'
- name: Install Dependencies and generate module docs
run: ssh injective-devnet 'export PATH=~/.nvm/versions/node/v16.15.0/bin/:$PATH && cd ~/injective/injective-docs && rm -rf node_modules && yarn install'
- name: Build static site and copy the dist
run: ssh injective-devnet 'export PATH=~/.nvm/versions/node/v16.15.0/bin/:$PATH && cd ~/injective/injective-docs && yarn build'
37 changes: 37 additions & 0 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Injective Docs Generation

on: workflow_dispatch

jobs:
generate:
runs-on: ubuntu-latest
env:
GH_CORE_USER: ${{ secrets.GH_CORE_USER }}
GH_CORE_TOKEN: ${{ secrets.GH_CORE_TOKEN }}
GH_DOCS_TOKEN: ${{ secrets.GH_DOCS_TOKEN }}
steps:
- name: Checkout injective-docs
uses: actions/checkout@v1
with:
repository: InjectiveLabs/injective-docs
ref: dev
path: ./injective-docs

- name: Generate new docs from injective-core
run: |
export GH_CORE_USER=${{ secrets.GH_CORE_USER }}
export GH_CORE_TOKEN=${{ secrets.GH_CORE_TOKEN }}
export GH_DOCS_TOKEN=${{ secrets.GH_DOCS_TOKEN }}
./scripts/setup.sh
- name: Set up Git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Commit the changes to injective-docs
run: |
git add .
git commit -m "chore: docs regenerated" || echo "No changes to commit"
git remote set-url origin https://${{ secrets.GH_CORE_USER }}:${{ secrets.GH_DOCS_TOKEN }}@github.com/InjectiveLabs/injective-docs.git
git push || echo "No changes to push"
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependencies
/node_modules
/temp

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 🌟 Injective Docs

[The main documentation for Injective](https://docs.injective.network)

---

## 📚 Getting Started

1. Clone the repository and install dependencies

```bash
$ git clone [email protected]:InjectiveLabs/injective-docs.git
$ cd injective-docs
$ yarn
```

2. Regenerate documentation based on the desired branches for `injective-core` and `cosmos-sdk`
_Note: you can change the branches/tags in the `scripts/setup.sh` file_

```bash
$ yarn generate
```

You can now either run the documentation locally OR build it for deployment and deploy it to the desired hosting service.

## 📚 Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## 📚 Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## 📚 Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

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.

---

## 🔓 License

Copyright © 2021 - 2024 Injective Foundation (https://injective.com/)

<a href="https://iili.io/mNneZN.md.png"><img src="https://iili.io/mNneZN.md.png" style="width: 300px; max-width: 100%; height: auto" />

Originally released by Injective Foundation under: <br />
Apache License <br />
Version 2.0, January 2004 <br />
http://www.apache.org/licenses/

<p>&nbsp;</p>
<div align="center">
<sub><em>Powering the future of decentralized finance.</em></sub>
</div>
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
8 changes: 8 additions & 0 deletions docs/develop/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Develop",
"position": 3,
"link": {
"type": "doc",
"id":"index"
}
}
9 changes: 9 additions & 0 deletions docs/develop/cheat-sheet/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "Injective Cheat Sheet",
"position": 4,
"link": {
"type": "doc",
"id":"index"
}
}

130 changes: 130 additions & 0 deletions docs/develop/cheat-sheet/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: Injective Cheat Sheet
---

# Injective Cheat Sheet

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.

## Contributing to the Burn Auction Pool

Every week, 60% of the accumulated trading fees transform into a pool of assets that's up for auction.

Members of the Injective community can participate in these auctions. Here's how it happens:

- Members place their bids on the asset basket using INJ.
- Once the auction concludes, the highest bid wins the assets.
- This winning bid is not re-circulated. Instead, it's burned, ensuring the value of INJ is maintained.

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.

:::info

When ready to contribute, send funds to the following subaccount via [MsgExternalTransfer](../modules/injective/exchange/messages#msgexternaltransfer):

`0x1111111111111111111111111111111111111111111111111111111111111111`

Be aware that any funds you send will be reflected in the next auction, not the current one.

:::

For additional help:

- 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.

- Alternatively, refer to the following simplified code snippet:

```python MsgExternalTransfer example
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
from pyinjective.wallet import PrivateKey

async def main() -> None:
# select network: local, testnet, mainnet
network = Network.mainnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
# client = AsyncClient(network, insecure=False)
client = AsyncClient(network, insecure=True)

await client.sync_timeout_height()

# load account
priv_key = PrivateKey.from_hex("Your PK")
pub_key = priv_key.to_public_key()

address = pub_key.to_address()
account = await client.get_account(address.to_acc_bech32())
print(f" pubkey {address.to_acc_bech32()}")
subaccount_id = address.get_subaccount_id(index=1)
dest_subaccount_id = "0x1111111111111111111111111111111111111111111111111111111111111111"

# prepare tx msg
msg = composer.MsgExternalTransfer(
sender=address.to_acc_bech32(),
source_subaccount_id=subaccount_id,
destination_subaccount_id=dest_subaccount_id,
amount=0.123123123,
denom="INJ"
)

tx = (
Transaction()
.with_messages(msg)
.with_sequence(client.get_sequence())
.with_account_num(client.get_number())
.with_chain_id(network.chain_id)
)

# build tx
gas_price = 500000000
gas_limit = 90000 + 20000 # add 20k for gas, fee computation
gas_fee = '{:.18f}'.format((gas_price * gas_limit) / pow(10, 18)).rstrip('0')
fee = [composer.Coin(
amount=gas_price * gas_limit,
denom=network.fee_denom,
)]
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo('').with_timeout_height(client.timeout_height)
sign_doc = tx.get_sign_doc(pub_key)
sig = priv_key.sign(sign_doc.SerializeToString())
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

# broadcast tx: send_tx_async_mode, send_tx_sync_mode, send_tx_block_mode
res = await client.send_tx_sync_mode(tx_raw_bytes)
print(res)
print("gas wanted: {}".format(gas_limit))
print("gas fee: {} INJ".format(gas_fee))

if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
```

### Burner Address

If you would like to burn tokens directly, send funds to the following address:

```
inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49
```

This is effectively the Injective `0x0...` address converted into `bech32`.

## Creating Transactions

### Via APIs

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.

### Via Ledger

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.

### Via `injectived`

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.
Loading

0 comments on commit ea942c8

Please sign in to comment.