🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

xplore-grpc-web-client

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xplore-grpc-web-client

Generated gRPC-web client for Xplore

1.10.2
latest
Source
npm
Version published
Weekly downloads
152
145.16%
Maintainers
1
Weekly downloads
 
Created
Source

xplore-grpc-web-client

Generated gRPC-web client for Xplore, providing TypeScript definitions and client implementations for the Xplore Aggregator service.

Installation

npm install xplore-grpc-web-client

Usage

Basic Example

import { AggregatorClient } from "xplore-grpc-web-client/aggregator_pb_service";
import {
  XploreRequest,
  ChainToken,
} from "xplore-grpc-web-client/aggregator_pb";

// Create a client
const client = new AggregatorClient("https://your-grpc-web-server.com");

// Create a request
const request = new XploreRequest();
const inputToken = new ChainToken();
inputToken.setChainId("chain-1");
inputToken.setAddress("0x123...");
request.setInputToken(inputToken);

// Make a call
client.aggregateCall(request, {}, (err, response) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(response.toObject());
});

Transaction Record Example

import { AggregatorClient } from "xplore-grpc-web-client/aggregator_pb_service";
import { TransactionRecordRequest } from "xplore-grpc-web-client/aggregator_pb";

const client = new AggregatorClient("https://your-grpc-web-server.com");
const request = new TransactionRecordRequest();
request.setTransactionHash("0xabcdef...");

client.getTransactionRecord(request, {}, (err, record) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(record.toObject());
});

API Reference

Services

AggregatorClient

Client for the Aggregator service.

Methods:

  • aggregateCall(request: XploreRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: XploreResponse | null) => void): grpc.ClientUnaryCall
  • getTransactionRecord(request: TransactionRecordRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: TransactionRecord | null) => void): grpc.ClientUnaryCall

Messages

XploreRequest

Request for the AggregateCall method.

Properties:

  • inputToken: ChainToken
  • outputToken: ChainToken
  • amountIn: string
  • amountOutMin: string
  • slippageTolerancePercent: number
  • recipientAddress: string
  • senderAddress: string
  • exactOut: boolean
  • timeoutMs: number
  • generateDepositAddress: boolean
  • allowedNodes: string[]

XploreResponse

Response from the AggregateCall method.

Properties:

  • amountIn: string
  • amountOut: string
  • priceImpact: number
  • route: RouteStep[]
  • executionTime: number
  • gasEstimate: number
  • depositAddress: string
  • value: string
  • transactionData: TransactionData

ChainToken

Represents a token on a specific chain.

Properties:

  • chainId: string
  • address: string
  • isNative: boolean

License

MIT

Keywords

grpc

FAQs

Package last updated on 25 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts