diff --git a/package-lock.json b/package-lock.json index 353fd2c..c66dbf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3917,14 +3917,12 @@ "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dev": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -5041,6 +5039,16 @@ "integrity": "sha512-6ljkLtF1KM5fQ+5ZN0wuyVvvebJxgJPTmScOMaFuQN2QuOzvRJnWSKfzQskQU5IOU4Gap3zasYPIinzwUjoj/g==", "dev": true }, + "canvas": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.6.1.tgz", + "integrity": "sha512-S98rKsPcuhfTcYbtF53UIJhcbgIAK533d1kJKMwsMwAIFgfd58MOyxRud3kktlzWiEkFliaJtvyZCBtud/XVEA==", + "requires": { + "nan": "^2.14.0", + "node-pre-gyp": "^0.11.0", + "simple-get": "^3.0.3" + } + }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -5159,8 +5167,7 @@ "chownr": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", - "dev": true + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==" }, "chrome-trace-event": { "version": "1.0.2", @@ -5701,8 +5708,7 @@ "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "consolidate": { "version": "0.15.1", @@ -6958,8 +6964,7 @@ "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, "dep-graph": { "version": "1.1.0", @@ -7001,6 +7006,11 @@ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=" }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + }, "detect-newline": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", @@ -9185,7 +9195,6 @@ "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -9201,7 +9210,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, "requires": { "number-is-nan": "^1.0.0" } @@ -9210,7 +9218,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -9221,7 +9228,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } @@ -9868,8 +9874,7 @@ "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, "has-value": { "version": "1.0.0", @@ -10408,6 +10413,14 @@ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "requires": { + "minimatch": "^3.0.4" + } + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -13185,6 +13198,30 @@ "minipass": "^3.0.0" } }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "requires": { + "minipass": "^2.9.0" + }, + "dependencies": { + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } + }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", @@ -13461,6 +13498,26 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "needle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.3.tgz", + "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", @@ -13619,6 +13676,75 @@ } } }, + "node-pre-gyp": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", + "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + }, + "dependencies": { + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "requires": { + "minipass": "^2.6.0" + } + }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } + }, "node-releases": { "version": "1.1.44", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.44.tgz", @@ -13777,6 +13903,14 @@ "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", "dev": true }, + "npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, "npm-conf": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", @@ -13818,6 +13952,16 @@ } } }, + "npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -13837,7 +13981,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -15518,6 +15661,11 @@ "resolved": "https://registry.npmjs.org/qrcode.vue/-/qrcode.vue-1.7.0.tgz", "integrity": "sha512-R7t6Y3fDDtcU7L4rtqwGUDP9xD64gJhIwpfjhRCTKmBoYF6SS49PIJHRJ048cse6OI7iwTwgyy2C46N9Ygoc6g==" }, + "qrious": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/qrious/-/qrious-4.0.2.tgz", + "integrity": "sha512-xWPJIrK1zu5Ypn898fBp8RHkT/9ibquV2Kv24S/JY9VYEhMBMKur1gHVsOiNUh7PHP9uCgejjpZUHUIXXKoU/g==" + }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -16158,7 +16306,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -16477,8 +16624,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "saxes": { "version": "3.1.11", @@ -16694,8 +16840,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { "version": "2.0.1", @@ -16780,6 +16925,36 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", + "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", + "requires": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "requires": { + "mimic-response": "^2.0.0" + } + }, + "mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" + } + } + }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -21096,7 +21271,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, "requires": { "string-width": "^1.0.2 || 2" } diff --git a/package.json b/package.json index 6904d44..4bb3660 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,14 @@ "dependencies": { "@quasar/extras": "^1.0.0", "bitcoinjs-lib": "^5.1.7", + "canvas": "^2.6.1", "cordova": "^9.0.0", "dotenv": "^8.2.0", "electron": "^7.1.7", "ethers": "^4.0.44", "module": "^1.2.5", "qrcode.vue": "^1.7.0", + "qrious": "^4.0.2", "quasar": "^1.0.0", "vuejs-dialog": "^1.4.1" }, diff --git a/src-cordova/package.json b/src-cordova/package.json index 4bf50d9..1596199 100644 --- a/src-cordova/package.json +++ b/src-cordova/package.json @@ -34,4 +34,4 @@ "android" ] } -} \ No newline at end of file +} diff --git a/src/css/app.sass b/src/css/app.sass index 2280f2a..0397406 100644 --- a/src/css/app.sass +++ b/src/css/app.sass @@ -1 +1 @@ -// app global css in Sass form +// app global css in Sass form \ No newline at end of file diff --git a/src/pages/EthereumPage.vue b/src/pages/EthereumPage.vue index 87839c6..b7577fa 100644 --- a/src/pages/EthereumPage.vue +++ b/src/pages/EthereumPage.vue @@ -10,18 +10,21 @@ - + - + - + -

