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

docs(client-examples): add transfer to readme #719

Merged
merged 5 commits into from
Aug 24, 2023
Merged

docs(client-examples): add transfer to readme #719

merged 5 commits into from
Aug 24, 2023

Conversation

javadkh2
Copy link
Collaborator

@javadkh2 javadkh2 commented Aug 2, 2023

No description provided.

@vercel
Copy link

vercel bot commented Aug 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 11:55am
immutable-records ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 11:55am
react-ui ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 11:55am
tools ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 11:55am

### Creating a type definition from a pact file

```shell
npx pactjs contract-generate --file=./coin.pact --api http://104.248.41.186:8080/chainweb/0.0/development/chain/0/pact
Copy link
Contributor

Choose a reason for hiding this comment

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

When I tried this, (with testnet) it gave me an error, the combination of --file and --api not sure if it's already fixed though (apha.7)

Copy link
Contributor

Choose a reason for hiding this comment

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

This error is expected, you don't need an API when you generate from a file. On a related note I'm wondering where the IP address comes from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that was the devnet url, I have replaced it with the mainnet url.
I also explained when you need --api and when you don't

const signedTr = await signWithChainweaver(transaction);

// As the signer function could be an external function, we double-check if the transaction is signed correctly.
if (isSignedCommand(signedTr)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though it's example code, I'd still recommend inverting the if statement to get early returns instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

if (!isSignedCommand(signedTr)) throw new Error('Transaction has not been signed');

... other code ...
if (response.result.status === 'failure) throw response.result.error;

console.log('yaaaaay')

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@javadkh2
Copy link
Collaborator Author

I am updating the doc

@javadkh2 javadkh2 marked this pull request as ready for review August 21, 2023 15:53
@javadkh2
Copy link
Collaborator Author

@EnoF @alber70g I have updated the readme, can you please have a look
and could you please also read the code comments.

@javadkh2 javadkh2 merged commit 6307988 into main Aug 24, 2023
3 checks passed
@javadkh2 javadkh2 deleted the docs/examples branch August 24, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants