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

Update dApp to work with the single-asset balance model. #80

Merged
merged 24 commits into from
Jan 10, 2023

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Jan 5, 2023

Closes #76.

@Shaptic Shaptic added the soroban-scrum A label to make relevant issues appear in the Platform Scrum board. label Jan 5, 2023
@Shaptic Shaptic self-assigned this Jan 5, 2023
We have to drop sandbox mode, because we need classic Stellar
operations. The sandbox RPC server (i.e. `soroban serve`) does not
support anything but the Soroban-only `invokeHostFunction`
operation.

We'd need to simulate trustlines in the sandbox if we want this
mode available to the example dApp.
components/molecules/form-pledge/index.tsx Outdated Show resolved Hide resolved
components/molecules/form-pledge/index.tsx Outdated Show resolved Hide resolved
components/molecules/form-pledge/index.tsx Outdated Show resolved Hide resolved
@@ -51,7 +51,7 @@ const Pledge: FunctionComponent = () => {
const tokenName =
token.name.result && convert.scvalToString(token.name.result)
const tokenSymbol =
token.symbol.result && convert.scvalToString(token.symbol.result)
token.symbol.result && convert.scvalToString(token.symbol.result)?.replace("\u0000", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment on why the "\u0000" thing is needed, please?
cc @sisuresh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is necessary. It looks like the symbol is "symbol", and ScSymbol allows 10 chars, so maybe something is filling out the last four chars and this just strips that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The symbol is an asset4 code; those get padded with null bytes, right? I think that's why this is there, but I need to root-cause where it comes from.

throw new Error(`Expected exactly one result, got ${response.results}.`);
}

return SorobanClient.xdr.ScVal.fromXDR(Buffer.from(results[0].xdr, 'base64'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is moving to @soroban-react/contract in #79, but let's do this here first, and move it over after.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will wait this to be finished and I'll include it.

components/molecules/form-pledge/index.tsx Outdated Show resolved Hide resolved
components/molecules/form-pledge/index.tsx Outdated Show resolved Hide resolved
@paulbellamy
Copy link
Contributor

The getPublicKey change is the only blocker, I think. Then should be good-to-go

Even without this, `deposit` should still fail on the `xfer_from`, so it
shouldn't be an issue.
@Shaptic Shaptic changed the title [draft] Update dApp to work with the single-asset balance model. Update dApp to work with the single-asset balance model. Jan 9, 2023
@Shaptic Shaptic marked this pull request as ready for review January 9, 2023 18:12
@Shaptic Shaptic linked an issue Jan 9, 2023 that may be closed by this pull request
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
soroban-scrum A label to make relevant issues appear in the Platform Scrum board.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

example-dapp: Update to support single-asset balances.
4 participants