aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/beta/contract-test/contract.js
diff options
context:
space:
mode:
authorpldespaigne <pl.despaigne@gmail.com>2019-05-31 00:22:55 +0800
committerpldespaigne <pl.despaigne@gmail.com>2019-05-31 00:22:55 +0800
commit9a658ee53d1f75ce07c33581ac1189fa8c4fd173 (patch)
treeea92ef1971ffaa72c29bf16904906bc1841654c7 /test/e2e/beta/contract-test/contract.js
parent9b87aaae1907eb04ca0a4055b5bb2c863e56aa39 (diff)
parent681f3f67b89b64fc837df1103198b641c7e7b2d6 (diff)
downloadtangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar.gz
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar.bz2
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar.lz
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar.xz
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.tar.zst
tangerine-wallet-browser-9a658ee53d1f75ce07c33581ac1189fa8c4fd173.zip
merge
Diffstat (limited to 'test/e2e/beta/contract-test/contract.js')
-rw-r--r--test/e2e/beta/contract-test/contract.js37
1 files changed, 31 insertions, 6 deletions
diff --git a/test/e2e/beta/contract-test/contract.js b/test/e2e/beta/contract-test/contract.js
index 65fb9377f..e1f886c58 100644
--- a/test/e2e/beta/contract-test/contract.js
+++ b/test/e2e/beta/contract-test/contract.js
@@ -37,8 +37,10 @@ web3.currentProvider.enable().then(() => {
const createToken = document.getElementById('createToken')
const transferTokens = document.getElementById('transferTokens')
const approveTokens = document.getElementById('approveTokens')
+ const transferTokensWithoutGas = document.getElementById('transferTokensWithoutGas')
+ const approveTokensWithoutGas = document.getElementById('approveTokensWithoutGas')
- deployButton.addEventListener('click', async function (event) {
+ deployButton.addEventListener('click', async function () {
document.getElementById('contractStatus').innerHTML = 'Deploying'
var piggybank = await piggybankContract.new(
@@ -55,7 +57,7 @@ web3.currentProvider.enable().then(() => {
document.getElementById('contractStatus').innerHTML = 'Deployed'
- depositButton.addEventListener('click', function (event) {
+ depositButton.addEventListener('click', function () {
document.getElementById('contractStatus').innerHTML = 'Deposit initiated'
contract.deposit({ from: web3.eth.accounts[0], value: '0x3782dace9d900000' }, function (result) {
console.log(result)
@@ -63,7 +65,7 @@ web3.currentProvider.enable().then(() => {
})
})
- withdrawButton.addEventListener('click', function (event) {
+ withdrawButton.addEventListener('click', function () {
contract.withdraw('0xde0b6b3a7640000', { from: web3.eth.accounts[0] }, function (result) {
console.log(result)
document.getElementById('contractStatus').innerHTML = 'Withdrawn'
@@ -75,7 +77,7 @@ web3.currentProvider.enable().then(() => {
console.log(piggybank)
})
- sendButton.addEventListener('click', function (event) {
+ sendButton.addEventListener('click', function () {
web3.eth.sendTransaction({
from: web3.eth.accounts[0],
to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970',
@@ -88,7 +90,7 @@ web3.currentProvider.enable().then(() => {
})
- createToken.addEventListener('click', async function (event) {
+ createToken.addEventListener('click', async function () {
var _initialAmount = 100
var _tokenName = 'TST'
var _decimalUnits = 0
@@ -124,7 +126,7 @@ web3.currentProvider.enable().then(() => {
})
})
- approveTokens.addEventListener('click', function (event) {
+ approveTokens.addEventListener('click', function () {
contract.approve('0x2f318C334780961FB129D2a6c30D0763d9a5C970', '7', {
from: web3.eth.accounts[0],
to: contract.address,
@@ -135,6 +137,29 @@ web3.currentProvider.enable().then(() => {
console.log(result)
})
})
+
+ transferTokensWithoutGas.addEventListener('click', function (event) {
+ console.log(`event`, event)
+ contract.transfer('0x2f318C334780961FB129D2a6c30D0763d9a5C970', '7', {
+ from: web3.eth.accounts[0],
+ to: contract.address,
+ data: '0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
+ gasPrice: '20000000000',
+ }, function (result) {
+ console.log('result', result)
+ })
+ })
+
+ approveTokensWithoutGas.addEventListener('click', function () {
+ contract.approve('0x2f318C334780961FB129D2a6c30D0763d9a5C970', '7', {
+ from: web3.eth.accounts[0],
+ to: contract.address,
+ data: '0x095ea7b30000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C9700000000000000000000000000000000000000000000000000000000000000005',
+ gasPrice: '20000000000',
+ }, function (result) {
+ console.log(result)
+ })
+ })
}
})