├── .gitignore ├── .prettierrc.json ├── README.adoc ├── guides ├── 05-dashboard │ └── plugins.ts ├── 07-ui-boilerplate │ └── hello_frontend │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── components │ │ ├── faucet.js │ │ ├── getAccountDetails.js │ │ ├── getHello.js │ │ ├── home.js │ │ ├── messageTimeline.js │ │ ├── newAccount.js │ │ ├── sendHello.js │ │ └── transfer.js │ │ ├── index.css │ │ ├── index.js │ │ ├── layout │ │ └── header.js │ │ ├── logo.png │ │ ├── reportWebVitals.js │ │ └── setupTests.js ├── calculate-minfee │ ├── api-client.js │ ├── dry-run.js │ ├── getMinFee.js │ ├── index.js │ ├── package-lock.json │ └── package.json ├── chain-registration │ ├── .gitignore │ ├── mainchain │ │ ├── aggregatedBFTWeight.js │ │ ├── constants.ts │ │ ├── mainchainRegistration.ts │ │ ├── mainchain_reg_params.json │ │ ├── params.json │ │ ├── paramsCreation.ts │ │ ├── schemas.ts │ │ ├── sidechainValidatorsSignatures.json │ │ └── validatorSignatures.ts │ ├── package-lock.json │ ├── package.json │ ├── sidechain │ │ ├── aggregatedBFTWeight.js │ │ └── sidechainRegistration.ts │ └── sidechain_reg_params.json ├── decoding-encoding │ ├── api-client.js │ ├── getBlockById.js │ ├── getTxById.js │ ├── package-lock.json │ └── package.json ├── multiSigtx-creation-signing │ ├── README.md │ ├── accounts.json │ ├── create-multiSig-transaction.js │ ├── package-lock.json │ ├── package.json │ └── signedTx.json ├── register-multi-sig-accounts │ ├── README.md │ ├── accounts.json │ ├── package-lock.json │ ├── package.json │ └── register-multiSig-account.js └── tx-creation-and-signing │ ├── action.js │ ├── api-client.js │ ├── cli.js │ ├── index.js │ ├── offline │ ├── account.json │ ├── create-offline.js │ ├── dry-run.js │ ├── index.js │ └── sign-offline.js │ ├── package-lock.json │ ├── package.json │ ├── schemas.js │ └── send.js └── tutorials ├── hello ├── hello_client │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .lintstagedrc.json │ ├── .liskrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── README.md │ ├── bin │ │ ├── run │ │ └── run.cmd │ ├── config │ │ ├── custom_config.json │ │ └── default │ │ │ ├── config.json │ │ │ ├── dev-validators.json │ │ │ ├── genesis_assets.json │ │ │ ├── genesis_block.blob │ │ │ └── passphrase.json │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app.ts │ │ │ ├── index.ts │ │ │ ├── modules.ts │ │ │ ├── modules │ │ │ │ ├── .gitkeep │ │ │ │ └── hello │ │ │ │ │ ├── commands │ │ │ │ │ └── create_hello_command.ts │ │ │ │ │ ├── endpoint.ts │ │ │ │ │ ├── events │ │ │ │ │ ├── .gitkeep │ │ │ │ │ └── new_hello.ts │ │ │ │ │ ├── method.ts │ │ │ │ │ ├── module.ts │ │ │ │ │ ├── schema.ts │ │ │ │ │ ├── stores │ │ │ │ │ ├── .gitkeep │ │ │ │ │ ├── counter.ts │ │ │ │ │ └── message.ts │ │ │ │ │ └── types.ts │ │ │ ├── plugins.ts │ │ │ └── plugins │ │ │ │ ├── .gitkeep │ │ │ │ └── hello_info │ │ │ │ ├── constants.ts │ │ │ │ ├── db.ts │ │ │ │ ├── endpoint.ts │ │ │ │ ├── hello_info_plugin.ts │ │ │ │ ├── schemas.ts │ │ │ │ ├── tsconfig.json │ │ │ │ └── types.ts │ │ └── commands │ │ │ ├── block │ │ │ └── get.ts │ │ │ ├── blockchain │ │ │ ├── export.ts │ │ │ ├── hash.ts │ │ │ ├── import.ts │ │ │ └── reset.ts │ │ │ ├── config │ │ │ ├── create.ts │ │ │ └── show.ts │ │ │ ├── console.ts │ │ │ ├── endpoint │ │ │ └── invoke.ts │ │ │ ├── generator │ │ │ ├── disable.ts │ │ │ ├── enable.ts │ │ │ ├── export.ts │ │ │ ├── import.ts │ │ │ └── status.ts │ │ │ ├── genesis-block │ │ │ └── create.ts │ │ │ ├── hash-onion.ts │ │ │ ├── keys │ │ │ ├── create.ts │ │ │ ├── encrypt.ts │ │ │ ├── export.ts │ │ │ └── import.ts │ │ │ ├── message │ │ │ ├── decrypt.ts │ │ │ ├── encrypt.ts │ │ │ ├── sign.ts │ │ │ └── verify.ts │ │ │ ├── node │ │ │ ├── info.ts │ │ │ └── metadata.ts │ │ │ ├── passphrase │ │ │ ├── create.ts │ │ │ ├── decrypt.ts │ │ │ └── encrypt.ts │ │ │ ├── start.ts │ │ │ └── transaction │ │ │ ├── create.ts │ │ │ ├── get.ts │ │ │ ├── send.ts │ │ │ └── sign.ts │ ├── test │ │ ├── .eslintrc.js │ │ ├── _setup.js │ │ ├── integration │ │ │ └── .gitkeep │ │ ├── network │ │ │ └── .gitkeep │ │ ├── tsconfig.json │ │ ├── unit │ │ │ ├── modules │ │ │ │ ├── .gitkeep │ │ │ │ └── hello │ │ │ │ │ ├── commands │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── create_hello_command.spec.ts.snap │ │ │ │ │ └── create_hello_command.spec.ts │ │ │ │ │ └── module.spec.ts │ │ │ └── plugins │ │ │ │ └── hello_info │ │ │ │ └── hello_info_plugin.spec.ts │ │ └── utils │ │ │ └── config.ts │ └── tsconfig.json └── hello_frontend │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── api.js │ ├── components │ ├── faucet.js │ ├── getAccountDetails.js │ ├── getHello.js │ ├── home.js │ ├── messageTimeline.js │ ├── newAccount.js │ ├── sendHello.js │ └── transfer.js │ ├── index.css │ ├── index.js │ ├── layout │ └── header.js │ ├── logo.png │ ├── reportWebVitals.js │ └── setupTests.js ├── lisk-name-service ├── README.md ├── lns-dashboard-plugin │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .eslintrc.test.js │ ├── .gitignore │ ├── .npmignore │ ├── .npmrc │ ├── .prettierignore │ ├── .prettierrc.json │ ├── README.md │ ├── config │ │ ├── env.js │ │ ├── getHttpsConfig.js │ │ ├── modules.js │ │ ├── paths.js │ │ ├── pnpTs.js │ │ ├── webpack.config.js │ │ └── webpackDevServer.config.js │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── manifest.json │ │ └── robots.txt │ ├── scripts │ │ ├── build.js │ │ ├── clean.sh │ │ └── start.js │ ├── src │ │ ├── index.ts │ │ ├── plugin │ │ │ ├── dashboard_plugin.ts │ │ │ ├── defaults │ │ │ │ ├── config.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── tsconfig.json │ │ └── ui │ │ │ ├── App.tsx │ │ │ ├── components │ │ │ ├── Connect.tsx │ │ │ ├── Copyright.tsx │ │ │ ├── LNSLabel.tsx │ │ │ ├── LNSNode.tsx │ │ │ ├── LNSTextField.tsx │ │ │ ├── RecentBlocks.tsx │ │ │ ├── RecentTransactions.tsx │ │ │ ├── SearchBar.tsx │ │ │ ├── SearchResult.tsx │ │ │ ├── transactions │ │ │ │ ├── RegisterNameDialog.tsx │ │ │ │ ├── TransferFundsDialog.tsx │ │ │ │ ├── UpdateRecordsDialog.tsx │ │ │ │ └── UpdateReverseLookupDialog.tsx │ │ │ └── utils │ │ │ │ ├── PassphraseInputDialog.tsx │ │ │ │ └── TransactionConfirmationDialog.tsx │ │ │ ├── contexts │ │ │ ├── AppContext.ts │ │ │ ├── BlocksContext.ts │ │ │ ├── EventEmitterContext.ts │ │ │ ├── NetworkContext.tsx │ │ │ ├── TransactionsContext.ts │ │ │ └── UserContext.ts │ │ │ ├── index.scss │ │ │ ├── index.tsx │ │ │ ├── layouts │ │ │ └── MainLayout.tsx │ │ │ ├── logo.svg │ │ │ ├── pages │ │ │ ├── MainPage.tsx │ │ │ ├── MyAccount.tsx │ │ │ └── SearchPage.tsx │ │ │ ├── react-app-env.d.ts │ │ │ ├── tsconfig.json │ │ │ ├── types.ts │ │ │ └── utils │ │ │ ├── index.ts │ │ │ └── useStateWithLocalStorage.ts │ ├── test │ │ ├── .eslintrc.js │ │ ├── _setup.js │ │ ├── tsconfig.json │ │ └── unit │ │ │ ├── jest.config.js │ │ │ └── plugin │ │ │ ├── __snapshots__ │ │ │ └── dashboard_plugin.spec.ts.snap │ │ │ └── dashboard_plugin.spec.ts │ └── tsconfig.json ├── lns │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .lintstagedrc.json │ ├── .liskrc.json │ ├── .mocharc.json │ ├── .npmignore │ ├── .npmrc │ ├── .nvmrc │ ├── .prettierignore │ ├── .prettierrc.json │ ├── .secret │ │ └── accounts.json │ ├── .tool-versions │ ├── bin │ │ ├── run │ │ └── run.cmd │ ├── config │ │ └── default │ │ │ ├── accounts.json │ │ │ ├── config.json │ │ │ ├── forging_info.json │ │ │ ├── genesis_block.json │ │ │ └── password.json │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── scripts │ ├── src │ │ ├── @types │ │ │ └── eth-ens-namehash │ │ │ │ └── index.d.ts │ │ ├── app │ │ │ ├── app.ts │ │ │ ├── index.ts │ │ │ ├── modules.ts │ │ │ ├── modules │ │ │ │ ├── .gitkeep │ │ │ │ └── lns │ │ │ │ │ ├── assets │ │ │ │ │ ├── register.ts │ │ │ │ │ ├── reverse_lookup.ts │ │ │ │ │ └── update_records.ts │ │ │ │ │ ├── constants.ts │ │ │ │ │ ├── data │ │ │ │ │ ├── account_props.ts │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── register.ts │ │ │ │ │ │ ├── reverse_lookup.ts │ │ │ │ │ │ └── update_records.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── lns_node.ts │ │ │ │ │ └── lns_node_record.ts │ │ │ │ │ ├── lns_module.ts │ │ │ │ │ ├── storage.ts │ │ │ │ │ └── utils.ts │ │ │ ├── plugins.ts │ │ │ └── plugins │ │ │ │ └── .gitkeep │ │ └── commands │ │ │ ├── account │ │ │ ├── create.ts │ │ │ ├── get.ts │ │ │ ├── show.ts │ │ │ └── validate.ts │ │ │ ├── block │ │ │ └── get.ts │ │ │ ├── blockchain │ │ │ ├── export.ts │ │ │ ├── hash.ts │ │ │ ├── import.ts │ │ │ └── reset.ts │ │ │ ├── config │ │ │ ├── create.ts │ │ │ └── show.ts │ │ │ ├── console.ts │ │ │ ├── forger-info │ │ │ ├── export.ts │ │ │ └── import.ts │ │ │ ├── forging │ │ │ ├── config.ts │ │ │ ├── disable.ts │ │ │ ├── enable.ts │ │ │ └── status.ts │ │ │ ├── genesis-block │ │ │ └── create.ts │ │ │ ├── hash-onion.ts │ │ │ ├── lns │ │ │ ├── lookup.ts │ │ │ └── resolve.ts │ │ │ ├── node │ │ │ └── info.ts │ │ │ ├── passphrase │ │ │ ├── decrypt.ts │ │ │ └── encrypt.ts │ │ │ ├── start.ts │ │ │ └── transaction │ │ │ ├── create.ts │ │ │ ├── get.ts │ │ │ ├── send.ts │ │ │ └── sign.ts │ ├── test │ │ ├── .eslintrc.js │ │ ├── _setup.js │ │ ├── commands │ │ │ └── account │ │ │ │ └── create.spec.ts │ │ ├── integration │ │ │ └── .gitkeep │ │ ├── network │ │ │ ├── .gitkeep │ │ │ └── lns_modules.spec.ts │ │ ├── tsconfig.json │ │ ├── unit │ │ │ └── modules │ │ │ │ ├── .gitkeep │ │ │ │ └── lns │ │ │ │ ├── assets │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── register.spec.ts.snap │ │ │ │ │ └── reverse_lookup.spec.ts.snap │ │ │ │ ├── register.spec.ts │ │ │ │ └── reverse_lookup.spec.ts │ │ │ │ └── lns.spec.ts │ │ └── utils │ │ │ └── config.ts │ └── tsconfig.json └── package-lock.json ├── nft ├── README.md ├── blockchain_app │ ├── .gitignore │ ├── .npmrc │ ├── .tool-versions │ ├── index.js │ ├── nft_api_plugin │ │ ├── db.js │ │ └── index.js │ ├── nft_module │ │ ├── index.js │ │ ├── nft.js │ │ └── transactions │ │ │ ├── create_nft_asset.js │ │ │ ├── purchase_nft_asset.js │ │ │ └── transfer_nft_asset.js │ ├── package-lock.json │ └── package.json └── frontend_app │ ├── .gitignore │ ├── .npmrc │ ├── .tool-versions │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── api │ └── index.js │ ├── components │ ├── Account.js │ ├── AccountPage.js │ ├── HomePage.js │ ├── NFTToken.js │ ├── TransactionsPage.js │ └── dialogs │ │ ├── CreateAccountDialog.js │ │ ├── CreateNFTTokenDialog.js │ │ ├── PurchaseNFTTokenDialog.js │ │ ├── TransferFundsDialog.js │ │ └── TransferNFTDialog.js │ ├── context │ └── index.js │ ├── fixture.txt │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── serviceWorker.js │ ├── setupTests.js │ └── utils │ ├── common.js │ ├── index.js │ └── transactions │ ├── create_nft_token.js │ ├── purchase_nft_token.js │ ├── transfer.js │ └── transfer_nft.js ├── postboard ├── blockchain-client │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .lintstagedrc.json │ ├── .liskrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── README.md │ ├── bin │ │ ├── run │ │ └── run.cmd │ ├── config │ │ └── default │ │ │ ├── config.json │ │ │ ├── dev-validators.json │ │ │ ├── genesis_assets.json │ │ │ ├── genesis_block.blob │ │ │ └── passphrase.json │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app.ts │ │ │ ├── index.ts │ │ │ ├── modules.ts │ │ │ ├── modules │ │ │ │ └── post │ │ │ │ │ ├── commands │ │ │ │ │ ├── create_post.ts │ │ │ │ │ ├── follow.ts │ │ │ │ │ ├── like.ts │ │ │ │ │ ├── reply.ts │ │ │ │ │ └── repost.ts │ │ │ │ │ ├── endpoint.ts │ │ │ │ │ ├── method.ts │ │ │ │ │ ├── post_module.ts │ │ │ │ │ ├── schemas.ts │ │ │ │ │ ├── stores │ │ │ │ │ ├── account.ts │ │ │ │ │ ├── all_posts.ts │ │ │ │ │ └── post.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ └── utils.ts │ │ │ ├── plugins.ts │ │ │ └── plugins │ │ │ │ └── .gitkeep │ │ └── commands │ │ │ ├── block │ │ │ └── get.ts │ │ │ ├── blockchain │ │ │ ├── export.ts │ │ │ ├── hash.ts │ │ │ ├── import.ts │ │ │ └── reset.ts │ │ │ ├── config │ │ │ ├── create.ts │ │ │ └── show.ts │ │ │ ├── console.ts │ │ │ ├── endpoint │ │ │ ├── invoke.ts │ │ │ └── list.ts │ │ │ ├── generator │ │ │ ├── disable.ts │ │ │ ├── enable.ts │ │ │ ├── export.ts │ │ │ ├── import.ts │ │ │ └── status.ts │ │ │ ├── genesis-block │ │ │ └── create.ts │ │ │ ├── hash-onion.ts │ │ │ ├── keys │ │ │ ├── create.ts │ │ │ ├── encrypt.ts │ │ │ ├── export.ts │ │ │ └── import.ts │ │ │ ├── message │ │ │ ├── decrypt.ts │ │ │ ├── encrypt.ts │ │ │ ├── sign.ts │ │ │ └── verify.ts │ │ │ ├── passphrase │ │ │ ├── create.ts │ │ │ ├── decrypt.ts │ │ │ └── encrypt.ts │ │ │ ├── start.ts │ │ │ ├── system │ │ │ ├── metadata.ts │ │ │ └── node-info.ts │ │ │ └── transaction │ │ │ ├── create.ts │ │ │ ├── get.ts │ │ │ ├── send.ts │ │ │ └── sign.ts │ ├── test │ │ ├── .eslintrc.js │ │ ├── _setup.js │ │ ├── commands │ │ │ └── account │ │ │ │ └── create.spec.ts │ │ ├── integration │ │ │ └── .gitkeep │ │ ├── network │ │ │ └── .gitkeep │ │ ├── tsconfig.json │ │ ├── unit │ │ │ └── modules │ │ │ │ ├── .gitkeep │ │ │ │ └── post │ │ │ │ ├── assets │ │ │ │ ├── create_post_asset.spec.ts │ │ │ │ ├── follow_asset.spec.ts │ │ │ │ ├── like_asset.spec.ts │ │ │ │ ├── reply_asset.spec.ts │ │ │ │ └── repost_asset.spec.ts │ │ │ │ └── post_module.spec.ts │ │ └── utils │ │ │ └── config.ts │ └── tsconfig.json ├── frontend │ ├── .editorconfig │ ├── .env.development │ ├── .env.production │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .nvmrc │ ├── .prettierrc.js │ ├── README.md │ ├── config │ │ ├── addons │ │ │ ├── webpack.bundleanalyze.js │ │ │ ├── webpack.bundlevisualizer.js │ │ │ └── webpack.dashboard.js │ │ ├── common-paths.js │ │ ├── jest │ │ │ ├── enzyme.js │ │ │ ├── fileMock.js │ │ │ └── styleMock.js │ │ ├── webpack.common.js │ │ ├── webpack.development.js │ │ └── webpack.production.js │ ├── jest.config.js │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── src │ │ ├── App.tsx │ │ ├── assets │ │ │ ├── icons │ │ │ │ ├── avatar.svg │ │ │ │ ├── bookmark.svg │ │ │ │ ├── close.svg │ │ │ │ ├── comment.svg │ │ │ │ ├── elipse.svg │ │ │ │ ├── home.svg │ │ │ │ ├── index.ts │ │ │ │ ├── like-filled.svg │ │ │ │ ├── like.svg │ │ │ │ ├── list.svg │ │ │ │ ├── notification.svg │ │ │ │ ├── profile.svg │ │ │ │ ├── repost.svg │ │ │ │ ├── search.svg │ │ │ │ └── settings.svg │ │ │ ├── images │ │ │ │ └── logo.png │ │ │ └── styles │ │ │ │ ├── _global.scss │ │ │ │ ├── _variables.scss │ │ │ │ ├── components │ │ │ │ ├── _alert.scss │ │ │ │ ├── _button.scss │ │ │ │ ├── _overlay.scss │ │ │ │ ├── _passphraseinput.scss │ │ │ │ ├── _postinput.scss │ │ │ │ ├── _postitem.scss │ │ │ │ ├── _replyitem.scss │ │ │ │ └── _sidebar.scss │ │ │ │ ├── postboard.scss │ │ │ │ └── views │ │ │ │ ├── _login.scss │ │ │ │ └── _viewpost.scss │ │ ├── components │ │ │ ├── Alert │ │ │ │ └── index.tsx │ │ │ ├── Button │ │ │ │ └── index.tsx │ │ │ ├── ExploreInput │ │ │ │ └── index.tsx │ │ │ ├── Loading.tsx │ │ │ ├── Overlay │ │ │ │ └── index.tsx │ │ │ ├── PostInput │ │ │ │ └── index.tsx │ │ │ ├── PostItem │ │ │ │ └── index.tsx │ │ │ ├── ReplyItem │ │ │ │ └── index.tsx │ │ │ ├── Sidebar │ │ │ │ └── index.tsx │ │ │ └── Tab │ │ │ │ └── index.tsx │ │ ├── constants │ │ │ └── keyCodes.js │ │ ├── context │ │ │ ├── AlertContext.ts │ │ │ ├── AlertController.ts │ │ │ ├── AuthContext.ts │ │ │ ├── AuthController.ts │ │ │ ├── PostContext.ts │ │ │ ├── PostController.ts │ │ │ └── types.ts │ │ ├── hooks │ │ │ ├── useAccount.tsx │ │ │ ├── useAlert.tsx │ │ │ └── usePosts.tsx │ │ ├── index.tsx │ │ ├── pages │ │ │ ├── Home.tsx │ │ │ ├── ViewFollowers.tsx │ │ │ ├── ViewFollowing.tsx │ │ │ ├── ViewPost.tsx │ │ │ └── ViewProfile.tsx │ │ ├── report-web-vitals.ts │ │ ├── routes │ │ │ ├── AccountRoutes.tsx │ │ │ └── AppRoutes.tsx │ │ ├── service-worker.ts │ │ ├── theme │ │ │ └── index.ts │ │ ├── types │ │ │ ├── Account.type.ts │ │ │ ├── Post.type.ts │ │ │ └── Reply.type.ts │ │ ├── utils │ │ │ ├── account.ts │ │ │ ├── getClient.ts │ │ │ ├── helpers.ts │ │ │ └── passphrase.js │ │ └── views │ │ │ └── Login │ │ │ ├── PassphraseInput │ │ │ └── index.tsx │ │ │ └── index.tsx │ ├── static │ │ ├── images │ │ │ └── .gitkeep │ │ └── locales │ │ │ └── en │ │ │ └── translations.json │ ├── tsconfig.json │ └── webpack.config.js └── utils │ ├── create_post.js │ ├── follow.js │ ├── like.js │ ├── package.json │ ├── privateKey.json │ ├── reply.js │ └── repost.js └── social-recovery ├── README.md ├── blockchain_app ├── .gitignore ├── .npmrc ├── index.js ├── package-lock.json ├── package.json ├── plugins │ ├── srs_api_plugin │ │ ├── constants.js │ │ ├── controllers │ │ │ ├── claim_recovery_api.js │ │ │ ├── close_recovery_api.js │ │ │ ├── create_recovery_api.js │ │ │ ├── index.js │ │ │ ├── initiate_recovery_api.js │ │ │ ├── remove_recovery_api.js │ │ │ ├── transfer_token_api.js │ │ │ └── vouch_recovery_api.js │ │ ├── index.js │ │ ├── schemas.js │ │ └── srs_api_plugin.js │ └── srs_data_plugin │ │ └── index.js ├── srs_module │ ├── assets │ │ ├── claim_recovery.js │ │ ├── close_recovery.js │ │ ├── create_recovery.js │ │ ├── initiate_recovery.js │ │ ├── remove_recovery.js │ │ └── vouch_recovery.js │ ├── constants.js │ ├── index.js │ └── schemas.js └── test │ ├── simulate_recovery.js │ └── utils │ ├── api_client.js │ └── transactions │ ├── balance_transfer.js │ ├── create_recovery_trx.js │ ├── initiate_trx.js │ ├── schemas.js │ └── vouch_trx.js └── frontend_app ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── api └── index.js ├── components ├── claimRecovery.js ├── closeRecovery.js ├── createRecovery.js ├── getAccount.js ├── getNodeInfo.js ├── getRecoveryAccounts.js ├── home.js ├── index.js ├── initiateRecovery.js ├── recoveryConfig.js ├── recoveryManager.js ├── removeRecovery.js ├── sideMenu.js └── vouchRecovery.js ├── index.css ├── index.js ├── setupTests.js └── utils └── defaults.js /.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | .DS_Store 3 | *.swp 4 | *.orig 5 | .bash_history 6 | 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | 17 | # node-waf configuration 18 | .lock-wscript 19 | 20 | # Dependency directories 21 | node_modules 22 | jspm_packages 23 | 24 | # Optional npm cache directory 25 | .npm 26 | 27 | # Optional REPL history 28 | .node_repl_history 29 | 30 | # IDE directories 31 | .idea 32 | tmp 33 | 34 | # Distribution directory 35 | .vscode 36 | dist/ 37 | dist-node/ 38 | dist-browser/ 39 | browsertest.build/ 40 | browsertest/package.json 41 | browsertest/browsertest.js 42 | browsertest/browsertest.min.js 43 | browsertest/src 44 | browsertest/test 45 | 46 | # Unsupported lock files 47 | yarn.lock 48 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "useTabs": true 5 | } 6 | -------------------------------------------------------------------------------- /guides/05-dashboard/plugins.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-empty-function */ 2 | import { Application } from 'lisk-sdk'; 3 | import { LatestHelloPlugin } from "./plugins/latest_hello/latest_hello_plugin"; 4 | 5 | // @ts-expect-error Unused variable error happens here until at least one module is registered 6 | export const registerPlugins = (app: Application): void => { 7 | 8 | app.registerPlugin(LatestHelloPlugin); 9 | }; 10 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello_frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-router": "^6.8.1", 12 | "react-router-dom": "^6.8.1", 13 | "react-scripts": "5.0.1", 14 | "semantic-ui-css": "^2.5.0", 15 | "semantic-ui-react": "^2.1.4", 16 | "web-vitals": "^2.1.4" 17 | }, 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "test": "react-scripts test", 22 | "eject": "react-scripts eject" 23 | }, 24 | "eslintConfig": { 25 | "extends": [ 26 | "react-app", 27 | "react-app/jest" 28 | ] 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/guides/07-ui-boilerplate/hello_frontend/public/favicon.ico -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/guides/07-ui-boilerplate/hello_frontend/public/logo192.png -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/guides/07-ui-boilerplate/hello_frontend/public/logo512.png -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: left; 3 | width: inherit; 4 | height: fit-content; 5 | overflow: scroll; 6 | } 7 | 8 | .App-logo { 9 | height: 40vmin; 10 | pointer-events: none; 11 | } 12 | 13 | @media (prefers-reduced-motion: no-preference) { 14 | .App-logo { 15 | animation: App-logo-spin infinite 20s linear; 16 | } 17 | } 18 | 19 | .App-header { 20 | background-color: #282c34; 21 | min-height: 100vh; 22 | display: flex; 23 | flex-direction: column; 24 | align-items: center; 25 | justify-content: center; 26 | font-size: calc(10px + 2vmin); 27 | color: white; 28 | } 29 | 30 | .App-link { 31 | color: #61dafb; 32 | } 33 | 34 | @keyframes App-logo-spin { 35 | from { 36 | transform: rotate(0deg); 37 | } 38 | 39 | to { 40 | transform: rotate(360deg); 41 | } 42 | } -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import { 2 | BrowserRouter as Router, 3 | Route, 4 | Routes 5 | } from "react-router-dom"; 6 | import NewAccount from './components/newAccount'; 7 | import './App.css'; 8 | import Transfer from "./components/transfer"; 9 | import Faucet from "./components/faucet"; 10 | import GetAccountDetails from "./components/getAccountDetails"; 11 | import Home from "./components/home"; 12 | import GetHello from "./components/getHello"; 13 | import SendHello from "./components/sendHello"; 14 | 15 | function App() { 16 | return ( 17 | 18 | 19 | } /> 20 | } /> 21 | } /> 22 | } /> 23 | } /> 24 | } /> 25 | } /> 26 | 27 | 28 | 29 | ); 30 | } 31 | 32 | export default App; 33 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/components/getHello.js: -------------------------------------------------------------------------------- 1 | import FixedMenuLayout from '../layout/header'; 2 | import { Divider, Container } from 'semantic-ui-react'; 3 | import MessageTimeline from './messageTimeline'; 4 | 5 | function GetHello() { 6 | return ( 7 |
8 | 9 | 10 |
11 |

