Python library and example scripts for interacting with the Injective RFQ system. Includes WebSocket streaming (gRPC-web), quote signing, wallet management, and on-chain settlement.
Python Guide: Building RFQ Market Making & Retail Tools — For teams building standalone MM or retail scripts. Covers grant creation, quote signing, indexer integration, contract expectations, and production tips. Use it as a guide and apply your own judgment.
src/rfq_test/ # Core library
├── clients/ # WebSocket (MakerStream/TakerStream), Chain, Contract clients
├── crypto/ # Quote signing (keccak256 + secp256k1), wallet management
├── proto/ # Protobuf message definitions (gRPC-web framing)
├── actors/ # High-level MM, Retail, Admin actors
├── models/ # Type definitions and config models
├── factories/ # Quote, request, and wallet factories
├── utils/ # Helpers (price, formatting, retry, logging)
├── config.py # Settings and environment config loader
└── exceptions.py # Custom exceptions
configs/ # Environment configs (testnet, local)
scripts/ # Setup scripts (authz grants, maker registration, funding)
examples/ # Standalone test scripts
pip install -e .Or install dependencies directly:
pip install -r requirements.txtcp .env.example .env
# Edit .env with your private keysSet the environment:
export RFQ_ENV=testnetGrant authz permissions to the RFQ contract:
python scripts/setup_authz_grants.pyRegister as a maker (requires admin):
python scripts/register_makers.pyDerive wallet from mnemonic:
python examples/derive_key.py your twelve word mnemonic phrase hereFull WebSocket round-trip (retail request → MM quote → retail receives quote):
python examples/test_roundtrip.pyEnd-to-end settlement (includes on-chain AcceptQuote):
python examples/test_settlement.py| Item | Value |
|---|---|
| Chain ID | injective-888 |
| RFQ Contract | inj1t8hyyle68vd0kzsdehxg0sywttrwmt58jzk29q |
| MakerStream WSS | wss://testnet.rfq.ws.injective.network/injective_rfqrpc.InjectiveRFQRPC/MakerStream |
| TakerStream WSS | wss://testnet.rfq.ws.injective.network/injective_rfqrpc.InjectiveRFQRPC/TakerStream |
| Chain gRPC | testnet-grpc.injective.dev:443 |
| Faucet | https://testnet-faucet.injective.dev |
The RFQ Indexer uses gRPC-web over WebSocket with protobuf framing:
- Subprotocol:
grpc-ws - Framing:
[1 byte flags][4 bytes length BE][protobuf payload] - Keep-alive: Send
pingmessage every 1 second - Signing:
keccak256(canonical_json) → secp256k1_sign(raw hash, NO EIP-191 prefix)
| Symbol | Market ID |
|---|---|
| INJ/USDT PERP | 0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6 |
| ATOM/USDT PERP | 0xd97d0da6f6c11710ef06315971250e4e9aed4b7d4cd02059c9477ec8cf243782 |
See LICENSE for details.