depay-blockchain-token
Advanced tools
Comparing version 0.12.0 to 1.0.0
@@ -139,3 +139,3 @@ 'use strict'; | ||
return { | ||
blockchain: 'ethereum', | ||
blockchain: this.blockchain, | ||
address: this.address, | ||
@@ -178,2 +178,16 @@ api: ERC20, | ||
} | ||
transferable() { | ||
return new Promise(async (resolve, reject) => { | ||
let accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); | ||
let provider = new ethers.ethers.providers.Web3Provider(window.ethereum); | ||
let signer = provider.getSigner(); | ||
let contract = new ethers.ethers.Contract(this.address, ERC20, provider); | ||
let estimate = contract | ||
.connect(signer) | ||
.estimateGas.transfer(accounts[0], '1') | ||
.then(() => resolve(true)) | ||
.catch(() => resolve(false)); | ||
}) | ||
} | ||
} | ||
@@ -180,0 +194,0 @@ |
@@ -131,3 +131,3 @@ import CONSTANTS from 'depay-blockchain-constants'; | ||
return { | ||
blockchain: 'ethereum', | ||
blockchain: this.blockchain, | ||
address: this.address, | ||
@@ -170,2 +170,16 @@ api: ERC20, | ||
} | ||
transferable() { | ||
return new Promise(async (resolve, reject) => { | ||
let accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); | ||
let provider = new ethers.providers.Web3Provider(window.ethereum); | ||
let signer = provider.getSigner(); | ||
let contract = new ethers.Contract(this.address, ERC20, provider); | ||
let estimate = contract | ||
.connect(signer) | ||
.estimateGas.transfer(accounts[0], '1') | ||
.then(() => resolve(true)) | ||
.catch(() => resolve(false)); | ||
}) | ||
} | ||
} | ||
@@ -172,0 +186,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('depay-blockchain-constants'), require('depay-blockchain-call'), require('ethers')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'depay-blockchain-constants', 'depay-blockchain-call', 'ethers'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BlockchainToken = {}, global.CONSTANTS, global.BlockchainCall, global.ethers)); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BlockchainToken = {}, global.BlockchainConstants, global.BlockchainCall, global.ethers)); | ||
}(this, (function (exports, CONSTANTS, depayBlockchainCall, ethers) { 'use strict'; | ||
@@ -137,3 +137,3 @@ | ||
return { | ||
blockchain: 'ethereum', | ||
blockchain: this.blockchain, | ||
address: this.address, | ||
@@ -176,2 +176,16 @@ api: ERC20, | ||
} | ||
transferable() { | ||
return new Promise(async (resolve, reject) => { | ||
let accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); | ||
let provider = new ethers.ethers.providers.Web3Provider(window.ethereum); | ||
let signer = provider.getSigner(); | ||
let contract = new ethers.ethers.Contract(this.address, ERC20, provider); | ||
let estimate = contract | ||
.connect(signer) | ||
.estimateGas.transfer(accounts[0], '1') | ||
.then(() => resolve(true)) | ||
.catch(() => resolve(false)); | ||
}) | ||
} | ||
} | ||
@@ -178,0 +192,0 @@ |
{ | ||
"name": "depay-blockchain-token", | ||
"moduleName": "BlockchainToken", | ||
"version": "0.12.0", | ||
"version": "1.0.0", | ||
"description": "JavaScript library providing basic functionalities to work with tokens.", | ||
@@ -13,3 +13,3 @@ "main": "dist/cjs/index.js", | ||
"scripts": { | ||
"build": "rm -rf dist && rollup -c", | ||
"build": "rm -rf dist && rollup -c rollup.module.config.js", | ||
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"", | ||
@@ -19,3 +19,3 @@ "lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix", | ||
"prepublishOnly": "yarn build", | ||
"start": "rollup -c rollup.demo.config.js -w", | ||
"dev": "rollup -c rollup.dev.config.js -w", | ||
"test:units": "yarn build && npx jest --no-cache", | ||
@@ -37,3 +37,3 @@ "test": "yarn test:units" | ||
"dependencies": { | ||
"depay-blockchain-call": "^1.1.1", | ||
"depay-blockchain-call": "^1.3.0", | ||
"depay-blockchain-constants": "^1.4.0", | ||
@@ -58,3 +58,3 @@ "ethers": "^5.3.1" | ||
"cypress": "^6.2.1", | ||
"depay-web3mock": "^1.0.2", | ||
"depay-web3mock": "^4.0.0", | ||
"eslint": "^7.15.0", | ||
@@ -61,0 +61,0 @@ "eslint-config-prettier": "^7.0.0", |
@@ -21,6 +21,7 @@ ## Quickstart | ||
expect(token.address).toEqual('0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb') | ||
expect(await token.decimals()).toEqual(18) | ||
expect(await token.symbol()).toEqual('DEPAY') | ||
expect(await token.name()).toEqual('DePay') | ||
token.address // '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb' | ||
await token.decimals() // 18 | ||
await token.symbol() // 'DEPAY' | ||
await token.name() // 'DePay' | ||
await token.transferable() // true | ||
``` | ||
@@ -65,2 +66,10 @@ | ||
### transferable | ||
Checks if token is transferable: | ||
```javascript | ||
await token.transferable() // true | ||
``` | ||
### BigNumber | ||
@@ -84,3 +93,3 @@ | ||
yarn install | ||
yarn start | ||
yarn dev | ||
``` | ||
@@ -87,0 +96,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20558
556
0
99
Updateddepay-blockchain-call@^1.3.0