[Github](https://github.com/urbit/PaperCollateralRenderer)
npm install urbit-paper-collateral-rendererPaperCollateralRenderer generates PNG wallets that can be printed from keygen-js. The layouts and static text content exist in Figma, and are imported via the LayoutGenerator component. This JSON is then saved to disk and bundled with the PaperCollateralRenderer and PageRenderer for prod. The layout objects contain variable strings like @heading or `` @management.seed.length `. PaperCollateralRenderer replaces these with real data. Variables can also specify special layout components like >sigil:@patp.
Install deps via npm:
``
$ npm install
How to build/run for development:
0. Create a .env file in the root directory. Paste in Tlon's Figma API token like the following:
FIGMA_API_TOKEN="your-token-here-within-the-quotes"
1. npm run convert translates the Figma design to JSON via the Figma API. You can target a specific Figma document by updating the document string and page name that are found in convert.js, lines 32 and 34. You can retrieve a Figma document string id by opening the document in your browser and copying the string that appears before the document name. Each document has pages, which you can target with a name string, such as our current page Registration 1.2.
2. npm run start builds all files for development and will watch for any JavaScript changes and serve the build on localhost:8000.
3. npm run build builds all files for production.
Making changes:
1. If you make changes to your targeted Figma document, you must re-convert the JSON with npm run convert.
2. Refreshing the webpage with cmd+shift+r will ensure that your browser doesn't render an older, cached version.
| Commands | Description |
| -------------------------| --------------------------------------------- |
|npm run convert | Import Figma design |npm run build:dev
| | Run the development testing page |$ npm run build:prod
| or | Build the library from source |npm run serve
| | Serve & watch build on localhost:8000 |
See our documentation of frequent bugs and how to fix them.
`js`
className={'extremely-hidden'}
callback={data => console.log(data)}
mode={'REGISTRATION'}
/>
PaperCollateralRenderer has four props.
|Prop Name | Description | Type
| -------------------- | --------------------------------------------- | -----
| wallet | A wallet in the format below | Transformed keygen-js wallet objectclassName
| | A class on the outer component div tag | stringcallback
| | A function to call when all PNGs have been generated | functionmode
| | Allows you to select a preset collection of PNGs to generate | string`, currently 'REGISTRATION' is the only option.
#### Sample Wallet Input
Here is a sample wallet's JSON. More sample wallets can be found in src/sampleWallets
#### License
This project is licensed under the MIT License - see the LICENSE.txt file for details