-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: txwrapper-template & CHAIN_BUILDER guide (#35)
* feat: txwrapper-template & CHAIN_BUILDER guide * Add EOF * Update wording * Update template example README' * Add todos * Update comment * Lint * Update tsconfig * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Update README and example * Update BUILDER_GUIDE based on David's feedback * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Update CHAIN_BUILDER.md Co-authored-by: Andrew Plaza <aplaza@liquidthink.net> Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: Andrew Plaza <aplaza@liquidthink.net>
- Loading branch information
1 parent
b392720
commit 427ea8c
Showing
14 changed files
with
441 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# txwrapper-template | ||
|
||
This directory is a template for creating a chain specific txwrapper package, in the vein of `txwrapper-polkadot`. For guidance on how to use this template consult the [CHAIN_BUILDER.md guide](../../CHAIN_BUILDER.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# How to use `txwrapper-[TODO]` | ||
|
||
Here's a mini-tutorial on how `txwrapper-[TODO]` can interact with a Substrate chain. We're using a [TODO LINK TO YOUR CHAINS REPO] dev chain: | ||
|
||
## Get Started | ||
|
||
1. Fetch the latest [TODO YOUR CHAINS NAME] node from the above link. Follow instructions to build it, and start a dev chain. | ||
|
||
```bash | ||
|
||
[TODO YOUR CHAINS BINARY NAME/PATH] --dev | ||
``` | ||
|
||
2. Run the example script in this folder. It will interact with your local node. | ||
|
||
```bash | ||
./node_modules/.bin/ts-node examples/[TODO].ts | ||
``` | ||
|
||
## Expected Output | ||
|
||
Here's a sample output of the above script, using a [TODO YOUR CHAINS NAME] node. Your payload to sign and signature will of course differ from this example. | ||
|
||
``` | ||
[TODO PUT OUTPUT FROM SCRIPT HERE] | ||
``` | ||
|
||
## Offline vs. Online | ||
|
||
In the examples, the `rpcToLocalNode` function is the only function that needs to be called with internet access. Everything else can be performed offline. In particular, this example shows how to perform the following operations offline: | ||
|
||
- Generate a tx, | ||
- Create its signing payload, | ||
- Sign the signing payload, | ||
- Calculate the tx hash, | ||
- Decode at various levels of the tx lifecycle. |
Oops, something went wrong.