Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/grpc gateway client #362

Merged
merged 6 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions __fixtures__/v-next/outputv2/akash/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "@improbable-eng/grpc-web-node-http-transport";
export const createGrpcWebClient = async ({
grpcWebEndpoint
endpoint
}: {
grpcWebEndpoint: string;
endpoint: string;
}) => {
grpcWebEndpoint = grpcWebEndpoint.replace(/\/*$/, "\"\"");
endpoint = endpoint.replace(/\/*$/, "\"\"");
const {
GrpcWebImpl
} = await import("../cosmos/app/v1alpha1/query.rpc.Query");
let grpcWeb;
if (typeof document !== "undefined") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: grpc.CrossBrowserHttpTransport({
withCredentials: false
})
});
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
} else {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
}
return {
akash: {
audit: {
v1beta2: new (await import("./audit/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta2: new (await import("./audit/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
cert: {
v1beta2: new (await import("./cert/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta2: new (await import("./cert/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
deployment: {
v1beta1: new (await import("./deployment/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb),
v1beta2: new (await import("./deployment/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./deployment/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb),
v1beta2: new (await import("./deployment/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
escrow: {
v1beta1: new (await import("./escrow/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb),
v1beta2: new (await import("./escrow/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./escrow/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb),
v1beta2: new (await import("./escrow/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
market: {
v1beta2: new (await import("./market/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta2: new (await import("./market/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
provider: {
v1beta2: new (await import("./provider/v1beta2/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta2: new (await import("./provider/v1beta2/query.rpc.Query")).QueryClientImpl(grpcWeb)
}
},
cosmos: {
app: {
v1alpha1: new (await import("../cosmos/app/v1alpha1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1alpha1: new (await import("../cosmos/app/v1alpha1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
auth: {
v1beta1: new (await import("../cosmos/auth/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/auth/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
authz: {
v1beta1: new (await import("../cosmos/authz/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/authz/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
bank: {
v1beta1: new (await import("../cosmos/bank/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/bank/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
base: {
tendermint: {
v1beta1: new (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service")).ServiceClientImpl(grpcWeb)
}
},
distribution: {
v1beta1: new (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
evidence: {
v1beta1: new (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
feegrant: {
v1beta1: new (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
gov: {
v1: new (await import("../cosmos/gov/v1/query.rpc.Query")).GrpcWebImpl(grpcWeb),
v1beta1: new (await import("../cosmos/gov/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1: new (await import("../cosmos/gov/v1/query.rpc.Query")).QueryClientImpl(grpcWeb),
v1beta1: new (await import("../cosmos/gov/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
group: {
v1: new (await import("../cosmos/group/v1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1: new (await import("../cosmos/group/v1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
mint: {
v1beta1: new (await import("../cosmos/mint/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/mint/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
nft: {
v1beta1: new (await import("../cosmos/nft/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/nft/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
params: {
v1beta1: new (await import("../cosmos/params/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/params/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
slashing: {
v1beta1: new (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
staking: {
v1beta1: new (await import("../cosmos/staking/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/staking/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
tx: {
v1beta1: new (await import("../cosmos/tx/v1beta1/service.rpc.Service")).ServiceClientImpl(grpcWeb)
},
upgrade: {
v1beta1: new (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
}
}
};
Expand Down
12 changes: 6 additions & 6 deletions __fixtures__/v-next/outputv2/akash/rpc.tx.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "@improbable-eng/grpc-web-node-http-transport";
export const createRPCMsgClient = async ({
grpcWebEndpoint
endpoint
}: {
grpcWebEndpoint: string;
endpoint: string;
}) => {
grpcWebEndpoint = grpcWebEndpoint.replace(/\/*$/, "\"\"");
endpoint = endpoint.replace(/\/*$/, "\"\"");
const {
GrpcWebImpl
} = await import("../cosmos/app/v1alpha1/query.rpc.Query");
let grpcWeb;
if (typeof document !== "undefined") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: grpc.CrossBrowserHttpTransport({
withCredentials: false
})
});
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
} else {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
}
Expand Down
44 changes: 22 additions & 22 deletions __fixtures__/v-next/outputv2/cosmos/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "@improbable-eng/grpc-web-node-http-transport";
export const createGrpcWebClient = async ({
grpcWebEndpoint
endpoint
}: {
grpcWebEndpoint: string;
endpoint: string;
}) => {
grpcWebEndpoint = grpcWebEndpoint.replace(/\/*$/, "\"\"");
endpoint = endpoint.replace(/\/*$/, "\"\"");
const {
GrpcWebImpl
} = await import("../cosmos/app/v1alpha1/query.rpc.Query");
let grpcWeb;
if (typeof document !== "undefined") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: grpc.CrossBrowserHttpTransport({
withCredentials: false
})
});
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
} else {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
}
return {
cosmos: {
app: {
v1alpha1: new (await import("./app/v1alpha1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1alpha1: new (await import("./app/v1alpha1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
auth: {
v1beta1: new (await import("./auth/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./auth/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
authz: {
v1beta1: new (await import("./authz/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./authz/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
bank: {
v1beta1: new (await import("./bank/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./bank/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
base: {
tendermint: {
v1beta1: new (await import("./base/tendermint/v1beta1/query.rpc.Service")).ServiceClientImpl(grpcWeb)
}
},
distribution: {
v1beta1: new (await import("./distribution/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./distribution/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
evidence: {
v1beta1: new (await import("./evidence/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./evidence/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
feegrant: {
v1beta1: new (await import("./feegrant/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./feegrant/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
gov: {
v1: new (await import("./gov/v1/query.rpc.Query")).GrpcWebImpl(grpcWeb),
v1beta1: new (await import("./gov/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1: new (await import("./gov/v1/query.rpc.Query")).QueryClientImpl(grpcWeb),
v1beta1: new (await import("./gov/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
group: {
v1: new (await import("./group/v1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1: new (await import("./group/v1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
mint: {
v1beta1: new (await import("./mint/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./mint/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
nft: {
v1beta1: new (await import("./nft/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./nft/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
params: {
v1beta1: new (await import("./params/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./params/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
slashing: {
v1beta1: new (await import("./slashing/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./slashing/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
staking: {
v1beta1: new (await import("./staking/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./staking/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
},
tx: {
v1beta1: new (await import("./tx/v1beta1/service.rpc.Service")).ServiceClientImpl(grpcWeb)
},
upgrade: {
v1beta1: new (await import("./upgrade/v1beta1/query.rpc.Query")).GrpcWebImpl(grpcWeb)
v1beta1: new (await import("./upgrade/v1beta1/query.rpc.Query")).QueryClientImpl(grpcWeb)
}
}
};
Expand Down
12 changes: 6 additions & 6 deletions __fixtures__/v-next/outputv2/cosmos/rpc.tx.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "@improbable-eng/grpc-web-node-http-transport";
export const createRPCMsgClient = async ({
grpcWebEndpoint
endpoint
}: {
grpcWebEndpoint: string;
endpoint: string;
}) => {
grpcWebEndpoint = grpcWebEndpoint.replace(/\/*$/, "\"\"");
endpoint = endpoint.replace(/\/*$/, "\"\"");
const {
GrpcWebImpl
} = await import("../cosmos/app/v1alpha1/query.rpc.Query");
let grpcWeb;
if (typeof document !== "undefined") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: grpc.CrossBrowserHttpTransport({
withCredentials: false
})
});
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
} else {
grpcWeb = new GrpcWebImpl(grpcWebEndpoint, {
grpcWeb = new GrpcWebImpl(endpoint, {
transport: NodeHttpTransport()
});
}
Expand Down
Loading