Hello messages sent so far!

12 | 13 | 14 | 15 |
16 |
17 |
18 | ); 19 | } 20 | 21 | export default GetHello; -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/components/newAccount.js: -------------------------------------------------------------------------------- 1 | import FixedMenuLayout from '../layout/header'; 2 | import { Container, Divider } from 'semantic-ui-react'; 3 | 4 | function NewAccount() { 5 | return ( 6 |
7 | 8 | 9 |
10 |
11 | TIP: Reload the page to generate a new account. 12 |
13 | 14 |

New account created!

15 | 16 |
17 | 18 |
19 |
20 | 21 |
22 |
23 | ); 24 | } 25 | 26 | export default NewAccount; -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/guides/07-ui-boilerplate/hello_frontend/src/logo.png -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /guides/07-ui-boilerplate/hello_frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /guides/calculate-minfee/api-client.js: -------------------------------------------------------------------------------- 1 | const { apiClient } = require('@liskhq/lisk-client'); 2 | let clientCache; 3 | const nodeAPIURL = 'ws://localhost:7887/rpc-ws' 4 | 5 | /** 6 | * Connects to a node API via WS 7 | * 8 | * @returns The API client 9 | */ 10 | const getClient = async () => { 11 | if (!clientCache) { 12 | clientCache = await apiClient.createWSClient(nodeAPIURL); 13 | } 14 | return clientCache; 15 | }; 16 | 17 | module.exports = { getClient }; -------------------------------------------------------------------------------- /guides/calculate-minfee/dry-run.js: -------------------------------------------------------------------------------- 1 | const { getClient } = require('./api-client'); 2 | 3 | /** 4 | * Performs a dry-run for a given transaction. 5 | * 6 | * @param txJSON The transaction to dry-run in JSON format 7 | * @returns The result of the dry-run 8 | */ 9 | const dryRun = async (txJSON) => { 10 | const client = await getClient(); 11 | 12 | const tx = client.transaction.fromJSON(txJSON); 13 | const encodedTx = client.transaction.encode(tx); 14 | 15 | const result = await client.invoke('txpool_dryRunTransaction',{"transaction":encodedTx.toString("hex") }) 16 | 17 | return result; 18 | }; 19 | 20 | module.exports = { dryRun }; -------------------------------------------------------------------------------- /guides/calculate-minfee/getMinFee.js: -------------------------------------------------------------------------------- 1 | const { getClient } = require('./api-client'); 2 | /** 3 | * Returns the minimum fee for a transaction. 4 | * 5 | * @param txJSON The transaction to calculate the minimum fee for in JSON format 6 | * @returns The minimum fee for the given transaction 7 | */ 8 | const getMinFee = async (txJSON) => { 9 | const client = await getClient(); 10 | 11 | const minFee = client.transaction.computeMinFee(txJSON); 12 | 13 | return minFee; 14 | }; 15 | 16 | module.exports = { getMinFee }; -------------------------------------------------------------------------------- /guides/calculate-minfee/index.js: -------------------------------------------------------------------------------- 1 | const { transactions } = require('@liskhq/lisk-client'); 2 | const { getMinFee } = require('./getMinFee'); 3 | const { dryRun } = require('./dry-run'); 4 | 5 | (async () => { 6 | // Replace this with your transaction 7 | const txJSON = {"module":"token","command":"transfer","fee":"0","nonce":"3","senderPublicKey":"ec10255d3e78b2977f04e59ea9afd3e9a2ce9a6b44619ef9f6c47c29695b1df3","signatures":["500d192a25a2c7b340b5ae03471c329b174d7fb3b05d47aefd71f0c4b76e220fe2edc79efcc16b9f89ac61708bcb9755f78262f1b00439f52972422a94f69a07"],"params":{"tokenID":"0300000800000000","amount":"1000000000","recipientAddress":"lskoytn4jcgs2pjpy2vfsttt7g8eb9wwbaf6hxc27","data":"Happy Birthday!"},"id":"0f81c6442ad49313046d73a8eb96178ff0c16ee2d353c4005f982310cdbbe39e"}; 8 | 9 | const minFee = await getMinFee(txJSON); 10 | 11 | console.log("The minimum fee for the given transaction is: ", minFee, " Beddows, i.e. ", transactions.convertBeddowsToLSK(minFee.toString()), " LSK."); 12 | 13 | const txWithFee = { 14 | ...txJSON, 15 | fee: minFee.toString() 16 | } 17 | 18 | const result = await dryRun(txWithFee); 19 | 20 | console.log("Dry run result", result); 21 | process.exit(0); 22 | })(); 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /guides/calculate-minfee/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "calculate-minfee", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@liskhq/lisk-client": "^v6.0.0-alpha.15" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /guides/chain-registration/.gitignore: -------------------------------------------------------------------------------- 1 | mainchain/keys.json -------------------------------------------------------------------------------- /guides/chain-registration/mainchain/aggregatedBFTWeight.js: -------------------------------------------------------------------------------- 1 | const { apiClient } = require('@liskhq/lisk-client'); 2 | // Update rpc endpoint to point to a mainchain node with enabled WS RPC API 3 | const RPC_ENDPOINT = 'ws://142.93.230.246:4002/rpc-ws'; 4 | 5 | (async () => { 6 | const mainchainClient = await apiClient.createWSClient(RPC_ENDPOINT); 7 | const mainchainNodeInfo = await mainchainClient.invoke('system_getNodeInfo'); 8 | // Get active validators from mainchain 9 | const { 10 | validators: mainchainActiveValidators, 11 | certificateThreshold: mainchainCertificateThreshold 12 | } = await mainchainClient.invoke('consensus_getBFTParameters', { height: mainchainNodeInfo.height }); 13 | 14 | // Calculate the aggregated BFT weight 15 | let aggregateBFTWeight = BigInt(0); 16 | for (const validator of mainchainActiveValidators) { 17 | aggregateBFTWeight += BigInt(validator.bftWeight); 18 | } 19 | 20 | console.log("certificateThreshold:"); 21 | console.log("min:"); 22 | console.log(aggregateBFTWeight / BigInt(3) + BigInt(1)); 23 | console.log("max:"); 24 | console.log(aggregateBFTWeight); 25 | process.exit(0); 26 | })(); -------------------------------------------------------------------------------- /guides/chain-registration/mainchain/constants.ts: -------------------------------------------------------------------------------- 1 | export const CHAIN_ID_LENGTH = 4; 2 | export const MIN_CHAIN_NAME_LENGTH = 1; 3 | export const MAX_CHAIN_NAME_LENGTH = 32; 4 | export const BLS_PUBLIC_KEY_LENGTH = 48; 5 | export const NUMBER_ACTIVE_VALIDATORS_MAINCHAIN = 101; 6 | export const MESSAGE_TAG_CHAIN_REG = 'LSK_CHAIN_REGISTRATION_'; 7 | -------------------------------------------------------------------------------- /guides/chain-registration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chain-registration", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "chain_registration.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@types/node": "^18.13.0" 13 | }, 14 | "dependencies": { 15 | "@chainsafe/blst": "^0.2.6", 16 | "@liskhq/lisk-api-client": "^6.0.0-alpha.14", 17 | "@liskhq/lisk-codec": "^0.3.0-alpha.7", 18 | "@liskhq/lisk-cryptography": "^4.0.0-alpha.6", 19 | "fs": "^0.0.1-security", 20 | "fs-extra": "^11.1.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /guides/chain-registration/sidechain/aggregatedBFTWeight.js: -------------------------------------------------------------------------------- 1 | const { apiClient } = require('@liskhq/lisk-client'); 2 | 3 | (async () => { 4 | // Update the path to point to your sidechain client's data folder 5 | const sidechainClient = await apiClient.createIPCClient('~/.lisk/hello_client'); 6 | const sidechainNodeInfo = await sidechainClient.invoke('system_getNodeInfo'); 7 | // Get active validators from sidechain 8 | const bftParams = await sidechainClient.invoke('consensus_getBFTParameters', { height: sidechainNodeInfo.height }); 9 | 10 | // Calculate the aggregated BFT weight 11 | let aggregateBFTWeight = BigInt(0); 12 | for (const validator of bftParams.validators) { 13 | aggregateBFTWeight += BigInt(validator.bftWeight); 14 | } 15 | 16 | console.log("certificateThreshold:"); 17 | console.log("min:"); 18 | console.log(aggregateBFTWeight / BigInt(3) + BigInt(1)); 19 | console.log("max:"); 20 | console.log(aggregateBFTWeight); 21 | process.exit(0); 22 | })(); -------------------------------------------------------------------------------- /guides/decoding-encoding/api-client.js: -------------------------------------------------------------------------------- 1 | const { apiClient } = require('@liskhq/lisk-client'); 2 | let clientCache; 3 | const nodeAPIURL = 'ws://localhost:7887/rpc-ws'; 4 | 5 | const getClient = async () => { 6 | if (!clientCache) { 7 | clientCache = await apiClient.createWSClient(nodeAPIURL); 8 | } 9 | return clientCache; 10 | }; 11 | 12 | module.exports = { getClient }; -------------------------------------------------------------------------------- /guides/decoding-encoding/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "decoding-blocks-transactions", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@liskhq/lisk-client": "^v6.0.0-alpha.16", 13 | "lisk-sdk": "^v6.0.0-alpha.16" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /guides/multiSigtx-creation-signing/README.md: -------------------------------------------------------------------------------- 1 | # Steps to execute the script 2 | 3 | - Register a multi-signature account (You can use [this](https://github.com/LiskHQ/lisk-sdk-examples/tree/development/guides/register-multi-sig-accounts) script). 4 | 5 | - Install the `lisk-sdk` package by executing the following: 6 | 7 | ``` 8 | npm install 9 | ``` 10 | - Replace the accounts details available in the `accounts.json` file with the accounts of your node. 11 | - Update the values of the `chainID` and the `tokenID` in the script to match with the node being used to test the script. 12 | - To run the script, the signatory should pass their private key to the following command like this: 13 | ``` 14 | node create-multiSig-transaction.js SIGNATORY'S_PRIVATE_KEY 15 | ``` -------------------------------------------------------------------------------- /guides/multiSigtx-creation-signing/accounts.json: -------------------------------------------------------------------------------- 1 | { 2 | "accounts": [ 3 | { 4 | "address": "lsk6oqambp2mgqvqxxxm5aohs6s6329sgwftax2rf", 5 | "keyPath": "m/44'/134'/0'", 6 | "publicKey": "e98e8a6325730be6bf2644af83d5a0b004bb31c15858fedbd0ac2c1f89e2eece" 7 | }, 8 | { 9 | "address": "lskgmmkgyc67n5jrpf2trgtxtc4yjg7bpu992chba", 10 | "keyPath": "m/44'/134'/1'", 11 | "publicKey": "c61cd862a8b7f73857b248a4358a7b35c29ca273d76ba3819e8c54b62801f16e" 12 | }, 13 | { 14 | "address": "lskrw8gmg6fgdkkgj48q364quzkoqzya479x7rc3d", 15 | "keyPath": "m/44'/134'/2'", 16 | "publicKey": "fad413df3fe5e7961b81ee8dc168d13d7e1f5cccdd062ed77da77142c7d571f0" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /guides/multiSigtx-creation-signing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multisigtx-creation-signing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "create-multiSig-transaction.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "lisk-sdk": "6.0.0-rc.5" 13 | } 14 | } -------------------------------------------------------------------------------- /guides/multiSigtx-creation-signing/signedTx.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /guides/register-multi-sig-accounts/README.md: -------------------------------------------------------------------------------- 1 | # Steps to execute the script 2 | 3 | - Install the `lisk-sdk` package by executing the following: 4 | 5 | ``` 6 | npm install 7 | ``` 8 | - Replace the accounts details available in the `accounts.json` file with the accounts of your node. 9 | - Update the `chainID` in the `register-multiSig-account.js` script to match the `chainID` of the node being used to test the script. 10 | - Execute the aforementioned script to register a multi-signature account. 11 | 12 | ``` 13 | node register-multiSig-account.js 14 | ``` 15 | - Invoke `auth_getAuthAccount` to check the account's status. 16 | The response should be similar to the following: 17 | 18 | ``` 19 | { 20 | "nonce": "1", 21 | "numberOfSignatures": 2, 22 | "mandatoryKeys": [], 23 | "optionalKeys": [ 24 | "c61cd862a8b7f73857b248a4358a7b35c29ca273d76ba3819e8c54b62801f16e", 25 | "e98e8a6325730be6bf2644af83d5a0b004bb31c15858fedbd0ac2c1f89e2eece", 26 | "fad413df3fe5e7961b81ee8dc168d13d7e1f5cccdd062ed77da77142c7d571f0" 27 | ] 28 | } 29 | ``` -------------------------------------------------------------------------------- /guides/register-multi-sig-accounts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-sig-accounts-tx", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "create-sig.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "lisk-sdk": "6.0.0-rc.3" 13 | } 14 | } -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/api-client.js: -------------------------------------------------------------------------------- 1 | const { apiClient } = require('@liskhq/lisk-client'); 2 | 3 | const RPC_ENDPOINT = 'ws://127.0.0.1:7887/rpc-ws'; 4 | let clientCache; 5 | 6 | const getClient = async () => { 7 | if (!clientCache) { 8 | clientCache = await apiClient.createWSClient(RPC_ENDPOINT); 9 | } 10 | return clientCache; 11 | }; 12 | 13 | module.exports = { getClient }; -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/index.js: -------------------------------------------------------------------------------- 1 | import { codec } from '@liskhq/lisk-codec'; 2 | import * as validator from '@liskhq/lisk-validator'; 3 | import { transactionSchema, transferAssetSchema } from 'schemas'; 4 | 5 | const unsignedTransaction = { 6 | moduleID: Number(2), 7 | assetID: Number(0), 8 | fee: BigInt(10000000), 9 | nonce: BigInt(23), 10 | senderPublicKey: Buffer.from('1dc86a88278ee6db12ff671318677ec23b9ee6231cfca71a2c99c2ab78338cb1'), 11 | asset: Buffer.alloc(0), 12 | signatures: [], 13 | }; 14 | 15 | const transactionErrors = validator.validator.validate(transactionSchema, unsignedTransaction); 16 | 17 | if (transactionErrors.length) { 18 | throw new validator.LiskValidationError([...transactionErrors]); 19 | } 20 | 21 | const rawTransferAsset = { 22 | amount: BigInt(2000000000), 23 | recipientAddress: Buffer.from('3e565c6f2d22e0a3c1e4717672ec8ac61c2660f2'), 24 | data: 'Happy birthday!' 25 | }; 26 | 27 | const encodedTransferAsset = codec.fromJSON(transferAssetSchema, rawTransferAsset); 28 | -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/offline/account.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "lskg6prjbqpm6m8rsvmsg6dgyx3e89drknbvxg7x8", 3 | "keyPath": "m/44'/134'/0'", 4 | "publicKey": "ec10255d3e78b2977f04e59ea9afd3e9a2ce9a6b44619ef9f6c47c29695b1df3", 5 | "privateKey": "ac3e34eb369d52a3cddf0bc4312d9b0aa3625b04721039bb114f4c607fb5256eec10255d3e78b2977f04e59ea9afd3e9a2ce9a6b44619ef9f6c47c29695b1df3", 6 | "binaryAddress": "fa892e1aa42a8af96c45dfd5afc428b3dba950e6" 7 | } -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/offline/dry-run.js: -------------------------------------------------------------------------------- 1 | const { getClient } = require('../api-client'); 2 | 3 | const dryRun = async (signedTransaction) => { 4 | const client = await getClient(); 5 | const encTx = client.transaction.encode(signedTransaction); 6 | const result = await client.invoke('txpool_dryRunTransaction', { "transaction": encTx.toString("hex") }); 7 | 8 | return result; 9 | } 10 | 11 | module.exports = { dryRun }; -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/offline/index.js: -------------------------------------------------------------------------------- 1 | const { createTxOffline } = require('./create-offline'); 2 | const { signTx } = require('./sign-offline'); 3 | const { dryRun } = require('./dry-run'); 4 | 5 | (async () => { 6 | // 1. Create an unsigned transaction 7 | const tx = createTxOffline(); 8 | console.log("Unsigned Transaction: ", tx); 9 | 10 | // 2. Sign the transaction 11 | const signedTx = signTx(tx); 12 | console.log("Signed Transaction: ", signedTx); 13 | 14 | // 3. Perform a dry-run for the signed transaction 15 | const dryRunResult = await dryRun(signedTx) 16 | console.log("Dry-Run Result: ", dryRunResult); 17 | 18 | process.exit(0); 19 | })(); -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/offline/sign-offline.js: -------------------------------------------------------------------------------- 1 | const { transactions } = require('@liskhq/lisk-client'); 2 | const { transferParamsSchema } = require('../schemas'); 3 | const account = require('./account.json'); 4 | 5 | const chainID = '00000001'; 6 | 7 | const signTx = (unsignedTransaction) => { 8 | const signedTransaction = transactions.signTransaction( 9 | unsignedTransaction, 10 | Buffer.from(chainID, 'hex'), 11 | Buffer.from(account.privateKey, 'hex'), 12 | transferParamsSchema 13 | ); 14 | 15 | return signedTransaction; 16 | } 17 | 18 | 19 | module.exports = { signTx } -------------------------------------------------------------------------------- /guides/tx-creation-and-signing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tx-creation-and-signing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@liskhq/lisk-client": "^v6.0.0-beta.7" 14 | } 15 | } -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.eslintignore: -------------------------------------------------------------------------------- 1 | docs/ 2 | examples/ 3 | **/*.d.ts 4 | jest.config.js 5 | .eslintrc.js 6 | coverage 7 | benchmark 8 | dist 9 | tmp 10 | build 11 | scripts 12 | config -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | extends: ['lisk-base/ts'], 8 | }; 9 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | ~ 3 | .DS_Store 4 | .project 5 | __MACOSX/ 6 | *.swp 7 | *.swo 8 | ssl/ 9 | tmp/ 10 | 11 | # Build revision file generated while building a release 12 | REVISION 13 | npm-shrinkwrap.json 14 | 15 | # Dependency directories 16 | tsconfig.tsbuildinfo 17 | node_modules/ 18 | 19 | # Docs 20 | docs/jsdoc/ 21 | 22 | # Logs 23 | logs/* 24 | logs.log 25 | npm-debug.log 26 | tmux-client-*.log 27 | stacktrace* 28 | 29 | # IDE directories 30 | .vscode/ 31 | .idea/ 32 | Session.vim 33 | 34 | # Config files 35 | sftp-config.json 36 | .secrets 37 | 38 | # Coverage directory used by tools like istanbul 39 | .coverage/ 40 | 41 | # Local config file useful for development 42 | config.local.json 43 | 44 | # Build Directory 45 | dist 46 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "*.js": ["prettier --write", "eslint"], 3 | "*.ts": ["prettier --write", "eslint"], 4 | "*.{json,md}": ["prettier --write"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.liskrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "commander": { 3 | "version": "6.1.0" 4 | }, 5 | "template": "lisk-ts" 6 | } 7 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.prettierignore: -------------------------------------------------------------------------------- 1 | # Files 2 | Jenkinsfile* 3 | Makefile 4 | Dockerfile 5 | LICENSE 6 | .DS_Store 7 | data/ 8 | .idea 9 | logs/ 10 | 11 | .gitkeep 12 | 13 | # rc files 14 | .*rc 15 | 16 | ## ignore files 17 | .*ignore 18 | 19 | # Ignore extensions 20 | *.png 21 | *.sql 22 | 23 | ## jest snapshot 24 | *.snap 25 | *.tsbuildinfo 26 | 27 | # project specific paths 28 | dist/ 29 | bin 30 | tmp/ 31 | 32 | *.pid 33 | *.gz 34 | 35 | docker/* 36 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "useTabs": true, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Lisk Blockchain Client 2 | 3 | This project was bootstrapped with [Lisk SDK](https://github.com/LiskHQ/lisk-sdk) 4 | 5 | ### Install packages 6 | 7 | ``` 8 | npm install 9 | ``` 10 | 11 | ### Build the code 12 | 13 | ``` 14 | npm run build 15 | ``` 16 | 17 | ### Start a node 18 | 19 | ``` 20 | ./bin/run start --config=config/custom_config.json 21 | ``` 22 | 23 | ### Add a new module 24 | 25 | ``` 26 | lisk generate:module ModuleName 27 | // Example 28 | lisk generate:module hello 29 | ``` 30 | 31 | ### Add a new plugin 32 | 33 | ``` 34 | lisk generate:plugin PluginName 35 | // Example 36 | lisk generate:plugin helloInfo 37 | ``` 38 | 39 | ## Learn More 40 | 41 | You can learn more in the [documentation](https://lisk.com/documentation/lisk-sdk/). 42 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('@oclif/core') 4 | .run() 5 | .then(require('@oclif/core/flush')) 6 | .catch(require('@oclif/core/handle')); 7 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* -------------------------------------------------------------------------------- /tutorials/hello/hello_client/config/default/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "system": { 3 | "dataPath": "/Users/iamtalha/.lisk/hello_client", 4 | "keepEventsForHeights": 300, 5 | "logLevel": "info" 6 | }, 7 | "rpc": { 8 | "modes": [ 9 | "ipc" 10 | ], 11 | "port": 7887, 12 | "host": "127.0.0.1", 13 | "allowedMethods": ["*"] 14 | }, 15 | "network": { 16 | "version": "1.0", 17 | "seedPeers": [], 18 | "port": 7667 19 | }, 20 | "transactionPool": { 21 | "maxTransactions": 4096, 22 | "maxTransactionsPerAccount": 64, 23 | "transactionExpiryTime": 10800000, 24 | "minEntranceFeePriority": "0", 25 | "minReplacementFeeDifference": "10" 26 | }, 27 | "genesis": { 28 | "block": { 29 | "fromFile": "./config/genesis_block.blob" 30 | }, 31 | "blockTime": 10, 32 | "bftBatchSize": 103, 33 | "maxTransactionsSize": 15360, 34 | "chainID": "00000001" 35 | }, 36 | "generator": { 37 | "keys": { 38 | "fromFile": "./config/dev-validators.json" 39 | } 40 | }, 41 | "modules": {}, 42 | "plugins": {} 43 | } 44 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/config/default/genesis_block.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/config/default/genesis_block.blob -------------------------------------------------------------------------------- /tutorials/hello/hello_client/config/default/passphrase.json: -------------------------------------------------------------------------------- 1 | { 2 | "passphrase": "wine marble deal into battle verify basic cattle hazard mesh squirrel small club kite excuse light resource garden scare curve ask wait salon eye" 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 2 | import { registerModules } from './modules'; 3 | import { registerPlugins } from './plugins'; 4 | 5 | export const getApplication = (config: PartialApplicationConfig): Application => { 6 | const { app } = Application.defaultApplication(config); 7 | 8 | registerModules(app); 9 | registerPlugins(app); 10 | 11 | return app; 12 | }; 13 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/index.ts: -------------------------------------------------------------------------------- 1 | export default {}; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-empty-function */ 2 | import { Application } from 'lisk-sdk'; 3 | import { HelloModule } from "./modules/hello/module"; 4 | 5 | export const registerModules = (app: Application): void => { 6 | 7 | app.registerModule(new HelloModule()); 8 | }; 9 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/src/app/modules/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/endpoint.ts: -------------------------------------------------------------------------------- 1 | import { BaseEndpoint, ModuleEndpointContext, cryptography } from 'lisk-sdk'; 2 | import { counterKey, CounterStore, CounterStoreData } from './stores/counter'; 3 | import { MessageStore, MessageStoreData } from './stores/message'; 4 | 5 | export class HelloEndpoint extends BaseEndpoint { 6 | public async getHelloCounter(ctx: ModuleEndpointContext): Promise { 7 | const counterSubStore = this.stores.get(CounterStore); 8 | 9 | const helloCounter = await counterSubStore.get( 10 | ctx, 11 | counterKey, 12 | ); 13 | 14 | return helloCounter; 15 | } 16 | 17 | public async getHello(ctx: ModuleEndpointContext): Promise { 18 | const messageSubStore = this.stores.get(MessageStore); 19 | 20 | const { address } = ctx.params; 21 | if (typeof address !== 'string') { 22 | throw new Error('Parameter address must be a string.'); 23 | } 24 | cryptography.address.validateLisk32Address(address); 25 | const helloMessage = await messageSubStore.get( 26 | ctx, 27 | cryptography.address.getAddressFromLisk32Address(address), 28 | ); 29 | return helloMessage; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/events/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/src/app/modules/hello/events/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/events/new_hello.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | import { BaseEvent } from 'lisk-sdk'; 15 | 16 | export const newHelloEventSchema = { 17 | $id: '/hello/events/new_hello', 18 | type: 'object', 19 | required: ['senderAddress', 'message'], 20 | properties: { 21 | senderAddress: { 22 | dataType: 'bytes', 23 | fieldNumber: 1, 24 | }, 25 | message: { 26 | dataType: 'string', 27 | fieldNumber: 2, 28 | }, 29 | }, 30 | }; 31 | 32 | export interface NewHelloEventData { 33 | senderAddress: Buffer; 34 | message: string; 35 | } 36 | 37 | export class NewHelloEvent extends BaseEvent { 38 | public schema = newHelloEventSchema; 39 | } 40 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/method.ts: -------------------------------------------------------------------------------- 1 | import { BaseMethod, ImmutableMethodContext } from 'lisk-sdk'; 2 | import { MessageStore, MessageStoreData } from './stores/message'; 3 | 4 | export class HelloMethod extends BaseMethod { 5 | public async getHello( 6 | methodContext: ImmutableMethodContext, 7 | address: Buffer, 8 | ): Promise { 9 | const messageSubStore = this.stores.get(MessageStore); 10 | const helloMessage = await messageSubStore.get(methodContext, address); 11 | 12 | return helloMessage; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/stores/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/src/app/modules/hello/stores/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/stores/counter.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | import { BaseStore } from 'lisk-sdk'; 15 | 16 | export interface CounterStoreData { 17 | counter: number; 18 | } 19 | 20 | export const counterKey = Buffer.alloc(0); 21 | 22 | export const counterStoreSchema = { 23 | $id: '/hello/counter', 24 | type: 'object', 25 | required: ['counter'], 26 | properties: { 27 | counter: { 28 | dataType: 'uint32', 29 | fieldNumber: 1, 30 | }, 31 | }, 32 | }; 33 | 34 | export class CounterStore extends BaseStore { 35 | public schema = counterStoreSchema; 36 | } -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/stores/message.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | import { BaseStore } from 'lisk-sdk'; 15 | 16 | export interface MessageStoreData { 17 | message: string; 18 | } 19 | 20 | export const messageStoreSchema = { 21 | $id: '/hello/message', 22 | type: 'object', 23 | required: ['message'], 24 | properties: { 25 | message: { 26 | dataType: 'string', 27 | fieldNumber: 1, 28 | }, 29 | }, 30 | }; 31 | 32 | export class MessageStore extends BaseStore { 33 | public schema = messageStoreSchema; 34 | } -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/modules/hello/types.ts: -------------------------------------------------------------------------------- 1 | import { 2 | JSONObject 3 | } from 'lisk-sdk'; 4 | 5 | export interface ModuleConfig { 6 | maxMessageLength: number; 7 | minMessageLength: number; 8 | blacklist: string[]; 9 | } 10 | 11 | export type ModuleConfigJSON = JSONObject; -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/plugins.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/namespace */ 2 | /* eslint-disable @typescript-eslint/no-empty-function */ 3 | import { Application } from 'lisk-sdk'; 4 | import { DashboardPlugin } from '@liskhq/lisk-framework-dashboard-plugin'; 5 | import { HelloInfoPlugin } from "./plugins/hello_info/hello_info_plugin"; 6 | 7 | export const registerPlugins = (app: Application): void => { 8 | app.registerPlugin(new HelloInfoPlugin()); 9 | app.registerPlugin(new DashboardPlugin()); 10 | }; 11 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/src/app/plugins/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/plugins/hello_info/constants.ts: -------------------------------------------------------------------------------- 1 | export const DB_KEY_EVENT_INFO = Buffer.from([0]); 2 | export const DB_LAST_COUNTER_INFO = Buffer.from([1]); 3 | export const DB_LAST_HEIGHT_INFO = Buffer.from([2]); 4 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/plugins/hello_info/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig" 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/app/plugins/hello_info/types.ts: -------------------------------------------------------------------------------- 1 | export interface HelloInfoPluginConfig { 2 | syncInterval: number; 3 | } 4 | 5 | export interface Event { 6 | senderAddress: Buffer; 7 | message: string; 8 | height: number; 9 | } 10 | 11 | export interface Counter { 12 | counter: number; 13 | } 14 | 15 | export interface Height { 16 | height: number; 17 | } 18 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/block/get.ts: -------------------------------------------------------------------------------- 1 | export { BlockGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/blockchain/export.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/blockchain/hash.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainHashCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/blockchain/import.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/blockchain/reset.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainResetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/config/create.ts: -------------------------------------------------------------------------------- 1 | export { ConfigCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/config/show.ts: -------------------------------------------------------------------------------- 1 | export { ConfigShowCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/console.ts: -------------------------------------------------------------------------------- 1 | export { ConsoleCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/endpoint/invoke.ts: -------------------------------------------------------------------------------- 1 | export { InvokeCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/generator/disable.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorDisableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/generator/enable.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorEnableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/generator/export.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/generator/import.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/generator/status.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorStatusCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/genesis-block/create.ts: -------------------------------------------------------------------------------- 1 | import { BaseGenesisBlockCommand } from 'lisk-commander'; 2 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 3 | import { join } from 'path'; 4 | import { getApplication } from '../../app/app'; 5 | 6 | export class GenesisBlockCommand extends BaseGenesisBlockCommand { 7 | public getApplication(config: PartialApplicationConfig): Application { 8 | const app = getApplication(config); 9 | return app; 10 | } 11 | 12 | public getApplicationConfigDir(): string { 13 | return join(__dirname, '../../../config'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/hash-onion.ts: -------------------------------------------------------------------------------- 1 | export { HashOnionCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/keys/create.ts: -------------------------------------------------------------------------------- 1 | export { KeysCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/keys/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { KeysEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/keys/export.ts: -------------------------------------------------------------------------------- 1 | export { KeysExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/keys/import.ts: -------------------------------------------------------------------------------- 1 | export { KeysImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/message/decrypt.ts: -------------------------------------------------------------------------------- 1 | export { MessageDecryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/message/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { MessageEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/message/sign.ts: -------------------------------------------------------------------------------- 1 | export { MessageSignCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/message/verify.ts: -------------------------------------------------------------------------------- 1 | export { MessageVerifyCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/node/info.ts: -------------------------------------------------------------------------------- 1 | export { NodeInfoCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/node/metadata.ts: -------------------------------------------------------------------------------- 1 | export { NodeMetadataCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/passphrase/create.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/passphrase/decrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseDecryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/passphrase/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/transaction/create.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | /* eslint-disable @typescript-eslint/explicit-member-accessibility */ 3 | import { TransactionCreateCommand } from 'lisk-commander'; 4 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 5 | import { getApplication } from '../../app/app'; 6 | 7 | type CreateFlags = typeof TransactionCreateCommand.flags & { 8 | [key: string]: Record; 9 | }; 10 | 11 | export class CreateCommand extends TransactionCreateCommand { 12 | static flags: CreateFlags = { 13 | ...TransactionCreateCommand.flags, 14 | }; 15 | 16 | static args = [...TransactionCreateCommand.args]; 17 | 18 | public getApplication(config: PartialApplicationConfig): Application { 19 | const app = getApplication(config); 20 | return app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/transaction/get.ts: -------------------------------------------------------------------------------- 1 | export { TransactionGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/transaction/send.ts: -------------------------------------------------------------------------------- 1 | export { TransactionSendCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/src/commands/transaction/sign.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | /* eslint-disable @typescript-eslint/explicit-member-accessibility */ 3 | import { TransactionSignCommand } from 'lisk-commander'; 4 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 5 | import { getApplication } from '../../app/app'; 6 | 7 | type SignFlags = typeof TransactionSignCommand.flags & { [key: string]: Record }; 8 | 9 | export class SignCommand extends TransactionSignCommand { 10 | static flags: SignFlags = { 11 | ...TransactionSignCommand.flags, 12 | }; 13 | 14 | static args = [...TransactionSignCommand.args]; 15 | 16 | public getApplication(config: PartialApplicationConfig): Application { 17 | const app = getApplication(config); 18 | return app; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['lisk-base/ts-jest'], 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/_setup.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const matchers = require('jest-extended'); 3 | 4 | expect.extend(matchers); 5 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/test/integration/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/network/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/test/network/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "../" 5 | }, 6 | "include": ["../src/**/*", "./**/*", "../package.json", "../config/**/*.json"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/unit/modules/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_client/test/unit/modules/.gitkeep -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/unit/modules/hello/commands/__snapshots__/create_hello_command.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`CreateHelloCommand constructor should have valid schema 1`] = ` 4 | { 5 | "$id": "hello/createHello-params", 6 | "properties": { 7 | "message": { 8 | "dataType": "string", 9 | "fieldNumber": 1, 10 | "maxLength": 1, 11 | "minLength": 256, 12 | }, 13 | }, 14 | "required": [ 15 | "message", 16 | ], 17 | "title": "CreateHelloCommand transaction parameter for the Hello module", 18 | "type": "object", 19 | } 20 | `; 21 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/unit/modules/hello/module.spec.ts: -------------------------------------------------------------------------------- 1 | // import * as modules from '../../../src/app/modules/hello' 2 | 3 | describe('HelloModule', () => { 4 | describe('constructor', () => { 5 | it.todo('should have valid name'); 6 | }); 7 | 8 | describe('beforeTransactionsExecute', () => { 9 | it.todo('should execute before block execute'); 10 | }); 11 | describe('afterTransactionsExecute', () => { 12 | it.todo('should execute after block execute'); 13 | }); 14 | describe('beforeCommandExecute', () => { 15 | it.todo('should execute before transaction execute'); 16 | }); 17 | describe('afterCommandExecute', () => { 18 | it.todo('should execute after transaction execute'); 19 | }); 20 | describe('beforeTransactionsExecute', () => { 21 | it.todo('should execute after genesis execute'); 22 | }); 23 | describe('afterTransactionsExecute', () => { 24 | it.todo('should execute after genesis execute'); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/unit/plugins/hello_info/hello_info_plugin.spec.ts: -------------------------------------------------------------------------------- 1 | // import * as plugins from '../../../src/app/plugins/helloInfo'; 2 | 3 | describe('HelloInfoPlugin', () => { 4 | describe('name', () => { 5 | it.todo('should have valid name'); 6 | }); 7 | describe('nodeModulePath', () => { 8 | it.todo('should have nodeModulePath'); 9 | }); 10 | describe('events', () => { 11 | it.todo('should fire an event'); 12 | }); 13 | describe('load', () => { 14 | it.todo('should load plugin'); 15 | }); 16 | describe('unload', () => { 17 | it.todo('should unload plugin'); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/test/utils/config.ts: -------------------------------------------------------------------------------- 1 | import { Config } from '@oclif/core'; 2 | 3 | import pJSON = require('../../package.json'); 4 | 5 | export const getConfig = async () => { 6 | const config = await Config.load(); 7 | config.pjson.lisk = { addressPrefix: 'lsk' }; 8 | config.pjson.version = pJSON.version; 9 | return config; 10 | }; 11 | -------------------------------------------------------------------------------- /tutorials/hello/hello_client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "target": "es2019", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "newLine": "lf", 8 | "importHelpers": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "noImplicitReturns": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "pretty": true, 14 | "removeComments": true, 15 | "resolveJsonModule": true, 16 | "sourceMap": true, 17 | "strict": true, 18 | "composite": true, 19 | "declaration": true, 20 | "noImplicitAny": false, 21 | "rootDir": "./src", 22 | "outDir": "./dist", 23 | "skipLibCheck": true 24 | }, 25 | "include": ["./src/**/*.ts", "./src/**/*.json"] 26 | } 27 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_frontend/public/favicon.ico -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_frontend/public/logo192.png -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_frontend/public/logo512.png -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: left; 3 | width: inherit; 4 | height: fit-content; 5 | overflow: scroll; 6 | } 7 | 8 | .App-logo { 9 | height: 40vmin; 10 | pointer-events: none; 11 | } 12 | 13 | @media (prefers-reduced-motion: no-preference) { 14 | .App-logo { 15 | animation: App-logo-spin infinite 20s linear; 16 | } 17 | } 18 | 19 | .App-header { 20 | background-color: #282c34; 21 | min-height: 100vh; 22 | display: flex; 23 | flex-direction: column; 24 | align-items: center; 25 | justify-content: center; 26 | font-size: calc(10px + 2vmin); 27 | color: white; 28 | } 29 | 30 | .App-link { 31 | color: #61dafb; 32 | } 33 | 34 | @keyframes App-logo-spin { 35 | from { 36 | transform: rotate(0deg); 37 | } 38 | 39 | to { 40 | transform: rotate(360deg); 41 | } 42 | } -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import { 2 | BrowserRouter as Router, 3 | Route, 4 | Routes 5 | } from "react-router-dom"; 6 | import NewAccount from './components/newAccount'; 7 | import './App.css'; 8 | import Transfer from "./components/transfer"; 9 | import Faucet from "./components/faucet"; 10 | import GetAccountDetails from "./components/getAccountDetails"; 11 | import Home from "./components/home"; 12 | import GetHello from "./components/getHello"; 13 | import SendHello from "./components/sendHello"; 14 | 15 | function App() { 16 | return ( 17 | 18 | 19 | } /> 20 | } /> 21 | } /> 22 | } /> 23 | } /> 24 | } /> 25 | } /> 26 | 27 | 28 | 29 | ); 30 | } 31 | 32 | export default App; 33 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/api.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '@liskhq/lisk-client/browser'; 2 | const RPC_ENDPOINT = 'ws://localhost:7887/rpc-ws'; 3 | 4 | let clientCache; 5 | 6 | export const getClient = async () => { 7 | if (!clientCache) { 8 | clientCache = await apiClient.createWSClient(RPC_ENDPOINT); 9 | } 10 | return clientCache; 11 | }; -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/components/getHello.js: -------------------------------------------------------------------------------- 1 | import FixedMenuLayout from '../layout/header'; 2 | import { Divider, Container } from 'semantic-ui-react'; 3 | import React, { useState, useEffect } from "react"; 4 | import MessageTimeline from './messageTimeline'; 5 | import * as api from '../api'; 6 | 7 | 8 | export default function GetHello() { 9 | const [messages, getHelloMessages] = useState(''); 10 | 11 | useEffect(() => { 12 | getMessages() 13 | }, []) 14 | 15 | async function getMessages() { 16 | const client = await api.getClient(); 17 | return client.invoke("helloInfo_getMessageList", { 18 | }).then(res => { 19 | const responseMessages = res 20 | getHelloMessages(responseMessages); 21 | }); 22 | } 23 | 24 | return ( 25 |
26 | 27 | 28 |
29 |

Hello messages sent so far!

30 | 31 | 32 | 33 |
34 |
35 |
36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/hello/hello_frontend/src/logo.png -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /tutorials/hello/hello_frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/README.md: -------------------------------------------------------------------------------- 1 | # Lisk Name Service - PoC 2 | 3 | This is a NFT Blockchain application created using `Version 5.1.0` of `lisk-sdk`. 4 | 5 | This demonstrates On-Chain and Off-Chain architecture of `lisk-sdk`. We will be building an PoC name Lisk Name Service inspired from the ethereum name service to cover the following requirements. 6 | 7 | - Able to register .lsk domains. 8 | - Manage and update domain records. 9 | - Able to resolve a domain to an account address. 10 | - Able to reverse lookup an address for its domain. 11 | - Use the domain names in the UI tools instead of account address. 12 | 13 | ## Install dependencies 14 | 15 | ```bash 16 | cd lns-dashboard-plugin && npm i && npm run build 17 | cd lns && npm i 18 | ``` 19 | 20 | ## Start node 21 | 22 | ```bash 23 | cd lns 24 | ./bin/run start --api-ws 25 | ``` 26 | 27 | ## Access UI 28 | 29 | Open http://localhost:8000/ in the browser to access the LNS dashboard. 30 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.eslintignore: -------------------------------------------------------------------------------- 1 | dist-node 2 | build 3 | config 4 | scripts 5 | jest.config.js 6 | .eslintrc.js 7 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | extends: ['lisk-base/ts'], 8 | }; 9 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.eslintrc.test.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['lisk-base/ts-jest'], 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintignore 3 | .eslintrc.json 4 | .eslintrc.js 5 | .gitignore 6 | .lintstagedrc.json 7 | .nycrc 8 | .prettierrc.json 9 | .prettierignore 10 | cypress.json 11 | index.html 12 | Jenkinsfile* 13 | *.log 14 | 15 | .nyc_output/ 16 | coverage/ 17 | benchmark/ 18 | .coverage/ 19 | cypress/ 20 | fixtures/ 21 | tmp/ 22 | logs/ 23 | src/ 24 | test/ 25 | scripts/ 26 | browsertest/ 27 | examples/ 28 | build/ 29 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.npmrc: -------------------------------------------------------------------------------- 1 | message = ":arrow_up: Version %s" 2 | save-exact = true 3 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.prettierignore: -------------------------------------------------------------------------------- 1 | # Files 2 | LICENSE 3 | .gitkeep 4 | mocha.opts 5 | .DS_Store 6 | REVISION 7 | 8 | # rc files 9 | .*rc 10 | ## ignore files 11 | .*ignore 12 | 13 | # Ignore extensions 14 | *.png 15 | *.sql 16 | *.sh 17 | *.html 18 | *.info 19 | *.xml 20 | *.log 21 | *.proto 22 | *.csv 23 | *.cmd 24 | *.tsbuildinfo 25 | 26 | ## jest snapshot 27 | *.snap 28 | 29 | # project specific paths 30 | coverage/ 31 | dist-node/ 32 | dist-browser/ 33 | dist/ 34 | tmp/ 35 | browsertest.build/ 36 | .coverage 37 | .coverage-unit 38 | build 39 | public 40 | *.svg 41 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "useTabs": true, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/README.md: -------------------------------------------------------------------------------- 1 | # @liskhq/lisk-framework-dashboard-plugin 2 | 3 | @liskhq/lisk-framework-dashboard-plugin is a plugin for interacting with a newly developed blockchain application. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | $ npm install --save @liskhq/lisk-framework-dashboard-plugin 9 | ``` 10 | 11 | ## Config Options 12 | 13 | ``` 14 | { 15 | applicationURL?: string, 16 | host?: string, 17 | port?: number, 18 | } 19 | ``` 20 | 21 | ## License 22 | 23 | Copyright 2016-2021 Lisk Foundation 24 | 25 | Licensed under the Apache License, Version 2.0 (the "License"); 26 | you may not use this file except in compliance with the License. 27 | You may obtain a copy of the License at 28 | 29 | http://www.apache.org/licenses/LICENSE-2.0 30 | 31 | Unless required by applicable law or agreed to in writing, software 32 | distributed under the License is distributed on an "AS IS" BASIS, 33 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | See the License for the specific language governing permissions and 35 | limitations under the License. 36 | 37 | [lisk core github]: https://github.com/LiskHQ/lisk 38 | [lisk documentation site]: https://lisk.io/documentation/lisk-elements 39 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/config/pnpTs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { resolveModuleName } = require('ts-pnp'); 4 | 5 | exports.resolveModuleName = ( 6 | typescript, 7 | moduleName, 8 | containingFile, 9 | compilerOptions, 10 | resolutionHost, 11 | ) => { 12 | return resolveModuleName( 13 | moduleName, 14 | containingFile, 15 | compilerOptions, 16 | resolutionHost, 17 | typescript.resolveModuleName, 18 | ); 19 | }; 20 | 21 | exports.resolveTypeReferenceDirective = ( 22 | typescript, 23 | moduleName, 24 | containingFile, 25 | compilerOptions, 26 | resolutionHost, 27 | ) => { 28 | return resolveModuleName( 29 | moduleName, 30 | containingFile, 31 | compilerOptions, 32 | resolutionHost, 33 | typescript.resolveTypeReferenceDirective, 34 | ); 35 | }; 36 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns-dashboard-plugin/public/favicon.ico -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Dashboard Plugin", 3 | "name": "Lisk SDK Dashboard Plugin", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | ../../../scripts/clean.sh -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | export { LNSDashboardPlugin } from './plugin/dashboard_plugin'; 15 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/plugin/defaults/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | 15 | export * from './config'; 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/plugin/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | 15 | export { LNSDashboardPlugin as DashboardPlugin } from './dashboard_plugin'; 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig" 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/components/Copyright.tsx: -------------------------------------------------------------------------------- 1 | import { Link, Typography } from '@material-ui/core'; 2 | import * as React from 'react'; 3 | 4 | const Copyright: React.FC = () => ( 5 | 6 | {'Copyright © '} 7 | 8 | Lisk Foundation 9 | {' '} 10 | {new Date().getFullYear()} 11 | {'.'} 12 | 13 | ); 14 | 15 | export default Copyright; 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/contexts/AppContext.ts: -------------------------------------------------------------------------------- 1 | import { apiClient } from '@liskhq/lisk-client'; 2 | import * as React from 'react'; 3 | 4 | export interface AppState { 5 | ready: boolean; 6 | enableLNSNames: boolean; 7 | } 8 | 9 | export interface AppContextState { 10 | client: apiClient.APIClient; 11 | appState: AppState; 12 | setAppState: (state: AppState) => void; 13 | } 14 | 15 | export const appContextDefaultValues: AppContextState = { 16 | appState: { 17 | ready: false, 18 | enableLNSNames: true, 19 | }, 20 | setAppState: (_: AppState) => { 21 | // 22 | }, 23 | client: {} as never, 24 | }; 25 | 26 | const AppContext = React.createContext(appContextDefaultValues); 27 | 28 | export default AppContext; 29 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/contexts/BlocksContext.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Block } from '../types'; 3 | 4 | const BlocksContext = React.createContext([]); 5 | 6 | export default BlocksContext; 7 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/contexts/EventEmitterContext.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as EventEmitter from 'events'; 3 | 4 | export const NEW_CONFIRMED_TX_EVENT = 'new:confirmed:tx'; 5 | export const NEW_BLOCK_EVENT = 'new:block'; 6 | 7 | const EventEmitterContext = React.createContext(new EventEmitter()); 8 | 9 | export default EventEmitterContext; 10 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/contexts/TransactionsContext.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Transaction } from '../types'; 3 | 4 | const TransactionsContext = React.createContext([]); 5 | 6 | export default TransactionsContext; 7 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/contexts/UserContext.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { User } from '../types'; 3 | 4 | export const userDefaultValue = { address: '', lisk32Address: '', publicKey: '' }; 5 | 6 | const UserContext = React.createContext<{ 7 | connected: boolean; 8 | user: User; 9 | setUser: (u?: User) => void; 10 | }>({ 11 | connected: false, 12 | user: userDefaultValue, 13 | // eslint-disable-next-line @typescript-eslint/no-empty-function 14 | setUser: () => {}, 15 | }); 16 | 17 | export default UserContext; 18 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/index.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap'); 2 | 3 | body { 4 | background: #f5f5f5; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/index.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | import * as React from 'react'; 3 | import * as ReactDOM from 'react-dom'; 4 | import './index.scss'; 5 | import App from './App'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root'), 12 | ); 13 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig", 3 | "compilerOptions": { 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "isolatedModules": true, 11 | "noEmit": true, 12 | "jsx": "react" 13 | }, 14 | "include": ["./**/*.{ts,tsx}", "react-app-env.d.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { AppConfig } from '../types'; 2 | 3 | export const getAppConfig = async (): Promise => { 4 | if (process.env.NODE_ENV && process.env.NODE_ENV === 'development') { 5 | return { 6 | applicationUrl: 'ws://localhost:5001/ws', 7 | }; 8 | } 9 | 10 | const res = await fetch('/api/config.json'); 11 | const config = ((await res.json()) as unknown) as AppConfig; 12 | return config; 13 | }; 14 | 15 | export const normalizeName = (name: string): string => { 16 | if (name.endsWith('.lsk')) { 17 | return name.toLowerCase(); 18 | } 19 | 20 | return `${name}.lsk`.toLowerCase(); 21 | }; 22 | 23 | export const toLocalTime = (timestamp: number): string => 24 | new Date(timestamp * 1000).toLocaleString(); 25 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/src/ui/utils/useStateWithLocalStorage.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | const useStateWithLocalStorage = ( 4 | localStorageKey: string, 5 | defaultValue?: T, 6 | ): [T, React.Dispatch>] => { 7 | const exitingKey = localStorage.getItem(localStorageKey); 8 | 9 | const [value, setValue] = React.useState( 10 | exitingKey === null ? defaultValue : JSON.parse(exitingKey), 11 | ); 12 | 13 | React.useEffect(() => { 14 | localStorage.setItem(localStorageKey, JSON.stringify(value)); 15 | }, [value]); 16 | 17 | return [value, setValue]; 18 | }; 19 | 20 | export default useStateWithLocalStorage; 21 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: '../../../.eslintrc.test.js', 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/test/_setup.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | 15 | require('jest-extended'); 16 | 17 | // @todo extend jest to have "toHaveBeenCalledOnceWith" matcher. 18 | 19 | process.env.NODE_ENV = 'test'; 20 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | "declaration": false 5 | }, 6 | "include": ["./**/*", "../node_modules/jest-extended/types/**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/test/unit/jest.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Lisk Foundation 3 | * 4 | * See the LICENSE file at the top-level directory of this distribution 5 | * for licensing information. 6 | * 7 | * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, 8 | * no part of this software, including this file, may be copied, modified, 9 | * propagated, or distributed except according to the terms contained in the 10 | * LICENSE file. 11 | * 12 | * Removal or modification of this copyright notice is prohibited. 13 | */ 14 | 15 | const base = require('../../jest.config'); 16 | 17 | module.exports = { 18 | ...base, 19 | rootDir: '../../', 20 | testMatch: ['/test/unit/**/*.(spec|test).(js|ts)'], 21 | }; 22 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/test/unit/plugin/__snapshots__/dashboard_plugin.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`DashboardPlugin constructor should load default config 1`] = ` 4 | Object { 5 | "applicationUrl": "ws://localhost:8080/ws", 6 | "host": "127.0.0.1", 7 | "port": 4005, 8 | } 9 | `; 10 | 11 | exports[`DashboardPlugin defaults should return valid config schema with default options 1`] = ` 12 | Object { 13 | "$id": "#/plugins/lns-dashboard/config", 14 | "default": Object { 15 | "applicationUrl": "ws://localhost:8080/ws", 16 | "host": "127.0.0.1", 17 | "port": 4005, 18 | }, 19 | "properties": Object { 20 | "applicationUrl": Object { 21 | "description": "URL to connect", 22 | "format": "uri", 23 | "type": "string", 24 | }, 25 | "host": Object { 26 | "format": "ip", 27 | "type": "string", 28 | }, 29 | "port": Object { 30 | "maximum": 65535, 31 | "minimum": 1, 32 | "type": "integer", 33 | }, 34 | }, 35 | "required": Array [], 36 | "type": "object", 37 | } 38 | `; 39 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns-dashboard-plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist-node", 4 | "jsx": "react", 5 | "forceConsistentCasingInFileNames": true, 6 | "target": "es2019", 7 | "module": "commonjs", 8 | "declaration": true, 9 | "moduleResolution": "node", 10 | "newLine": "lf", 11 | "noFallthroughCasesInSwitch": true, 12 | "noImplicitReturns": true, 13 | "noUnusedLocals": true, 14 | "noUnusedParameters": true, 15 | "pretty": true, 16 | "removeComments": true, 17 | "resolveJsonModule": true, 18 | "sourceMap": true, 19 | "strict": true, 20 | "skipLibCheck": true 21 | }, 22 | "include": ["src/**/*"], 23 | } 24 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.eslintignore: -------------------------------------------------------------------------------- 1 | docs/ 2 | examples/ 3 | **/*.d.ts 4 | jest.config.js 5 | .eslintrc.js 6 | coverage 7 | benchmark 8 | dist 9 | tmp 10 | build 11 | scripts 12 | config -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | ~ 3 | .DS_Store 4 | .project 5 | __MACOSX/ 6 | *.swp 7 | *.swo 8 | ssl/ 9 | tmp/ 10 | 11 | # Build revision file generated while building a release 12 | REVISION 13 | npm-shrinkwrap.json 14 | 15 | # Dependency directories 16 | tsconfig.tsbuildinfo 17 | node_modules/ 18 | 19 | # Docs 20 | docs/jsdoc/ 21 | 22 | # Logs 23 | logs/* 24 | src/logs/ 25 | src/logs.log 26 | logs.log 27 | npm-debug.log 28 | tmux-client-*.log 29 | framework/test/mocha/network/logs/ 30 | stacktrace* 31 | 32 | # IDE directories 33 | .vscode/ 34 | .idea/ 35 | Session.vim 36 | 37 | # Config files 38 | sftp-config.json 39 | framework/test/mocha/network/pm2.network.json 40 | framework/test/mocha/network/configs/ 41 | framework/test/mocha/network/networkTestsLogger.logs 42 | .secrets 43 | 44 | # Coverage directory used by tools like istanbul 45 | .coverage-unit/ 46 | .coverage/ 47 | 48 | # Local config file useful for development 49 | config.local.json 50 | 51 | # Build Directory 52 | dist 53 | 54 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js}": ["prettier --write", "eslint"], 3 | "*.{ts}": ["prettier --write", "eslint"], 4 | "*.{json,md}": ["prettier --write"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.liskrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "commander": { 3 | "version": "5.0.1" 4 | }, 5 | "template": "lisk-ts" 6 | } 7 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diff": true, 3 | "extension": ["ts"], 4 | "recursive": true, 5 | "spec": "test/**/*.ts", 6 | "require": ["ts-node/register", "./test/setup.js"], 7 | "timeout": 10000, 8 | "watch-files": ["src/**/*.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | build/ 3 | docker/ 4 | Dockerfile 5 | docs/ 6 | qa/ 7 | logs/* 8 | package/ 9 | pids/* 10 | release/ 11 | tmp/ 12 | tasks/ 13 | src/ 14 | test/ 15 | Jenkins* 16 | *.sh 17 | *.tgz 18 | tsconfig.json 19 | tslint.json 20 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.npmrc: -------------------------------------------------------------------------------- 1 | message = ":arrow_up: Version %s" 2 | save-exact = true 3 | engine-strict = true 4 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.nvmrc: -------------------------------------------------------------------------------- 1 | 12.20.1 -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.prettierignore: -------------------------------------------------------------------------------- 1 | # Files 2 | Jenkinsfile* 3 | Makefile 4 | Dockerfile 5 | LICENSE 6 | .DS_Store 7 | data/ 8 | .idea 9 | logs/ 10 | 11 | .gitkeep 12 | mocha.opts 13 | 14 | # rc files 15 | .*rc 16 | ## ignore files 17 | .*ignore 18 | 19 | # Ignore extensions 20 | *.png 21 | *.sql 22 | ## jest snapshot 23 | *.snap 24 | *.tsbuildinfo 25 | 26 | # project specific paths 27 | test/.coverage-unit/ 28 | helm 29 | build/ 30 | dist/ 31 | docker/.env* 32 | qa/ 33 | bin 34 | tmp/ 35 | 36 | *.pid 37 | *.gz 38 | 39 | docker/* 40 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "useTabs": true, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 12.22.1 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('@oclif/command') 4 | .run() 5 | .then(require('@oclif/command/flush')) 6 | .catch(require('@oclif/errors/handle')); 7 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/config/default/password.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultPassword": "allow acid sort limb april differ work screen nuclear matrix bicycle impose" 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/scripts: -------------------------------------------------------------------------------- 1 | ../../scripts -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/@types/eth-ens-namehash/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'eth-ens-namehash' { 2 | export function hash(domain: string): string; 3 | export function normalize(input: string): string; 4 | } 5 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import { Application, PartialApplicationConfig, utils } from 'lisk-sdk'; 2 | import { registerModules } from './modules'; 3 | import { registerPlugins } from './plugins'; 4 | 5 | export const getApplication = ( 6 | genesisBlock: Record, 7 | config: PartialApplicationConfig, 8 | ): Application => { 9 | const app = Application.defaultApplication(genesisBlock, config); 10 | 11 | registerModules(app); 12 | registerPlugins(app); 13 | 14 | return app; 15 | }; 16 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/index.ts: -------------------------------------------------------------------------------- 1 | export default {}; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'lisk-sdk'; 2 | import { LnsModule } from './modules/lns/lns_module'; 3 | 4 | // eslint-disable-next-line @typescript-eslint/no-empty-function 5 | export const registerModules = (_app: Application): void => { 6 | _app.registerModule(LnsModule); 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns/src/app/modules/.gitkeep -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/assets/reverse_lookup.ts: -------------------------------------------------------------------------------- 1 | import { ApplyAssetContext, BaseAsset } from 'lisk-sdk'; 2 | import { LNSAccountProps, ReverseLookupAssetProps, reverseLookupAssetPropsSchema } from '../data'; 3 | import { getNodeForName } from '../storage'; 4 | 5 | export class ReverseLookupAsset extends BaseAsset { 6 | public name = 'reverse-lookup'; 7 | public id = 2; 8 | 9 | // Define schema for asset 10 | public schema = reverseLookupAssetPropsSchema; 11 | 12 | // eslint-disable-next-line class-methods-use-this 13 | public async apply({ 14 | asset, 15 | stateStore, 16 | transaction, 17 | }: ApplyAssetContext): Promise { 18 | const node = getNodeForName(asset.name); 19 | const sender = await stateStore.account.get(transaction.senderAddress); 20 | 21 | const exists = sender.lns.ownNodes.find(n => n.equals(node)); 22 | 23 | if (!exists) { 24 | throw new Error('You can only assign lookup node which you own.'); 25 | } 26 | 27 | sender.lns.reverseLookup = node; 28 | await stateStore.account.set(sender.address, sender); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/constants.ts: -------------------------------------------------------------------------------- 1 | export const LNS_PREFIX = 'LNS'; 2 | export const MIN_TTL_VALUE = 60 * 60; // 1 hour 3 | export const VALID_TLDS = ['lsk']; 4 | export const EMPTY_BUFFER = Buffer.alloc(0); 5 | export const CNAME_RECORD_TYPE = 1; 6 | export const TXT_RECORD_TYPE = 2; 7 | export const VALID_RECORD_TYPES = [CNAME_RECORD_TYPE, TXT_RECORD_TYPE]; 8 | export const MAX_RECORDS = 50; 9 | export const MIN_RECORD_LABEL_LENGTH = 3; 10 | export const MAX_RECORD_LABEL_LENGTH = 15; 11 | export const MIN_RECORD_VALUE_LENGTH = 3; 12 | export const MAX_RECORD_VALUE_LENGTH = 255; 13 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/account_props.ts: -------------------------------------------------------------------------------- 1 | import { EMPTY_BUFFER } from "../constants"; 2 | 3 | export interface LNSAccountProps { 4 | lns: { 5 | ownNodes: Buffer[]; 6 | reverseLookup: Buffer; 7 | }; 8 | } 9 | 10 | export const lsnAccountPropsSchema = { 11 | $id: 'lisk/lns/lnsAccount', 12 | type: 'object', 13 | required: ['ownNodes', 'reverseLookup'], 14 | properties: { 15 | reverseLookup: { 16 | dataType: 'bytes', 17 | fieldNumber: 1, 18 | }, 19 | ownNodes: { 20 | type: 'array', 21 | fieldNumber: 2, 22 | items: { 23 | dataType: 'bytes', 24 | }, 25 | }, 26 | }, 27 | default: { 28 | ownNodes: [], 29 | reverseLookup: EMPTY_BUFFER, 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/assets/register.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterAssetProps { 2 | name: string; 3 | ttl: number; 4 | registerFor: number; 5 | } 6 | 7 | export const registerAssetPropsSchema = { 8 | $id: 'lns/assets/register', 9 | title: 'RegisterAsset transaction asset for lns module', 10 | type: 'object', 11 | required: ['name', 'ttl', 'registerFor'], 12 | properties: { 13 | name: { 14 | dataType: 'string', 15 | fieldNumber: 1, 16 | }, 17 | ttl: { 18 | dataType: 'uint32', 19 | fieldNumber: 2, 20 | }, 21 | registerFor: { 22 | dataType: 'uint32', 23 | fieldNumber: 3, 24 | }, 25 | }, 26 | } -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/assets/reverse_lookup.ts: -------------------------------------------------------------------------------- 1 | export interface ReverseLookupAssetProps { 2 | name: string; 3 | } 4 | 5 | export const reverseLookupAssetPropsSchema = { 6 | $id: 'lns/assets/set-lookup', 7 | title: 'SetLookup transaction asset for lns module', 8 | type: 'object', 9 | required: ['name'], 10 | properties: { 11 | name: { 12 | dataType: 'string', 13 | fieldNumber: 1, 14 | }, 15 | }, 16 | } -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/assets/update_records.ts: -------------------------------------------------------------------------------- 1 | import { LNSNodeRecord, lnsNodeRecordSchema } from "../lns_node_record"; 2 | 3 | export interface UpdateRecordsAssetProps { 4 | name: string; 5 | records: LNSNodeRecord[]; 6 | } 7 | 8 | export const updateRecordsAssetPropsSchema = { 9 | $id: 'lns/assets/update-records', 10 | title: 'Update Records transaction asset for lns module', 11 | type: 'object', 12 | required: ['records'], 13 | properties: { 14 | name: { 15 | dataType: 'string', 16 | fieldNumber: 1, 17 | }, 18 | records: { 19 | type: 'array', 20 | fieldNumber: 2, 21 | items: { 22 | ...lnsNodeRecordSchema, 23 | }, 24 | } 25 | }, 26 | } -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/index.ts: -------------------------------------------------------------------------------- 1 | export * from './account_props' 2 | export * from './lns_node' 3 | export * from './lns_node_record' 4 | export * from './assets/register' 5 | export * from './assets/reverse_lookup' 6 | export * from './assets/update_records' -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/data/lns_node_record.ts: -------------------------------------------------------------------------------- 1 | export interface LNSNodeRecord { 2 | type: number; 3 | label: string; 4 | value: string; 5 | } 6 | 7 | export type LNSNodeRecordJSON = LNSNodeRecord; 8 | 9 | export const lnsNodeRecordSchema = { 10 | $id: 'lisk/lns/lnsNodeRecord', 11 | type: 'object', 12 | required: ['type', 'label', 'value'], 13 | properties: { 14 | type: { 15 | dataType: 'uint32', 16 | fieldNumber: 1, 17 | }, 18 | label: { 19 | dataType: 'string', 20 | fieldNumber: 2, 21 | }, 22 | value: { 23 | dataType: 'string', 24 | fieldNumber: 3, 25 | } 26 | }, 27 | }; -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/modules/lns/utils.ts: -------------------------------------------------------------------------------- 1 | import { LNSNode } from './data'; 2 | 3 | export const isExpired = (node: LNSNode): boolean => { 4 | const currentTime = Math.ceil(new Date().getTime() / 1000); 5 | 6 | return currentTime > node.expiry; 7 | }; 8 | 9 | export const isTTLPassed = (node: LNSNode): boolean => { 10 | const currentTime = Math.ceil(new Date().getTime() / 1000); 11 | const validUpdateTime = node.updatedAt + node.ttl; 12 | 13 | return currentTime > validUpdateTime; 14 | }; 15 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/plugins.ts: -------------------------------------------------------------------------------- 1 | import { Application, ForgerPlugin, HTTPAPIPlugin } from 'lisk-sdk'; 2 | import { LNSDashboardPlugin } from 'lns-dashboard-plugin'; 3 | import { DashboardPlugin } from "@liskhq/lisk-framework-dashboard-plugin"; 4 | import { FaucetPlugin } from "@liskhq/lisk-framework-faucet-plugin"; 5 | 6 | export const registerPlugins = (app: Application): void => { 7 | app.registerPlugin(HTTPAPIPlugin); 8 | app.registerPlugin(ForgerPlugin); 9 | app.registerPlugin(DashboardPlugin); 10 | app.registerPlugin(FaucetPlugin); 11 | app.registerPlugin(LNSDashboardPlugin); 12 | 13 | app.overridePluginOptions(LNSDashboardPlugin.alias, { 14 | applicationUrl: `ws://localhost:${app.config.rpc.port}/ws`, 15 | port: 8000, 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/app/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns/src/app/plugins/.gitkeep -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/account/create.ts: -------------------------------------------------------------------------------- 1 | export { AccountCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/account/get.ts: -------------------------------------------------------------------------------- 1 | export { AccountGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/account/show.ts: -------------------------------------------------------------------------------- 1 | export { AccountShowCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/account/validate.ts: -------------------------------------------------------------------------------- 1 | export { AccountValidateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/block/get.ts: -------------------------------------------------------------------------------- 1 | export { BlockGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/blockchain/export.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/blockchain/hash.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainHashCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/blockchain/import.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/blockchain/reset.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainResetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/config/create.ts: -------------------------------------------------------------------------------- 1 | export { ConfigCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/config/show.ts: -------------------------------------------------------------------------------- 1 | export { ConfigShowCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/console.ts: -------------------------------------------------------------------------------- 1 | export { ConsoleCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forger-info/export.ts: -------------------------------------------------------------------------------- 1 | export { ForgerInfoExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forger-info/import.ts: -------------------------------------------------------------------------------- 1 | export { ForgerInfoImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forging/config.ts: -------------------------------------------------------------------------------- 1 | export { ForgingConfigCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forging/disable.ts: -------------------------------------------------------------------------------- 1 | export { ForgingDisableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forging/enable.ts: -------------------------------------------------------------------------------- 1 | export { ForgingEnableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/forging/status.ts: -------------------------------------------------------------------------------- 1 | export { ForgingStatusCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/genesis-block/create.ts: -------------------------------------------------------------------------------- 1 | import { BaseGenesisBlockCommand } from 'lisk-commander'; 2 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 3 | import { getApplication } from '../../app/app'; 4 | 5 | export class GenesisBlockCommand extends BaseGenesisBlockCommand { 6 | public getApplication( 7 | genesisBlock: Record, 8 | config: PartialApplicationConfig, 9 | ): Application { 10 | const app = getApplication(genesisBlock, config); 11 | return app; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/hash-onion.ts: -------------------------------------------------------------------------------- 1 | export { HashOnionCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/lns/lookup.ts: -------------------------------------------------------------------------------- 1 | import { BaseIPCClientCommand } from 'lisk-commander'; 2 | 3 | export class LNSLookupCommand extends BaseIPCClientCommand { 4 | static args = [ 5 | { 6 | name: 'address', 7 | required: true, 8 | description: 'Address to lookup', 9 | }, 10 | ]; 11 | 12 | static examples = ['lns:lookup ', 'lns:lookup afe179fa12a988c1244444479c --pretty']; 13 | 14 | public async run(): Promise { 15 | const { args } = this.parse(LNSLookupCommand); 16 | const { address } = args as { address: string }; 17 | 18 | if (address !== Buffer.from(address, 'hex').toString('hex')) { 19 | this.error('Invalid address format'); 20 | } 21 | 22 | const result = await this._client?.invoke('lns:lookupAddress', { address }); 23 | 24 | if (result) { 25 | return this.printJSON(result); 26 | } 27 | 28 | return this.log(`Can not find account with address "${address}"`); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/lns/resolve.ts: -------------------------------------------------------------------------------- 1 | import { BaseIPCClientCommand } from 'lisk-commander'; 2 | 3 | export class LNSResolveCommand extends BaseIPCClientCommand { 4 | static args = [ 5 | { 6 | name: 'name', 7 | required: true, 8 | description: 'Name to resolve.', 9 | }, 10 | ]; 11 | 12 | static examples = ['lns:resolve jhon.lisk', 'lns:resolve jhon.lisk --pretty']; 13 | 14 | public async run(): Promise { 15 | const { args } = this.parse(LNSResolveCommand); 16 | const { name } = args as { name: string }; 17 | 18 | const result = await this._client?.invoke('lns:resolveName', { name }); 19 | 20 | if (result) { 21 | return this.printJSON(result); 22 | } 23 | 24 | return this.log(`Can not resolve name "${name}"`); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/node/info.ts: -------------------------------------------------------------------------------- 1 | export { NodeInfoCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/passphrase/decrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseDecryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/passphrase/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/transaction/create.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | import { TransactionCreateCommand } from 'lisk-commander'; 3 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 4 | import { getApplication } from '../../app/app'; 5 | 6 | type CreateFlags = typeof TransactionCreateCommand.flags & { 7 | [key: string]: Record; 8 | }; 9 | 10 | export class CreateCommand extends TransactionCreateCommand { 11 | static flags: CreateFlags = { 12 | ...TransactionCreateCommand.flags, 13 | }; 14 | 15 | static args = [...TransactionCreateCommand.args]; 16 | 17 | public getApplication( 18 | genesisBlock: Record, 19 | config: PartialApplicationConfig, 20 | ): Application { 21 | const app = getApplication(genesisBlock, config); 22 | return app; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/transaction/get.ts: -------------------------------------------------------------------------------- 1 | export { TransactionGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/transaction/send.ts: -------------------------------------------------------------------------------- 1 | export { TransactionSendCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/src/commands/transaction/sign.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | import { TransactionSignCommand } from 'lisk-commander'; 3 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 4 | import { getApplication } from '../../app/app'; 5 | 6 | type SignFlags = typeof TransactionSignCommand.flags & { [key: string]: Record }; 7 | 8 | export class SignCommand extends TransactionSignCommand { 9 | static flags: SignFlags = { 10 | ...TransactionSignCommand.flags, 11 | }; 12 | 13 | static args = [...TransactionSignCommand.args]; 14 | 15 | public getApplication( 16 | genesisBlock: Record, 17 | config: PartialApplicationConfig, 18 | ): Application { 19 | const app = getApplication(genesisBlock, config); 20 | return app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['../.eslintrc.js', 'lisk-base/ts-jest'], 3 | rules: { 4 | 'arrow-body-style': 'off', 5 | 'dot-notation': 'off', 6 | '@typescript-eslint/explicit-function-return-type': 'off', 7 | '@typescript-eslint/no-magic-numbers': 'off', 8 | '@typescript-eslint/unbound-method': 'off', 9 | '@typescript-eslint/no-require-imports': 'off', 10 | '@typescript-eslint/no-explicit-any': 'off', 11 | '@typescript-eslint/no-unsafe-assignment': 'off', 12 | '@typescript-eslint/no-unsafe-member-access': 'off', 13 | '@typescript-eslint/no-unsafe-call': 'off', 14 | '@typescript-eslint/no-unsafe-return': 'off', 15 | }, 16 | parserOptions: { 17 | project: './tsconfig.json', 18 | tsconfigRootDir: __dirname, 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/_setup.js: -------------------------------------------------------------------------------- 1 | require('jest-extended'); 2 | 3 | process.env.NODE_ENV = 'test'; 4 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns/test/integration/.gitkeep -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/network/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns/test/network/.gitkeep -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "../" 5 | }, 6 | "include": ["../src/**/*", "./**/*", "../package.json", "../config/**/*.json"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/unit/modules/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/lisk-name-service/lns/test/unit/modules/.gitkeep -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/unit/modules/lns/assets/__snapshots__/register.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`RegisterAsset constructor should have valid schema 1`] = ` 4 | Object { 5 | "$id": "lns/assets/register", 6 | "properties": Object { 7 | "name": Object { 8 | "dataType": "string", 9 | "fieldNumber": 1, 10 | }, 11 | "registerFor": Object { 12 | "dataType": "uint32", 13 | "fieldNumber": 3, 14 | }, 15 | "ttl": Object { 16 | "dataType": "uint32", 17 | "fieldNumber": 2, 18 | }, 19 | }, 20 | "required": Array [ 21 | "name", 22 | "ttl", 23 | "registerFor", 24 | ], 25 | "title": "RegisterAsset transaction asset for lns module", 26 | "type": "object", 27 | } 28 | `; 29 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/unit/modules/lns/assets/__snapshots__/reverse_lookup.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ReverseLookupAsset constructor should have valid schema 1`] = ` 4 | Object { 5 | "$id": "lns/assets/set-lookup", 6 | "properties": Object { 7 | "name": Object { 8 | "dataType": "string", 9 | "fieldNumber": 1, 10 | }, 11 | }, 12 | "required": Array [ 13 | "name", 14 | ], 15 | "title": "SetLookup transaction asset for lns module", 16 | "type": "object", 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/test/utils/config.ts: -------------------------------------------------------------------------------- 1 | import * as Config from '@oclif/config'; 2 | 3 | import pJSON = require('../../package.json'); 4 | 5 | export const getConfig = async (): Promise => { 6 | const config = await Config.load(); 7 | config.pjson.lisk = { addressPrefix: 'lsk' }; 8 | config.pjson.version = pJSON.version; 9 | return config; 10 | }; 11 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/lns/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "target": "es2019", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "newLine": "lf", 8 | "importHelpers": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "noImplicitReturns": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "pretty": true, 14 | "removeComments": true, 15 | "resolveJsonModule": true, 16 | "sourceMap": true, 17 | "strict": true, 18 | "composite": true, 19 | "declaration": true, 20 | "noImplicitAny": false, 21 | "rootDir": "./src", 22 | "outDir": "./dist" 23 | }, 24 | "include": ["./src/**/*.ts", "./src/**/*.json"] 25 | } 26 | -------------------------------------------------------------------------------- /tutorials/lisk-name-service/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "lockfileVersion": 1 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/nft/blockchain_app/.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://npm.lisk.io -------------------------------------------------------------------------------- /tutorials/nft/blockchain_app/.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 12.18.4 2 | -------------------------------------------------------------------------------- /tutorials/nft/blockchain_app/nft_module/index.js: -------------------------------------------------------------------------------- 1 | const { BaseModule } = require("lisk-sdk"); 2 | const { getAllNFTTokensAsJSON } = require("./nft"); 3 | 4 | const CreateNFTAsset = require("./transactions/create_nft_asset"); 5 | const PurchaseNFTAsset = require("./transactions/purchase_nft_asset"); 6 | const TransferNFTAsset = require("./transactions/transfer_nft_asset"); 7 | 8 | // Extend base module to implement your custom module 9 | class NFTModule extends BaseModule { 10 | name = "nft"; 11 | id = 1024; 12 | accountSchema = { 13 | type: "object", 14 | required: ["ownNFTs"], 15 | properties: { 16 | ownNFTs: { 17 | type: "array", 18 | fieldNumber: 1, 19 | items: { 20 | dataType: "bytes", 21 | }, 22 | }, 23 | }, 24 | default: { 25 | ownNFTs: [], 26 | }, 27 | }; 28 | transactionAssets = [new CreateNFTAsset(), new PurchaseNFTAsset(), new TransferNFTAsset()]; 29 | actions = { 30 | // get all the registered NFT tokens from blockchain 31 | getAllNFTTokens: async () => getAllNFTTokensAsJSON(this._dataAccess), 32 | }; 33 | } 34 | 35 | module.exports = { NFTModule }; 36 | -------------------------------------------------------------------------------- /tutorials/nft/blockchain_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lisk-nft-demo", 3 | "version": "1.0.0", 4 | "description": "A blockchain demo app for creating NFT tokens", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Lisk Foundation , lightcurve GmbH ", 10 | "keywords": [ 11 | "lisk", 12 | "blockchain" 13 | ], 14 | "license": "Apache-2.0", 15 | "dependencies": { 16 | "cors": "^2.8.5", 17 | "express": "^4.17.3", 18 | "lisk-sdk": "^5.2.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://npm.lisk.io -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 12.18.4 2 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nft_frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@liskhq/lisk-client": "^5.0.3", 7 | "@material-ui/core": "^4.11.0", 8 | "@testing-library/jest-dom": "^4.2.4", 9 | "@testing-library/react": "^9.3.2", 10 | "@testing-library/user-event": "^7.1.2", 11 | "react": "^16.13.1", 12 | "react-dom": "^16.13.1", 13 | "react-router-dom": "^5.2.0", 14 | "react-scripts": "5.0.1" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": "react-app", 24 | "globals": { 25 | "BigInt": true 26 | } 27 | }, 28 | "browserslist": { 29 | "production": [ 30 | ">0.2%", 31 | "not dead", 32 | "not op_mini all" 33 | ], 34 | "development": [ 35 | "last 1 chrome version", 36 | "last 1 firefox version", 37 | "last 1 safari version" 38 | ] 39 | }, 40 | "devDependencies": { 41 | "@material-ui/icons": "^4.9.1", 42 | "@material-ui/lab": "^4.0.0-alpha.56" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/nft/frontend_app/public/favicon.ico -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/nft/frontend_app/public/logo192.png -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/nft/frontend_app/public/logo512.png -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/components/AccountPage.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment, useEffect, useState } from "react"; 2 | import { useParams } from "react-router-dom"; 3 | import { fetchAccountInfo } from "../api"; 4 | import Account from "./Account"; 5 | import { cryptography } from "@liskhq/lisk-client"; 6 | 7 | 8 | function AccountPage() { 9 | const { address } = useParams(); 10 | const [account, setAccount] = useState({}); 11 | const [loaded, setLoaded] = useState(false); 12 | 13 | useEffect(() => { 14 | async function fetchData() { 15 | const binaryAddress = cryptography.getAddressFromBase32Address(address).toString('hex'); 16 | setAccount(await fetchAccountInfo(binaryAddress)); 17 | setLoaded(true); 18 | } 19 | 20 | fetchData(); 21 | }, [address]); 22 | 23 | return loaded ? : ; 24 | } 25 | 26 | export default AccountPage; 27 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/components/HomePage.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment, useEffect, useState } from "react"; 2 | import NFTToken from "./NFTToken"; 3 | import { Grid } from "@material-ui/core"; 4 | import { fetchAllNFTTokens } from "../api"; 5 | 6 | function HomePage() { 7 | const [NFTAccounts, setNFTAccounts] = useState([]); 8 | 9 | useEffect(() => { 10 | async function fetchData() { 11 | setNFTAccounts(await fetchAllNFTTokens()); 12 | } 13 | fetchData(); 14 | }, []); 15 | 16 | return ( 17 | 18 | 19 | {NFTAccounts.map((item) => ( 20 | 21 | 22 | 23 | ))} 24 | 25 | 26 | ); 27 | } 28 | 29 | export default HomePage; 30 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/context/index.js: -------------------------------------------------------------------------------- 1 | /* global BigInt */ 2 | 3 | import React from "react"; 4 | 5 | export const nodeInfoContextDefaultValue = { networkIdentifier: "", genesisConfig: { minFeePerByte: BigInt(0) }, height: 0 }; 6 | export const NodeInfoContext = React.createContext({ ...nodeInfoContextDefaultValue }); 7 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/fixture.txt: -------------------------------------------------------------------------------- 1 | ------------------------------ARTIST(Leonardo da Vinci)-------------------------------------------- 2 | 3 | "passphrase": "demand hungry surface wear pond great economy essence occur crowd leave large" 4 | 5 | "binaryAddress": "eee694bc9a6f5ca064cf1e6b99e3b93d63996d79", 6 | 7 | ------------------------------collector1(MANU)-------------------------------------------- 8 | 9 | "passphrase": "fruit session repair run noise brush turkey glue whale fame spice example" 10 | 11 | "binaryAddress": "4189dd498ea5d119dfa9dad1c35fb3170a5ec0eb", 12 | 13 | ------------------------------collector1(SHU)------------------------------------------ 14 | 15 | "passphrase": "defense audit accuse evoke mass helmet end scatter people lecture title void", 16 | "binaryAddress": "5f01ca377ff3c82b1a143202779915cd305b7bc8", 17 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('root') 10 | ); 11 | 12 | // If you want your app to work offline and load faster, you can change 13 | // unregister() to register() below. Note this comes with some pitfalls. 14 | // Learn more about service workers: https://bit.ly/CRA-PWA 15 | serviceWorker.unregister(); 16 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /tutorials/nft/frontend_app/src/utils/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/nft/frontend_app/src/utils/index.js -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.eslintignore: -------------------------------------------------------------------------------- 1 | docs/ 2 | examples/ 3 | **/*.d.ts 4 | jest.config.js 5 | .eslintrc.js 6 | coverage 7 | benchmark 8 | dist 9 | tmp 10 | build 11 | scripts 12 | config -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | extends: ['lisk-base/ts'], 8 | }; 9 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | ~ 3 | .DS_Store 4 | .project 5 | __MACOSX/ 6 | *.swp 7 | *.swo 8 | ssl/ 9 | tmp/ 10 | 11 | # Build revision file generated while building a release 12 | REVISION 13 | npm-shrinkwrap.json 14 | 15 | # Dependency directories 16 | tsconfig.tsbuildinfo 17 | node_modules/ 18 | 19 | # Docs 20 | docs/jsdoc/ 21 | 22 | # Logs 23 | logs/* 24 | logs.log 25 | npm-debug.log 26 | tmux-client-*.log 27 | stacktrace* 28 | 29 | # IDE directories 30 | .vscode/ 31 | .idea/ 32 | Session.vim 33 | 34 | # Config files 35 | sftp-config.json 36 | .secrets 37 | 38 | # Coverage directory used by tools like istanbul 39 | .coverage/ 40 | 41 | # Local config file useful for development 42 | config.local.json 43 | 44 | # Build Directory 45 | dist 46 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js}": ["prettier --write", "eslint"], 3 | "*.{ts}": ["prettier --write", "eslint"], 4 | "*.{json,md}": ["prettier --write"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.liskrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "commander": { 3 | "version": "5.1.10" 4 | }, 5 | "template": "lisk-ts" 6 | } 7 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.prettierignore: -------------------------------------------------------------------------------- 1 | # Files 2 | Jenkinsfile* 3 | Makefile 4 | Dockerfile 5 | LICENSE 6 | .DS_Store 7 | data/ 8 | .idea 9 | logs/ 10 | 11 | .gitkeep 12 | 13 | # rc files 14 | .*rc 15 | 16 | ## ignore files 17 | .*ignore 18 | 19 | # Ignore extensions 20 | *.png 21 | *.sql 22 | 23 | ## jest snapshot 24 | *.snap 25 | *.tsbuildinfo 26 | 27 | # project specific paths 28 | dist/ 29 | bin 30 | tmp/ 31 | 32 | *.pid 33 | *.gz 34 | 35 | docker/* 36 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "useTabs": true, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('@oclif/command') 4 | .run() 5 | .then(require('@oclif/command/flush')) 6 | .catch(require('@oclif/errors/handle')); 7 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/config/default/genesis_block.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/blockchain-client/config/default/genesis_block.blob -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/config/default/passphrase.json: -------------------------------------------------------------------------------- 1 | { 2 | "passphrase": "economy cliff diamond van multiply general visa picture actor teach cruel tree adjust quit maid hurry fence peace glare library curve soap cube must" 3 | } 4 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 2 | import { registerModules } from './modules'; 3 | import { registerPlugins } from './plugins'; 4 | 5 | export const getApplication = (config: PartialApplicationConfig): Application => { 6 | const { app } = Application.defaultApplication(config, true); 7 | 8 | registerModules(app); 9 | registerPlugins(app); 10 | 11 | return app; 12 | }; 13 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/index.ts: -------------------------------------------------------------------------------- 1 | export default {}; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-empty-function */ 2 | import { Application } from 'lisk-sdk'; 3 | // import { PinModule } from "./modules/pin/pin_module"; 4 | import { PostModule } from './modules/post/post_module'; 5 | 6 | export const registerModules = (app: Application): void => { 7 | app.registerModule(new PostModule()); 8 | }; 9 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules/post/method.ts: -------------------------------------------------------------------------------- 1 | import { BaseMethod } from 'lisk-sdk'; 2 | 3 | export class PostMethod extends BaseMethod {} 4 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules/post/stores/account.ts: -------------------------------------------------------------------------------- 1 | import { NotFoundError } from '@liskhq/lisk-chain'; 2 | import { BaseStore, ImmutableStoreGetter } from 'lisk-sdk'; 3 | import { PostboardAccount } from '../types'; 4 | import { accountSchema } from '../schemas'; 5 | 6 | export class AccountStore extends BaseStore { 7 | public schema = accountSchema; 8 | 9 | public async getOrDefault( 10 | context: ImmutableStoreGetter, 11 | address: Buffer, 12 | ): Promise { 13 | try { 14 | const authAccount = await this.get(context, address); 15 | return authAccount; 16 | } catch (error) { 17 | if (!(error instanceof NotFoundError)) { 18 | throw error; 19 | } 20 | 21 | return { 22 | address, 23 | post: { 24 | following: [], 25 | followers: [], 26 | posts: [], 27 | replies: [], 28 | likes: [], 29 | }, 30 | }; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules/post/stores/all_posts.ts: -------------------------------------------------------------------------------- 1 | import { BaseStore, ImmutableStoreGetter, StoreGetter } from 'lisk-sdk'; 2 | import { allPostsSchema } from '../schemas'; 3 | import { AllPosts } from '../types'; 4 | 5 | const DEFAULT_KEY = Buffer.alloc(0); 6 | 7 | export class AllPostsStore extends BaseStore { 8 | public schema = allPostsSchema; 9 | 10 | public async getAllPosts(context: ImmutableStoreGetter): Promise { 11 | if (!(await this.has(context, DEFAULT_KEY))) { 12 | return { 13 | posts: [], 14 | }; 15 | } 16 | return this.get(context, DEFAULT_KEY); 17 | } 18 | 19 | public async setAllPosts(context: StoreGetter, posts: AllPosts) { 20 | return this.set(context, DEFAULT_KEY, posts); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules/post/stores/post.ts: -------------------------------------------------------------------------------- 1 | import { BaseStore } from 'lisk-sdk'; 2 | import { postSchema } from '../schemas'; 3 | 4 | export interface Post { 5 | id: string; 6 | content: string; 7 | date: number; 8 | author: Buffer; 9 | replies: { 10 | author: Buffer; 11 | date: number; 12 | content: string; 13 | }[]; 14 | reposts: Buffer[]; 15 | likes: Buffer[]; 16 | } 17 | 18 | export class PostStore extends BaseStore { 19 | public schema = postSchema; 20 | } 21 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/modules/post/utils.ts: -------------------------------------------------------------------------------- 1 | import { cryptography } from 'lisk-sdk'; 2 | import { Post, PostJSON } from './types'; 3 | 4 | export const stringifyPost = (post: Post): PostJSON => 5 | ({ 6 | author: cryptography.address.getLisk32AddressFromAddress(post.author), 7 | content: post.content, 8 | date: post.date, 9 | id: post.id, 10 | likes: post.likes.map(l => cryptography.address.getLisk32AddressFromAddress(l)), 11 | replies: post.replies.map(r => ({ 12 | ...r, 13 | author: cryptography.address.getLisk32AddressFromAddress(r.author), 14 | })), 15 | reposts: post.reposts.map(p => cryptography.address.getLisk32AddressFromAddress(p)), 16 | } as PostJSON); 17 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/plugins.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-empty-function */ 2 | import { Application } from 'lisk-sdk'; 3 | 4 | export const registerPlugins = (_app: Application): void => { 5 | // app.registerPlugin(DashboardPlugin); 6 | // app.registerPlugin(UserTrackerPlugin); 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/app/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/blockchain-client/src/app/plugins/.gitkeep -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/block/get.ts: -------------------------------------------------------------------------------- 1 | export { BlockGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/blockchain/export.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/blockchain/hash.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainHashCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/blockchain/import.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/blockchain/reset.ts: -------------------------------------------------------------------------------- 1 | export { BlockchainResetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/config/create.ts: -------------------------------------------------------------------------------- 1 | export { ConfigCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/config/show.ts: -------------------------------------------------------------------------------- 1 | export { ConfigShowCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/console.ts: -------------------------------------------------------------------------------- 1 | export { ConsoleCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/endpoint/invoke.ts: -------------------------------------------------------------------------------- 1 | export { InvokeCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/endpoint/list.ts: -------------------------------------------------------------------------------- 1 | export { ListCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/generator/disable.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorDisableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/generator/enable.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorEnableCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/generator/export.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/generator/import.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/generator/status.ts: -------------------------------------------------------------------------------- 1 | export { GeneratorStatusCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/genesis-block/create.ts: -------------------------------------------------------------------------------- 1 | import { BaseGenesisBlockCommand } from 'lisk-commander'; 2 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 3 | import { join } from 'path'; 4 | import { getApplication } from '../../app/app'; 5 | 6 | export class GenesisBlockCommand extends BaseGenesisBlockCommand { 7 | public getApplication(config: PartialApplicationConfig): Application { 8 | const app = getApplication(config); 9 | return app; 10 | } 11 | 12 | public getApplicationConfigDir(): string { 13 | return join(__dirname, '../../../config'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/hash-onion.ts: -------------------------------------------------------------------------------- 1 | export { HashOnionCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/keys/create.ts: -------------------------------------------------------------------------------- 1 | export { KeysCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/keys/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { KeysEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/keys/export.ts: -------------------------------------------------------------------------------- 1 | export { KeysExportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/keys/import.ts: -------------------------------------------------------------------------------- 1 | export { KeysImportCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/message/decrypt.ts: -------------------------------------------------------------------------------- 1 | export { MessageDecryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/message/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { MessageEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/message/sign.ts: -------------------------------------------------------------------------------- 1 | export { MessageSignCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/message/verify.ts: -------------------------------------------------------------------------------- 1 | export { MessageVerifyCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/passphrase/create.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseCreateCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/passphrase/decrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseDecryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/passphrase/encrypt.ts: -------------------------------------------------------------------------------- 1 | export { PassphraseEncryptCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/system/metadata.ts: -------------------------------------------------------------------------------- 1 | export { NodeMetadataCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/system/node-info.ts: -------------------------------------------------------------------------------- 1 | export { NodeInfoCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/transaction/create.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | /* eslint-disable @typescript-eslint/explicit-member-accessibility */ 3 | import { TransactionCreateCommand } from 'lisk-commander'; 4 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 5 | import { getApplication } from '../../app/app'; 6 | 7 | type CreateFlags = typeof TransactionCreateCommand.flags & { 8 | [key: string]: Record; 9 | }; 10 | 11 | export class CreateCommand extends TransactionCreateCommand { 12 | static flags: CreateFlags = { 13 | ...TransactionCreateCommand.flags, 14 | }; 15 | 16 | static args = [...TransactionCreateCommand.args]; 17 | 18 | public getApplication(config: PartialApplicationConfig): Application { 19 | const app = getApplication(config); 20 | return app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/transaction/get.ts: -------------------------------------------------------------------------------- 1 | export { TransactionGetCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/transaction/send.ts: -------------------------------------------------------------------------------- 1 | export { TransactionSendCommand } from 'lisk-commander'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/src/commands/transaction/sign.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable class-methods-use-this */ 2 | /* eslint-disable @typescript-eslint/explicit-member-accessibility */ 3 | import { TransactionSignCommand } from 'lisk-commander'; 4 | import { Application, PartialApplicationConfig } from 'lisk-sdk'; 5 | import { getApplication } from '../../app/app'; 6 | 7 | type SignFlags = typeof TransactionSignCommand.flags & { [key: string]: Record }; 8 | 9 | export class SignCommand extends TransactionSignCommand { 10 | static flags: SignFlags = { 11 | ...TransactionSignCommand.flags, 12 | }; 13 | 14 | static args = [...TransactionSignCommand.args]; 15 | 16 | public getApplication(config: PartialApplicationConfig): Application { 17 | const app = getApplication(config); 18 | return app; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['lisk-base/ts-jest'], 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/_setup.js: -------------------------------------------------------------------------------- 1 | require('jest-extended'); 2 | 3 | process.env.NODE_ENV = 'test'; 4 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/blockchain-client/test/integration/.gitkeep -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/network/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/blockchain-client/test/network/.gitkeep -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "../" 5 | }, 6 | "include": ["../src/**/*", "./**/*", "../package.json", "../config/**/*.json"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/blockchain-client/test/unit/modules/.gitkeep -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/assets/create_post_asset.spec.ts: -------------------------------------------------------------------------------- 1 | import { CreatePostAsset } from '../../../../../src/app/modules/post/assets/create_post_asset'; 2 | 3 | describe('CreatePostAsset', () => { 4 | let transactionAsset: CreatePostAsset; 5 | 6 | beforeEach(() => { 7 | transactionAsset = new CreatePostAsset(); 8 | }); 9 | 10 | describe('constructor', () => { 11 | it('should have valid id', () => { 12 | expect(transactionAsset.id).toEqual(0); 13 | }); 14 | 15 | it('should have valid name', () => { 16 | expect(transactionAsset.name).toEqual('createPost'); 17 | }); 18 | 19 | it('should have valid schema', () => { 20 | expect(transactionAsset.schema).toMatchSnapshot(); 21 | }); 22 | }); 23 | 24 | describe('validate', () => { 25 | describe('schema validation', () => { 26 | it.todo('should throw errors for invalid schema'); 27 | it.todo('should be ok for valid schema'); 28 | }); 29 | }); 30 | 31 | describe('apply', () => { 32 | describe('valid cases', () => { 33 | it.todo('should update the state store'); 34 | }); 35 | 36 | describe('invalid cases', () => { 37 | it.todo('should throw error'); 38 | }); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/assets/follow_asset.spec.ts: -------------------------------------------------------------------------------- 1 | import { FollowAsset } from '../../../../../src/app/modules/post/assets/follow_asset'; 2 | 3 | describe('FollowAsset', () => { 4 | let transactionAsset: FollowAsset; 5 | 6 | beforeEach(() => { 7 | transactionAsset = new FollowAsset(); 8 | }); 9 | 10 | describe('constructor', () => { 11 | it('should have valid id', () => { 12 | expect(transactionAsset.id).toEqual(4); 13 | }); 14 | 15 | it('should have valid name', () => { 16 | expect(transactionAsset.name).toEqual('follow'); 17 | }); 18 | 19 | it('should have valid schema', () => { 20 | expect(transactionAsset.schema).toMatchSnapshot(); 21 | }); 22 | }); 23 | 24 | describe('validate', () => { 25 | describe('schema validation', () => { 26 | it.todo('should throw errors for invalid schema'); 27 | it.todo('should be ok for valid schema'); 28 | }); 29 | }); 30 | 31 | describe('apply', () => { 32 | describe('valid cases', () => { 33 | it.todo('should update the state store'); 34 | }); 35 | 36 | describe('invalid cases', () => { 37 | it.todo('should throw error'); 38 | }); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/assets/like_asset.spec.ts: -------------------------------------------------------------------------------- 1 | import { LikeAsset } from '../../../../../src/app/modules/post/assets/like_asset'; 2 | 3 | describe('LikeAsset', () => { 4 | let transactionAsset: LikeAsset; 5 | 6 | beforeEach(() => { 7 | transactionAsset = new LikeAsset(); 8 | }); 9 | 10 | describe('constructor', () => { 11 | it('should have valid id', () => { 12 | expect(transactionAsset.id).toEqual(3); 13 | }); 14 | 15 | it('should have valid name', () => { 16 | expect(transactionAsset.name).toEqual('like'); 17 | }); 18 | 19 | it('should have valid schema', () => { 20 | expect(transactionAsset.schema).toMatchSnapshot(); 21 | }); 22 | }); 23 | 24 | describe('validate', () => { 25 | describe('schema validation', () => { 26 | it.todo('should throw errors for invalid schema'); 27 | it.todo('should be ok for valid schema'); 28 | }); 29 | }); 30 | 31 | describe('apply', () => { 32 | describe('valid cases', () => { 33 | it.todo('should update the state store'); 34 | }); 35 | 36 | describe('invalid cases', () => { 37 | it.todo('should throw error'); 38 | }); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/assets/reply_asset.spec.ts: -------------------------------------------------------------------------------- 1 | import { ReplyAsset } from '../../../../../src/app/modules/post/assets/reply_asset'; 2 | 3 | describe('ReplyAsset', () => { 4 | let transactionAsset: ReplyAsset; 5 | 6 | beforeEach(() => { 7 | transactionAsset = new ReplyAsset(); 8 | }); 9 | 10 | describe('constructor', () => { 11 | it('should have valid id', () => { 12 | expect(transactionAsset.id).toEqual(2); 13 | }); 14 | 15 | it('should have valid name', () => { 16 | expect(transactionAsset.name).toEqual('reply'); 17 | }); 18 | 19 | it('should have valid schema', () => { 20 | expect(transactionAsset.schema).toMatchSnapshot(); 21 | }); 22 | }); 23 | 24 | describe('validate', () => { 25 | describe('schema validation', () => { 26 | it.todo('should throw errors for invalid schema'); 27 | it.todo('should be ok for valid schema'); 28 | }); 29 | }); 30 | 31 | describe('apply', () => { 32 | describe('valid cases', () => { 33 | it.todo('should update the state store'); 34 | }); 35 | 36 | describe('invalid cases', () => { 37 | it.todo('should throw error'); 38 | }); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/assets/repost_asset.spec.ts: -------------------------------------------------------------------------------- 1 | import { RepostAsset } from '../../../../../src/app/modules/post/assets/repost_asset'; 2 | 3 | describe('RepostAsset', () => { 4 | let transactionAsset: RepostAsset; 5 | 6 | beforeEach(() => { 7 | transactionAsset = new RepostAsset(); 8 | }); 9 | 10 | describe('constructor', () => { 11 | it('should have valid id', () => { 12 | expect(transactionAsset.id).toEqual(1); 13 | }); 14 | 15 | it('should have valid name', () => { 16 | expect(transactionAsset.name).toEqual('repost'); 17 | }); 18 | 19 | it('should have valid schema', () => { 20 | expect(transactionAsset.schema).toMatchSnapshot(); 21 | }); 22 | }); 23 | 24 | describe('validate', () => { 25 | describe('schema validation', () => { 26 | it.todo('should throw errors for invalid schema'); 27 | it.todo('should be ok for valid schema'); 28 | }); 29 | }); 30 | 31 | describe('apply', () => { 32 | describe('valid cases', () => { 33 | it.todo('should update the state store'); 34 | }); 35 | 36 | describe('invalid cases', () => { 37 | it.todo('should throw error'); 38 | }); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/unit/modules/post/post_module.spec.ts: -------------------------------------------------------------------------------- 1 | // import * as modules from '../../../src/app/modules/post' 2 | 3 | describe('PostModuleModule', () => { 4 | describe('constructor', () => { 5 | it.todo('should have valid id'); 6 | it.todo('should have valid name'); 7 | }); 8 | 9 | describe('beforeBlockApply', () => { 10 | it.todo('should execute before block apply'); 11 | }); 12 | describe('afterBlockApply', () => { 13 | it.todo('should execute after block apply'); 14 | }); 15 | describe('beforeTransactionApply', () => { 16 | it.todo('should execute before transaction apply'); 17 | }); 18 | describe('afterTransactionApply', () => { 19 | it.todo('should execute after transaction apply'); 20 | }); 21 | describe('afterGenesisBlockApply', () => { 22 | it.todo('should execute after genesis apply'); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/test/utils/config.ts: -------------------------------------------------------------------------------- 1 | import * as Config from '@oclif/config'; 2 | 3 | import pJSON = require('../../package.json'); 4 | 5 | export const getConfig = async (): Promise => { 6 | const config = await Config.load(); 7 | config.pjson.lisk = { addressPrefix: 'lsk' }; 8 | config.pjson.version = pJSON.version; 9 | return config; 10 | }; 11 | -------------------------------------------------------------------------------- /tutorials/postboard/blockchain-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "target": "es2019", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "newLine": "lf", 8 | "importHelpers": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "noImplicitReturns": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "pretty": true, 14 | "removeComments": true, 15 | "resolveJsonModule": true, 16 | "sourceMap": true, 17 | "strict": true, 18 | "composite": true, 19 | "declaration": true, 20 | "noImplicitAny": false, 21 | "skipLibCheck": true, 22 | "rootDir": "./src", 23 | "outDir": "./dist" 24 | }, 25 | "include": ["./src/**/*.ts", "./src/**/*.json"] 26 | } 27 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | insert_final_newline = false 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.env.development: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.env.production: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.eslintignore: -------------------------------------------------------------------------------- 1 | /config/ 2 | /build/ 3 | /public/ 4 | /node_modules/ 5 | /src/theme/ 6 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | parser: '@typescript-eslint/parser', 5 | extends: ['plugin:react/recommended', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended'], 6 | parserOptions: { 7 | project: './tsconfig.json', 8 | ecmaVersion: 2020, 9 | ecmaFeatures: { 10 | jsx: true, 11 | }, 12 | sourceType: 'module', 13 | }, 14 | env: { 15 | browser: true, 16 | commonjs: true, 17 | node: true, 18 | es2020: true, 19 | 'jest/globals': true, 20 | }, 21 | settings: { 22 | 'import/resolver': { 23 | webpack: { 24 | config: path.join(__dirname, 'config', 'webpack.common.js'), 25 | }, 26 | }, 27 | }, 28 | plugins: ['react', 'jsx-a11y', 'import', 'jest'], 29 | overrides: [ 30 | { 31 | files: ['**/*.tsx'], 32 | rules: { 33 | 'react/prop-types': 'off', 34 | }, 35 | }, 36 | ], 37 | }; 38 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.nvmrc: -------------------------------------------------------------------------------- 1 | 16.14.0 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | semi: true, 3 | trailingComma: 'all', 4 | singleQuote: true, 5 | printWidth: 120, 6 | tabWidth: 2, 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/addons/webpack.bundleanalyze.js: -------------------------------------------------------------------------------- 1 | const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); 2 | 3 | const config = { 4 | plugins: [ 5 | new BundleAnalyzerPlugin({ 6 | analyzerMode: 'static', 7 | reportFilename: './report.html', 8 | openAnalyzer: true, 9 | }), 10 | ], 11 | }; 12 | 13 | module.exports = config; 14 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/addons/webpack.bundlevisualizer.js: -------------------------------------------------------------------------------- 1 | const Visualizer = require('webpack-visualizer-plugin2'); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new Visualizer() 6 | ] 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/addons/webpack.dashboard.js: -------------------------------------------------------------------------------- 1 | const DashboardPlugin = require('webpack-dashboard/plugin'); 2 | 3 | const config = { 4 | plugins: [ 5 | new DashboardPlugin(), 6 | ], 7 | }; 8 | 9 | module.exports = config; 10 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/common-paths.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | context: path.resolve(__dirname, '..'), 5 | root: path.resolve(__dirname, '../..'), 6 | sourcePath: path.resolve(__dirname, '..', 'src/'), 7 | 8 | devEnv: path.resolve(__dirname, '..', process.env.DEV_ENV_FILE || '.env.development'), 9 | prodEnv: path.resolve(__dirname, '..', process.env.PROD_ENV_FILE || '.env.production'), 10 | 11 | entryPoints: [ 12 | path.resolve(__dirname, '..', 'src/index.tsx'), 13 | ], 14 | 15 | outputPath: path.resolve(__dirname, '..', process.env.DEV_BUILD_DIR || 'build/'), 16 | outputServerPath: path.resolve(__dirname, '..', process.env.PROD_BUILD_DIR || 'build/'), 17 | templatesOutputServerPath: path.resolve(__dirname, '..', process.env.PROD_TEMPLATES_BUILD_DIR || process.env.PROD_BUILD_DIR || 'build/'), 18 | 19 | images: path.resolve(__dirname, '..', 'static/images/'), 20 | template: path.resolve(__dirname, '..', 'public/index.html'), 21 | favicon: path.resolve(__dirname, '..', 'public/favicon.ico'), 22 | manifest: path.resolve(__dirname, '..', 'public/manifest.json'), 23 | serviceWorker: path.resolve(__dirname, '..', 'src/', 'service-worker.ts'), 24 | }; 25 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/jest/enzyme.js: -------------------------------------------------------------------------------- 1 | import Enzyme, { configure, shallow, mount, render } from 'enzyme'; 2 | import Adapter from 'enzyme-adapter-react-16'; 3 | 4 | configure({ adapter: new Adapter() }); 5 | 6 | export { shallow, mount, render }; 7 | export default Enzyme; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/jest/fileMock.js: -------------------------------------------------------------------------------- 1 | module.exports = 'test-file-stub'; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/config/jest/styleMock.js: -------------------------------------------------------------------------------- 1 | module.exports = {}; 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['/src'], 3 | transform: { 4 | '^.+\\.(ts|tsx)?$': 'ts-jest', 5 | }, 6 | moduleNameMapper: { 7 | '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 8 | '/config/jest/fileMock.js', 9 | '\\.(css|sass|less)$': '/config/jest/styleMock.js', 10 | }, 11 | testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(ts|tsx|js|jsx)?$', 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'], 13 | testEnvironment: 'node', 14 | globals: { 15 | 'ts-jest': { 16 | diagnostics: { 17 | warnOnly: true, 18 | }, 19 | }, 20 | }, 21 | 22 | // Setup Enzyme 23 | snapshotSerializers: ['enzyme-to-json/serializer'], 24 | setupFilesAfterEnv: ['/config/jest/enzyme.js'], 25 | }; 26 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/frontend/public/favicon.ico -------------------------------------------------------------------------------- /tutorials/postboard/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/comment.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/elipse.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/index.ts: -------------------------------------------------------------------------------- 1 | export { ReactComponent as HomeSvg } from './home.svg'; 2 | export { ReactComponent as ProfileSvg } from './profile.svg'; 3 | export { ReactComponent as BookmarkSvg } from './bookmark.svg'; 4 | export { ReactComponent as NotificationSvg } from './notification.svg'; 5 | export { ReactComponent as SettingsSvg } from './settings.svg'; 6 | export { ReactComponent as ListSvg } from './list.svg'; 7 | export { ReactComponent as AvatarSvg } from './avatar.svg'; 8 | export { ReactComponent as CloseSvg } from './close.svg'; 9 | export { ReactComponent as ElipseSvg } from './elipse.svg'; 10 | export { ReactComponent as SearchSvg } from './search.svg'; 11 | export { ReactComponent as LikeSvg } from './like.svg'; 12 | export { ReactComponent as CommentSvg } from './comment.svg'; 13 | export { ReactComponent as RepostSvg } from './repost.svg'; 14 | export { ReactComponent as LikeFilledSvg } from './like-filled.svg'; 15 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/like-filled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/list.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/notification.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/icons/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/frontend/src/assets/images/logo.png -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/_global.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;600;700&display=swap'); 2 | body { 3 | margin: 0; 4 | font-family: 'Rubik', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 5 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | background-color: $background; 10 | } 11 | 12 | .grid-container { 13 | display: flex; 14 | } 15 | 16 | .float-right { 17 | float: right 18 | } 19 | 20 | .app { 21 | flex: 1; 22 | padding-top: 20px; 23 | } 24 | 25 | input:-webkit-autofill, 26 | input:-webkit-autofill:hover, 27 | input:-webkit-autofill:focus, 28 | input:-webkit-autofill:active{ 29 | -webkit-box-shadow: 0 0 0 30px white inset !important; 30 | } 31 | 32 | .right-content { 33 | padding: 10px 34 | } 35 | 36 | .bold { 37 | font-weight: 600; 38 | } 39 | 40 | .small { 41 | font-weight: 400; 42 | font-size: 0.9rem; 43 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/_variables.scss: -------------------------------------------------------------------------------- 1 | $background: #F3F5F8; 2 | $platinum_gray: #DFE6F2; 3 | $ultramarine_blue: #4070F4; 4 | $dark_border_color: rgba(0, 0, 0, 0.08); 5 | $ghost: #bec1cd; 6 | $overlay: rgba(12, 21, 46, 0.4); 7 | $white: #FFFFFF; 8 | $blue_gray: #8A8CA2; 9 | $fully_red: #FF4557; 10 | $silver_gray: #C5CFE4; 11 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/components/_alert.scss: -------------------------------------------------------------------------------- 1 | .alert-item { 2 | position: fixed; 3 | bottom: 0; 4 | left: 0; 5 | right: 0; 6 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/components/_button.scss: -------------------------------------------------------------------------------- 1 | .button { 2 | padding: 5px 35px; 3 | border-radius: 25px; 4 | &.btn-primary { 5 | min-width: 150px; 6 | background-color: $ultramarine_blue; 7 | border-color: $ultramarine_blue; 8 | &.outline { 9 | background-color: $background; 10 | color: $ultramarine_blue; 11 | border-color: 1px solid $ultramarine_blue; 12 | &:hover { 13 | color: $background; 14 | background-color: $ultramarine_blue; 15 | border-color: $ultramarine_blue; 16 | } 17 | } 18 | } 19 | &:disabled { 20 | opacity: 0.4; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/components/_postinput.scss: -------------------------------------------------------------------------------- 1 | .post-input { 2 | display: flex; 3 | flex: 1; 4 | background: $white; 5 | padding: 10px; 6 | border-radius: 15px; 7 | align-items: center; 8 | margin: 10px 0px; 9 | &.explore { 10 | border-radius: 30px; 11 | } 12 | input { 13 | padding: 5px 10px; 14 | flex: 1; 15 | outline: none; 16 | border: none 17 | } 18 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/components/_replyitem.scss: -------------------------------------------------------------------------------- 1 | .reply-item { 2 | background-color: $white; 3 | padding: 15px; 4 | display: flex; 5 | margin: 10px 5px; 6 | border-top: 1px solid $silver_gray; 7 | .avatar { 8 | margin-right: 10px; 9 | } 10 | .content { 11 | .message { 12 | cursor: pointer; 13 | } 14 | .sub { 15 | color: $blue_gray 16 | } 17 | .icons { 18 | display: flex; 19 | .icon { 20 | margin-right: 15px; 21 | cursor: pointer; 22 | &.like:hover { 23 | svg, path, mask { 24 | fill-rule: unset; 25 | fill: $fully_red; 26 | } 27 | } 28 | svg, path { 29 | fill: $blue_gray; 30 | } 31 | &:hover { 32 | svg, path { 33 | fill: $ultramarine_blue; 34 | stroke-width: 2; 35 | fill-rule: unset; 36 | } 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/postboard.scss: -------------------------------------------------------------------------------- 1 | @import "./variables"; 2 | @import "./global"; 3 | 4 | // Views 5 | @import "./views/login"; 6 | @import "./views/viewpost"; 7 | 8 | // Components 9 | @import "./components/sidebar"; 10 | @import "./components/passphraseinput"; 11 | @import "./components/overlay"; 12 | @import "./components/button"; 13 | @import "./components/postitem"; 14 | @import "./components/postinput"; 15 | @import "./components/replyitem"; 16 | @import "./components/alert"; -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/views/_login.scss: -------------------------------------------------------------------------------- 1 | .login { 2 | margin-top: 20px; 3 | .login-overlay { 4 | background-color: $background; 5 | padding: 20px; 6 | border-radius: 10px; 7 | } 8 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/assets/styles/views/_viewpost.scss: -------------------------------------------------------------------------------- 1 | .view-post { 2 | background-color: $white; 3 | margin: 10px 5px; 4 | border-radius: 15px; 5 | .reply-input { 6 | border-top: 1px solid $silver_gray; 7 | border-radius: 0px; 8 | padding-top: 20px; 9 | padding-bottom: 20px; 10 | } 11 | } -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Alert/index.tsx: -------------------------------------------------------------------------------- 1 | import { AlertContext } from 'context/AlertContext'; 2 | import types from 'context/types'; 3 | import React, { useContext, useEffect } from 'react'; 4 | 5 | type AlertType = { 6 | message: string; 7 | type?: 'success' | 'danger'; 8 | }; 9 | 10 | const Alert = ({ message, type = 'success' }: AlertType) => { 11 | const { state, dispatch } = useContext(AlertContext); 12 | 13 | useEffect(() => { 14 | let timeout: ReturnType; 15 | if (state.message) { 16 | timeout = setTimeout(() => dispatch({ type: types.REMOVE_ALERT, payload: {} }), 1500); 17 | } 18 | return () => clearTimeout(timeout); 19 | }, [state.message]); 20 | 21 | return ( 22 |
23 |
24 |
{message}
25 |
26 |
27 | ); 28 | }; 29 | 30 | export default Alert; 31 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Button/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode, ButtonHTMLAttributes } from 'react'; 2 | 3 | interface ButtonProps extends ButtonHTMLAttributes { 4 | children: ReactNode; 5 | onClick?: () => void; 6 | className?: string; 7 | } 8 | 9 | const Button = ({ children, className, onClick, disabled, ...props }: ButtonProps) => ( 10 | 13 | ); 14 | 15 | export default Button; 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/ExploreInput/index.tsx: -------------------------------------------------------------------------------- 1 | import { SearchSvg } from 'assets/icons'; 2 | import React from 'react'; 3 | 4 | const ExploreInput = () => { 5 | return ( 6 |
7 | 8 | 9 |
10 | ); 11 | }; 12 | 13 | export default ExploreInput; 14 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Loading.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Loading = () => <>; 4 | 5 | export default Loading; 6 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Overlay/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | 3 | type OverlayProps = { 4 | children: ReactNode; 5 | isOpen: boolean; 6 | setIsOpen: (isOpen: boolean) => void; 7 | }; 8 | 9 | const Overlay = ({ children, isOpen }: OverlayProps) => { 10 | return ( 11 |
12 |
13 | {isOpen &&
{children}
} 14 |
15 |
16 | ); 17 | }; 18 | 19 | export default Overlay; 20 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/ReplyItem/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { AvatarSvg } from 'assets/icons'; 3 | import { stringShortener } from 'utils/helpers'; 4 | import { ReplyType } from 'types/Reply.type'; 5 | import { Link } from 'react-router-dom'; 6 | 7 | type PostItemProps = { 8 | reply: ReplyType; 9 | }; 10 | 11 | const ReplyItem = ({ reply }: PostItemProps) => { 12 | return ( 13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

22 | 23 | {stringShortener(reply.author, 6, 6)} 24 | 25 |

26 |

{reply.content}

27 |
28 |
29 |
30 | ); 31 | }; 32 | 33 | export default ReplyItem; 34 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Sidebar/index.tsx: -------------------------------------------------------------------------------- 1 | import { MenuItem } from 'hooks/types'; 2 | import React from 'react'; 3 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment 4 | // @ts-ignore 5 | import Logo from 'assets/images/logo.png'; 6 | import { useNavigate } from 'react-router'; 7 | import Login from 'views/Login'; 8 | 9 | type SidebarProps = { 10 | items: Array; 11 | }; 12 | 13 | const Sidebar = ({ items }: SidebarProps) => { 14 | const navigate = useNavigate(); 15 | return ( 16 |
17 |
18 |
19 | Postcard app logo 20 |
    21 | {items.map((item) => ( 22 |
  • navigate(item.route)}> 23 | 27 |
  • 28 | ))} 29 | 30 |
