-
Notifications
You must be signed in to change notification settings - Fork 9
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
Decorate RegenApi to have all queries #2
Comments
👍 Ideally we want separate namespaces (i.e. What else would the custom generation tool do @amaurymartiny ? |
I think it's possible, in #7 I created a
I can mainly think of generating convenient interfaces that would improve UX:
const msg1: Any = api.tx.cosmos.bank.v1beta1.send({...}); // ts-proto normally returns MsgSendResponse, with our fork we can have Any
const msg2: Any = api.tx.regen.data.v1alpha1.signData({...});
// Then plug the Anys into cosmjs
txBuilder.addMsg(api.tx.cosmos.bank.v1beta1.send({...}, (res)=>{
// callback with `res` is called when we get a TxResponse from the node,
// and res has correct TS typings
});
txBuilder.addMsg(...); // can create tx with multiple Msgs, each with their own callback
|
Do the two packages depend on each other correctly then? Or are there duplicated types? Maybe doesn't matter so much if they're just js interfaces... |
Is there a way to have an abbreviated default version of |
Before
Right now, to make a query, we need to do the following:
regen-js/packages/api/src/api.spec.ts
Lines 17 to 20 in 6460062
After
Ideally, what we want is:
I.e. create a
.query
field on RegenApi, and decorate with all the queries that are found in the proto files.Proposals
src/generated
folder. Maybe we could useexport * from './{file}
everywhere, and decorate the query object at runtime:The challenge here with method 2 is keeping TS types (doable though, but be ready for generics all over the place).
The text was updated successfully, but these errors were encountered: