Blockchain Ads web3 connect library
This is a library to connect user across web3 platform.
Prerequisites
This project requires NodeJS (version v16.17.1 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
8.11.0
v17.6.0
Table of contents
Getting Started
To install and set up the library
$ npm install -S bca-web3-lib
Or if you prefer using Yarn:
$ yarn add --dev bca-web3-lib
import { bcaWeb3Connect } from "bca-web3-lib";
bcaWeb3Connect("0x7Da81FA63Ee343De9ca33ab7A16be3D022549828");
Demo
Develop repository locally
BEFORE YOU INSTALL: please read the prerequisites
Start with cloning this repo on your local machine:
$ git clone https://github.com/Blockchain-Ads/attribution-analytics.git
$ cd attribution-analytics
Watching library
$ npm dev
Running the tests
$ npm test
Building a distribution version
$ npm run build
This task will create a distribution version of the project
inside your local dist/
folder
Library usage
To connect user account with Blockchain Ads
import { bcaWeb3Connect } from "bca-web3-lib";
bcaWeb3Connect("0x7Da81FA63Ee343De9ca33ab7A16be3D022549828");
This will
- check if there is Blockchain Ads cookie or local storage exist locally
- Generate and gather user attribution
- Call register user API to Blockchain Ads backend
- Create cookie and local storage to store token locally
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Add your changes:
git add .
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
😎
Built With
- microbundle
- JavaScript
- Atom
- Love
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Napat Charuphant - Initial work - Pat
License
Copyright © 2021 Blockchain-Ads All rights reserved.