fadffffffffffffffffffffffffffffffffffffffffff + + + +

{{ message }}
@@ -56,4 +59,12 @@ + + diff --git a/src/pages/Index.vue b/src/pages/Index.vue index 6e5e567..81c4e37 100644 --- a/src/pages/Index.vue +++ b/src/pages/Index.vue @@ -3,6 +3,5 @@

Start page

-
{{ message }}
diff --git a/src/scripts/Ethereum/Address.js b/src/scripts/Ethereum/Address.js index 8940609..c64b5c8 100644 --- a/src/scripts/Ethereum/Address.js +++ b/src/scripts/Ethereum/Address.js @@ -1,5 +1,6 @@ import Contract from './contracts/Contract.js' - +import Transaction from './Transaction.js' +var QRious = require('QRious') var ethers = require('ethers') const contacts = [ @@ -17,7 +18,15 @@ export default { newAddress() { var pKey = ethers.Wallet.createRandom().privateKey - alert('New wallets private key: ' + pKey) + alert('New wallets private key: ') + + + var qr = new QRious({ + element: document.getElementById('qr'), + value: pKey + }) + + contacts.push({ id: 6, name: 'first wallet', key: pKey }) }, @@ -47,11 +56,8 @@ export default { //console.log("factory: " + factory); let transaction = await factory.getDeployTransaction(['0x55D73ccA422253a8a287074c6f4857Dd15EFdC46', '0xE704eBE589b6ac907887D1997df7BF69A50D416E'], 2, overrides); //console.log(transaction) - let signPromise = wallet.sign(transaction); - //console.log("wallet : " + wallet.address); - - signPromise.then((signedTransaction) => console.log("deployed transaction: " + signedTransaction)); + Transaction.signing(wallet, transaction) })(); }, diff --git a/src/scripts/Ethereum/ERC20Token.js b/src/scripts/Ethereum/ERC20Token.js index 94c1132..b565fd6 100644 --- a/src/scripts/Ethereum/ERC20Token.js +++ b/src/scripts/Ethereum/ERC20Token.js @@ -5,7 +5,7 @@ var ethers = require('ethers'); export default { - transfer(privateKey, transaction){ + transfer(privateKey, transaction, tokenAddress){ let abiToken = new MultisigContract().abiJSON; //to do: get provider by id from transaction @@ -15,13 +15,14 @@ export default { var iface = new ethers.utils.Interface(abiToken); var func = iface.functions.transfer; - transaction.data = func.encode(['0x6692d46B5319a0AE807264155C6725EF951378eD', transaction.value]) - transaction.value = 0 + transaction.data = func.encode([transaction.to, transaction.value]); + transaction.to = tokenAddress; + transaction.value = 0; return Transaction.signing(wallet, transaction) }, - transferMulti(privateKey, transaction, tokenAddress, reciever){ + transferMulti(privateKey, transaction, tokenAddress, contractAddress){ let abiJSON = new Contract().abiJSON //to do: get provider by id from transaction @@ -30,8 +31,8 @@ export default { let iface = new ethers.utils.Interface(abiJSON); let func = iface.functions.submitTransaction; - transaction.data = func.encode([tokenAddress, 0, '0xa9059cbb000000000000000000000000' + reciever + '00000000000000000000000000000000000000000000000000000000000003e8']), - + transaction.data = func.encode([tokenAddress, 0, '0xa9059cbb000000000000000000000000' + transaction.to + '00000000000000000000000000000000000000000000000000000000000003e8']), + transaction.to = contractAddress; transaction.value = 0 return Transaction.signing(wallet, transaction) diff --git a/src/scripts/Ethereum/Transaction.js b/src/scripts/Ethereum/Transaction.js index 89986fe..20f86e9 100644 --- a/src/scripts/Ethereum/Transaction.js +++ b/src/scripts/Ethereum/Transaction.js @@ -1,4 +1,6 @@ var ethers = require('ethers') +var QRious = require('QRious') + import Contract from './contracts/Contract.js' @@ -14,7 +16,18 @@ export default { let signPromise = wallet.sign(transaction) signPromise.then((signedTransaction) => { - console.log(signedTransaction) + console.log('Singed Transaction: \n' + signedTransaction) + + var qr = new QRious({ + + element: document.getElementById('qr'), + value: signedTransaction, + level: 'H', + size: 1000, + }) + + return signedTransaction + //return signedTransaction @@ -34,26 +47,23 @@ export default { }, //to do arguments: wallet, transaction - createMultiSigTransaction(wallet){ - //TO DO scan from QR-code - let contractAddress = "0x6692d46B5319a0AE807264155C6725EF951378eD"; - + createMultiSigTransaction(privateKey, transaction, contractAddress){ + let provider = ethers.getDefaultProvider('ropsten'); + + let wallet = new ethers.Wallet(privateKey, provider); + var abiJSON = new Contract().abiJSON var iface = new ethers.utils.Interface(abiJSON); var func = iface.functions.submitTransaction; - var transaction = { - gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), - gasLimit: 8000000, - data: func.encode(['0xCe39AB30911Eeb024eB6316123339A4893337639', 5, '0x']), - to: contractAddress, - nonce: 12, - chainId: 3 - } + + transaction.data = func.encode([transaction.to, transaction.value, transaction.data]); + transaction.to = contractAddress; + transaction.value = 0; this.signing(wallet, transaction) }, - confirmMultisigTransaction(privateKey, transaction, txNumber){ + confirmMultisigTransaction(privateKey, transaction, contractAddress, txNumber){ let provider = ethers.getDefaultProvider('ropsten'); let wallet = new ethers.Wallet(privateKey, provider); @@ -61,7 +71,10 @@ export default { var abiJSON = new Contract().abiJSON var iface = new ethers.utils.Interface(abiJSON); var func = iface.functions.confirmTransaction; + transaction.data = func.encode([txNumber]); + transaction.to = contractAddress; + transaction.value = 0; this.signing(wallet, transaction) }, diff --git a/src/scripts/Ethereum/index.js b/src/scripts/Ethereum/index.js index 3773e93..32363fc 100644 --- a/src/scripts/Ethereum/index.js +++ b/src/scripts/Ethereum/index.js @@ -1,13 +1,15 @@ var ethers = require('ethers'); - -import Addresses from './Address.js' -import Transaction from './Transaction.js' +var QRious = require('QRious') +//var QRCode = require('./qr-code/qrcode.js'); +//import QRcode2 from './qr-code/qrcode.js'; +import Addresses from './Address.js'; +import Transaction from './Transaction.js'; import QRcode from './QRcode.js' -import Desktop from './Desktop.js' -import ERC20Token from './ERC20Token.js' -import Vue from 'vue' -import QrcodeVue from 'qrcode.vue' - +import Desktop from './Desktop.js'; +import ERC20Token from './ERC20Token.js'; +import Vue from 'vue'; +//import QrcodeVue from 'qrcode.vue' + const contacts = [ {name: 'first', key: '0x6aa6b11778e120f4e856693953c07b2c679397763fa8afc6d5984425bc456f1a'}, //0x55D73ccA422253a8a287074c6f4857Dd15EFdC46 @@ -32,7 +34,13 @@ export default { methods: { Address () { - new Vue({ el: '#components-demo' }) + var qr = new QRious({ + + element: document.getElementById('qr'), + value: 'fff' + + }) + //new Vue({ el: '#components-demo' }) return Addresses.newAddress(); }, @@ -44,20 +52,96 @@ export default { return QRcode.Scan(); }, - DesktopSending() { - return Desktop.send(); - }, + CallMultiSig(){ + + let contractAddress = '0x6692d46B5319a0AE807264155C6725EF951378eD'; + + let to = '0xE704eBE589b6ac907887D1997df7BF69A50D416E'; + + let privateKey = '0x6aa6b11778e120f4e856693953c07b2c679397763fa8afc6d5984425bc456f1a'; - CallMultiSig(){ //creating transaction to send tokens - return Transaction.createMultiSigTransaction() + var transaction = { + gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), + gasLimit: 8000000, + data: '0x', + to: to, + value: 5, + nonce: 12, + chainId: 3 + }; + + return Transaction.createMultiSigTransaction(privateKey, transaction, contractAddress); }, ConfirmMultiSig(){ - return Transaction.createMultiSigTransaction() + + let contractAddress = '0x6692d46B5319a0AE807264155C6725EF951378eD'; + + let to = '0xE704eBE589b6ac907887D1997df7BF69A50D416E'; + + let privateKey = '0x6aa6b11778e120f4e856693953c07b2c679397763fa8afc6d5984425bc456f1a'; + + let txNumber = 9; + + var transaction = { + gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), + gasLimit: 8000000, + data: '0x', + to: to, + value: 5, + nonce: 12, + chainId: 3 + }; + + return Transaction.confirmMultisigTransaction(privateKey, transaction, contractAddress, txNumber) }, - TokenContract(){ //testing single-sig contract - return ERC20Token.transfer() - } + TokenContract(){ //testing single-sig contract + let nonce = 60; + + let privateKey = '0x6aa6b11778e120f4e856693953c07b2c679397763fa8afc6d5984425bc456f1a'; + + let tokenAddress = "0x3b94F6446C1EB46472B246d40dC99162C271c3D4"; + + let reciever = '0x6692d46B5319a0AE807264155C6725EF951378eD'; + + let transaction = { + gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), + gasLimit: 8000000, + data: '', + value: 1000, + to: reciever, + nonce: nonce, + chainId: 3 + } + + + return ERC20Token.transfer(privateKey, transaction, tokenAddress) + }, + + TokenMultiContractSubmit(){ + let nonce = 60; + + let privateKey = '0x6aa6b11778e120f4e856693953c07b2c679397763fa8afc6d5984425bc456f1a'; + + //Address: 0xE704eBE589b6ac907887D1997df7BF69A50D416E + let contractAddress = "0x6692d46B5319a0AE807264155C6725EF951378eD"; + + let tokenAddress = "0x3b94F6446C1EB46472B246d40dC99162C271c3D4"; + + let reciever = '6692d46B5319a0AE807264155C6725EF951378eD' + + let transaction = { + gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), + gasLimit: 8000000, + data: '0x',//func.encode(['0xCe39AB30911Eeb024eB6316123339A4893337639', 5, '0x']), + to: reciever, + nonce: nonce, + chainId: 3 + } + + console.log('Creating multisig transaction: \n') + ERC20Token.transferMulti(privateKey, transaction, tokenAddress, contractAddress) + } } } \ No newline at end of file diff --git a/src/scripts/Ethereum/tests/ERC-20-test.js b/src/scripts/Ethereum/tests/ERC-20-test.js index 7efe7af..ad69a85 100644 --- a/src/scripts/Ethereum/tests/ERC-20-test.js +++ b/src/scripts/Ethereum/tests/ERC-20-test.js @@ -7,17 +7,19 @@ function sendToken(nonce){ let tokenAddress = "0x3b94F6446C1EB46472B246d40dC99162C271c3D4"; + let reciever = '6692d46B5319a0AE807264155C6725EF951378eD' + let transaction = { gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), gasLimit: 8000000, data: '', value: 1000, - to: tokenAddress, + to: reciever, nonce: nonce, chainId: 3 } console.log('Single sig token sending: \n') - ERC20Token.transfer(privateKey, transaction) + ERC20Token.transfer(privateKey, transaction, tokenAddress) } function sendTokenMulti(nonce, nonce2, txNum){ @@ -37,18 +39,18 @@ function sendTokenMulti(nonce, nonce2, txNum){ gasPrice: ethers.utils.parseUnits('40.0', 'gwei'), gasLimit: 8000000, data: '',//func.encode(['0xCe39AB30911Eeb024eB6316123339A4893337639', 5, '0x']), - to: contractAddress, + to: reciever, nonce: nonce, chainId: 3 } console.log('Creating multisig transaction: \n') - ERC20Token.transferMulti(privateKey, transaction, tokenAddress, reciever) + ERC20Token.transferMulti(privateKey, transaction, tokenAddress, contractAddress) transaction.nonce = nonce2; console.log('Confirming multisig transacrion: \n') - Transaction.confirmMultisigTransaction(secondPrivateKey, transaction, txNum) + Transaction.confirmMultisigTransaction(secondPrivateKey, transaction, contractAddress, txNum) } module.exports = { sendToken, sendTokenMulti }; \ No newline at end of file