hamidra / dotdrop

Send dots as gifts to anyone and invite them to join polkadot
https://hamidra.github.io/dotdrop
The Unlicense
21 stars 12 forks source link

🚨 🚚
Dotdrop dapp has been split into two separate DAPPs. You can find the new dapps in the following locations:

Substrate Gifts

Substrate Gifts is a dapp (decentralized app) built on top of substrate compatible networks to let the users of any substrate based network send tokens as a gift no matter if the recepient has any accounts in the network or not. The sender of a gift can simply wrap their tokens (KSMs, DOTs, etc) as a gift in a unique secret hash that functions as a voucher and share the gift secret with the recipient (through email, message or just simply write it on a paper), while the recipient of the gift can go to the dapp and reveal the recieved voucher (gift secret) to redeem their gifted tokens to their account. If the recipient has no accounts in the network to redeem their gift, the dapp will walk them through account creation steps to let them create an account before redeeming their gift.

Running Substrate Gifts dapp

Requirements

Installation

The codebase is installed using git and yarn. This assumes you have installed yarn globally prior to installing it within the subdirectories. For the most recent version and how to install yarn, please refer to yarn documentation and installation guides.

# Clone the repository
git clone https://github.com/hamidra/dotdrop.git
cd dotdrop
yarn install

Usage

You can start the dapp in development mode to connect to a locally running node.

yarn start

You can also build the app in production mode,

yarn build

and host the build/ folder using any webserver. refer to [create react app] (https://create-react-app.dev/docs/deployment) documentations for more info

Configuration

The dapps configuration is stored in the src/config directory, with common.json being loaded first, then the environment-specific json file, and finally environment variables, with precedence.

Some environment variables are read and integrated in the template config object, including:

More on React environment variables.

When writing and deploying your own dapp, you should configure:

Specifying Connecting Node

There are two ways to specify it:

Reusable Components

useSubstrate Custom Hook

The custom hook useSubstrate provides access to the Polkadot js API and thus the keyring and the blockchain itself. Specifically it exposes this API.

{
  socket,
  types,
  keyring,
  keyringState,
  api,
  apiError,
  apiState,
  chainInfo,
}