31 |
32 |
33 | ); 34 | }; 35 | 36 | export default Sidebar; 37 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/components/Tab/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | type TabItem = { 5 | label: string; 6 | route: string; 7 | }; 8 | 9 | type TabProps = { tabs: Array }; 10 | 11 | const Tab = ({ tabs }: TabProps) => ( 12 |
13 | 20 |
21 | ); 22 | 23 | export default Tab; 24 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/constants/keyCodes.js: -------------------------------------------------------------------------------- 1 | const keyCodes = { 2 | arrowRight: 39, 3 | arrowLeft: 37, 4 | arrowDown: 40, 5 | arrowUp: 38, 6 | escape: 27, 7 | tab: 9, 8 | space: 32, 9 | delete: 8, 10 | enter: 13, 11 | }; 12 | 13 | export default keyCodes; 14 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/AlertContext.ts: -------------------------------------------------------------------------------- 1 | import { createContext, Dispatch } from 'react'; 2 | 3 | export type AlertContextState = { 4 | message?: string; 5 | type?: 'success' | 'danger'; 6 | }; 7 | 8 | export type AlertActionType = { type: string; payload: AlertContextState }; 9 | 10 | type AlertContext = { 11 | state: AlertContextState; 12 | dispatch: Dispatch; 13 | }; 14 | 15 | export const AlertContext = createContext({} as AlertContext); 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/AlertController.ts: -------------------------------------------------------------------------------- 1 | import { useReducer } from 'react'; 2 | import { AlertContextState, AlertActionType } from './AlertContext'; 3 | import types from './types'; 4 | 5 | const initialState: AlertContextState = { 6 | message: undefined, 7 | type: undefined, 8 | }; 9 | 10 | function reducer(state: AlertContextState, action: AlertActionType) { 11 | switch (action.type) { 12 | case types.ADD_ALERT: 13 | return { 14 | ...state, 15 | ...action.payload, 16 | }; 17 | case types.REMOVE_ALERT: 18 | return { 19 | message: undefined, 20 | type: undefined, 21 | }; 22 | default: 23 | return state; 24 | } 25 | } 26 | 27 | const useAlertController = () => { 28 | const [state, dispatch] = useReducer(reducer, initialState); 29 | 30 | return { state, dispatch }; 31 | }; 32 | 33 | export default useAlertController; 34 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/AuthContext.ts: -------------------------------------------------------------------------------- 1 | import { createContext, Dispatch } from 'react'; 2 | 3 | export type AuthContextState = { 4 | address: string; 5 | passphrase: string; 6 | hexAddress: string; 7 | }; 8 | 9 | export type AuthActionType = { type: string; payload: AuthContextState }; 10 | 11 | type AuthContext = { 12 | state: AuthContextState; 13 | dispatch: Dispatch; 14 | }; 15 | 16 | export const AuthContext = createContext({} as AuthContext); 17 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/PostContext.ts: -------------------------------------------------------------------------------- 1 | import { createContext, Dispatch } from 'react'; 2 | import { PostType } from 'types/Post.type'; 3 | 4 | export type PostContextState = { 5 | posts: Array; 6 | }; 7 | 8 | export type PostActionType = { type: string; payload: Array }; 9 | 10 | type PostContext = { 11 | state: PostContextState; 12 | dispatch: Dispatch; 13 | }; 14 | 15 | export const PostContext = createContext({} as PostContext); 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/PostController.ts: -------------------------------------------------------------------------------- 1 | import { useReducer } from 'react'; 2 | import { PostContextState, PostActionType } from './PostContext'; 3 | import types from './types'; 4 | 5 | const initialState: PostContextState = { 6 | posts: [], 7 | }; 8 | 9 | function reducer(state: PostContextState, action: PostActionType) { 10 | switch (action.type) { 11 | case types.GET_POSTS: 12 | return { 13 | posts: action.payload, 14 | }; 15 | default: 16 | return state; 17 | } 18 | } 19 | 20 | const usePostController = () => { 21 | const [state, dispatch] = useReducer(reducer, initialState); 22 | 23 | return { state, dispatch }; 24 | }; 25 | 26 | export default usePostController; 27 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/context/types.ts: -------------------------------------------------------------------------------- 1 | const types = { 2 | // Accounts 3 | FETCH_ACCOUNT: 'FETCH_ACCOUNT', 4 | LOG_OUT: 'LOG_OUT', 5 | // Posts 6 | GET_POSTS: 'GET_POSTS', 7 | // Alert 8 | ADD_ALERT: 'ADD_ALERT', 9 | REMOVE_ALERT: 'REMOVE_ALERT', 10 | }; 11 | 12 | export default types; 13 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/hooks/useAlert.tsx: -------------------------------------------------------------------------------- 1 | import { AlertContext } from 'context/AlertContext'; 2 | import types from 'context/types'; 3 | import { useContext } from 'react'; 4 | 5 | const useAlert = () => { 6 | const { dispatch } = useContext(AlertContext); 7 | const showSuccessAlert = (message: string) => 8 | dispatch({ type: types.ADD_ALERT, payload: { message, type: 'success' } }); 9 | const showErrorAlert = (message: string) => dispatch({ type: types.ADD_ALERT, payload: { message, type: 'danger' } }); 10 | 11 | return { showSuccessAlert, showErrorAlert }; 12 | }; 13 | 14 | export default useAlert; 15 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { createRoot } from 'react-dom/client'; 3 | 4 | import * as serviceWorker from 'service-worker'; 5 | import reportWebVitals from 'report-web-vitals'; 6 | import App from 'App'; 7 | import './assets/styles/postboard.scss'; 8 | 9 | const root = createRoot(document.getElementById('app') as HTMLElement); 10 | root.render( 11 | 12 | 13 | , 14 | ); 15 | 16 | // If you want to start measuring performance in your app, pass a function 17 | // to log results (for example: reportWebVitals(console.log)) 18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 19 | reportWebVitals(); 20 | 21 | // If you want your app to work offline and load faster, you can change 22 | // unregister() to register() below. Note this comes with some pitfalls. 23 | // Learn more about service workers: https://bit.ly/CRA-PWA 24 | serviceWorker.unregister(); 25 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/report-web-vitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler): void => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/routes/AccountRoutes.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Routes, Route, useParams } from 'react-router'; 3 | import Tab from 'components/Tab'; 4 | import ViewProfile from 'pages/ViewProfile'; 5 | import ViewFollowers from 'pages/ViewFollowers'; 6 | import ViewFollowing from 'pages/ViewFollowing'; 7 | 8 | const AccountRoutes = () => { 9 | const address = useParams().id; 10 | return ( 11 |
12 |

13 | Account {address} 14 |

15 | 22 | 23 | } /> 24 | } /> 25 | } /> 26 | 27 |
28 | ); 29 | }; 30 | 31 | export default AccountRoutes; 32 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/theme/index.ts: -------------------------------------------------------------------------------- 1 | // Import theme setup and global styles here 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/types/Account.type.ts: -------------------------------------------------------------------------------- 1 | export type AccountType = { 2 | username: string; 3 | followers: Array; 4 | following: Array; 5 | posts: Array; 6 | replies: Array; 7 | address: string; 8 | }; 9 | 10 | export type AccountApiResponse = { 11 | address: string; 12 | token: { 13 | balance: string; 14 | }; 15 | sequence: { 16 | nonce: string; 17 | }; 18 | keys: { 19 | numberOfSignatures: number; 20 | mandatoryKeys: Array; 21 | optionalKeys: Array; 22 | }; 23 | dpos: { 24 | delegate: { 25 | username: string; 26 | }; 27 | sentVotes: Array; 28 | unlocking: Array; 29 | }; 30 | post: { 31 | following: Array; 32 | followers: Array; 33 | posts: Array; 34 | replies: Array; 35 | likes: Array; 36 | }; 37 | }; 38 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/types/Post.type.ts: -------------------------------------------------------------------------------- 1 | import { ReplyType } from './Reply.type'; 2 | 3 | export type PostType = { 4 | id: string; 5 | likes: string[]; 6 | replies: ReplyType[]; 7 | reposts: string[]; 8 | date: Date; 9 | author: string; 10 | content: string; 11 | }; 12 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/types/Reply.type.ts: -------------------------------------------------------------------------------- 1 | export type ReplyType = { 2 | id: string; 3 | likes: string[]; 4 | date: Date; 5 | author: string; 6 | content: string; 7 | }; 8 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/utils/account.ts: -------------------------------------------------------------------------------- 1 | import { cryptography } from '@liskhq/lisk-client/browser'; 2 | 3 | export const extractPrivateKey = async (passphrase: string) => 4 | await cryptography.ed.getPrivateKeyFromPhraseAndPath(passphrase, "m/44'/134'/0'"); 5 | export const extractHexAddress = async (passphrase: string) => 6 | //cryptography.address.getAddressFromPrivateKey(await extractPrivateKey(passphrase)).toString('hex'); 7 | cryptography.address.getAddressFromPrivateKey(await extractPrivateKey(passphrase)); 8 | //export const extractHexAddress = (address: string) => cryptography.address.getAddressFromLisk32Address(address); 9 | export const getAddressFromHex = (address: Buffer) => cryptography.address.getLisk32AddressFromAddress(address); 10 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/utils/getClient.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import { apiClient } from '@liskhq/lisk-client/browser'; 3 | 4 | let clientCache: any; 5 | const nodeAPIURL = 'ws://localhost:7887/rpc-ws'; 6 | 7 | export const getClient = async () => { 8 | if (!clientCache) { 9 | clientCache = await apiClient.createWSClient(nodeAPIURL); 10 | } 11 | return clientCache; 12 | }; 13 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/src/utils/helpers.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Shortens a given string by replacing a certain number of 3 | * characters with ellipsis (...). 4 | * if only one parameter passed, it'll add ellipsis to the end: 5 | * shortAddress("A very long stringified term") === "A very lon..." 6 | * 7 | * if rightPadd is passed it'll keep some trailing characters: 8 | * shortAddress("12345678901111L, 3) === "1234567890...11L" 9 | * 10 | * No change will be applied for already short strings 11 | * 12 | * @param {String} str - Any string to get shortened 13 | * @param {Number?} leftPadd - how many characters should be shown before ellipsis. default 10 14 | * @param {Number?} rightPadd - how many characters should be shown after ellipsis. default 0 15 | * 16 | * @returns {String} - the shortened string 17 | */ 18 | export const stringShortener = (str: string, leftPadd = 10, rightPadd = 0) => { 19 | if (str && str.length > 15) { 20 | return `${str.substr(0, leftPadd)}...${rightPadd ? str.substr(-1 * rightPadd) : ''}`; 21 | } 22 | return str; 23 | }; 24 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/static/images/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/postboard/frontend/static/images/.gitkeep -------------------------------------------------------------------------------- /tutorials/postboard/frontend/static/locales/en/translations.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["es5", "es6", "dom", "dom.iterable"], 5 | "baseUrl": "src", 6 | "paths": { 7 | "app/*": ["../src/*"], 8 | "app-assets/*": ["../static/*"] 9 | }, 10 | "allowJs": true, 11 | "skipLibCheck": true, 12 | "esModuleInterop": true, 13 | "allowSyntheticDefaultImports": true, 14 | "strict": true, 15 | "forceConsistentCasingInFileNames": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "noEmit": true, 19 | "jsx": "react", 20 | "resolveJsonModule": true 21 | }, 22 | "include": ["**/*.ts", "**/*.tsx"], 23 | "exclude": ["node_modules"] 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/postboard/frontend/webpack.config.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge'); 2 | 3 | const commonConfig = require('./config/webpack.common.js'); 4 | 5 | /** 6 | * getAddons is a function that returns valid addon modules 7 | * 8 | * @param {string} addons - List of addons separated by comma 9 | * @returns required addons modules 10 | */ 11 | const getAddons = (addons = '') => 12 | addons 13 | .split(',') 14 | .filter(Boolean) 15 | .map((name) => require(`./config/addons/webpack.${name}.js`)); 16 | 17 | module.exports = ({ env, addon }) => { 18 | const envConfig = require(`./config/webpack.${env || 'production'}.js`); 19 | 20 | return merge(commonConfig, envConfig, ...getAddons(addon)); 21 | }; 22 | -------------------------------------------------------------------------------- /tutorials/postboard/utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postboard-utils", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@liskhq/lisk-client": "^6.0.0-beta.6" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tutorials/postboard/utils/privateKey.json: -------------------------------------------------------------------------------- 1 | { 2 | "privateKey": "*** Enter Private Key here ***" 3 | } -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://npm.lisk.io -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "srs-lisk", 3 | "version": "1.0.0", 4 | "description": "Social Recovery System", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "ishantiw", 11 | "license": "ISC", 12 | "keywords": [ 13 | "lisk", 14 | "blockchain", 15 | "keys", 16 | "security" 17 | ], 18 | "dependencies": { 19 | "@liskhq/lisk-api-client": "^5.0.4", 20 | "@liskhq/lisk-client": "^5.0.5", 21 | "@liskhq/lisk-utils": "^0.1.0", 22 | "axios": "^0.21.1", 23 | "cors": "^2.8.5", 24 | "express": "^4.17.3", 25 | "lisk-sdk": "^5.2.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/plugins/srs_api_plugin/constants.js: -------------------------------------------------------------------------------- 1 | const SRS_MODULE_ID = 1026; 2 | const SRS_CREATE_ASSET_ID = 0; 3 | const SRS_INITIATE_ASSET_ID = 1; 4 | const SRS_VOUCH_ASSET_ID = 2; 5 | const SRS_CLAIM_ASSET_ID = 3; 6 | const SRS_CLOSE_ASSET_ID = 4; 7 | const SRS_REMOVE_ASSET_ID = 5; 8 | const DEFAULT_FEE = BigInt('200000'); 9 | const TOKEN_MODULE_ID = 2; 10 | const TOKEN_TRANSFER_ASSET_ID = 0; 11 | 12 | module.exports = { 13 | SRS_MODULE_ID, 14 | SRS_CREATE_ASSET_ID, 15 | DEFAULT_FEE, 16 | TOKEN_MODULE_ID, 17 | TOKEN_TRANSFER_ASSET_ID, 18 | SRS_INITIATE_ASSET_ID, 19 | SRS_VOUCH_ASSET_ID, 20 | SRS_CLAIM_ASSET_ID, 21 | SRS_CLOSE_ASSET_ID, 22 | SRS_REMOVE_ASSET_ID, 23 | }; 24 | -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/plugins/srs_api_plugin/controllers/index.js: -------------------------------------------------------------------------------- 1 | const { initiateRecovery } = require('./initiate_recovery_api'); 2 | const { transferToken } = require('./transfer_token_api'); 3 | const { createRecoveryConfigTrs } = require('./create_recovery_api'); 4 | const { vouchRecovery } = require('./vouch_recovery_api'); 5 | const { claimRecovery } = require('./claim_recovery_api'); 6 | const { closeRecovery } = require('./close_recovery_api'); 7 | const { removeRecovery } = require('./remove_recovery_api'); 8 | 9 | module.exports = { 10 | initiateRecovery, 11 | transferToken, 12 | createRecoveryConfigTrs, 13 | vouchRecovery, 14 | claimRecovery, 15 | closeRecovery, 16 | removeRecovery, 17 | }; -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/plugins/srs_api_plugin/index.js: -------------------------------------------------------------------------------- 1 | const { SRSAPIPlugin } = require('./srs_api_plugin'); 2 | 3 | module.exports = { 4 | SRSAPIPlugin 5 | }; -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/srs_module/constants.js: -------------------------------------------------------------------------------- 1 | const BASE_RECOVERY_DEPOSIT = '1000000000'; 2 | const FRIEND_FACTOR_FEE = 2; 3 | const CREATE_RECOVERY_ASSET_ID = 0; 4 | const INITIATE_RECOVERY_ASSET_ID = 1; 5 | const VOUCH_RECOVERY_ASSET_ID = 2; 6 | const CLAIM_RECOVERY_ASSET_ID = 3; 7 | const CLOSE_RECOVERY_ASSET_ID = 4; 8 | const REMOVE_RECOVERY_ASSET_ID = 5; 9 | 10 | module.exports = { 11 | BASE_RECOVERY_DEPOSIT, 12 | FRIEND_FACTOR_FEE, 13 | CREATE_RECOVERY_ASSET_ID, 14 | VOUCH_RECOVERY_ASSET_ID, 15 | CLAIM_RECOVERY_ASSET_ID, 16 | CLOSE_RECOVERY_ASSET_ID, 17 | INITIATE_RECOVERY_ASSET_ID, 18 | REMOVE_RECOVERY_ASSET_ID, 19 | }; 20 | -------------------------------------------------------------------------------- /tutorials/social-recovery/blockchain_app/test/utils/api_client.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const { systemDirs, apiClient } = require('lisk-sdk'); 4 | 5 | const getIPCClient = async (label, rootPath) => 6 | await apiClient.createIPCClient(systemDirs(label, rootPath).dataPath); 7 | 8 | module.exports = { 9 | getIPCClient, 10 | }; 11 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiskArchive/lisk-sdk-examples/1643a82e04e6b757f5fe4fce4161e46b66be0c2c/tutorials/social-recovery/frontend_app/public/favicon.ico -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Social Recovery System", 3 | "name": "Social Recovery System", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/App.js: -------------------------------------------------------------------------------- 1 | import './App.css'; 2 | import RecoveryManager from './components/recoveryManager' 3 | 4 | function App() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | 12 | export default App; 13 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/components/index.js: -------------------------------------------------------------------------------- 1 | export * from "./createRecovery"; 2 | export * from "./recoveryManager"; 3 | export * from "./home"; -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ); 12 | 13 | -------------------------------------------------------------------------------- /tutorials/social-recovery/frontend_app/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------