InjectiveLabs/injective-rfq-toolkit:
- Python:
examples/test_settlement.py - TypeScript native gRPC example:
examples/ts-retail/main-grpc.ts
Prerequisites
- An Injective wallet (a 32-byte secp256k1 private key)
-
A small amount of INJ for gas on
injective-888(testnet) – testnet faucet - USDC in the wallet’s exchange subaccount to cover your margin
-
Network connectivity to
wss://testnet.rfq.ws.injective.network/injective_rfq_rpc.InjectiveRfqRPC/TakerStream - Python 3.11+ or Node.js 18+
1. Install
Python – clone the toolkit repo and install the library:2. Configure environment
Create a.env file at the repo root:
configs/testnet.yaml) already points at:
TakerStream supports an optional v1 challenge-response handshake that proves control of the request address. Authentication failure is currently informational and does not block RFQ requests, but integrations should authenticate and check the result before submitting requests. The toolkit handles the handshake when you provide the taker or authorized autosigner key and the RFQ contract address.
3. Grant authz permissions (once)
Before you can accept any quotes, you must grant the TrueCurrent contract three message types via Injective’sauthz module. See Authorization setup for the full explanation.
Python:
RETAIL_AUTHZ_GRANTS expands to three message types:
/injective.exchange.v2.MsgPrivilegedExecuteContract/injective.exchange.v2.MsgBatchUpdateOrders/cosmos.bank.v1beta1.MsgSend
4. Submit a request
Open a TakerStream WebSocket and send an RFQ request. Python:rfq_id for quote collection and settlement. The request uses a client UUID for correlation; the indexer assigns the RFQ id that makers quote against.
TypeScript:
The native gRPC retail example shows the complete TypeScript flow: open TakerStream with request_address and auth_version: v1, sign TakerChallenge, check TakerAuthResult, then submit the request. If you use the lower-level WebSocket transport below, complete the same handshake before sending RFQs.
rfq_id for quote filtering and settlement. Do not use Date.now() as the settlement rfq_id.
See TakerStream for the full request schema, the gRPC-web framing details, and the rfq_id correlation patterns.
5. Collect quotes
Quotes stream in over the same WebSocket. Open a collection window, gather every quote matching your taker stream andrfq_id, and pick the best one (or several – see Accepting quotes for multi-quote aggregation).
Python:
6. Accept onchain
Now submitAcceptQuote to the TrueCurrent contract. This is where the three encoding gotchas bite – read Accepting quotes for the full story.
Python (the ContractClient.accept_quote helper handles encoding for you):
What happens on failure
See Best practices for reconnection and error handling patterns.
Next
- Authorization setup – grant details and revocation
- TakerStream – request schema and quote collection
- Accepting quotes – multi-quote aggregation and every field of the
AcceptQuotemessage - Best practices – slippage, expiry, reconnection, testing

