-
Notifications
You must be signed in to change notification settings - Fork 135
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: use JS SDK's Client for "invoke contract" #1101
Conversation
6947bcd
to
44d1161
Compare
Preview is available here: |
Preview is available here: |
@chadoh and @willemneal, howdy! Are we still working on this one? Waiting on anything? Thanks! :) |
@willemneal [pointed out](stellar/stellar-docs#1101 (review)) that it's a bit of a bummer to create accounts with a pure-SDK interface just to revert to `fetch` and a hard-coded Friendbot URL in order to fund that account. This uses `rpc.Server#requestAirdrop` to do the funding. I find the name of this method a bit unexpected! I wonder if the language here has evolved since the method was first added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🤷
@willemneal [pointed out](stellar/stellar-docs#1101 (review)) that it's a bit of a bummer to create accounts with a pure-SDK interface just to revert to `fetch` and a hard-coded Friendbot URL in order to fund that account. This uses `rpc.Server#requestAirdrop` to do the funding. I find the name of this method a bit unexpected! I wonder if the language here has evolved since the method was first added.
@willemneal [pointed out](stellar/stellar-docs#1101 (review)) that it's a bit of a bummer to create accounts with a pure-SDK interface just to revert to `fetch` and a hard-coded Friendbot URL in order to fund that account. This uses `rpc.Server#requestAirdrop` to do the funding. I find the name of this method a bit unexpected! I wonder if the language here has evolved since the method was first added.
28dbcaa
to
b491346
Compare
This page contained a very complicated, old-school example of how to invoke a smart contract. I've updated it with how to use `contract.Client`. I made this somewhat more complicated than it needs to be, showing how to also deploy a new contract from an already-uploaded Wasm hash. I wanted to do this for a few reasons: - The part where we actually call `increment` has become so simple that the page feels almost unnecessary, if that's all we show. (Although maybe that would be good?) - The example contract ID is almost certainly invalid. If people want to walk through the whole thing, it would be nice to show them how to walk through _the whole thing._ - It's actually fairly straightforward! It allows us to show off more of Client's features. That said, I would love to add the ability to deploy directly from a file: ```ts Client.deploy({ wasm: "path/to/some/file.wasm" }) ``` If the JS SDK gains this ability, then we can clean up this example even more, removing the `stellar contract install` CLI step.
b491346
to
445c7e9
Compare
@willemneal [pointed out](stellar/stellar-docs#1101 (review)) that it's a bit of a bummer to create accounts with a pure-SDK interface just to revert to `fetch` and a hard-coded Friendbot URL in order to fund that account. This uses `rpc.Server#requestAirdrop` to do the funding. I find the name of this method a bit unexpected! I wonder if the language here has evolved since the method was first added.
Preview is available here: |
2 similar comments
Preview is available here: |
Preview is available here: |
@willemneal [pointed out](stellar/stellar-docs#1101 (review)) that it's a bit of a bummer to create accounts with a pure-SDK interface just to revert to `fetch` and a hard-coded Friendbot URL in order to fund that account. This uses `rpc.Server#requestAirdrop` to do the funding. I find the name of this method a bit unexpected! I wonder if the language here has evolved since the method was first added.
This page contained a very complicated, old-school example of how to invoke a smart contract. I've updated it with how to use
contract.Client
.I made this somewhat more complicated than it needs to be, showing how to also deploy a new contract from an already-uploaded Wasm hash. I wanted to do this for a few reasons:
increment
has become so simple thatthe page feels almost unnecessary, if that's all we show. (Although
maybe that would be good?)
walk through the whole thing, it would be nice to show them how to
walk through the whole thing.
Client's features.
That said, I would love to add the ability to deploy directly from a file:
If the JS SDK gains this ability, then we can clean up this example even more, removing the
stellar contract install
CLI step.Should we keep the old example?
Maybe it's nice to see a side-by-side of low-level JS SDK logic next to higher-level Client logic? Sort of a "peek under the hood", to show how much Client is doing. This seems most useful to SDK/client authors, since I can't imagine most app developers caring to dive into that logic. Unless they encounter some problem, and need to understand these lower-level details? Not sure if this is the document where we should do that, though. Honestly, it might be fine to refer them to the source code of
Client
.