├── LICENSE
├── README.md
├── frontend
├── .babelrc
├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .postcssrc.js
├── README.md
├── build
│ ├── build.js
│ ├── logo.png
│ ├── utils.js
│ ├── vue-loader.conf.js
│ ├── webpack.base.conf.js
│ ├── webpack.dev.conf.js
│ └── webpack.prod.conf.js
├── config
│ ├── dev.env.js
│ ├── index.js
│ └── prod.env.js
├── index.html
├── package.json
├── src
│ ├── App.vue
│ ├── assets
│ │ └── libra.png
│ ├── components
│ │ └── Home.vue
│ ├── main.js
│ └── router
│ │ └── index.js
└── static
│ └── .gitkeep
└── node
├── .gitignore
├── app.js
├── package-lock.json
├── package.json
└── router
└── index.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 LearnDapp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Libra-wallet
2 | Fackbook Libra blockchain wallet
3 |
4 | ## How to run
5 |
6 | **1.Libra**
7 |
8 | run
9 | ```
10 | cargo run -p libra_swarm -- -s
11 | ```
12 | or
13 | ```
14 | ./scripts/cli/start_cli_testnet.sh
15 | ```
16 |
17 | **2.node**
18 |
19 | Change the package.json scripts start, from `ADDR` value `localhost:55383` to your local validator address.
20 |
21 | then
22 | ```
23 | cd node
24 | npm i
25 | npm run start
26 | ```
27 | or
28 | ```
29 | cd node
30 | npm i
31 | npm run start-testnet
32 | ```
33 | default runing port is 17000
34 |
35 | **3.api demo**
36 | ```
37 | http://localhost:17000/api/account/state/be14f4294dba063c447623f0ed80d6b98166321b3f03f9f571c6526380917c4d
38 |
39 | http://localhost:17000/api/account/transaction/be14f4294dba063c447623f0ed80d6b98166321b3f03f9f571c6526380917c4d/0/true
40 |
41 | http://localhost:17000/api/events/be14f4294dba063c447623f0ed80d6b98166321b3f03f9f571c6526380917c4d/0/true/10
42 |
43 | http://localhost:17000/api/transactions/0/10/true
44 |
45 | http://localhost:17000/api/transactions/0/10/true?scope=txn_list_with_proof.transactions[0].raw_txn
46 | ```
47 |
48 | **4.frontend**
49 | ```
50 | cd frontend
51 | npm i
52 | npm run dev
53 | ```
54 |
55 | ## License
56 | MIT
57 |
--------------------------------------------------------------------------------
/frontend/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-vue-jsx", "transform-runtime"]
12 | }
13 |
--------------------------------------------------------------------------------
/frontend/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/frontend/.eslintignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /config/
3 | /dist/
4 | /*.js
5 |
--------------------------------------------------------------------------------
/frontend/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parserOptions: {
6 | parser: 'babel-eslint'
7 | },
8 | env: {
9 | browser: true,
10 | },
11 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
12 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
13 | extends: ['plugin:vue/essential', 'airbnb-base'],
14 | // required to lint *.vue files
15 | plugins: [
16 | 'vue'
17 | ],
18 | // check if imports actually resolve
19 | settings: {
20 | 'import/resolver': {
21 | webpack: {
22 | config: 'build/webpack.base.conf.js'
23 | }
24 | }
25 | },
26 | // add your custom rules here
27 | rules: {
28 | // don't require .vue extension when importing
29 | 'import/extensions': ['error', 'always', {
30 | js: 'never',
31 | vue: 'never'
32 | }],
33 | // disallow reassignment of function parameters
34 | // disallow parameter object manipulation except for specific exclusions
35 | 'no-param-reassign': ['error', {
36 | props: true,
37 | ignorePropertyModificationsFor: [
38 | 'state', // for vuex state
39 | 'acc', // for reduce accumulators
40 | 'e' // for e.returnvalue
41 | ]
42 | }],
43 | // allow optionalDependencies
44 | 'import/no-extraneous-dependencies': ['error', {
45 | optionalDependencies: ['test/unit/index.js']
46 | }],
47 | // allow debugger during development
48 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Editor directories and files
9 | .idea
10 | .vscode
11 | *.suo
12 | *.ntvs*
13 | *.njsproj
14 | *.sln
15 |
--------------------------------------------------------------------------------
/frontend/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # frontend
2 |
3 | > Fackbook Libra blockchain wallet frontend
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 | ```
20 |
21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
22 |
--------------------------------------------------------------------------------
/frontend/build/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | process.env.NODE_ENV = 'production'
5 |
6 | const ora = require('ora')
7 | const rm = require('rimraf')
8 | const path = require('path')
9 | const chalk = require('chalk')
10 | const webpack = require('webpack')
11 | const config = require('../config')
12 | const webpackConfig = require('./webpack.prod.conf')
13 |
14 | const spinner = ora('building for production...')
15 | spinner.start()
16 |
17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 | if (err) throw err
19 | webpack(webpackConfig, (err, stats) => {
20 | spinner.stop()
21 | if (err) throw err
22 | process.stdout.write(stats.toString({
23 | colors: true,
24 | modules: false,
25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26 | chunks: false,
27 | chunkModules: false
28 | }) + '\n\n')
29 |
30 | if (stats.hasErrors()) {
31 | console.log(chalk.red(' Build failed with errors.\n'))
32 | process.exit(1)
33 | }
34 |
35 | console.log(chalk.cyan(' Build complete.\n'))
36 | console.log(chalk.yellow(
37 | ' Tip: built files are meant to be served over an HTTP server.\n' +
38 | ' Opening index.html over file:// won\'t work.\n'
39 | ))
40 | })
41 | })
42 |
--------------------------------------------------------------------------------
/frontend/build/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/learndapp/Libra-wallet/0364e4c3fd4efa84c98cf56c5d2920394ff1871f/frontend/build/logo.png
--------------------------------------------------------------------------------
/frontend/build/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const config = require('../config')
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
5 | const packageConfig = require('../package.json')
6 |
7 | exports.assetsPath = function (_path) {
8 | const assetsSubDirectory = process.env.NODE_ENV === 'production'
9 | ? config.build.assetsSubDirectory
10 | : config.dev.assetsSubDirectory
11 |
12 | return path.posix.join(assetsSubDirectory, _path)
13 | }
14 |
15 | exports.cssLoaders = function (options) {
16 | options = options || {}
17 |
18 | const cssLoader = {
19 | loader: 'css-loader',
20 | options: {
21 | sourceMap: options.sourceMap
22 | }
23 | }
24 |
25 | const postcssLoader = {
26 | loader: 'postcss-loader',
27 | options: {
28 | sourceMap: options.sourceMap
29 | }
30 | }
31 |
32 | // generate loader string to be used with extract text plugin
33 | function generateLoaders (loader, loaderOptions) {
34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35 |
36 | if (loader) {
37 | loaders.push({
38 | loader: loader + '-loader',
39 | options: Object.assign({}, loaderOptions, {
40 | sourceMap: options.sourceMap
41 | })
42 | })
43 | }
44 |
45 | // Extract CSS when that option is specified
46 | // (which is the case during production build)
47 | if (options.extract) {
48 | return ExtractTextPlugin.extract({
49 | use: loaders,
50 | fallback: 'vue-style-loader'
51 | })
52 | } else {
53 | return ['vue-style-loader'].concat(loaders)
54 | }
55 | }
56 |
57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
58 | return {
59 | css: generateLoaders(),
60 | postcss: generateLoaders(),
61 | less: generateLoaders('less'),
62 | sass: generateLoaders('sass', { indentedSyntax: true }),
63 | scss: generateLoaders('sass'),
64 | stylus: generateLoaders('stylus'),
65 | styl: generateLoaders('stylus')
66 | }
67 | }
68 |
69 | // Generate loaders for standalone style files (outside of .vue)
70 | exports.styleLoaders = function (options) {
71 | const output = []
72 | const loaders = exports.cssLoaders(options)
73 |
74 | for (const extension in loaders) {
75 | const loader = loaders[extension]
76 | output.push({
77 | test: new RegExp('\\.' + extension + '$'),
78 | use: loader
79 | })
80 | }
81 |
82 | return output
83 | }
84 |
85 | exports.createNotifierCallback = () => {
86 | const notifier = require('node-notifier')
87 |
88 | return (severity, errors) => {
89 | if (severity !== 'error') return
90 |
91 | const error = errors[0]
92 | const filename = error.file && error.file.split('!').pop()
93 |
94 | notifier.notify({
95 | title: packageConfig.name,
96 | message: severity + ': ' + error.name,
97 | subtitle: filename || '',
98 | icon: path.join(__dirname, 'logo.png')
99 | })
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/frontend/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const config = require('../config')
4 | const isProduction = process.env.NODE_ENV === 'production'
5 | const sourceMapEnabled = isProduction
6 | ? config.build.productionSourceMap
7 | : config.dev.cssSourceMap
8 |
9 | module.exports = {
10 | loaders: utils.cssLoaders({
11 | sourceMap: sourceMapEnabled,
12 | extract: isProduction
13 | }),
14 | cssSourceMap: sourceMapEnabled,
15 | cacheBusting: config.dev.cacheBusting,
16 | transformToRequire: {
17 | video: ['src', 'poster'],
18 | source: 'src',
19 | img: 'src',
20 | image: 'xlink:href'
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/frontend/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const config = require('../config')
5 | const vueLoaderConfig = require('./vue-loader.conf')
6 |
7 | function resolve (dir) {
8 | return path.join(__dirname, '..', dir)
9 | }
10 |
11 | const createLintingRule = () => ({
12 | test: /\.(js|vue)$/,
13 | loader: 'eslint-loader',
14 | enforce: 'pre',
15 | include: [resolve('src'), resolve('test')],
16 | options: {
17 | formatter: require('eslint-friendly-formatter'),
18 | emitWarning: !config.dev.showEslintErrorsInOverlay
19 | }
20 | })
21 |
22 | module.exports = {
23 | context: path.resolve(__dirname, '../'),
24 | entry: {
25 | app: './src/main.js'
26 | },
27 | output: {
28 | path: config.build.assetsRoot,
29 | filename: '[name].js',
30 | publicPath: process.env.NODE_ENV === 'production'
31 | ? config.build.assetsPublicPath
32 | : config.dev.assetsPublicPath
33 | },
34 | resolve: {
35 | extensions: ['.js', '.vue', '.json'],
36 | alias: {
37 | 'vue$': 'vue/dist/vue.esm.js',
38 | '@': resolve('src'),
39 | }
40 | },
41 | module: {
42 | rules: [
43 | ...(config.dev.useEslint ? [createLintingRule()] : []),
44 | {
45 | test: /\.vue$/,
46 | loader: 'vue-loader',
47 | options: vueLoaderConfig
48 | },
49 | {
50 | test: /\.js$/,
51 | loader: 'babel-loader',
52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
53 | },
54 | {
55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
56 | loader: 'url-loader',
57 | options: {
58 | limit: 10000,
59 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
60 | }
61 | },
62 | {
63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
64 | loader: 'url-loader',
65 | options: {
66 | limit: 10000,
67 | name: utils.assetsPath('media/[name].[hash:7].[ext]')
68 | }
69 | },
70 | {
71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
72 | loader: 'url-loader',
73 | options: {
74 | limit: 10000,
75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
76 | }
77 | }
78 | ]
79 | },
80 | node: {
81 | // prevent webpack from injecting useless setImmediate polyfill because Vue
82 | // source contains it (although only uses it if it's native).
83 | setImmediate: false,
84 | // prevent webpack from injecting mocks to Node native modules
85 | // that does not make sense for the client
86 | dgram: 'empty',
87 | fs: 'empty',
88 | net: 'empty',
89 | tls: 'empty',
90 | child_process: 'empty'
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/frontend/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const webpack = require('webpack')
4 | const config = require('../config')
5 | const merge = require('webpack-merge')
6 | const path = require('path')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
11 | const portfinder = require('portfinder')
12 |
13 | const HOST = process.env.HOST
14 | const PORT = process.env.PORT && Number(process.env.PORT)
15 |
16 | const devWebpackConfig = merge(baseWebpackConfig, {
17 | module: {
18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
19 | },
20 | // cheap-module-eval-source-map is faster for development
21 | devtool: config.dev.devtool,
22 |
23 | // these devServer options should be customized in /config/index.js
24 | devServer: {
25 | clientLogLevel: 'warning',
26 | historyApiFallback: {
27 | rewrites: [
28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
29 | ],
30 | },
31 | hot: true,
32 | contentBase: false, // since we use CopyWebpackPlugin.
33 | compress: true,
34 | host: HOST || config.dev.host,
35 | port: PORT || config.dev.port,
36 | open: config.dev.autoOpenBrowser,
37 | overlay: config.dev.errorOverlay
38 | ? { warnings: false, errors: true }
39 | : false,
40 | publicPath: config.dev.assetsPublicPath,
41 | proxy: config.dev.proxyTable,
42 | quiet: true, // necessary for FriendlyErrorsPlugin
43 | watchOptions: {
44 | poll: config.dev.poll,
45 | }
46 | },
47 | plugins: [
48 | new webpack.DefinePlugin({
49 | 'process.env': require('../config/dev.env')
50 | }),
51 | new webpack.HotModuleReplacementPlugin(),
52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
53 | new webpack.NoEmitOnErrorsPlugin(),
54 | // https://github.com/ampedandwired/html-webpack-plugin
55 | new HtmlWebpackPlugin({
56 | filename: 'index.html',
57 | template: 'index.html',
58 | inject: true
59 | }),
60 | // copy custom static assets
61 | new CopyWebpackPlugin([
62 | {
63 | from: path.resolve(__dirname, '../static'),
64 | to: config.dev.assetsSubDirectory,
65 | ignore: ['.*']
66 | }
67 | ])
68 | ]
69 | })
70 |
71 | module.exports = new Promise((resolve, reject) => {
72 | portfinder.basePort = process.env.PORT || config.dev.port
73 | portfinder.getPort((err, port) => {
74 | if (err) {
75 | reject(err)
76 | } else {
77 | // publish the new Port, necessary for e2e tests
78 | process.env.PORT = port
79 | // add port to devServer config
80 | devWebpackConfig.devServer.port = port
81 |
82 | // Add FriendlyErrorsPlugin
83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
84 | compilationSuccessInfo: {
85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
86 | },
87 | onErrors: config.dev.notifyOnErrors
88 | ? utils.createNotifierCallback()
89 | : undefined
90 | }))
91 |
92 | resolve(devWebpackConfig)
93 | }
94 | })
95 | })
96 |
--------------------------------------------------------------------------------
/frontend/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const webpack = require('webpack')
5 | const config = require('../config')
6 | const merge = require('webpack-merge')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
13 |
14 | const env = require('../config/prod.env')
15 |
16 | const webpackConfig = merge(baseWebpackConfig, {
17 | module: {
18 | rules: utils.styleLoaders({
19 | sourceMap: config.build.productionSourceMap,
20 | extract: true,
21 | usePostCSS: true
22 | })
23 | },
24 | devtool: config.build.productionSourceMap ? config.build.devtool : false,
25 | output: {
26 | path: config.build.assetsRoot,
27 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
29 | },
30 | plugins: [
31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
32 | new webpack.DefinePlugin({
33 | 'process.env': env
34 | }),
35 | new UglifyJsPlugin({
36 | uglifyOptions: {
37 | compress: {
38 | warnings: false
39 | }
40 | },
41 | sourceMap: config.build.productionSourceMap,
42 | parallel: true
43 | }),
44 | // extract css into its own file
45 | new ExtractTextPlugin({
46 | filename: utils.assetsPath('css/[name].[contenthash].css'),
47 | // Setting the following option to `false` will not extract CSS from codesplit chunks.
48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
51 | allChunks: true,
52 | }),
53 | // Compress extracted CSS. We are using this plugin so that possible
54 | // duplicated CSS from different components can be deduped.
55 | new OptimizeCSSPlugin({
56 | cssProcessorOptions: config.build.productionSourceMap
57 | ? { safe: true, map: { inline: false } }
58 | : { safe: true }
59 | }),
60 | // generate dist index.html with correct asset hash for caching.
61 | // you can customize output by editing /index.html
62 | // see https://github.com/ampedandwired/html-webpack-plugin
63 | new HtmlWebpackPlugin({
64 | filename: config.build.index,
65 | template: 'index.html',
66 | inject: true,
67 | minify: {
68 | removeComments: true,
69 | collapseWhitespace: true,
70 | removeAttributeQuotes: true
71 | // more options:
72 | // https://github.com/kangax/html-minifier#options-quick-reference
73 | },
74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
75 | chunksSortMode: 'dependency'
76 | }),
77 | // keep module.id stable when vendor modules does not change
78 | new webpack.HashedModuleIdsPlugin(),
79 | // enable scope hoisting
80 | new webpack.optimize.ModuleConcatenationPlugin(),
81 | // split vendor js into its own file
82 | new webpack.optimize.CommonsChunkPlugin({
83 | name: 'vendor',
84 | minChunks (module) {
85 | // any required modules inside node_modules are extracted to vendor
86 | return (
87 | module.resource &&
88 | /\.js$/.test(module.resource) &&
89 | module.resource.indexOf(
90 | path.join(__dirname, '../node_modules')
91 | ) === 0
92 | )
93 | }
94 | }),
95 | // extract webpack runtime and module manifest to its own file in order to
96 | // prevent vendor hash from being updated whenever app bundle is updated
97 | new webpack.optimize.CommonsChunkPlugin({
98 | name: 'manifest',
99 | minChunks: Infinity
100 | }),
101 | // This instance extracts shared chunks from code splitted chunks and bundles them
102 | // in a separate chunk, similar to the vendor chunk
103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
104 | new webpack.optimize.CommonsChunkPlugin({
105 | name: 'app',
106 | async: 'vendor-async',
107 | children: true,
108 | minChunks: 3
109 | }),
110 |
111 | // copy custom static assets
112 | new CopyWebpackPlugin([
113 | {
114 | from: path.resolve(__dirname, '../static'),
115 | to: config.build.assetsSubDirectory,
116 | ignore: ['.*']
117 | }
118 | ])
119 | ]
120 | })
121 |
122 | if (config.build.productionGzip) {
123 | const CompressionWebpackPlugin = require('compression-webpack-plugin')
124 |
125 | webpackConfig.plugins.push(
126 | new CompressionWebpackPlugin({
127 | asset: '[path].gz[query]',
128 | algorithm: 'gzip',
129 | test: new RegExp(
130 | '\\.(' +
131 | config.build.productionGzipExtensions.join('|') +
132 | ')$'
133 | ),
134 | threshold: 10240,
135 | minRatio: 0.8
136 | })
137 | )
138 | }
139 |
140 | if (config.build.bundleAnalyzerReport) {
141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
143 | }
144 |
145 | module.exports = webpackConfig
146 |
--------------------------------------------------------------------------------
/frontend/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/frontend/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.3.1
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | dev: {
9 |
10 | // Paths
11 | assetsSubDirectory: 'static',
12 | assetsPublicPath: '/',
13 | proxyTable: {},
14 |
15 | // Various Dev Server settings
16 | host: 'localhost', // can be overwritten by process.env.HOST
17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
18 | autoOpenBrowser: false,
19 | errorOverlay: true,
20 | notifyOnErrors: true,
21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
22 |
23 | // Use Eslint Loader?
24 | // If true, your code will be linted during bundling and
25 | // linting errors and warnings will be shown in the console.
26 | useEslint: true,
27 | // If true, eslint errors and warnings will also be shown in the error overlay
28 | // in the browser.
29 | showEslintErrorsInOverlay: false,
30 |
31 | /**
32 | * Source Maps
33 | */
34 |
35 | // https://webpack.js.org/configuration/devtool/#development
36 | devtool: 'cheap-module-eval-source-map',
37 |
38 | // If you have problems debugging vue-files in devtools,
39 | // set this to false - it *may* help
40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting
41 | cacheBusting: true,
42 |
43 | cssSourceMap: true
44 | },
45 |
46 | build: {
47 | // Template for index.html
48 | index: path.resolve(__dirname, '../dist/index.html'),
49 |
50 | // Paths
51 | assetsRoot: path.resolve(__dirname, '../dist'),
52 | assetsSubDirectory: 'static',
53 | assetsPublicPath: '/',
54 |
55 | /**
56 | * Source Maps
57 | */
58 |
59 | productionSourceMap: true,
60 | // https://webpack.js.org/configuration/devtool/#production
61 | devtool: '#source-map',
62 |
63 | // Gzip off by default as many popular static hosts such as
64 | // Surge or Netlify already gzip all static assets for you.
65 | // Before setting to `true`, make sure to:
66 | // npm install --save-dev compression-webpack-plugin
67 | productionGzip: false,
68 | productionGzipExtensions: ['js', 'css'],
69 |
70 | // Run the build command with an extra argument to
71 | // View the bundle analyzer report after build finishes:
72 | // `npm run build --report`
73 | // Set to `true` or `false` to always turn it on or off
74 | bundleAnalyzerReport: process.env.npm_config_report
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/frontend/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/frontend/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | frontend
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "1.0.0",
4 | "description": "Fackbook Libra blockchain wallet frontend",
5 | "author": "jim",
6 | "private": true,
7 | "scripts": {
8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9 | "start": "npm run dev",
10 | "lint": "eslint --ext .js,.vue src",
11 | "build": "node build/build.js"
12 | },
13 | "dependencies": {
14 | "vue": "^2.5.2",
15 | "vue-router": "^3.0.1"
16 | },
17 | "devDependencies": {
18 | "autoprefixer": "^7.1.2",
19 | "babel-core": "^6.22.1",
20 | "babel-eslint": "^8.2.1",
21 | "babel-helper-vue-jsx-merge-props": "^2.0.3",
22 | "babel-loader": "^7.1.1",
23 | "babel-plugin-syntax-jsx": "^6.18.0",
24 | "babel-plugin-transform-runtime": "^6.22.0",
25 | "babel-plugin-transform-vue-jsx": "^3.5.0",
26 | "babel-preset-env": "^1.3.2",
27 | "babel-preset-stage-2": "^6.22.0",
28 | "chalk": "^2.0.1",
29 | "copy-webpack-plugin": "^4.0.1",
30 | "css-loader": "^0.28.0",
31 | "eslint": "^4.15.0",
32 | "eslint-config-airbnb-base": "^11.3.0",
33 | "eslint-friendly-formatter": "^3.0.0",
34 | "eslint-import-resolver-webpack": "^0.8.3",
35 | "eslint-loader": "^1.7.1",
36 | "eslint-plugin-import": "^2.7.0",
37 | "eslint-plugin-vue": "^4.0.0",
38 | "extract-text-webpack-plugin": "^3.0.0",
39 | "file-loader": "^1.1.4",
40 | "friendly-errors-webpack-plugin": "^1.6.1",
41 | "html-webpack-plugin": "^2.30.1",
42 | "node-notifier": "^5.1.2",
43 | "optimize-css-assets-webpack-plugin": "^3.2.0",
44 | "ora": "^1.2.0",
45 | "portfinder": "^1.0.13",
46 | "postcss-import": "^11.0.0",
47 | "postcss-loader": "^2.0.8",
48 | "postcss-url": "^7.2.1",
49 | "rimraf": "^2.6.0",
50 | "semver": "^5.3.0",
51 | "shelljs": "^0.7.6",
52 | "uglifyjs-webpack-plugin": "^1.1.1",
53 | "url-loader": "^0.5.8",
54 | "vue-loader": "^13.3.0",
55 | "vue-style-loader": "^3.0.1",
56 | "vue-template-compiler": "^2.5.2",
57 | "webpack": "^3.6.0",
58 | "webpack-bundle-analyzer": "^2.9.0",
59 | "webpack-dev-server": "^2.9.1",
60 | "webpack-merge": "^4.1.0"
61 | },
62 | "engines": {
63 | "node": ">= 6.0.0",
64 | "npm": ">= 3.0.0"
65 | },
66 | "browserslist": [
67 | "> 1%",
68 | "last 2 versions",
69 | "not ie <= 8"
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/frontend/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
13 |
14 |
27 |
--------------------------------------------------------------------------------
/frontend/src/assets/libra.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/learndapp/Libra-wallet/0364e4c3fd4efa84c98cf56c5d2920394ff1871f/frontend/src/assets/libra.png
--------------------------------------------------------------------------------
/frontend/src/components/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
33 |
42 |
43 |
44 |
60 |
--------------------------------------------------------------------------------
/frontend/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue';
4 | import App from './App';
5 | import router from './router';
6 |
7 | Vue.config.productionTip = false;
8 |
9 | /* eslint-disable no-new */
10 | new Vue({
11 | el: '#app',
12 | router,
13 | components: { App },
14 | template: '',
15 | });
16 |
--------------------------------------------------------------------------------
/frontend/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Router from 'vue-router';
3 | import Home from '@/components/Home';
4 |
5 | Vue.use(Router);
6 |
7 | export default new Router({
8 | routes: [
9 | {
10 | path: '/',
11 | name: 'Home',
12 | component: Home,
13 | },
14 | ],
15 | });
16 |
--------------------------------------------------------------------------------
/frontend/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/learndapp/Libra-wallet/0364e4c3fd4efa84c98cf56c5d2920394ff1871f/frontend/static/.gitkeep
--------------------------------------------------------------------------------
/node/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | dist
4 | web-dist
5 |
6 |
--------------------------------------------------------------------------------
/node/app.js:
--------------------------------------------------------------------------------
1 | const Koa = require("koa");
2 | const app = new Koa();
3 | const koaBody = require("koa-body");
4 |
5 | const router = require("./router");
6 | const PORT = process.env.PORT || 17000;
7 |
8 | app
9 | .use(async (ctx, next) => {
10 | ctx.set("Access-Control-Allow-Origin", "*");
11 | ctx.set("Access-Control-Allow-Methods", "GET,POST");
12 | ctx.set(
13 | "Access-Control-Allow-Headers",
14 | "X-Real-IP, Content-Type, Authorization"
15 | );
16 | if (ctx.method === "OPTIONS") {
17 | ctx.status = 204;
18 | } else {
19 | await next();
20 | }
21 | })
22 | .use(
23 | koaBody({
24 | multipart: true,
25 | formLimit: "20mb",
26 | jsonLimit: "20mb",
27 | textLimit: "20mb"
28 | })
29 | )
30 | .use(router.routes())
31 | .use(router.allowedMethods());
32 |
33 | app.listen(PORT, "localhost");
34 |
--------------------------------------------------------------------------------
/node/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "libra-wallet",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@grpc/proto-loader": {
8 | "version": "0.5.1",
9 | "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.1.tgz",
10 | "integrity": "sha512-3y0FhacYAwWvyXshH18eDkUI40wT/uGio7MAegzY8lO5+wVsc19+1A7T0pPptae4kl7bdITL+0cHpnAPmryBjQ==",
11 | "requires": {
12 | "lodash.camelcase": "^4.3.0",
13 | "protobufjs": "^6.8.6"
14 | }
15 | },
16 | "@protobufjs/aspromise": {
17 | "version": "1.1.2",
18 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
19 | "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
20 | },
21 | "@protobufjs/base64": {
22 | "version": "1.1.2",
23 | "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
24 | "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
25 | },
26 | "@protobufjs/codegen": {
27 | "version": "2.0.4",
28 | "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
29 | "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
30 | },
31 | "@protobufjs/eventemitter": {
32 | "version": "1.1.0",
33 | "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
34 | "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
35 | },
36 | "@protobufjs/fetch": {
37 | "version": "1.1.0",
38 | "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
39 | "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
40 | "requires": {
41 | "@protobufjs/aspromise": "^1.1.1",
42 | "@protobufjs/inquire": "^1.1.0"
43 | }
44 | },
45 | "@protobufjs/float": {
46 | "version": "1.0.2",
47 | "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
48 | "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
49 | },
50 | "@protobufjs/inquire": {
51 | "version": "1.1.0",
52 | "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
53 | "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
54 | },
55 | "@protobufjs/path": {
56 | "version": "1.1.2",
57 | "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
58 | "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
59 | },
60 | "@protobufjs/pool": {
61 | "version": "1.1.0",
62 | "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
63 | "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
64 | },
65 | "@protobufjs/utf8": {
66 | "version": "1.1.0",
67 | "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
68 | "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
69 | },
70 | "@types/events": {
71 | "version": "3.0.0",
72 | "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
73 | "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g=="
74 | },
75 | "@types/formidable": {
76 | "version": "1.0.31",
77 | "resolved": "https://registry.npmjs.org/@types/formidable/-/formidable-1.0.31.tgz",
78 | "integrity": "sha512-dIhM5t8lRP0oWe2HF8MuPvdd1TpPTjhDMAqemcq6oIZQCBQTovhBAdTQ5L5veJB4pdQChadmHuxtB0YzqvfU3Q==",
79 | "requires": {
80 | "@types/events": "*",
81 | "@types/node": "*"
82 | }
83 | },
84 | "@types/long": {
85 | "version": "4.0.0",
86 | "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz",
87 | "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q=="
88 | },
89 | "@types/node": {
90 | "version": "12.0.10",
91 | "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.10.tgz",
92 | "integrity": "sha512-LcsGbPomWsad6wmMNv7nBLw7YYYyfdYcz6xryKYQhx89c3XXan+8Q6AJ43G5XDIaklaVkK3mE4fCb0SBvMiPSQ=="
93 | },
94 | "accepts": {
95 | "version": "1.3.7",
96 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
97 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
98 | "requires": {
99 | "mime-types": "~2.1.24",
100 | "negotiator": "0.6.2"
101 | }
102 | },
103 | "ansi-regex": {
104 | "version": "2.1.1",
105 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
106 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
107 | },
108 | "any-promise": {
109 | "version": "1.3.0",
110 | "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
111 | "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8="
112 | },
113 | "ascli": {
114 | "version": "1.0.1",
115 | "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz",
116 | "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=",
117 | "requires": {
118 | "colour": "~0.7.1",
119 | "optjs": "~3.2.2"
120 | }
121 | },
122 | "balanced-match": {
123 | "version": "1.0.0",
124 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
125 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
126 | },
127 | "brace-expansion": {
128 | "version": "1.1.11",
129 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
130 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
131 | "requires": {
132 | "balanced-match": "^1.0.0",
133 | "concat-map": "0.0.1"
134 | }
135 | },
136 | "bytebuffer": {
137 | "version": "5.0.1",
138 | "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz",
139 | "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=",
140 | "requires": {
141 | "long": "~3"
142 | },
143 | "dependencies": {
144 | "long": {
145 | "version": "3.2.0",
146 | "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
147 | "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s="
148 | }
149 | }
150 | },
151 | "bytes": {
152 | "version": "3.1.0",
153 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
154 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
155 | },
156 | "cache-content-type": {
157 | "version": "1.0.1",
158 | "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz",
159 | "integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==",
160 | "requires": {
161 | "mime-types": "^2.1.18",
162 | "ylru": "^1.2.0"
163 | }
164 | },
165 | "camelcase": {
166 | "version": "2.1.1",
167 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
168 | "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8="
169 | },
170 | "cliui": {
171 | "version": "3.2.0",
172 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
173 | "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
174 | "requires": {
175 | "string-width": "^1.0.1",
176 | "strip-ansi": "^3.0.1",
177 | "wrap-ansi": "^2.0.0"
178 | }
179 | },
180 | "co": {
181 | "version": "4.6.0",
182 | "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
183 | "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
184 | },
185 | "co-body": {
186 | "version": "5.2.0",
187 | "resolved": "https://registry.npmjs.org/co-body/-/co-body-5.2.0.tgz",
188 | "integrity": "sha512-sX/LQ7LqUhgyaxzbe7IqwPeTr2yfpfUIQ/dgpKo6ZI4y4lpQA0YxAomWIY+7I7rHWcG02PG+OuPREzMW/5tszQ==",
189 | "requires": {
190 | "inflation": "^2.0.0",
191 | "qs": "^6.4.0",
192 | "raw-body": "^2.2.0",
193 | "type-is": "^1.6.14"
194 | }
195 | },
196 | "code-point-at": {
197 | "version": "1.1.0",
198 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
199 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
200 | },
201 | "colour": {
202 | "version": "0.7.1",
203 | "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz",
204 | "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g="
205 | },
206 | "concat-map": {
207 | "version": "0.0.1",
208 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
209 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
210 | },
211 | "content-disposition": {
212 | "version": "0.5.3",
213 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
214 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
215 | "requires": {
216 | "safe-buffer": "5.1.2"
217 | }
218 | },
219 | "content-type": {
220 | "version": "1.0.4",
221 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
222 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
223 | },
224 | "cookies": {
225 | "version": "0.7.3",
226 | "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.7.3.tgz",
227 | "integrity": "sha512-+gixgxYSgQLTaTIilDHAdlNPZDENDQernEMiIcZpYYP14zgHsCt4Ce1FEjFtcp6GefhozebB6orvhAAWx/IS0A==",
228 | "requires": {
229 | "depd": "~1.1.2",
230 | "keygrip": "~1.0.3"
231 | }
232 | },
233 | "debug": {
234 | "version": "3.1.0",
235 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
236 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
237 | "requires": {
238 | "ms": "2.0.0"
239 | }
240 | },
241 | "decamelize": {
242 | "version": "1.2.0",
243 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
244 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
245 | },
246 | "deep-equal": {
247 | "version": "1.0.1",
248 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
249 | "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
250 | },
251 | "delegates": {
252 | "version": "1.0.0",
253 | "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
254 | "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
255 | },
256 | "depd": {
257 | "version": "1.1.2",
258 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
259 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
260 | },
261 | "destroy": {
262 | "version": "1.0.4",
263 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
264 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
265 | },
266 | "ee-first": {
267 | "version": "1.1.1",
268 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
269 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
270 | },
271 | "error-inject": {
272 | "version": "1.0.0",
273 | "resolved": "https://registry.npmjs.org/error-inject/-/error-inject-1.0.0.tgz",
274 | "integrity": "sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc="
275 | },
276 | "escape-html": {
277 | "version": "1.0.3",
278 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
279 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
280 | },
281 | "formidable": {
282 | "version": "1.2.1",
283 | "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz",
284 | "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg=="
285 | },
286 | "fresh": {
287 | "version": "0.5.2",
288 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
289 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
290 | },
291 | "fs.realpath": {
292 | "version": "1.0.0",
293 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
294 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
295 | },
296 | "glob": {
297 | "version": "7.1.4",
298 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
299 | "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
300 | "requires": {
301 | "fs.realpath": "^1.0.0",
302 | "inflight": "^1.0.4",
303 | "inherits": "2",
304 | "minimatch": "^3.0.4",
305 | "once": "^1.3.0",
306 | "path-is-absolute": "^1.0.0"
307 | }
308 | },
309 | "google-protobuf": {
310 | "version": "3.8.0",
311 | "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.8.0.tgz",
312 | "integrity": "sha512-tx39PTc//HaIT7K/baUF/8JYLGDozEi1e4xwPP1qSx3InP78cNpbSJpxiDsDMwj77qNOndVBDXnn7oi9zKxZew=="
313 | },
314 | "grpc": {
315 | "version": "1.21.1",
316 | "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.21.1.tgz",
317 | "integrity": "sha512-PFsZQazf62nP05a0xm23mlImMuw5oVlqF/0zakmsdqJgvbABe+d6VThY2PfhqJmWEL/FhQ6QNYsxS5EAM6++7g==",
318 | "requires": {
319 | "lodash.camelcase": "^4.3.0",
320 | "lodash.clone": "^4.5.0",
321 | "nan": "^2.13.2",
322 | "node-pre-gyp": "^0.13.0",
323 | "protobufjs": "^5.0.3"
324 | },
325 | "dependencies": {
326 | "abbrev": {
327 | "version": "1.1.1",
328 | "bundled": true
329 | },
330 | "ansi-regex": {
331 | "version": "2.1.1",
332 | "bundled": true
333 | },
334 | "aproba": {
335 | "version": "1.2.0",
336 | "bundled": true
337 | },
338 | "are-we-there-yet": {
339 | "version": "1.1.5",
340 | "bundled": true,
341 | "requires": {
342 | "delegates": "^1.0.0",
343 | "readable-stream": "^2.0.6"
344 | }
345 | },
346 | "balanced-match": {
347 | "version": "1.0.0",
348 | "bundled": true
349 | },
350 | "brace-expansion": {
351 | "version": "1.1.11",
352 | "bundled": true,
353 | "requires": {
354 | "balanced-match": "^1.0.0",
355 | "concat-map": "0.0.1"
356 | }
357 | },
358 | "chownr": {
359 | "version": "1.1.1",
360 | "bundled": true
361 | },
362 | "code-point-at": {
363 | "version": "1.1.0",
364 | "bundled": true
365 | },
366 | "concat-map": {
367 | "version": "0.0.1",
368 | "bundled": true
369 | },
370 | "console-control-strings": {
371 | "version": "1.1.0",
372 | "bundled": true
373 | },
374 | "core-util-is": {
375 | "version": "1.0.2",
376 | "bundled": true
377 | },
378 | "deep-extend": {
379 | "version": "0.6.0",
380 | "bundled": true
381 | },
382 | "delegates": {
383 | "version": "1.0.0",
384 | "bundled": true
385 | },
386 | "detect-libc": {
387 | "version": "1.0.3",
388 | "bundled": true
389 | },
390 | "fs-minipass": {
391 | "version": "1.2.5",
392 | "bundled": true,
393 | "requires": {
394 | "minipass": "^2.2.1"
395 | }
396 | },
397 | "fs.realpath": {
398 | "version": "1.0.0",
399 | "bundled": true
400 | },
401 | "gauge": {
402 | "version": "2.7.4",
403 | "bundled": true,
404 | "requires": {
405 | "aproba": "^1.0.3",
406 | "console-control-strings": "^1.0.0",
407 | "has-unicode": "^2.0.0",
408 | "object-assign": "^4.1.0",
409 | "signal-exit": "^3.0.0",
410 | "string-width": "^1.0.1",
411 | "strip-ansi": "^3.0.1",
412 | "wide-align": "^1.1.0"
413 | }
414 | },
415 | "has-unicode": {
416 | "version": "2.0.1",
417 | "bundled": true
418 | },
419 | "iconv-lite": {
420 | "version": "0.4.23",
421 | "bundled": true,
422 | "requires": {
423 | "safer-buffer": ">= 2.1.2 < 3"
424 | }
425 | },
426 | "ignore-walk": {
427 | "version": "3.0.1",
428 | "bundled": true,
429 | "requires": {
430 | "minimatch": "^3.0.4"
431 | }
432 | },
433 | "inflight": {
434 | "version": "1.0.6",
435 | "bundled": true,
436 | "requires": {
437 | "once": "^1.3.0",
438 | "wrappy": "1"
439 | }
440 | },
441 | "inherits": {
442 | "version": "2.0.3",
443 | "bundled": true
444 | },
445 | "ini": {
446 | "version": "1.3.5",
447 | "bundled": true
448 | },
449 | "is-fullwidth-code-point": {
450 | "version": "1.0.0",
451 | "bundled": true,
452 | "requires": {
453 | "number-is-nan": "^1.0.0"
454 | }
455 | },
456 | "isarray": {
457 | "version": "1.0.0",
458 | "bundled": true
459 | },
460 | "minimatch": {
461 | "version": "3.0.4",
462 | "bundled": true,
463 | "requires": {
464 | "brace-expansion": "^1.1.7"
465 | }
466 | },
467 | "minimist": {
468 | "version": "1.2.0",
469 | "bundled": true
470 | },
471 | "minipass": {
472 | "version": "2.3.5",
473 | "bundled": true,
474 | "requires": {
475 | "safe-buffer": "^5.1.2",
476 | "yallist": "^3.0.0"
477 | }
478 | },
479 | "minizlib": {
480 | "version": "1.2.1",
481 | "bundled": true,
482 | "requires": {
483 | "minipass": "^2.2.1"
484 | }
485 | },
486 | "mkdirp": {
487 | "version": "0.5.1",
488 | "bundled": true,
489 | "requires": {
490 | "minimist": "0.0.8"
491 | },
492 | "dependencies": {
493 | "minimist": {
494 | "version": "0.0.8",
495 | "bundled": true
496 | }
497 | }
498 | },
499 | "needle": {
500 | "version": "2.3.1",
501 | "bundled": true,
502 | "requires": {
503 | "debug": "^4.1.0",
504 | "iconv-lite": "^0.4.4",
505 | "sax": "^1.2.4"
506 | },
507 | "dependencies": {
508 | "debug": {
509 | "version": "4.1.1",
510 | "bundled": true,
511 | "requires": {
512 | "ms": "^2.1.1"
513 | }
514 | },
515 | "ms": {
516 | "version": "2.1.1",
517 | "bundled": true
518 | }
519 | }
520 | },
521 | "node-pre-gyp": {
522 | "version": "0.13.0",
523 | "bundled": true,
524 | "requires": {
525 | "detect-libc": "^1.0.2",
526 | "mkdirp": "^0.5.1",
527 | "needle": "^2.2.1",
528 | "nopt": "^4.0.1",
529 | "npm-packlist": "^1.1.6",
530 | "npmlog": "^4.0.2",
531 | "rc": "^1.2.7",
532 | "rimraf": "^2.6.1",
533 | "semver": "^5.3.0",
534 | "tar": "^4"
535 | }
536 | },
537 | "nopt": {
538 | "version": "4.0.1",
539 | "bundled": true,
540 | "requires": {
541 | "abbrev": "1",
542 | "osenv": "^0.1.4"
543 | }
544 | },
545 | "npm-bundled": {
546 | "version": "1.0.6",
547 | "bundled": true
548 | },
549 | "npm-packlist": {
550 | "version": "1.4.1",
551 | "bundled": true,
552 | "requires": {
553 | "ignore-walk": "^3.0.1",
554 | "npm-bundled": "^1.0.1"
555 | }
556 | },
557 | "npmlog": {
558 | "version": "4.1.2",
559 | "bundled": true,
560 | "requires": {
561 | "are-we-there-yet": "~1.1.2",
562 | "console-control-strings": "~1.1.0",
563 | "gauge": "~2.7.3",
564 | "set-blocking": "~2.0.0"
565 | }
566 | },
567 | "number-is-nan": {
568 | "version": "1.0.1",
569 | "bundled": true
570 | },
571 | "object-assign": {
572 | "version": "4.1.1",
573 | "bundled": true
574 | },
575 | "once": {
576 | "version": "1.4.0",
577 | "bundled": true,
578 | "requires": {
579 | "wrappy": "1"
580 | }
581 | },
582 | "os-homedir": {
583 | "version": "1.0.2",
584 | "bundled": true
585 | },
586 | "os-tmpdir": {
587 | "version": "1.0.2",
588 | "bundled": true
589 | },
590 | "osenv": {
591 | "version": "0.1.5",
592 | "bundled": true,
593 | "requires": {
594 | "os-homedir": "^1.0.0",
595 | "os-tmpdir": "^1.0.0"
596 | }
597 | },
598 | "path-is-absolute": {
599 | "version": "1.0.1",
600 | "bundled": true
601 | },
602 | "process-nextick-args": {
603 | "version": "2.0.0",
604 | "bundled": true
605 | },
606 | "protobufjs": {
607 | "version": "5.0.3",
608 | "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz",
609 | "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==",
610 | "requires": {
611 | "ascli": "~1",
612 | "bytebuffer": "~5",
613 | "glob": "^7.0.5",
614 | "yargs": "^3.10.0"
615 | }
616 | },
617 | "rc": {
618 | "version": "1.2.8",
619 | "bundled": true,
620 | "requires": {
621 | "deep-extend": "^0.6.0",
622 | "ini": "~1.3.0",
623 | "minimist": "^1.2.0",
624 | "strip-json-comments": "~2.0.1"
625 | }
626 | },
627 | "readable-stream": {
628 | "version": "2.3.6",
629 | "bundled": true,
630 | "requires": {
631 | "core-util-is": "~1.0.0",
632 | "inherits": "~2.0.3",
633 | "isarray": "~1.0.0",
634 | "process-nextick-args": "~2.0.0",
635 | "safe-buffer": "~5.1.1",
636 | "string_decoder": "~1.1.1",
637 | "util-deprecate": "~1.0.1"
638 | }
639 | },
640 | "rimraf": {
641 | "version": "2.6.3",
642 | "bundled": true,
643 | "requires": {
644 | "glob": "^7.1.3"
645 | },
646 | "dependencies": {
647 | "glob": {
648 | "version": "7.1.4",
649 | "bundled": true,
650 | "requires": {
651 | "fs.realpath": "^1.0.0",
652 | "inflight": "^1.0.4",
653 | "inherits": "2",
654 | "minimatch": "^3.0.4",
655 | "once": "^1.3.0",
656 | "path-is-absolute": "^1.0.0"
657 | }
658 | }
659 | }
660 | },
661 | "safe-buffer": {
662 | "version": "5.1.2",
663 | "bundled": true
664 | },
665 | "safer-buffer": {
666 | "version": "2.1.2",
667 | "bundled": true
668 | },
669 | "sax": {
670 | "version": "1.2.4",
671 | "bundled": true
672 | },
673 | "semver": {
674 | "version": "5.7.0",
675 | "bundled": true
676 | },
677 | "set-blocking": {
678 | "version": "2.0.0",
679 | "bundled": true
680 | },
681 | "signal-exit": {
682 | "version": "3.0.2",
683 | "bundled": true
684 | },
685 | "string-width": {
686 | "version": "1.0.2",
687 | "bundled": true,
688 | "requires": {
689 | "code-point-at": "^1.0.0",
690 | "is-fullwidth-code-point": "^1.0.0",
691 | "strip-ansi": "^3.0.0"
692 | }
693 | },
694 | "string_decoder": {
695 | "version": "1.1.1",
696 | "bundled": true,
697 | "requires": {
698 | "safe-buffer": "~5.1.0"
699 | }
700 | },
701 | "strip-ansi": {
702 | "version": "3.0.1",
703 | "bundled": true,
704 | "requires": {
705 | "ansi-regex": "^2.0.0"
706 | }
707 | },
708 | "strip-json-comments": {
709 | "version": "2.0.1",
710 | "bundled": true
711 | },
712 | "tar": {
713 | "version": "4.4.8",
714 | "bundled": true,
715 | "requires": {
716 | "chownr": "^1.1.1",
717 | "fs-minipass": "^1.2.5",
718 | "minipass": "^2.3.4",
719 | "minizlib": "^1.1.1",
720 | "mkdirp": "^0.5.0",
721 | "safe-buffer": "^5.1.2",
722 | "yallist": "^3.0.2"
723 | }
724 | },
725 | "util-deprecate": {
726 | "version": "1.0.2",
727 | "bundled": true
728 | },
729 | "wide-align": {
730 | "version": "1.1.3",
731 | "bundled": true,
732 | "requires": {
733 | "string-width": "^1.0.2 || 2"
734 | }
735 | },
736 | "wrappy": {
737 | "version": "1.0.2",
738 | "bundled": true
739 | },
740 | "yallist": {
741 | "version": "3.0.3",
742 | "bundled": true
743 | }
744 | }
745 | },
746 | "http-assert": {
747 | "version": "1.4.1",
748 | "resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.4.1.tgz",
749 | "integrity": "sha512-rdw7q6GTlibqVVbXr0CKelfV5iY8G2HqEUkhSk297BMbSpSL8crXC+9rjKoMcZZEsksX30le6f/4ul4E28gegw==",
750 | "requires": {
751 | "deep-equal": "~1.0.1",
752 | "http-errors": "~1.7.2"
753 | }
754 | },
755 | "http-errors": {
756 | "version": "1.7.3",
757 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
758 | "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
759 | "requires": {
760 | "depd": "~1.1.2",
761 | "inherits": "2.0.4",
762 | "setprototypeof": "1.1.1",
763 | "statuses": ">= 1.5.0 < 2",
764 | "toidentifier": "1.0.0"
765 | }
766 | },
767 | "iconv-lite": {
768 | "version": "0.4.24",
769 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
770 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
771 | "requires": {
772 | "safer-buffer": ">= 2.1.2 < 3"
773 | }
774 | },
775 | "inflation": {
776 | "version": "2.0.0",
777 | "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz",
778 | "integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8="
779 | },
780 | "inflight": {
781 | "version": "1.0.6",
782 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
783 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
784 | "requires": {
785 | "once": "^1.3.0",
786 | "wrappy": "1"
787 | }
788 | },
789 | "inherits": {
790 | "version": "2.0.4",
791 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
792 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
793 | },
794 | "invert-kv": {
795 | "version": "1.0.0",
796 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
797 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
798 | },
799 | "is-fullwidth-code-point": {
800 | "version": "1.0.0",
801 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
802 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
803 | "requires": {
804 | "number-is-nan": "^1.0.0"
805 | }
806 | },
807 | "is-generator-function": {
808 | "version": "1.0.7",
809 | "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz",
810 | "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw=="
811 | },
812 | "isarray": {
813 | "version": "0.0.1",
814 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
815 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
816 | },
817 | "keygrip": {
818 | "version": "1.0.3",
819 | "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.0.3.tgz",
820 | "integrity": "sha512-/PpesirAIfaklxUzp4Yb7xBper9MwP6hNRA6BGGUFCgbJ+BM5CKBtsoxinNXkLHAr+GXS1/lSlF2rP7cv5Fl+g=="
821 | },
822 | "koa": {
823 | "version": "2.7.0",
824 | "resolved": "https://registry.npmjs.org/koa/-/koa-2.7.0.tgz",
825 | "integrity": "sha512-7ojD05s2Q+hFudF8tDLZ1CpCdVZw8JQELWSkcfG9bdtoTDzMmkRF6BQBU7JzIzCCOY3xd3tftiy/loHBUYaY2Q==",
826 | "requires": {
827 | "accepts": "^1.3.5",
828 | "cache-content-type": "^1.0.0",
829 | "content-disposition": "~0.5.2",
830 | "content-type": "^1.0.4",
831 | "cookies": "~0.7.1",
832 | "debug": "~3.1.0",
833 | "delegates": "^1.0.0",
834 | "depd": "^1.1.2",
835 | "destroy": "^1.0.4",
836 | "error-inject": "^1.0.0",
837 | "escape-html": "^1.0.3",
838 | "fresh": "~0.5.2",
839 | "http-assert": "^1.3.0",
840 | "http-errors": "^1.6.3",
841 | "is-generator-function": "^1.0.7",
842 | "koa-compose": "^4.1.0",
843 | "koa-convert": "^1.2.0",
844 | "koa-is-json": "^1.0.0",
845 | "on-finished": "^2.3.0",
846 | "only": "~0.0.2",
847 | "parseurl": "^1.3.2",
848 | "statuses": "^1.5.0",
849 | "type-is": "^1.6.16",
850 | "vary": "^1.1.2"
851 | }
852 | },
853 | "koa-body": {
854 | "version": "4.1.0",
855 | "resolved": "https://registry.npmjs.org/koa-body/-/koa-body-4.1.0.tgz",
856 | "integrity": "sha512-rWkMfMaCjFmIAMohtjlrg4BqDzcotK5BdZhiwJu1ONuR1ceoFUjnH3wp0hEV39HuBlc9tI3eUUFMK4Cp6ccFtA==",
857 | "requires": {
858 | "@types/formidable": "^1.0.31",
859 | "co-body": "^5.1.1",
860 | "formidable": "^1.1.1"
861 | }
862 | },
863 | "koa-compose": {
864 | "version": "4.1.0",
865 | "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz",
866 | "integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw=="
867 | },
868 | "koa-convert": {
869 | "version": "1.2.0",
870 | "resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-1.2.0.tgz",
871 | "integrity": "sha1-2kCHXfSd4FOQmNFwC1CCDOvNIdA=",
872 | "requires": {
873 | "co": "^4.6.0",
874 | "koa-compose": "^3.0.0"
875 | },
876 | "dependencies": {
877 | "koa-compose": {
878 | "version": "3.2.1",
879 | "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-3.2.1.tgz",
880 | "integrity": "sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=",
881 | "requires": {
882 | "any-promise": "^1.1.0"
883 | }
884 | }
885 | }
886 | },
887 | "koa-is-json": {
888 | "version": "1.0.0",
889 | "resolved": "https://registry.npmjs.org/koa-is-json/-/koa-is-json-1.0.0.tgz",
890 | "integrity": "sha1-JzwH7c3Ljfaiwat9We52SRRR7BQ="
891 | },
892 | "koa-router": {
893 | "version": "7.4.0",
894 | "resolved": "https://registry.npmjs.org/koa-router/-/koa-router-7.4.0.tgz",
895 | "integrity": "sha512-IWhaDXeAnfDBEpWS6hkGdZ1ablgr6Q6pGdXCyK38RbzuH4LkUOpPqPw+3f8l8aTDrQmBQ7xJc0bs2yV4dzcO+g==",
896 | "requires": {
897 | "debug": "^3.1.0",
898 | "http-errors": "^1.3.1",
899 | "koa-compose": "^3.0.0",
900 | "methods": "^1.0.1",
901 | "path-to-regexp": "^1.1.1",
902 | "urijs": "^1.19.0"
903 | },
904 | "dependencies": {
905 | "koa-compose": {
906 | "version": "3.2.1",
907 | "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-3.2.1.tgz",
908 | "integrity": "sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=",
909 | "requires": {
910 | "any-promise": "^1.1.0"
911 | }
912 | }
913 | }
914 | },
915 | "lcid": {
916 | "version": "1.0.0",
917 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
918 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
919 | "requires": {
920 | "invert-kv": "^1.0.0"
921 | }
922 | },
923 | "libra-grpc": {
924 | "version": "0.0.3",
925 | "resolved": "https://registry.npmjs.org/libra-grpc/-/libra-grpc-0.0.3.tgz",
926 | "integrity": "sha512-J+/rIVL66QaLtIkCNbi3djN7Nxn77bPLbMTBBYaxE9O/bFp1sFAah06OQ/3JJBdOOyMU3BGEjsA7GQB96fYxTA==",
927 | "requires": {
928 | "@grpc/proto-loader": "^0.5.1",
929 | "google-protobuf": "^3.8.0",
930 | "grpc": "^1.21.1"
931 | }
932 | },
933 | "libra-weight": {
934 | "version": "0.0.2",
935 | "resolved": "https://registry.npmjs.org/libra-weight/-/libra-weight-0.0.2.tgz",
936 | "integrity": "sha512-YszcLI3i4OXB1aggEW27TGTC8P1q5eAuVFH9PAIcYSS9Uq7Tn0Ui275ANjyCH7vx9v5P1u3wLXrEX+kAKp4luQ==",
937 | "requires": {
938 | "@grpc/proto-loader": "^0.5.1",
939 | "google-protobuf": "^3.9.0-rc.1",
940 | "grpc": "^1.21.1"
941 | },
942 | "dependencies": {
943 | "google-protobuf": {
944 | "version": "3.9.0-rc.1",
945 | "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.9.0-rc.1.tgz",
946 | "integrity": "sha512-89ldj84zM2qm1F74/d/xXq/EpRwxox6uLtp3oHK/JSFZ6cTMWhMssgc5CdyxXd5eITaaOyAnB1Fv2TC1K6RO6g=="
947 | }
948 | }
949 | },
950 | "lodash": {
951 | "version": "4.17.11",
952 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
953 | "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
954 | },
955 | "lodash.camelcase": {
956 | "version": "4.3.0",
957 | "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
958 | "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
959 | },
960 | "lodash.clone": {
961 | "version": "4.5.0",
962 | "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz",
963 | "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y="
964 | },
965 | "long": {
966 | "version": "4.0.0",
967 | "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
968 | "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
969 | },
970 | "media-typer": {
971 | "version": "0.3.0",
972 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
973 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
974 | },
975 | "methods": {
976 | "version": "1.1.2",
977 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
978 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
979 | },
980 | "mime-db": {
981 | "version": "1.40.0",
982 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
983 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
984 | },
985 | "mime-types": {
986 | "version": "2.1.24",
987 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
988 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
989 | "requires": {
990 | "mime-db": "1.40.0"
991 | }
992 | },
993 | "minimatch": {
994 | "version": "3.0.4",
995 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
996 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
997 | "requires": {
998 | "brace-expansion": "^1.1.7"
999 | }
1000 | },
1001 | "ms": {
1002 | "version": "2.0.0",
1003 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1004 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
1005 | },
1006 | "nan": {
1007 | "version": "2.14.0",
1008 | "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
1009 | "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
1010 | },
1011 | "negotiator": {
1012 | "version": "0.6.2",
1013 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
1014 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
1015 | },
1016 | "number-is-nan": {
1017 | "version": "1.0.1",
1018 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
1019 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
1020 | },
1021 | "on-finished": {
1022 | "version": "2.3.0",
1023 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
1024 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
1025 | "requires": {
1026 | "ee-first": "1.1.1"
1027 | }
1028 | },
1029 | "once": {
1030 | "version": "1.4.0",
1031 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
1032 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
1033 | "requires": {
1034 | "wrappy": "1"
1035 | }
1036 | },
1037 | "only": {
1038 | "version": "0.0.2",
1039 | "resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz",
1040 | "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q="
1041 | },
1042 | "optjs": {
1043 | "version": "3.2.2",
1044 | "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz",
1045 | "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4="
1046 | },
1047 | "os-locale": {
1048 | "version": "1.4.0",
1049 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
1050 | "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
1051 | "requires": {
1052 | "lcid": "^1.0.0"
1053 | }
1054 | },
1055 | "parseurl": {
1056 | "version": "1.3.3",
1057 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
1058 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
1059 | },
1060 | "path-is-absolute": {
1061 | "version": "1.0.1",
1062 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
1063 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
1064 | },
1065 | "path-to-regexp": {
1066 | "version": "1.7.0",
1067 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
1068 | "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
1069 | "requires": {
1070 | "isarray": "0.0.1"
1071 | }
1072 | },
1073 | "protobufjs": {
1074 | "version": "6.8.8",
1075 | "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz",
1076 | "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==",
1077 | "requires": {
1078 | "@protobufjs/aspromise": "^1.1.2",
1079 | "@protobufjs/base64": "^1.1.2",
1080 | "@protobufjs/codegen": "^2.0.4",
1081 | "@protobufjs/eventemitter": "^1.1.0",
1082 | "@protobufjs/fetch": "^1.1.0",
1083 | "@protobufjs/float": "^1.0.2",
1084 | "@protobufjs/inquire": "^1.1.0",
1085 | "@protobufjs/path": "^1.1.2",
1086 | "@protobufjs/pool": "^1.1.0",
1087 | "@protobufjs/utf8": "^1.1.0",
1088 | "@types/long": "^4.0.0",
1089 | "@types/node": "^10.1.0",
1090 | "long": "^4.0.0"
1091 | },
1092 | "dependencies": {
1093 | "@types/node": {
1094 | "version": "10.14.10",
1095 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.10.tgz",
1096 | "integrity": "sha512-V8wj+w2YMNvGuhgl/MA5fmTxgjmVHVoasfIaxMMZJV6Y8Kk+Ydpi1z2whoShDCJ2BuNVoqH/h1hrygnBxkrw/Q=="
1097 | }
1098 | }
1099 | },
1100 | "qs": {
1101 | "version": "6.7.0",
1102 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
1103 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
1104 | },
1105 | "raw-body": {
1106 | "version": "2.4.1",
1107 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz",
1108 | "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==",
1109 | "requires": {
1110 | "bytes": "3.1.0",
1111 | "http-errors": "1.7.3",
1112 | "iconv-lite": "0.4.24",
1113 | "unpipe": "1.0.0"
1114 | }
1115 | },
1116 | "safe-buffer": {
1117 | "version": "5.1.2",
1118 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
1119 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
1120 | },
1121 | "safer-buffer": {
1122 | "version": "2.1.2",
1123 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
1124 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
1125 | },
1126 | "setprototypeof": {
1127 | "version": "1.1.1",
1128 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
1129 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
1130 | },
1131 | "statuses": {
1132 | "version": "1.5.0",
1133 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
1134 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
1135 | },
1136 | "string-width": {
1137 | "version": "1.0.2",
1138 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
1139 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
1140 | "requires": {
1141 | "code-point-at": "^1.0.0",
1142 | "is-fullwidth-code-point": "^1.0.0",
1143 | "strip-ansi": "^3.0.0"
1144 | }
1145 | },
1146 | "strip-ansi": {
1147 | "version": "3.0.1",
1148 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
1149 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
1150 | "requires": {
1151 | "ansi-regex": "^2.0.0"
1152 | }
1153 | },
1154 | "toidentifier": {
1155 | "version": "1.0.0",
1156 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
1157 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
1158 | },
1159 | "type-is": {
1160 | "version": "1.6.18",
1161 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
1162 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
1163 | "requires": {
1164 | "media-typer": "0.3.0",
1165 | "mime-types": "~2.1.24"
1166 | }
1167 | },
1168 | "unpipe": {
1169 | "version": "1.0.0",
1170 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
1171 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
1172 | },
1173 | "urijs": {
1174 | "version": "1.19.1",
1175 | "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.1.tgz",
1176 | "integrity": "sha512-xVrGVi94ueCJNrBSTjWqjvtgvl3cyOTThp2zaMaFNGp3F542TR6sM3f2o8RqZl+AwteClSVmoCyt0ka4RjQOQg=="
1177 | },
1178 | "vary": {
1179 | "version": "1.1.2",
1180 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1181 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
1182 | },
1183 | "window-size": {
1184 | "version": "0.1.4",
1185 | "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz",
1186 | "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY="
1187 | },
1188 | "wrap-ansi": {
1189 | "version": "2.1.0",
1190 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
1191 | "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
1192 | "requires": {
1193 | "string-width": "^1.0.1",
1194 | "strip-ansi": "^3.0.1"
1195 | }
1196 | },
1197 | "wrappy": {
1198 | "version": "1.0.2",
1199 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
1200 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
1201 | },
1202 | "y18n": {
1203 | "version": "3.2.1",
1204 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
1205 | "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE="
1206 | },
1207 | "yargs": {
1208 | "version": "3.32.0",
1209 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz",
1210 | "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=",
1211 | "requires": {
1212 | "camelcase": "^2.0.1",
1213 | "cliui": "^3.0.3",
1214 | "decamelize": "^1.1.1",
1215 | "os-locale": "^1.4.0",
1216 | "string-width": "^1.0.1",
1217 | "window-size": "^0.1.4",
1218 | "y18n": "^3.2.0"
1219 | }
1220 | },
1221 | "ylru": {
1222 | "version": "1.2.1",
1223 | "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz",
1224 | "integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ=="
1225 | }
1226 | }
1227 | }
1228 |
--------------------------------------------------------------------------------
/node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "libra-wallet",
3 | "version": "1.0.0",
4 | "description": "Fackbook Libra blockchain wallet",
5 | "main": "app.js",
6 | "scripts": {
7 | "start": "ADDR=localhost:55383 node app.js",
8 | "start-testnet": "ADDR=ac.testnet.libra.org:80 node app.js",
9 | "test": "echo \"Error: no test specified\" && exit 1"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/learndapp/Libra-wallet.git"
14 | },
15 | "author": "jim",
16 | "license": "MIT",
17 | "bugs": {
18 | "url": "https://github.com/learndapp/Libra-wallet/issues"
19 | },
20 | "homepage": "https://github.com/learndapp/Libra-wallet#readme",
21 | "dependencies": {
22 | "koa": "^2.7.0",
23 | "koa-body": "^4.1.0",
24 | "koa-router": "^7.4.0",
25 | "libra-grpc": "0.0.3",
26 | "libra-weight": "0.0.2",
27 | "lodash": "^4.17.11"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/node/router/index.js:
--------------------------------------------------------------------------------
1 | const router = require("koa-router")();
2 | const { has, at } = require("lodash");
3 | const LW = require("libra-weight");
4 | const lw = new LW(process.env.ADDR);
5 |
6 | const libraAction = (method, params, scope) => {
7 | return new Promise((resolve, reject) => {
8 | lw.request(method, params, (error, result) => {
9 | if (error) {
10 | return resolve({
11 | error
12 | });
13 | }
14 |
15 | if (method === "get_transactions") {
16 | const transactions = [];
17 | result.txn_list_with_proof.transactions.forEach(tx => {
18 | const decodedTx = {
19 | raw_txn: lw.utils.deserializeRawTxnBytes(tx.raw_txn_bytes),
20 | ...tx
21 | };
22 | transactions.push(decodedTx);
23 | });
24 | result.txn_list_with_proof.transactions = transactions;
25 | }
26 |
27 | if (scope && has(result, scope)) {
28 | return resolve(at(result, scope));
29 | }
30 | return resolve({
31 | result
32 | });
33 | });
34 | });
35 | };
36 |
37 | router
38 | .get("/api/account/state/:address?", async (ctx, next) => {
39 | const { scope } = ctx.query;
40 | const address = ctx.params.address;
41 | const params = { address: Buffer.from(address, "hex") };
42 | const result = await libraAction("get_account_state", params, scope);
43 | ctx.body = {
44 | result
45 | };
46 | })
47 | .get(
48 | "/api/account/transaction/:address?/:sequenceNumber?/:fetchEvents?",
49 | async (ctx, next) => {
50 | const { scope } = ctx.query;
51 | const address = ctx.params.address || SAMPLE_ADDRESS;
52 | const sequenceNumber = ctx.params.sequenceNumber || 0;
53 | const fetchEvents = ctx.params.fetchEvents !== "false";
54 | const params = {
55 | account: Buffer.from(address, "hex"),
56 | sequence_number: parseInt(sequenceNumber, 10),
57 | fetch_events: fetchEvents
58 | };
59 | const result = await libraAction(
60 | "get_account_transaction_by_sequence_number",
61 | params,
62 | scope
63 | );
64 | ctx.body = {
65 | result
66 | };
67 | }
68 | )
69 | .get(
70 | "/api/events/:address?/:startEventSeqNum?/:ascending?/:limit?",
71 | async (ctx, next) => {
72 | const { scope } = ctx.query;
73 | const address = ctx.params.address || SAMPLE_ADDRESS;
74 | const startEventSeqNum = ctx.params.startEventSeqNum || 0;
75 | const ascending = ctx.params.ascending !== "false";
76 | const limit = ctx.params.limit || 10;
77 | const params = {
78 | access_path: { address: Buffer.from(address, "hex") },
79 | start_event_seq_num: parseInt(startEventSeqNum, 10),
80 | ascending,
81 | limit: parseInt(limit, 10)
82 | };
83 | const result = await libraAction(
84 | "get_events_by_event_access_path",
85 | params,
86 | scope
87 | );
88 | ctx.body = {
89 | result
90 | };
91 | }
92 | )
93 | .get(
94 | "/api/transactions/:startVersion?/:limit?/:fetchEvents?",
95 | async (ctx, next) => {
96 | const { scope } = ctx.query;
97 | const startVersion = ctx.params.startVersion || 0;
98 | const limit = ctx.params.limit || 10;
99 | const fetchEvents = ctx.params.fetchEvents !== "false";
100 | const params = {
101 | start_version: startVersion,
102 | limit: parseInt(limit, 10),
103 | fetch_events: fetchEvents
104 | };
105 |
106 | const result = await libraAction("get_transactions", params, scope);
107 | ctx.body = {
108 | result
109 | };
110 | }
111 | )
112 | .post("/rpc", async (ctx, next) => {
113 | const { method, params, id } = ctx.request.body;
114 | return lw.request(method, params, (error, result) => {
115 | return (ctx.body = { jsonrpc: "2.0", id, method, result, error });
116 | });
117 | })
118 | .get("*", (ctx, next) => {
119 | ctx.status = 404;
120 | ctx.body = "404";
121 | });
122 |
123 | module.exports = router;
124 |
--------------------------------------------------------------------------------