-
Make sure the aurras is up and running
-
Make sure wsk cli is installed.
-
Install the actions
-
Workflow generation with composer: Once your YAML configuration is ready, hand it over to the composer. This composer leverages the configuration to produce a WebAssembly (wasm) file. This wasm file encapsulates the workflow based on your specified criteria. Generating a wasm file
e.g.: output.wasm
from the PayoutNotification.yaml.cat examples/PayoutNotification.yaml | docker run -i hugobyte/workflow-composer:v0.2 generate > output.wasm
-
Deployment to openwhisk environment: After creating a wasm file, copy the wasm file from
workflow
directory to theruntime/openwhisk
directory. Rename theoutput.wasm
intoworkflow.wasm
, However wasm file should undergo compilation into executable format, tailord for openwhisk depolyment. Which can be done by using the below commandzip -r - Cargo.toml src workflow.wasm | docker run -e RELEASE=true -i --rm hugobyte/openwhisk-runtime-rust:v0.3 -compile main > output.zip
-
Creating the action: Action name -
polkadot_payout
wsk -i action create polkadot_payout output.zip --docker hugobyte/openwhisk-runtime-rust:v0.3 --timeout 300000 --web true --param allowed_hosts "<allowed_hosts>"
-
After Creating the action, create a rule for it
wsk -i --apihost <API_HOST> rule update "payout_notify-rule" "send-payout-notify" "payout_notify" --auth <AUTH_KEY>
-
Register event source using the below command with name as param
e.g.: --name polkadot_payout
../register_event_source_polkadot.sh --name polkadot_payout --openwhiskApiHost <API_HOST>
-
After registering the event, the system generates a topic. Please make sure to keep a record of this token.
-
Navigate to
aurras/example/payout-notification
directory. -
Add API configuration and Firebase Push Notification Configuration.
-
Install Node Dependencies using
yarn install
ornpm install
-
Start Payout-notification using
npx yarn start
For Brave browser enable
Use Google services for push messaging
using brave://settings/privacy
- User registration and user login actions are performed here by giving the credentials like name, email and password.
User registration should be done by giving the parameters like name, email and password.
curl -X POST "<API_HOST>/api/v1/web/guest/default/user-registration.json?blocking=true&result=true" -H 'Content-Type: application/json' -u <TOPIC_TOKEN> -d '{"name": "john.doe", "email": "[email protected]", "password":"abc@123"}' -k
User can login with the credentials mentioned during the registration, this will create the JWT token
curl -X POST "<API_HOST>/api/v1/web/guest/default/user-login.json?blocking=true&result=true" -H 'Content-Type: application/json' -u <TOPIC_TOKEN> -d '{"email": "[email protected]", "password": "abc@123"}' -k
-
Now the next step is to run aurras-event-feed-substrate-js.
-
Create a
.env
file.
CHAIN_NAME=NodeTemplate
CHAIN_ENDPOINT=wss://westend-rpc.polkadot.io
LOGGERS=console,info;file,error,./logs/event-feed.log
EXCLUDES=system; balances Deposit, Endowed, DustLost; staking-Chilled, ForceEra, Kicked, Slashed, SlashReported, Stakers Elected, Validator
TYPES_FILE=/config/types.json
KAFKA_BROKERS=172.17.0.1:9092
OPENWHISK_API_KEY=<AUTH_KEY>
OPENWHISK_API_HOST=<API_HOST>
OPENWHISK_NAMESPACE=guest
EVENT_RECEIVER=event-receiver
EVENT_PROCESSOR=substrate-event-processor
TOPICS=staking=<TOPIC>
-
Install the Node Dependencies using
yarn install
ornpm install
. -
Start aurras-event-feed-substrate-js using
npx yarn serve
NOTE
In postman,