Conversation
📝 WalkthroughWalkthroughAdds RFQ support across the SDK: new gRPC RFQ client, gRPC V2 stream, WebSocket gRPC-over-WS transport and codec, stream clients (taker/maker), transformers and types, tests, proto generation/publish script updates, and an RFQ error module identifier. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant TakerApp as Taker App
participant Codec as GrpcWebSocketCodec
participant WsTransport as GrpcWebSocketTransport
participant Server as Indexer Server
User->>TakerApp: connect()
TakerApp->>WsTransport: connect()
WsTransport->>Server: WebSocket handshake
Server-->>WsTransport: connected
WsTransport-->>TakerApp: connect event
User->>TakerApp: sendRequest(rfqRequestInput)
TakerApp->>Codec: encodeTakerRequest(input)
Codec-->>TakerApp: Uint8Array (5-byte header + payload)
TakerApp->>WsTransport: send(data)
WsTransport->>Server: WebSocket.send(data)
Server-->>WsTransport: StreamQuoteResponse (gRPC frame)
WsTransport->>Codec: decodeTakerResponse(data)
Codec-->>TakerApp: GrpcFrame<TakerStreamResponse>
TakerApp->>TakerApp: transform via IndexerGrpcRfqTransformer
TakerApp->>User: emit quote event
sequenceDiagram
actor MakerUser as Maker App
participant Codec as GrpcWebSocketCodec
participant WsTransport as GrpcWebSocketTransport
participant Server as Indexer Server
MakerUser->>MakerApp: connect()
MakerApp->>WsTransport: connect()
Note over WsTransport: reconnection/backoff + ping keep-alive
Server-->>WsTransport: StreamRequestResponse (gRPC frame)
WsTransport->>Codec: decodeMakerResponse(data)
Codec-->>MakerApp: GrpcFrame<MakerStreamResponse>
MakerApp->>MakerApp: transform Request via IndexerRfqStreamTransformer
MakerApp->>MakerUser: emit request event
MakerUser->>MakerApp: submitQuote(rfqQuoteInput)
MakerApp->>Codec: encodeMakerQuote(input)
Codec-->>MakerApp: Uint8Array (5-byte header + payload)
MakerApp->>WsTransport: send(data)
WsTransport->>Server: WebSocket.send(data)
Server-->>WsTransport: StreamQuoteAckResponse
WsTransport->>Codec: decodeMakerResponse(data)
Codec-->>MakerApp: GrpcFrame<MakerStreamResponse>
MakerApp->>MakerUser: emit quote_ack event
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.spec.ts`:
- Around line 9-34: The test "submitRequest" wraps the API call in a try/catch
which swallows failures and uses a tautological assertion; remove the try/catch
so exceptions from indexerGrpcRfqApi.submitRequest propagate and fail the test,
and replace the tautological expect(response).toEqual(expect.objectContaining<{
status: string }>(response)) with concrete assertions such as
expect(response).toBeDefined(), expect(response).toHaveProperty('status'), and a
type check like expect(typeof response.status).toBe('string') (adjust
property/type checks to match the actual response shape).
- Around line 55-80: The test labeled "submitQuote" incorrectly calls
indexerGrpcRfqApi.submitRequest and logs "IndexerGrpcRFQApi.submitRequest";
change the call to indexerGrpcRfqApi.submitQuote and update the catch log string
to "IndexerGrpcRFQApi.submitQuote" (and any related variable names/messages) so
the test invokes and reports the correct method.
In `@packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts`:
- Around line 159-166: The createWebSocket function currently calls
require('ws') which fails in ESM strict mode; replace that fallback with a
dynamic import and construct the socket from the module default (e.g.
import('ws').then(m => new m.default(url, protocol))) or alternatively add at
top: import { createRequire } from 'module' and use const require =
createRequire(import.meta.url) before calling require('ws'); also ensure the ws
package is declared in dependencies so the dynamic import/require succeeds at
runtime.
In `@packages/sdk-ts/src/client/indexer/ws/types.ts`:
- Around line 240-267: Update the incorrect JSDoc comments on the RFQQuoteInput
interface: replace the repeated "/** Market ID */" comments for chainId and
contractAddress with accurate descriptions (e.g., chainId -> "/** Chain ID */"
and contractAddress -> "/** Contract address */"), and ensure marketId retains a
proper "/** Market ID */" comment; modify the comments directly on the
RFQQuoteInput type so each field (chainId, contractAddress, marketId) has the
correct, unique JSDoc description.
In `@protoV2/indexer/src/index.d.ts`:
- Line 19: The exports for InjectiveRfqRPCClient
(injective_rfq_rpc_pb.client.js) and injective_rfq_rpc_pb.js are referencing
missing generated RFQ protobuf files; run or add the protobuf generation that
produces these files before importing/exporting them, or gate the exports to
only export when the generated modules exist. Locate the export statements
referencing InjectiveRfqRPCClient and the injective_rfq_rpc_pb module in
index.d.ts and ensure the build step that runs the RFQ proto generator is
invoked prior to module resolution (or commit the generated files into
protoV2/indexer/src/generated/) so the imports succeed at runtime.
🧹 Nitpick comments (11)
proto/indexer/gen.sh (1)
10-10: Prefer a stable ref (tag/commit) over a feature branch for reproducible clones.
Feature branches likef/rfqcan be deleted or rebased, breaking the clone step if this script is ever re-enabled. Consider pinning to a tag/commit or at least verify the branch is long-lived.protoV2/indexer/gen.sh (1)
15-16: Avoid deleting lockfiles pre-install; it can dirty the repo and lose lock state on failure.
Consider preserving lockfiles and usingnpm ciwhenpackage-lock.jsonexists.💡 Suggested safer install flow
- rm -f package-lock.json pnpm-lock.yaml - npm install || { + if [ -f package-lock.json ]; then + npm ci || { + echo "❌ Failed to install dependencies" + exit 1 + } + else + npm install || { + echo "❌ Failed to install dependencies" + exit 1 + } + fi - echo "❌ Failed to install dependencies" - exit 1 - }protoV2/indexer/publish.sh (1)
38-42: Inconsistent with other publish scripts in this PR.The
mito/publish.shandcore/publish.shscripts have been updated with:
- Support for explicitly provided versions via
$1- Automatic prerelease tag detection and
--tagpublishingThis script only has a commented note about alpha versions but lacks the actual implementation. Consider aligning this script with the others for consistency across the monorepo.
♻️ Suggested alignment with other publish scripts
-npm publish +# Use provided version or auto-increment +if [ -n "$1" ]; then + v1="$1" + echo "using provided version: $v1" +else + v1="${v%.*}.$((${v##*.}+1))" + echo "auto-incremented version: $v1" +fi + +# Update version in package.json +npm version "$v1" --no-git-tag-version -# note: making alpha versions -# npm version 1.17.7-alpha.1 -# npm publish . --tag alpha +# Detect prerelease tag (alpha, beta, rc, etc.) +if [[ "$v1" =~ -([a-z]+) ]]; then + tag="${BASH_REMATCH[1]}" + echo "publishing prerelease version with tag: $tag" + npm publish . --tag "$tag" +else + echo "publishing release version" + npm publish . +fipackages/sdk-ts/src/client/indexer/ws/README.md (1)
220-228: Add language specifier to fenced code block.The frame format diagram should have a language specifier for consistency and to satisfy linting rules. Since this is a text diagram, use
textorplaintext.📝 Proposed fix
-``` +```text Frame format: [compressionFlag: 1 byte][length: 4 bytes BE][payload: N bytes]packages/sdk-ts/src/client/indexer/grpc_stream/streamV2/IndexerGrpcRfqStreamV2.ts (1)
28-35: Consider removing unusedtransportfield.The
transportfield is stored but never accessed after being used to initializeclient. You could simplify by not storing it as an instance property.♻️ Suggested simplification
export class IndexerGrpcRfqStreamV2 { private client: InjectiveRFQRPCClient - private transport: GrpcWebRpcTransport constructor(endpoint: string, metadata?: Record<string, string>) { - this.transport = new GrpcWebRpcTransport(endpoint, metadata) - this.client = new InjectiveRFQRPCClient(this.transport) + const transport = new GrpcWebRpcTransport(endpoint, metadata) + this.client = new InjectiveRFQRPCClient(transport) }packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.ts (1)
18-110: Add explicit return type annotation for consistency.
submitRequestlacks an explicit return type annotation whilesubmitQuotehasPromise<{ status: string }>. Adding it improves API clarity and consistency.♻️ Add return type
- }): Promise<{ status: string }> { + }: { ... }): Promise<{ status: string }> {Apply at line 46:
- }) { + }): Promise<{ status: string }> {packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts (2)
250-261: Empty ping interval callback may be confusing.The ping interval is set up but the callback body is empty with only a comment. While the comment explains that higher-level classes handle gRPC-level pings, this empty interval still creates unnecessary timer overhead. Consider either removing it or adding a TODO to implement transport-level keepalive if needed.
♻️ Consider removing empty interval or adding transport-level ping
If transport-level ping is not needed, remove
startPingIntervalandclearPingIntervalentirely since higher-level stream classes (likeIndexerWsTakerStream) handle their own ping intervals.
284-303: Silent error swallowing in reconnection may hide issues.The empty catch block at line 296 silently discards reconnection errors. Consider logging for observability or emitting an error event.
♻️ Add error logging
try { await this.createConnection() - } catch {} + } catch (error) { + // Connection failed, backoff will continue + // Error already emitted via handleError + }packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts (1)
215-228: Consider logging ping failures at debug level instead of error.Failed pings during normal operation (e.g., during disconnect) might flood error logs. Consider using a debug log level or only logging on repeated failures.
♻️ Reduce log noise
} catch (error) { - console.error('Failed to send ping:', error) + // Ping failures are expected during disconnect; logged for debugging + if (process.env.NODE_ENV === 'development') { + console.debug('Failed to send ping:', error) + } }Or simply remove the log if pings failing during disconnect is expected behavior.
packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketCodec.ts (2)
31-55: Consider validating input before BigInt conversion.
BigInt(input.rfqId)on Line 33 will throw aSyntaxErrorifrfqIdis not a valid integer string (e.g., empty string, decimal, or non-numeric). While callers should provide valid inputs, the codec could fail silently or provide a clearer error message.💡 Optional: Add validation or wrap with descriptive error
encodeTakerRequest(input: RFQRequestInput): Uint8Array { + if (!/^\d+$/.test(input.rfqId)) { + throw new Error(`Invalid rfqId: expected numeric string, got "${input.rfqId}"`) + } const request = RFQRequestType.create({ rfqId: BigInt(input.rfqId),
75-104: Same BigInt validation concern applies here.Lines 80 and 85 have the same potential for
SyntaxErrorifrfqIdorexpirycontain invalid values. Consider applying consistent validation across both encoder methods.
| test('submitRequest', async () => { | ||
| try { | ||
| const response = await indexerGrpcRfqApi.submitRequest({ | ||
| direction: 'LONG', | ||
| status: 'PENDING', | ||
| rfqId: BigInt(1717000000), | ||
| height: BigInt(1717000000), | ||
| expiry: BigInt(1717000000), | ||
| margin: '1000000000000000000', | ||
| updatedAt: BigInt(1717000000), | ||
| createdAt: BigInt(1717000000), | ||
| quantity: '1000000000000000000', | ||
| worstPrice: '1000000000000000000', | ||
| transactionTime: BigInt(1717000000), | ||
| marketId: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49', | ||
| requestAddress: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49', | ||
| }) | ||
|
|
||
| expect(response).toBeDefined() | ||
| expect(response).toEqual( | ||
| expect.objectContaining<{ status: string }>(response), | ||
| ) | ||
| } catch (e) { | ||
| console.error('IndexerGrpcRFQApi.submitRequest => ' + (e as any).message) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Tests silently pass on API failures due to try/catch pattern.
Wrapping test logic in try/catch and only logging errors means tests will pass even when the API calls fail. This defeats the purpose of testing.
Additionally, the assertion expect(response).toEqual(expect.objectContaining<{ status: string }>(response)) is tautological—it asserts the response equals itself.
🧪 Recommended test pattern
Either let exceptions propagate (remove try/catch) or explicitly fail:
test('submitRequest', async () => {
const response = await indexerGrpcRfqApi.submitRequest({
// ... params
})
expect(response).toBeDefined()
expect(response).toHaveProperty('status')
expect(typeof response.status).toBe('string')
})If network failures are expected and tests should be skipped in CI, consider marking them as integration tests or using conditional skipping.
🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.spec.ts` around
lines 9 - 34, The test "submitRequest" wraps the API call in a try/catch which
swallows failures and uses a tautological assertion; remove the try/catch so
exceptions from indexerGrpcRfqApi.submitRequest propagate and fail the test, and
replace the tautological expect(response).toEqual(expect.objectContaining<{
status: string }>(response)) with concrete assertions such as
expect(response).toBeDefined(), expect(response).toHaveProperty('status'), and a
type check like expect(typeof response.status).toBe('string') (adjust
property/type checks to match the actual response shape).
| test('submitQuote', async () => { | ||
| try { | ||
| const response = await indexerGrpcRfqApi.submitRequest({ | ||
| direction: 'LONG', | ||
| status: 'PENDING', | ||
| rfqId: BigInt(1717000000), | ||
| height: BigInt(1717000000), | ||
| expiry: BigInt(1717000000), | ||
| margin: '1000000000000000000', | ||
| updatedAt: BigInt(1717000000), | ||
| createdAt: BigInt(1717000000), | ||
| quantity: '1000000000000000000', | ||
| worstPrice: '1000000000000000000', | ||
| transactionTime: BigInt(1717000000), | ||
| marketId: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49', | ||
| requestAddress: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49', | ||
| }) | ||
|
|
||
| expect(response).toBeDefined() | ||
| expect(response).toEqual( | ||
| expect.objectContaining<{ status: string }>(response), | ||
| ) | ||
| } catch (e) { | ||
| console.error('IndexerGrpcRFQApi.submitRequest => ' + (e as any).message) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Copy-paste error: submitQuote test calls submitRequest instead.
The test named submitQuote is calling submitRequest (line 57) and the error message (line 78) also references submitRequest. This appears to be a copy-paste error.
🐛 Proposed fix
test('submitQuote', async () => {
try {
- const response = await indexerGrpcRfqApi.submitRequest({
- direction: 'LONG',
- status: 'PENDING',
- rfqId: BigInt(1717000000),
- height: BigInt(1717000000),
- expiry: BigInt(1717000000),
- margin: '1000000000000000000',
- updatedAt: BigInt(1717000000),
- createdAt: BigInt(1717000000),
- quantity: '1000000000000000000',
- worstPrice: '1000000000000000000',
- transactionTime: BigInt(1717000000),
- marketId: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49',
- requestAddress: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49',
+ const response = await indexerGrpcRfqApi.submitQuote({
+ // Use appropriate quote payload fields
})
expect(response).toBeDefined()
expect(response).toEqual(
expect.objectContaining<{ status: string }>(response),
)
} catch (e) {
- console.error('IndexerGrpcRFQApi.submitRequest => ' + (e as any).message)
+ console.error('IndexerGrpcRFQApi.submitQuote => ' + (e as any).message)
}
})🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.spec.ts` around
lines 55 - 80, The test labeled "submitQuote" incorrectly calls
indexerGrpcRfqApi.submitRequest and logs "IndexerGrpcRFQApi.submitRequest";
change the call to indexerGrpcRfqApi.submitQuote and update the catch log string
to "IndexerGrpcRFQApi.submitQuote" (and any related variable names/messages) so
the test invokes and reports the correct method.
| private createWebSocket(url: string, protocol: string): IsomorphicWebSocket { | ||
| if (typeof WebSocket !== 'undefined') { | ||
| return new WebSocket(url, protocol) | ||
| } | ||
|
|
||
| const WS = require('ws') | ||
| return new WS(url, protocol) | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check package.json for type field
echo "=== package.json type field ==="
cat packages/sdk-ts/package.json | jq '.type' 2>/dev/null || echo "Not found or no package.json"
# Check tsconfig in sdk-ts
echo -e "\n=== tsconfig module setting ==="
fd -t f 'tsconfig.*json' packages/sdk-ts --exec bash -c 'echo "File: {}"; cat {} | jq ".compilerOptions.module" 2>/dev/null' \;
# Check if ws is in dependencies
echo -e "\n=== ws module in dependencies ==="
cat packages/sdk-ts/package.json | jq '.dependencies.ws, .devDependencies.ws' 2>/dev/null
# Check webpack or other bundler config
echo -e "\n=== Bundler configuration files ==="
fd -t f -e 'webpack.config.*' -e 'vite.config.*' -e 'rollup.config.*' packages/sdk-tsRepository: InjectiveLabs/injective-ts
Length of output: 649
🏁 Script executed:
#!/bin/bash
# Examine the actual file context around line 164
echo "=== File context around createWebSocket ==="
sed -n '155,170p' packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts
# Check imports at the top of the file
echo -e "\n=== Top of file imports ==="
head -30 packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.tsRepository: InjectiveLabs/injective-ts
Length of output: 1190
🏁 Script executed:
#!/bin/bash
# Check if there are any .d.ts files declaring types for ws in isomorphic contexts
echo "=== Search for IsomorphicWebSocket definition ==="
rg -t ts "type IsomorphicWebSocket|interface IsomorphicWebSocket" packages/sdk-ts/src --max-count 5 -A 3Repository: InjectiveLabs/injective-ts
Length of output: 430
🏁 Script executed:
#!/bin/bash
# Check root package.json for ws
echo "=== ws in root package.json ==="
cat package.json | jq '.dependencies.ws, .devDependencies.ws, .optionalDependencies.ws' 2>/dev/null
# Check if createRequire is imported in the file
echo -e "\n=== createRequire usage in file ==="
grep -n "createRequire\|require.*ws" packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts
# Check entire file for any CommonJS patterns
echo -e "\n=== All require() calls in file ==="
rg "require\(" packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.tsRepository: InjectiveLabs/injective-ts
Length of output: 252
🏁 Script executed:
#!/bin/bash
# Check the entire file to understand the context better
wc -l packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts
# Read full file to understand overall structure
cat packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts | head -70Repository: InjectiveLabs/injective-ts
Length of output: 2124
require('ws') will cause a runtime error in ESM strict mode.
This file uses ESM ("type": "module" in package.json) but calls require('ws') without importing createRequire from the module package. This will throw ReferenceError: require is not defined when the code executes in Node.js environments. Additionally, the ws module is not declared as a dependency.
Replace with: import('ws').then(m => new m.default(url, protocol)) or import createRequire at the top and use const require = createRequire(import.meta.url) before the fallback.
🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketTransport.ts` around lines
159 - 166, The createWebSocket function currently calls require('ws') which
fails in ESM strict mode; replace that fallback with a dynamic import and
construct the socket from the module default (e.g. import('ws').then(m => new
m.default(url, protocol))) or alternatively add at top: import { createRequire }
from 'module' and use const require = createRequire(import.meta.url) before
calling require('ws'); also ensure the ws package is declared in dependencies so
the dynamic import/require succeeds at runtime.
| export interface RFQQuoteInput { | ||
| /** Market ID */ | ||
| chainId: string | ||
| /** Market ID */ | ||
| contractAddress: string | ||
| /** Market ID */ | ||
| marketId: string | ||
| /** RFQ ID being quoted */ | ||
| rfqId: string | ||
| /** Taker's direction: 'LONG' or 'SHORT' */ | ||
| takerDirection: string | ||
| /** Margin amount as string */ | ||
| margin: string | ||
| /** Quantity as string */ | ||
| quantity: string | ||
| /** Quote price as string */ | ||
| price: string | ||
| /** Expiry timestamp in seconds */ | ||
| expiry: number | ||
| /** Maker's Injective address */ | ||
| maker: string | ||
| /** Taker's Injective address */ | ||
| taker: string | ||
| /** Cryptographic signature */ | ||
| signature: string | ||
| /** Status (typically 'pending' for new quotes) */ | ||
| status: string | ||
| } |
There was a problem hiding this comment.
Fix copy-paste error in JSDoc comments.
Lines 241, 243, and 245 all have /** Market ID */ as the comment, but chainId and contractAddress are not market IDs.
📝 Proposed fix for JSDoc comments
export interface RFQQuoteInput {
- /** Market ID */
+ /** Chain identifier */
chainId: string
- /** Market ID */
+ /** Contract address */
contractAddress: string
/** Market ID */
marketId: string📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export interface RFQQuoteInput { | |
| /** Market ID */ | |
| chainId: string | |
| /** Market ID */ | |
| contractAddress: string | |
| /** Market ID */ | |
| marketId: string | |
| /** RFQ ID being quoted */ | |
| rfqId: string | |
| /** Taker's direction: 'LONG' or 'SHORT' */ | |
| takerDirection: string | |
| /** Margin amount as string */ | |
| margin: string | |
| /** Quantity as string */ | |
| quantity: string | |
| /** Quote price as string */ | |
| price: string | |
| /** Expiry timestamp in seconds */ | |
| expiry: number | |
| /** Maker's Injective address */ | |
| maker: string | |
| /** Taker's Injective address */ | |
| taker: string | |
| /** Cryptographic signature */ | |
| signature: string | |
| /** Status (typically 'pending' for new quotes) */ | |
| status: string | |
| } | |
| export interface RFQQuoteInput { | |
| /** Chain identifier */ | |
| chainId: string | |
| /** Contract address */ | |
| contractAddress: string | |
| /** Market ID */ | |
| marketId: string | |
| /** RFQ ID being quoted */ | |
| rfqId: string | |
| /** Taker's direction: 'LONG' or 'SHORT' */ | |
| takerDirection: string | |
| /** Margin amount as string */ | |
| margin: string | |
| /** Quantity as string */ | |
| quantity: string | |
| /** Quote price as string */ | |
| price: string | |
| /** Expiry timestamp in seconds */ | |
| expiry: number | |
| /** Maker's Injective address */ | |
| maker: string | |
| /** Taker's Injective address */ | |
| taker: string | |
| /** Cryptographic signature */ | |
| signature: string | |
| /** Status (typically 'pending' for new quotes) */ | |
| status: string | |
| } |
🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/ws/types.ts` around lines 240 - 267,
Update the incorrect JSDoc comments on the RFQQuoteInput interface: replace the
repeated "/** Market ID */" comments for chainId and contractAddress with
accurate descriptions (e.g., chainId -> "/** Chain ID */" and contractAddress ->
"/** Contract address */"), and ensure marketId retains a proper "/** Market ID
*/" comment; modify the comments directly on the RFQQuoteInput type so each
field (chainId, contractAddress, marketId) has the correct, unique JSDoc
description.
| export { InjectiveReferralRPCClient } from './generated/injective_referral_rpc_pb.client.js' | ||
| export { InjectiveSpotExchangeRPCClient } from './generated/injective_spot_exchange_rpc_pb.client.js' | ||
| export { InjectiveTradingRPCClient } from './generated/injective_trading_rpc_pb.client.js' | ||
| export { InjectiveRfqRPCClient } from './generated/injective_rfq_rpc_pb.client.js' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, check if the index.d.ts file exists and examine its contents
wc -l "protoV2/indexer/src/index.d.ts" 2>/dev/null || echo "File not found"Repository: InjectiveLabs/injective-ts
Length of output: 103
🏁 Script executed:
# Read the full index.d.ts file to understand the context
cat -n "protoV2/indexer/src/index.d.ts" 2>/dev/null | head -50Repository: InjectiveLabs/injective-ts
Length of output: 3619
🏁 Script executed:
# Look for generated RFQ protobuf files
fd -t f "injective_rfq_rpc_pb" "protoV2/indexer/src/generated/" 2>/dev/null || echo "No RFQ files found in generated/"Repository: InjectiveLabs/injective-ts
Length of output: 102
🏁 Script executed:
# Check what files exist in the generated directory
ls -la "protoV2/indexer/src/generated/" 2>/dev/null | grep -i rfq || echo "No RFQ-related files in generated/"Repository: InjectiveLabs/injective-ts
Length of output: 104
🏁 Script executed:
# List all generated files to understand the structure
ls -la "protoV2/indexer/src/generated/" 2>/dev/null | head -20Repository: InjectiveLabs/injective-ts
Length of output: 52
Missing generated RFQ protobuf files.
The exports at lines 19 and 39 reference generated files that do not exist in protoV2/indexer/src/generated/:
injective_rfq_rpc_pb.client.js(line 19)injective_rfq_rpc_pb.js(line 39)
These exports will fail at runtime. Ensure the RFQ protobuf generation step is executed before these exports are used.
🤖 Prompt for AI Agents
In `@protoV2/indexer/src/index.d.ts` at line 19, The exports for
InjectiveRfqRPCClient (injective_rfq_rpc_pb.client.js) and
injective_rfq_rpc_pb.js are referencing missing generated RFQ protobuf files;
run or add the protobuf generation that produces these files before
importing/exporting them, or gate the exports to only export when the generated
modules exist. Locate the export statements referencing InjectiveRfqRPCClient
and the injective_rfq_rpc_pb module in index.d.ts and ensure the build step that
runs the RFQ proto generator is invoked prior to module resolution (or commit
the generated files into protoV2/indexer/src/generated/) so the imports succeed
at runtime.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts`:
- Around line 80-89: In sendRequest (IndexerWsTakerStream.sendRequest) remove
the two debug console.log calls so the method only checks isConnected(), encodes
the request with GrpcWebSocketCodec.encodeTakerRequest(request), and forwards
the encoded payload via this.transport.send(encoded); ensure no other logging
remains in that function.
- Around line 108-152: Remove the debug console.log calls in the event pipeline:
delete the console.log in emit and all console.log/debug prints inside
setupTransportHandlers (the 'connect', 'disconnect', 'state_change', 'error'
handlers and the emit call at top). Keep the functionality of emit,
startPingInterval/stopPingInterval, handleMessage, and the transport.on
registrations intact; if needed later, replace these console.log calls with
calls to a configurable logger (e.g., this.logger.debug) — but for this change
simply remove the console.log lines from the emit method and from the
transport.on handlers in setupTransportHandlers.
- Line 1: Remove the unused import "log" from 'console' in
IndexerWsTakerStream.ts; locate the top-level import statement "import { log }
from 'console'" and delete it so ESLint no longer flags an unused import (no
other code changes required).
- Around line 154-231: Remove the debug console.log calls in handleMessage (the
logs around response and messageType and quote) so production doesn't emit stray
logs, and add a null/undefined guard before calling .toString() on
response.requestAck.rfqId in the request_ack branch of handleMessage (use a safe
conversion or skip/emit an ack with a safe rfqId value when rfqId is missing) so
RFQStreamAckData.rfqId is never produced by calling toString() on
null/undefined.
🧹 Nitpick comments (1)
packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts (1)
31-34: Consider improving type safety for event listeners.The
Set<TakerEventListener<any>>loses the type safety provided by the genericTakerStreamEventsinterface. This is a common trade-off in event emitter patterns, but you could consider a more type-safe approach using mapped types if stricter typing is desired.
packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts
Outdated
Show resolved
Hide resolved
| private handleMessage(data: ArrayBuffer): void { | ||
| try { | ||
| const frame = GrpcWebSocketCodec.decodeTakerResponse(data) | ||
|
|
||
| if (frame.isTrailer) { | ||
| return | ||
| } | ||
|
|
||
| const response = frame.message | ||
|
|
||
| if (response?.messageType !== 'pong') { | ||
| console.log('handleMessage - response', response) | ||
| } | ||
|
|
||
| if (!response) { | ||
| return | ||
| } | ||
|
|
||
| if (response.messageType !== 'pong') { | ||
| console.log('handleMessage messageType', response.messageType) | ||
| } | ||
|
|
||
| switch (response.messageType) { | ||
| case 'pong': | ||
| this.emit('pong', undefined) | ||
| break | ||
|
|
||
| case 'quote': | ||
| console.log('handleMessage quote') | ||
| if (response.quote) { | ||
| const quote = IndexerGrpcRfqTransformer.grpcRfqQuoteToRfqQuote( | ||
| response.quote, | ||
| ) | ||
| this.emit('quote', { | ||
| quote, | ||
| }) | ||
| } | ||
| break | ||
|
|
||
| case 'request_ack': | ||
| if (response.requestAck) { | ||
| const ack: RFQStreamAckData = { | ||
| rfqId: response.requestAck.rfqId.toString(), | ||
| status: response.requestAck.status, | ||
| } | ||
| this.emit('request_ack', ack) | ||
| } | ||
| break | ||
|
|
||
| case 'error': | ||
| if (response.error) { | ||
| const error: RFQStreamErrorData = { | ||
| code: response.error.code, | ||
| message: response.error.message, | ||
| } | ||
| this.emit('error', error) | ||
| } | ||
| break | ||
|
|
||
| default: | ||
| console.warn( | ||
| `Unknown taker stream message type: ${response.messageType}`, | ||
| ) | ||
| } | ||
| } catch (error) { | ||
| if (error instanceof GrpcDecodeError) { | ||
| this.emit('error', { | ||
| code: 'DECODE_ERROR', | ||
| message: error.message, | ||
| }) | ||
| } else { | ||
| this.emit('error', { | ||
| code: 'UNKNOWN_ERROR', | ||
| message: error instanceof Error ? error.message : String(error), | ||
| }) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, let's check the repository structure and locate the file
git ls-files | grep -E "IndexerWsTakerStream|\.proto" | head -20Repository: InjectiveLabs/injective-ts
Length of output: 242
🏁 Script executed:
#!/bin/bash
# Check if the file exists and read the handleMessage method
cat -n packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts | sed -n '154,231p'Repository: InjectiveLabs/injective-ts
Length of output: 2614
🏁 Script executed:
#!/bin/bash
# Search for RFQStreamAckData type definition
rg -n "RFQStreamAckData|requestAck" --type=ts -A 3 -B 1 | head -100Repository: InjectiveLabs/injective-ts
Length of output: 4728
🏁 Script executed:
#!/bin/bash
# Search for rfqId type definition to understand if it's optional
rg -n "rfqId" --type=ts -A 2 -B 2 | head -150Repository: InjectiveLabs/injective-ts
Length of output: 9812
🏁 Script executed:
#!/bin/bash
# Search for protobuf definitions and requestAck/quoteAck message types
find . -name "*.proto" -type f | head -20Repository: InjectiveLabs/injective-ts
Length of output: 182
🏁 Script executed:
#!/bin/bash
# Look for gRPC generated types or proto definitions
rg -n "requestAck|quoteAck|RequestAck|QuoteAck" --type=proto -A 3 -B 1 | head -100Repository: InjectiveLabs/injective-ts
Length of output: 99
🏁 Script executed:
#!/bin/bash
# Search for the generated types used in GrpcWebSocketCodec
rg -n "GrpcRFQRequest|GrpcRFQQuote|TakerStreamResponse|MakerStreamResponse" --type=ts -A 2 | head -80Repository: InjectiveLabs/injective-ts
Length of output: 2990
🏁 Script executed:
#!/bin/bash
# Find where TakerStreamResponse and MakerStreamResponse are imported from
rg -n "TakerStreamResponse|MakerStreamResponse" --type=ts -B 3 | grep -E "import|from|export" | head -40Repository: InjectiveLabs/injective-ts
Length of output: 140
🏁 Script executed:
#!/bin/bash
# Check the imports in GrpcWebSocketCodec to find the source
head -20 packages/sdk-ts/src/client/indexer/ws/GrpcWebSocketCodec.tsRepository: InjectiveLabs/injective-ts
Length of output: 691
🏁 Script executed:
#!/antml:bash
# Look for the generated protobuf types file
find . -path "*/node_modules" -prune -o -name "*pb*.ts" -type f -print | grep -i rfq | head -20Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
#!/bin/bash
# Look for any proto files that might contain RFQ stream definitions
find . -type f -name "*.proto" | xargs cat 2>/dev/null | grep -A 20 "TakerStreamResponse\|requestAck" | head -100Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
#!/bin/bash
# Check if there's any documentation or types file that describes the structure
rg -n "requestAck" --type=ts -B 5 -A 5 | head -150Repository: InjectiveLabs/injective-ts
Length of output: 1396
🏁 Script executed:
#!/bin/bash
# Look at the actual type definition/interface for the response in the codebase
rg -n "interface.*Response|type.*Response" packages/sdk-ts/src/client/indexer/ws/ --type=ts -A 3 | head -100Repository: InjectiveLabs/injective-ts
Length of output: 867
🏁 Script executed:
#!/bin/bash
# Get more context around TakerResponseType definition
cat -n packages/sdk-ts/src/client/indexer/ws/types.ts | sed -n '100,200p'Repository: InjectiveLabs/injective-ts
Length of output: 3060
🏁 Script executed:
#!/antml:bash
# Look for the actual response interface/type structure
rg -n "requestAck|quoteAck" packages/sdk-ts/src/client/indexer/ws/types.ts -B 10 -A 2Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
#!/bin/bash
# Check if there are any type safety checks or guards around rfqId
rg -n "rfqId.*toString\|requestAck.*rfqId" packages/sdk-ts/src/client/indexer/ws/ --type=ts -B 2 -A 1Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
#!/bin/bash
# Look for any existing null/undefined checks on rfqId in the codebase
rg -n "rfqId\s*(===|!==|!=|==).*null|rfqId\s*(===|!==|!=|==).*undefined" --type=tsRepository: InjectiveLabs/injective-ts
Length of output: 260
🏁 Script executed:
#!/bin/bash
# Check the proto-ts package to see if we can find rfqId field definition
rg -n "rfqId" packages/sdk-ts/src/client/indexer/ --type=ts | grep -E "(bigint|Long|number|optional)" | head -20Repository: InjectiveLabs/injective-ts
Length of output: 236
🏁 Script executed:
#!/bin/bash
# Search for the indexer-proto-ts package to understand the response structure
find . -type f -name "package.json" | xargs grep -l "indexer-proto-ts" | head -5Repository: InjectiveLabs/injective-ts
Length of output: 115
🏁 Script executed:
#!/bin/bash
# Check if there's any documentation or test files that show requestAck structure
rg -n "requestAck|quoteAck" packages/sdk-ts/src/client/indexer/ --type=ts -B 3 -A 3 | grep -E "test|spec|mock|stub|\.requestAck|\.quoteAck" | head -50Repository: InjectiveLabs/injective-ts
Length of output: 775
🏁 Script executed:
#!/bin/bash
# Look for any comments or type guards that might indicate rfqId optionality
rg -n "optional|nullable|undefined|null" packages/sdk-ts/src/client/indexer/ws/types.ts -B 2 -A 2 | head -60Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
#!/bin/bash
# Check if there are similar patterns in the rest of the codebase where rfqId is accessed
rg -n "\.rfqId\." packages/sdk-ts/src/client/indexer/ --type=tsRepository: InjectiveLabs/injective-ts
Length of output: 695
🏁 Script executed:
#!/bin/bash
# Get more context on how response object is used elsewhere
rg -n "response\.\w+\." packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts -C 1 | head -60Repository: InjectiveLabs/injective-ts
Length of output: 421
🏁 Script executed:
#!/bin/bash
# Check the IndexerWsMakerStream to see if it has similar code pattern
cat -n packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsMakerStream.ts | sed -n '170,190p'Repository: InjectiveLabs/injective-ts
Length of output: 770
Remove debug console.log statements and add safety check for rfqId.
- Debug logging statements (lines 165, 173, 182) should be removed for production.
- Line 196: Add a null/undefined check before calling
.toString()onresponse.requestAck.rfqIdfor defensive robustness.
Proposed fix
private handleMessage(data: ArrayBuffer): void {
try {
const frame = GrpcWebSocketCodec.decodeTakerResponse(data)
if (frame.isTrailer) {
return
}
const response = frame.message
- if (response?.messageType !== 'pong') {
- console.log('handleMessage - response', response)
- }
-
if (!response) {
return
}
- if (response.messageType !== 'pong') {
- console.log('handleMessage messageType', response.messageType)
- }
-
switch (response.messageType) {
case 'pong':
this.emit('pong', undefined)
break
case 'quote':
- console.log('handleMessage quote')
if (response.quote) {
const quote = IndexerGrpcRfqTransformer.grpcRfqQuoteToRfqQuote(
response.quote,
)
this.emit('quote', {
quote,
})
}
break
case 'request_ack':
- if (response.requestAck) {
+ if (response.requestAck && response.requestAck.rfqId != null) {
const ack: RFQStreamAckData = {
rfqId: response.requestAck.rfqId.toString(),
status: response.requestAck.status,
}
this.emit('request_ack', ack)
}
break📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private handleMessage(data: ArrayBuffer): void { | |
| try { | |
| const frame = GrpcWebSocketCodec.decodeTakerResponse(data) | |
| if (frame.isTrailer) { | |
| return | |
| } | |
| const response = frame.message | |
| if (response?.messageType !== 'pong') { | |
| console.log('handleMessage - response', response) | |
| } | |
| if (!response) { | |
| return | |
| } | |
| if (response.messageType !== 'pong') { | |
| console.log('handleMessage messageType', response.messageType) | |
| } | |
| switch (response.messageType) { | |
| case 'pong': | |
| this.emit('pong', undefined) | |
| break | |
| case 'quote': | |
| console.log('handleMessage quote') | |
| if (response.quote) { | |
| const quote = IndexerGrpcRfqTransformer.grpcRfqQuoteToRfqQuote( | |
| response.quote, | |
| ) | |
| this.emit('quote', { | |
| quote, | |
| }) | |
| } | |
| break | |
| case 'request_ack': | |
| if (response.requestAck) { | |
| const ack: RFQStreamAckData = { | |
| rfqId: response.requestAck.rfqId.toString(), | |
| status: response.requestAck.status, | |
| } | |
| this.emit('request_ack', ack) | |
| } | |
| break | |
| case 'error': | |
| if (response.error) { | |
| const error: RFQStreamErrorData = { | |
| code: response.error.code, | |
| message: response.error.message, | |
| } | |
| this.emit('error', error) | |
| } | |
| break | |
| default: | |
| console.warn( | |
| `Unknown taker stream message type: ${response.messageType}`, | |
| ) | |
| } | |
| } catch (error) { | |
| if (error instanceof GrpcDecodeError) { | |
| this.emit('error', { | |
| code: 'DECODE_ERROR', | |
| message: error.message, | |
| }) | |
| } else { | |
| this.emit('error', { | |
| code: 'UNKNOWN_ERROR', | |
| message: error instanceof Error ? error.message : String(error), | |
| }) | |
| } | |
| } | |
| } | |
| private handleMessage(data: ArrayBuffer): void { | |
| try { | |
| const frame = GrpcWebSocketCodec.decodeTakerResponse(data) | |
| if (frame.isTrailer) { | |
| return | |
| } | |
| const response = frame.message | |
| if (!response) { | |
| return | |
| } | |
| switch (response.messageType) { | |
| case 'pong': | |
| this.emit('pong', undefined) | |
| break | |
| case 'quote': | |
| if (response.quote) { | |
| const quote = IndexerGrpcRfqTransformer.grpcRfqQuoteToRfqQuote( | |
| response.quote, | |
| ) | |
| this.emit('quote', { | |
| quote, | |
| }) | |
| } | |
| break | |
| case 'request_ack': | |
| if (response.requestAck && response.requestAck.rfqId != null) { | |
| const ack: RFQStreamAckData = { | |
| rfqId: response.requestAck.rfqId.toString(), | |
| status: response.requestAck.status, | |
| } | |
| this.emit('request_ack', ack) | |
| } | |
| break | |
| case 'error': | |
| if (response.error) { | |
| const error: RFQStreamErrorData = { | |
| code: response.error.code, | |
| message: response.error.message, | |
| } | |
| this.emit('error', error) | |
| } | |
| break | |
| default: | |
| console.warn( | |
| `Unknown taker stream message type: ${response.messageType}`, | |
| ) | |
| } | |
| } catch (error) { | |
| if (error instanceof GrpcDecodeError) { | |
| this.emit('error', { | |
| code: 'DECODE_ERROR', | |
| message: error.message, | |
| }) | |
| } else { | |
| this.emit('error', { | |
| code: 'UNKNOWN_ERROR', | |
| message: error instanceof Error ? error.message : String(error), | |
| }) | |
| } | |
| } | |
| } |
🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/ws/rfq/IndexerWsTakerStream.ts` around
lines 154 - 231, Remove the debug console.log calls in handleMessage (the logs
around response and messageType and quote) so production doesn't emit stray
logs, and add a null/undefined guard before calling .toString() on
response.requestAck.rfqId in the request_ack branch of handleMessage (use a safe
conversion or skip/emit an ack with a safe rfqId value when rfqId is missing) so
RFQStreamAckData.rfqId is never produced by calling toString() on
null/undefined.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@packages/sdk-ts/package.json`:
- Line 331: The package.json currently pins an alpha release of the indexer
proto package; change the dependency "@injectivelabs/indexer-proto-ts-v2":
"1.17.7-alpha.3" to a stable version (e.g., revert to "1.17.6" or update to a
released "1.17.7" if available) before cutting a production SDK; locate the
dependency entry in packages/sdk-ts/package.json and update the version string,
run a fresh install and tests, and add a note in the changelog or release
checklist that the alpha was replaced with a stable release.
In `@packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.ts`:
- Around line 11-16: Add two methods to IndexerGrpcRFQApi: fetchOpenRequests and
fetchPendingQuotes. For fetchOpenRequests create an
InjectiveRFQExchangeRpcPb.GetOpenRequestsRequest, call this.executeGrpcCall with
that request and this.client.getOpenRequests.bind(this.client), then return
IndexerGrpcRfqTransformer.openRequestsResponseToOpenRequests(response). For
fetchPendingQuotes create an InjectiveRFQExchangeRpcPb.GetPendingQuotesRequest,
call this.executeGrpcCall with that request and
this.client.getPendingQuotes.bind(this.client), then return
IndexerGrpcRfqTransformer.pendingQuotesResponseToPendingQuotes(response). Ensure
you use the same generic request/response types as in the suggested
implementation and keep methods async.
🧹 Nitpick comments (1)
packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.ts (1)
18-46: Add explicit return type annotation for consistency.The
submitQuotemethod has an explicit return typePromise<{ status: string }>, butsubmitRequestlacks one. Add the return type for consistency and better type safety.Proposed fix
transactionTime?: bigint - }) { + }): Promise<{ status: string }> {
| "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", | ||
| "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", | ||
| "@injectivelabs/indexer-proto-ts-v2": "1.17.5", | ||
| "@injectivelabs/indexer-proto-ts-v2": "1.17.7-alpha.3", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
npm view `@injectivelabs/indexer-proto-ts-v2` versions --json 2>/dev/null | jq -r '.[]' | grep "1.17"Repository: InjectiveLabs/injective-ts
Length of output: 191
Verify alpha dependency before production release.
The dependency @injectivelabs/indexer-proto-ts-v2 is being upgraded to 1.17.7-alpha.3. The latest stable version in this range is 1.17.6. Since no stable 1.17.7 is available yet, the alpha version indicates this dependency is still under active development.
Using alpha versions introduces risk of breaking changes. Ensure this is updated to a stable release before the SDK is released to production. Track this as a pre-release blocker.
🤖 Prompt for AI Agents
In `@packages/sdk-ts/package.json` at line 331, The package.json currently pins an
alpha release of the indexer proto package; change the dependency
"@injectivelabs/indexer-proto-ts-v2": "1.17.7-alpha.3" to a stable version
(e.g., revert to "1.17.6" or update to a released "1.17.7" if available) before
cutting a production SDK; locate the dependency entry in
packages/sdk-ts/package.json and update the version string, run a fresh install
and tests, and add a note in the changelog or release checklist that the alpha
was replaced with a stable release.
| export class IndexerGrpcRFQApi extends BaseIndexerGrpcConsumer { | ||
| protected module: string = IndexerModule.RFQ | ||
|
|
||
| private get client() { | ||
| return this.initClient(InjectiveRFQRPCClient) | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the actual file content
cat -n packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.tsRepository: InjectiveLabs/injective-ts
Length of output: 7465
🏁 Script executed:
# Check for transformer methods
cat -n packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqTransformer.ts | head -100Repository: InjectiveLabs/injective-ts
Length of output: 170
🏁 Script executed:
# Search for any references to getOpenRequests and getPendingQuotes in the codebase
rg "getOpenRequests|getPendingQuotes" --type ts -A 2 -B 2Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Find all transformer files
fd -t f "*[Tt]ransformer*" packages/sdk-ts/src/client/indexer/Repository: InjectiveLabs/injective-ts
Length of output: 365
🏁 Script executed:
# Search for the transformer methods mentioned in the review
rg "openRequestsResponseToOpenRequests|pendingQuotesResponseToPendingQuotes" --type tsRepository: InjectiveLabs/injective-ts
Length of output: 315
🏁 Script executed:
# Search for any RFQ transformer imports or references
rg "RfqTransformer" --type ts -A 2 -B 2Repository: InjectiveLabs/injective-ts
Length of output: 8975
🏁 Script executed:
# Check what methods are available on the gRPC client by checking the proto definitions
rg "getOpenRequests|getPendingQuotes|openRequests|pendingQuotes" --type ts -iRepository: InjectiveLabs/injective-ts
Length of output: 1175
🏁 Script executed:
# View the transformer methods
cat -n packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcRfqTransformer.ts | grep -A 10 "openRequestsResponseToOpenRequests\|pendingQuotesResponseToPendingQuotes"Repository: InjectiveLabs/injective-ts
Length of output: 787
🏁 Script executed:
# Check the InjectiveRFQRPCClient definition to see what methods are available
rg "InjectiveRFQRPCClient|getOpenRequests|getPendingQuotes" --type ts -i --max-count=50Repository: InjectiveLabs/injective-ts
Length of output: 1427
🏁 Script executed:
# Look for the proto client definition file
fd -name "*rfqrpc*client*" --type fRepository: InjectiveLabs/injective-ts
Length of output: 300
🏁 Script executed:
# Search for usages of this.client to see what methods are called on it
rg "this\.client\." packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.tsRepository: InjectiveLabs/injective-ts
Length of output: 248
🏁 Script executed:
# Find all proto-related files that might have the client definition
find . -type f -name "*rfqrpc*" 2>/dev/null | head -20Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Check if getOpenRequests or getPendingQuotes methods are used anywhere in the codebase
rg "\.(getOpenRequests|getPendingQuotes)" --type tsRepository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Look at the IndexerGrpcRfqStreamV2 to see if it uses any open requests or pending quotes methods
cat -n packages/sdk-ts/src/client/indexer/grpc_stream/streamV2/IndexerGrpcRfqStreamV2.ts | head -150Repository: InjectiveLabs/injective-ts
Length of output: 4940
🏁 Script executed:
# Check the transformer file to see what it imports and all its methods
cat -n packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcRfqTransformer.ts | head -120Repository: InjectiveLabs/injective-ts
Length of output: 4167
🏁 Script executed:
# Look for any tests or usage of openRequestsResponseToOpenRequests or pendingQuotesResponseToPendingQuotes
rg "openRequestsResponseToOpenRequests|pendingQuotesResponseToPendingQuotes" --type ts -B 3 -A 3Repository: InjectiveLabs/injective-ts
Length of output: 1462
🏁 Script executed:
# Check if there are any similar RFQ API classes or if this pattern exists elsewhere
rg "async fetch.*Response" packages/sdk-ts/src/client/indexer/grpc/ --type ts -A 5Repository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Check the types file to see if OpenRequestsResponse and PendingQuotesResponse are defined
cat -n packages/sdk-ts/src/client/indexer/types/rfq.tsRepository: InjectiveLabs/injective-ts
Length of output: 1993
🏁 Script executed:
# Look at other similar indexer grpc API files to understand the pattern
ls -la packages/sdk-ts/src/client/indexer/grpc/ | grep -i "IndexerGrpc.*Api"Repository: InjectiveLabs/injective-ts
Length of output: 2873
🏁 Script executed:
# Check if there's any documentation or interfaces that hint at these methods
rg "GetOpenRequestsRequest|GetPendingQuotesRequest" --type tsRepository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Check the spec file to see if there are any tests or hints about these methods
cat -n packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.spec.tsRepository: InjectiveLabs/injective-ts
Length of output: 3504
🏁 Script executed:
# Check if GetOpenRequestsRequest and GetPendingQuotesRequest exist in the proto definitions
rg "GetOpenRequestsRequest|GetPendingQuotesRequest|getOpenRequests|getPendingQuotes" --type ts -iRepository: InjectiveLabs/injective-ts
Length of output: 338
🏁 Script executed:
# Check if the proto types are exported and available
rg "export.*GetOpenRequestsResponse|export.*GetPendingQuotesResponse" --type tsRepository: InjectiveLabs/injective-ts
Length of output: 52
🏁 Script executed:
# Look at what the InjectiveRFQRpcPb exports by checking imports
rg "InjectiveRFQRpcPb\." packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcRfqTransformer.tsRepository: InjectiveLabs/injective-ts
Length of output: 240
🏁 Script executed:
# Search for any pattern showing these proto types being used
rg "GetOpenRequestsResponse|GetPendingQuotesResponse" --type ts -B 2 -A 2Repository: InjectiveLabs/injective-ts
Length of output: 1134
🏁 Script executed:
# Check if there's any documentation or PR history about these methods
rg "openRequests|pendingQuotes" --type ts -iRepository: InjectiveLabs/injective-ts
Length of output: 1175
🏁 Script executed:
# Look at similar API patterns to understand the structure better
cat -n packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts | head -100Repository: InjectiveLabs/injective-ts
Length of output: 3643
🏁 Script executed:
# Let's check the complete IndexerGrpcRfqApi.ts to make sure there are no other methods
wc -l packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.tsRepository: InjectiveLabs/injective-ts
Length of output: 134
🏁 Script executed:
# View the entire file to verify no other methods exist
tail -n 50 packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.tsRepository: InjectiveLabs/injective-ts
Length of output: 1378
🏁 Script executed:
# Check if there are any imports or references to getOpenRequests or getPendingQuotes anywhere
rg "\.getOpenRequests|\.getPendingQuotes" --type tsRepository: InjectiveLabs/injective-ts
Length of output: 52
Missing fetchOpenRequests and fetchPendingQuotes methods.
The IndexerGrpcRfqTransformer provides openRequestsResponseToOpenRequests and pendingQuotesResponseToPendingQuotes transformer methods with corresponding type definitions (OpenRequestsResponse and PendingQuotesResponse), but this API class doesn't implement the corresponding fetch methods to use them. This appears to be incomplete implementation.
Suggested implementation
async fetchOpenRequests() {
const request = InjectiveRFQExchangeRpcPb.GetOpenRequestsRequest.create()
const response = await this.executeGrpcCall<
InjectiveRFQExchangeRpcPb.GetOpenRequestsRequest,
InjectiveRFQExchangeRpcPb.GetOpenRequestsResponse
>(request, this.client.getOpenRequests.bind(this.client))
return IndexerGrpcRfqTransformer.openRequestsResponseToOpenRequests(response)
}
async fetchPendingQuotes() {
const request = InjectiveRFQExchangeRpcPb.GetPendingQuotesRequest.create()
const response = await this.executeGrpcCall<
InjectiveRFQExchangeRpcPb.GetPendingQuotesRequest,
InjectiveRFQExchangeRpcPb.GetPendingQuotesResponse
>(request, this.client.getPendingQuotes.bind(this.client))
return IndexerGrpcRfqTransformer.pendingQuotesResponseToPendingQuotes(response)
}🤖 Prompt for AI Agents
In `@packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcRfqApi.ts` around lines 11
- 16, Add two methods to IndexerGrpcRFQApi: fetchOpenRequests and
fetchPendingQuotes. For fetchOpenRequests create an
InjectiveRFQExchangeRpcPb.GetOpenRequestsRequest, call this.executeGrpcCall with
that request and this.client.getOpenRequests.bind(this.client), then return
IndexerGrpcRfqTransformer.openRequestsResponseToOpenRequests(response). For
fetchPendingQuotes create an InjectiveRFQExchangeRpcPb.GetPendingQuotesRequest,
call this.executeGrpcCall with that request and
this.client.getPendingQuotes.bind(this.client), then return
IndexerGrpcRfqTransformer.pendingQuotesResponseToPendingQuotes(response). Ensure
you use the same generic request/response types as in the suggested
implementation and keep methods async.
Summary by CodeRabbit
New Features
Tests
Chores