xplore-grpc-web-client
v1.18.2
Published
Generated gRPC-web client for Xplore
Maintainers
Readme
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-clientUsage
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.ClientUnaryCallgetTransactionRecord(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: ChainTokenoutputToken: ChainTokenamountIn: stringamountOutMin: stringslippageTolerancePercent: numberrecipientAddress: stringsenderAddress: stringexactOut: booleantimeoutMs: numbergenerateDepositAddress: booleanallowedNodes: string[]
XploreResponse
Response from the AggregateCall method.
Properties:
amountIn: stringamountOut: stringpriceImpact: numberroute: RouteStep[]executionTime: numbergasEstimate: numberdepositAddress: stringvalue: stringtransactionData: TransactionData
ChainToken
Represents a token on a specific chain.
Properties:
chainId: stringaddress: stringisNative: boolean
License
MIT
