1.4.0 • Published 3 years ago

like-js-interface v1.4.0

Weekly downloads
1
License
BSD-3-Clause
Repository
-
Last release
3 years ago

like-js-interface

About Like Search

Like Search is a decentralized search engine based on the Ethereum smart contracts. Users can like a URL, that is, deposit ETH to increase the number of likes of a URL for a keyword. URLs with likes will be displayed in the smart contract results and ranked by the number of likes. Any individual can vote in this way to evaluate the quality of resources.

Installation

NPM

npm install like-js-interface

Yarn

yarn add like-js-interface

Usage

const Web3 = require('web3');
const BN = require('bn.js')
const { Like } = require('like-js-interface');
const providerUrl = "Provider URL";
const contractAddress = "XXX";
const from = "XXX";
(async () => {
    try {
        const web3 = new Web3(providerUrl)
        const like = new Like(web3, contractAddress)
        const keywordId = Like.keywordId("search engine")
        const url = new URL("https://www.like.foundation")
        const amount = new BN(1)
        const likeTran = like.like(keywordId, url, amount)
        const estimatedGas = await likeTran.estimateGas()
        const receipt = await likeTran.send({
            from,
            gas: estimatedGas
        })
        console.log('receipt:', receipt)
    } catch (error) {
        console.error(error)
    }
})()
1.4.0

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago