-
Notifications
You must be signed in to change notification settings - Fork 82
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: upgrade freighter-api to 1.5.0 & soroban-client to 0.8.1 #708
Conversation
Uses the version with updated freighter-api stellar/stellar-cli#708
c00eca9
to
9f20723
Compare
9f20723
to
9fbf755
Compare
Uses the version with updated freighter-api stellar/stellar-cli#708
- if the transaction only needs to be simulated, then the user doesn't need to have Freighter connected. This now uses a default/dummy account for such calls, but throws an error if the app author tries to `signAndSend` such calls. - use the new methods from `freighter-api@1.5.0` to avoid popping pop-ups over and over every time a view call is invoked
9fbf755
to
5e6315e
Compare
this version correctly pins the stellar-base version, so we can remove that from the explicit list of dependencies
const freighterAccount = await getAccount() | ||
|
||
// use a placeholder account if not yet connected to Freighter so that view calls can still work | ||
const account = freighterAccount ?? new SorobanClient.Account('GBZXP4PWQLOTBL3P6OE6DQ7QXNYDAZMWQG27V7ATM7P3TKSRDLQS4V7Q', '0') |
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.
Non urgent followup: Not a big deal since the seq num is zero this tx will be unusable and I assume no one has the priv key, but to communicate even clearer that this account is meaningless I'd replace it with the zero account.
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.
This was just meant for simulation only calls. Does the sequence number matter?
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.
Yes, I'd love to replace it with the zero account. I haven't seen that around yet and don't see it documented at soroban.stellar.org/docs. Is this correct?
G0000000000000000000000000000000000000000000000000000000
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.
use stellar_strkey::ed25519::PublicKey;
fn main() {
let zero = PublicKey([0; 32]);
println!("{zero}");
}
GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF
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.
strkeys are base32 encoded. Lots of zeros encode into AAAAAAAAAA...
The WHF
at the end is because strkeys end with a CRC16. Helps to catch typos.
The G
prefix indicates it's a public key.
The first character after the G
will be affected by the type of public key. We only support ed25519 right now, but there's room for us to support a few different keys if needed.
SEP-23 is the spec.
Uses the version with updated freighter-api stellar/stellar-cli#708
* feat: switch from soroban-react to generated libs * feat: add ft-contract source; rm `../examples` - don't use `soroban lab token` to generate/deploy token - instead, copy example token from examples repo - remove `../examples` reference in `generate` script - add `target/bin/soroban` with pinned version of `soroban` to be used throughout initialize.sh * fix: use workspace dependency versions; update sdk * feat: no more embedding secret keys This copies ideas from the contract in https://github.com/AhaLabs/soroban-abundance-token, allowing anyone to mint themselves tokens. Now this can be used from the frontend directly, so we no longer need to embed the admin's secret key in the JS. Hooray! Upon closer inspection, we didn't need any of those constants anymore, since the contract IDs are embedded in the token libraries. * fix: add mint_100 and comment out events * fix: start tryna fix event subscriptions * fix: update UI after minting 100 ABND * fix: signAndSend `deposit`; fix modal; update form The whole page no longer reloads after a pledge. Instead, FormPledge now takes an `onPledge` param, which it calls after the pledge succeeds. The now-somewhat-awkward `resultSubmit` has also been filled back out to match what the modal expects, so the modal looks correct. * docs: update AlmostUnnecessaryProvider comment * build: allow newer node versions; improve package name * build: generate contract clients * build: fill in .soroban-example-dapp/* first The CI script needs the values there before it can generate the libraries, of course. And the `token_admin*` stuff isn't needed anymore. * build: install locked CLI version with alias * build: build contracts before generating clients * build: s/run-script/run/ Replace `run-script` with the much more common alias `run` to match the rest of the workflow file * build: make convert.ts pass strict; exclude target/ from type checking * build: use node 18 in CI * build: update lockfile; cat lockfiles during build * build: switch to yarn; will it work better? * build: omg yarn works with relative paths but not file: * build: rm busted debug steps; update docs for yarn * build: s/yarn ci/yarn install --frozen-lockfile * build: back to npm we go * build: switch to postinstall script * build: rm outdated build step * build: warn, don't deny, on clippy complaints and add .cargo/config.toml to match CI settings * feat: use freighter-api@1.5 * feat: straightforward copy/paste of subscribe logic This gets the subscriptions working, and finally breaks all dependence on the @soroban-react packages. The logic is a little confusing, but it works! * feat: move subscribe logic to useSubscription hook This is a hook that can be copy/pasted into other React projects that need such functionality, to work alongside their generated libraries until these generated libraries expose subscription logic natively. * fix: update all relevant UI after pledging * fix: avoid Freighter error if not yet connected * fix: can't default build to wasm because tests * build: use latest soroban-cli Uses the version with updated freighter-api stellar/stellar-cli#708 * build: use latest cli/soroban-client; rm stellar-base pin * build: use latest CLI rev from stellar repo * fix: deal with undefined case * build: rm RUSTFLAGS from Makefile Since d771b3f, the default settings are now set in `.cargo/config.toml` * fix: allow using standalone Everything looks correct, but when running the app it fails with: Error: Cannot connect to insecure soroban-rpc server * build: update freighter-api * build: update pinned soroban-cli version * build(ci): stub .soroban-example-dapp/network * fix: add 'await' --------- Co-authored-by: Willem Wyndham <willem@ahalabs.dev>
* feat: switch from soroban-react to generated libs * feat: add ft-contract source; rm `../examples` - don't use `soroban lab token` to generate/deploy token - instead, copy example token from examples repo - remove `../examples` reference in `generate` script - add `target/bin/soroban` with pinned version of `soroban` to be used throughout initialize.sh * fix: use workspace dependency versions; update sdk * feat: no more embedding secret keys This copies ideas from the contract in https://github.com/AhaLabs/soroban-abundance-token, allowing anyone to mint themselves tokens. Now this can be used from the frontend directly, so we no longer need to embed the admin's secret key in the JS. Hooray! Upon closer inspection, we didn't need any of those constants anymore, since the contract IDs are embedded in the token libraries. * fix: add mint_100 and comment out events * fix: start tryna fix event subscriptions * fix: update UI after minting 100 ABND * fix: signAndSend `deposit`; fix modal; update form The whole page no longer reloads after a pledge. Instead, FormPledge now takes an `onPledge` param, which it calls after the pledge succeeds. The now-somewhat-awkward `resultSubmit` has also been filled back out to match what the modal expects, so the modal looks correct. * docs: update AlmostUnnecessaryProvider comment * build: allow newer node versions; improve package name * build: generate contract clients * build: fill in .soroban-example-dapp/* first The CI script needs the values there before it can generate the libraries, of course. And the `token_admin*` stuff isn't needed anymore. * build: install locked CLI version with alias * build: build contracts before generating clients * build: s/run-script/run/ Replace `run-script` with the much more common alias `run` to match the rest of the workflow file * build: make convert.ts pass strict; exclude target/ from type checking * build: use node 18 in CI * build: update lockfile; cat lockfiles during build * build: switch to yarn; will it work better? * build: omg yarn works with relative paths but not file: * build: rm busted debug steps; update docs for yarn * build: s/yarn ci/yarn install --frozen-lockfile * build: back to npm we go * build: switch to postinstall script * build: rm outdated build step * build: warn, don't deny, on clippy complaints and add .cargo/config.toml to match CI settings * feat: use freighter-api@1.5 * feat: straightforward copy/paste of subscribe logic This gets the subscriptions working, and finally breaks all dependence on the @soroban-react packages. The logic is a little confusing, but it works! * feat: move subscribe logic to useSubscription hook This is a hook that can be copy/pasted into other React projects that need such functionality, to work alongside their generated libraries until these generated libraries expose subscription logic natively. * fix: update all relevant UI after pledging * fix: avoid Freighter error if not yet connected * fix: can't default build to wasm because tests * build: use latest soroban-cli Uses the version with updated freighter-api stellar/stellar-cli#708 * build: use latest cli/soroban-client; rm stellar-base pin * build: use latest CLI rev from stellar repo * fix: deal with undefined case * build: rm RUSTFLAGS from Makefile Since d771b3f28599664d3e96c313397bb6aad3b71d38, the default settings are now set in `.cargo/config.toml` * fix: allow using standalone Everything looks correct, but when running the app it fails with: Error: Cannot connect to insecure soroban-rpc server * build: update freighter-api * build: update pinned soroban-cli version * build(ci): stub .soroban-example-dapp/network * fix: add 'await' --------- Co-authored-by: Willem Wyndham <willem@ahalabs.dev>
* feat: switch from soroban-react to generated libs * feat: add ft-contract source; rm `../examples` - don't use `soroban lab token` to generate/deploy token - instead, copy example token from examples repo - remove `../examples` reference in `generate` script - add `target/bin/soroban` with pinned version of `soroban` to be used throughout initialize.sh * fix: use workspace dependency versions; update sdk * feat: no more embedding secret keys This copies ideas from the contract in https://github.com/AhaLabs/soroban-abundance-token, allowing anyone to mint themselves tokens. Now this can be used from the frontend directly, so we no longer need to embed the admin's secret key in the JS. Hooray! Upon closer inspection, we didn't need any of those constants anymore, since the contract IDs are embedded in the token libraries. * fix: add mint_100 and comment out events * fix: start tryna fix event subscriptions * fix: update UI after minting 100 ABND * fix: signAndSend `deposit`; fix modal; update form The whole page no longer reloads after a pledge. Instead, FormPledge now takes an `onPledge` param, which it calls after the pledge succeeds. The now-somewhat-awkward `resultSubmit` has also been filled back out to match what the modal expects, so the modal looks correct. * docs: update AlmostUnnecessaryProvider comment * build: allow newer node versions; improve package name * build: generate contract clients * build: fill in .soroban-example-dapp/* first The CI script needs the values there before it can generate the libraries, of course. And the `token_admin*` stuff isn't needed anymore. * build: install locked CLI version with alias * build: build contracts before generating clients * build: s/run-script/run/ Replace `run-script` with the much more common alias `run` to match the rest of the workflow file * build: make convert.ts pass strict; exclude target/ from type checking * build: use node 18 in CI * build: update lockfile; cat lockfiles during build * build: switch to yarn; will it work better? * build: omg yarn works with relative paths but not file: * build: rm busted debug steps; update docs for yarn * build: s/yarn ci/yarn install --frozen-lockfile * build: back to npm we go * build: switch to postinstall script * build: rm outdated build step * build: warn, don't deny, on clippy complaints and add .cargo/config.toml to match CI settings * feat: use freighter-api@1.5 * feat: straightforward copy/paste of subscribe logic This gets the subscriptions working, and finally breaks all dependence on the @soroban-react packages. The logic is a little confusing, but it works! * feat: move subscribe logic to useSubscription hook This is a hook that can be copy/pasted into other React projects that need such functionality, to work alongside their generated libraries until these generated libraries expose subscription logic natively. * fix: update all relevant UI after pledging * fix: avoid Freighter error if not yet connected * fix: can't default build to wasm because tests * build: use latest soroban-cli Uses the version with updated freighter-api stellar/stellar-cli#708 * build: use latest cli/soroban-client; rm stellar-base pin * build: use latest CLI rev from stellar repo * fix: deal with undefined case * build: rm RUSTFLAGS from Makefile Since d771b3f28599664d3e96c313397bb6aad3b71d38, the default settings are now set in `.cargo/config.toml` * fix: allow using standalone Everything looks correct, but when running the app it fails with: Error: Cannot connect to insecure soroban-rpc server * build: update freighter-api * build: update pinned soroban-cli version * build(ci): stub .soroban-example-dapp/network * fix: add 'await' --------- Co-authored-by: Willem Wyndham <willem@ahalabs.dev>
* feat: switch from soroban-react to generated libs * feat: add ft-contract source; rm `../examples` - don't use `soroban lab token` to generate/deploy token - instead, copy example token from examples repo - remove `../examples` reference in `generate` script - add `target/bin/soroban` with pinned version of `soroban` to be used throughout initialize.sh * fix: use workspace dependency versions; update sdk * feat: no more embedding secret keys This copies ideas from the contract in https://github.com/AhaLabs/soroban-abundance-token, allowing anyone to mint themselves tokens. Now this can be used from the frontend directly, so we no longer need to embed the admin's secret key in the JS. Hooray! Upon closer inspection, we didn't need any of those constants anymore, since the contract IDs are embedded in the token libraries. * fix: add mint_100 and comment out events * fix: start tryna fix event subscriptions * fix: update UI after minting 100 ABND * fix: signAndSend `deposit`; fix modal; update form The whole page no longer reloads after a pledge. Instead, FormPledge now takes an `onPledge` param, which it calls after the pledge succeeds. The now-somewhat-awkward `resultSubmit` has also been filled back out to match what the modal expects, so the modal looks correct. * docs: update AlmostUnnecessaryProvider comment * build: allow newer node versions; improve package name * build: generate contract clients * build: fill in .soroban-example-dapp/* first The CI script needs the values there before it can generate the libraries, of course. And the `token_admin*` stuff isn't needed anymore. * build: install locked CLI version with alias * build: build contracts before generating clients * build: s/run-script/run/ Replace `run-script` with the much more common alias `run` to match the rest of the workflow file * build: make convert.ts pass strict; exclude target/ from type checking * build: use node 18 in CI * build: update lockfile; cat lockfiles during build * build: switch to yarn; will it work better? * build: omg yarn works with relative paths but not file: * build: rm busted debug steps; update docs for yarn * build: s/yarn ci/yarn install --frozen-lockfile * build: back to npm we go * build: switch to postinstall script * build: rm outdated build step * build: warn, don't deny, on clippy complaints and add .cargo/config.toml to match CI settings * feat: use freighter-api@1.5 * feat: straightforward copy/paste of subscribe logic This gets the subscriptions working, and finally breaks all dependence on the @soroban-react packages. The logic is a little confusing, but it works! * feat: move subscribe logic to useSubscription hook This is a hook that can be copy/pasted into other React projects that need such functionality, to work alongside their generated libraries until these generated libraries expose subscription logic natively. * fix: update all relevant UI after pledging * fix: avoid Freighter error if not yet connected * fix: can't default build to wasm because tests * build: use latest soroban-cli Uses the version with updated freighter-api stellar/stellar-cli#708 * build: use latest cli/soroban-client; rm stellar-base pin * build: use latest CLI rev from stellar repo * fix: deal with undefined case * build: rm RUSTFLAGS from Makefile Since d771b3f28599664d3e96c313397bb6aad3b71d38, the default settings are now set in `.cargo/config.toml` * fix: allow using standalone Everything looks correct, but when running the app it fails with: Error: Cannot connect to insecure soroban-rpc server * build: update freighter-api * build: update pinned soroban-cli version * build(ci): stub .soroban-example-dapp/network * fix: add 'await' --------- Co-authored-by: Willem Wyndham <willem@ahalabs.dev>
TODO
main
to remove all but the last commit hereWhat
For JS libraries generated with
soroban contract bindings typescript
:upgrade to freighter-api 1.5.0
use the new methods from
freighter-api@1.5.0
to avoid poppingpop-ups over and over every time a view call is invoked
if the transaction only needs to be simulated, then the user doesn't
need to have Freighter connected. This now uses a default/dummy
account for such calls, but throws an error if the app author tries to
signAndSend
such calls.upgrade
soroban-client
to 0.8.1, which allows removing the pinned version ofstellar-base
Why
This greatly improves the devx & ux of apps that use these generated libraries.
Known limitations
N/A