Add request params
This commit is contained in:
parent
ed02a75354
commit
0cc5c42b55
@ -42,7 +42,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.connectionChannels();
|
||||
const response = await client.ibc.unverified.connectionChannels("foo");
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -55,7 +55,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.packetCommitment();
|
||||
const response = await client.ibc.unverified.packetCommitment("foo", "bar", 0);
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -68,7 +68,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.packetCommitments();
|
||||
const response = await client.ibc.unverified.packetCommitments("foo", "bar");
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -81,7 +81,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.packetAcknowledgement();
|
||||
const response = await client.ibc.unverified.packetAcknowledgement("foo", "bar", 1);
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -94,7 +94,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.unrelayedPackets();
|
||||
const response = await client.ibc.unverified.unrelayedPackets("foo", "bar", [0, 1], true);
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -107,7 +107,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.nextSequenceReceive();
|
||||
const response = await client.ibc.unverified.nextSequenceReceive("foo", "bar");
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
@ -147,7 +147,7 @@ describe("IbcExtension", () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
|
||||
|
||||
const response = await client.ibc.unverified.clientConnections();
|
||||
const response = await client.ibc.unverified.clientConnections("foo");
|
||||
expect(response).toBeTruthy(); // TODO: implement checks
|
||||
|
||||
tmClient.disconnect();
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import Long from "long";
|
||||
|
||||
import { ibc } from "../codec";
|
||||
import { QueryClient } from "./queryclient";
|
||||
import { toObject } from "./utils";
|
||||
@ -9,18 +11,41 @@ export interface IbcExtension {
|
||||
|
||||
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IQueryChannelResponse>;
|
||||
readonly channels: () => Promise<ibc.channel.IQueryChannelsResponse>;
|
||||
readonly connectionChannels: () => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
|
||||
readonly packetCommitment: () => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
|
||||
readonly packetCommitments: () => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
|
||||
readonly packetAcknowledgement: () => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
|
||||
readonly unrelayedPackets: () => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
|
||||
readonly nextSequenceReceive: () => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
|
||||
readonly connectionChannels: (
|
||||
connection: string,
|
||||
) => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
|
||||
readonly packetCommitment: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
sequence: number,
|
||||
) => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
|
||||
readonly packetCommitments: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
) => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
|
||||
readonly packetAcknowledgement: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
sequence: number,
|
||||
) => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
|
||||
readonly unrelayedPackets: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
packetCommitmentSequences: readonly number[],
|
||||
acknowledgements: boolean,
|
||||
) => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
|
||||
readonly nextSequenceReceive: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
) => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
|
||||
|
||||
// Queries for ibc.connection
|
||||
|
||||
readonly connection: (connectionId: string) => Promise<ibc.connection.IQueryConnectionResponse>;
|
||||
readonly connections: () => Promise<ibc.connection.IQueryConnectionsResponse>;
|
||||
readonly clientConnections: () => Promise<ibc.connection.IQueryClientConnectionsResponse>;
|
||||
readonly clientConnections: (
|
||||
clientId: string,
|
||||
) => Promise<ibc.connection.IQueryClientConnectionsResponse>;
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -60,28 +85,52 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
|
||||
const response = await channelQuerySerice.channels({});
|
||||
return toObject(response);
|
||||
},
|
||||
connectionChannels: async () => {
|
||||
const response = await channelQuerySerice.connectionChannels({});
|
||||
connectionChannels: async (connection: string) => {
|
||||
const response = await channelQuerySerice.connectionChannels({ connection: connection });
|
||||
return toObject(response);
|
||||
},
|
||||
packetCommitment: async () => {
|
||||
const response = await channelQuerySerice.packetCommitment({});
|
||||
packetCommitment: async (portId: string, channelId: string, sequence: number) => {
|
||||
const response = await channelQuerySerice.packetCommitment({
|
||||
portId: portId,
|
||||
channelId: channelId,
|
||||
sequence: Long.fromNumber(sequence),
|
||||
});
|
||||
return toObject(response);
|
||||
},
|
||||
packetCommitments: async () => {
|
||||
const response = await channelQuerySerice.packetCommitments({});
|
||||
packetCommitments: async (portId: string, channelId: string) => {
|
||||
const response = await channelQuerySerice.packetCommitments({
|
||||
portId: portId,
|
||||
channelId: channelId,
|
||||
});
|
||||
return toObject(response);
|
||||
},
|
||||
packetAcknowledgement: async () => {
|
||||
const response = await channelQuerySerice.packetAcknowledgement({});
|
||||
packetAcknowledgement: async (portId: string, channelId: string, sequence: number) => {
|
||||
const response = await channelQuerySerice.packetAcknowledgement({
|
||||
portId: portId,
|
||||
channelId: channelId,
|
||||
sequence: Long.fromNumber(sequence),
|
||||
});
|
||||
return toObject(response);
|
||||
},
|
||||
unrelayedPackets: async () => {
|
||||
const response = await channelQuerySerice.unrelayedPackets({});
|
||||
unrelayedPackets: async (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
packetCommitmentSequences: readonly number[],
|
||||
acknowledgements: boolean,
|
||||
) => {
|
||||
const response = await channelQuerySerice.unrelayedPackets({
|
||||
portId: portId,
|
||||
channelId: channelId,
|
||||
packetCommitmentSequences: packetCommitmentSequences.map((s) => Long.fromNumber(s)),
|
||||
acknowledgements: acknowledgements,
|
||||
});
|
||||
return toObject(response);
|
||||
},
|
||||
nextSequenceReceive: async () => {
|
||||
const response = await channelQuerySerice.nextSequenceReceive({});
|
||||
nextSequenceReceive: async (portId: string, channelId: string) => {
|
||||
const response = await channelQuerySerice.nextSequenceReceive({
|
||||
portId: portId,
|
||||
channelId: channelId,
|
||||
});
|
||||
return toObject(response);
|
||||
},
|
||||
|
||||
@ -95,8 +144,8 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
|
||||
const response = await connectionQuerySerice.connections({});
|
||||
return toObject(response);
|
||||
},
|
||||
clientConnections: async () => {
|
||||
const response = await connectionQuerySerice.clientConnections({});
|
||||
clientConnections: async (clientId: string) => {
|
||||
const response = await connectionQuerySerice.clientConnections({ clientId: clientId });
|
||||
return toObject(response);
|
||||
},
|
||||
},
|
||||
|
||||
37
packages/stargate/types/queries/ibc.d.ts
vendored
37
packages/stargate/types/queries/ibc.d.ts
vendored
@ -5,15 +5,38 @@ export interface IbcExtension {
|
||||
readonly unverified: {
|
||||
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IQueryChannelResponse>;
|
||||
readonly channels: () => Promise<ibc.channel.IQueryChannelsResponse>;
|
||||
readonly connectionChannels: () => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
|
||||
readonly packetCommitment: () => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
|
||||
readonly packetCommitments: () => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
|
||||
readonly packetAcknowledgement: () => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
|
||||
readonly unrelayedPackets: () => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
|
||||
readonly nextSequenceReceive: () => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
|
||||
readonly connectionChannels: (
|
||||
connection: string,
|
||||
) => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
|
||||
readonly packetCommitment: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
sequence: number,
|
||||
) => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
|
||||
readonly packetCommitments: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
) => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
|
||||
readonly packetAcknowledgement: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
sequence: number,
|
||||
) => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
|
||||
readonly unrelayedPackets: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
packetCommitmentSequences: readonly number[],
|
||||
acknowledgements: boolean,
|
||||
) => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
|
||||
readonly nextSequenceReceive: (
|
||||
portId: string,
|
||||
channelId: string,
|
||||
) => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
|
||||
readonly connection: (connectionId: string) => Promise<ibc.connection.IQueryConnectionResponse>;
|
||||
readonly connections: () => Promise<ibc.connection.IQueryConnectionsResponse>;
|
||||
readonly clientConnections: () => Promise<ibc.connection.IQueryClientConnectionsResponse>;
|
||||
readonly clientConnections: (
|
||||
clientId: string,
|
||||
) => Promise<ibc.connection.IQueryClientConnectionsResponse>;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user