Convert project to Vue v3

Convert to Vue v3
This commit is contained in:
emizzle 2019-06-18 15:40:42 +10:00
commit de6f9a8804
No known key found for this signature in database
GPG Key ID: 1FD4BAB3C37EE9BA
34 changed files with 12158 additions and 0 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
/src/embarkArtifacts/*

19
.gitignore vendored Normal file
View File

@ -0,0 +1,19 @@
.DS_Store
chains.json
node_modules/
config/livenet/password
config/production/password
coverage
dist/
embarkArtifacts
src/embarkArtifacts
npm-debug.log
yarn-error.log
.embark
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln

2
AUTHORS Normal file
View File

@ -0,0 +1,2 @@
OmiseGo Pte Ltd
Status.im Pte Ltd

190
LICENSE Normal file
View File

@ -0,0 +1,190 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2017-2019 OmiseGO
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

64
README.md Normal file
View File

@ -0,0 +1,64 @@
# Embark Plasma Demo
The Embark Plasma Demo is a DApp built using Embark and the [`Embark-Plasma`](https://github.com/embark-framework/embark-plasma) plugin. The frontend is the OmiseGO [`js-starter-kit`](https://github.com/omisego/js-starter-kit) that has been converted to use [`EmbarkJS-Plasma`](https://github.com/embark-framework/embarkjs-plasma).
> **PLEASE NOTE**
> This is completely alpha software and should not be used in a production environment.
## Vue.js project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn run serve
```
### Compiles and minifies for production
```
yarn run build
```
### Run your tests
```
yarn run test
```
### Lints and fixes files
```
yarn run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
## Embark-Plasma Demo Setup
This is an example client side wallet built in Vue.js which allows you to make interactions with the OMG network from the browser.
NOTE:
- This kit is meant for development and demonstration purposes. It is not safe for production use.
- This example application is compatible with `Samrong v0.2`
## Initial Setup
Make sure you have access to the endpoints including Watcher, Childchain, address of the Plasma Contract and Web3 RPC endpoint. The wallet also requires an in-browser web3 wallet like MetaMask to sign transactions.
the endpoints for production deployment can be found [here](https://github.com/omisego/dev-portal/blob/master/guides/network_endpoints.md)
1. Installing dependencies by running `yarn install` on the root directory
2. Run embark `embark run`
3. Start the app by running `yarn serve`
## Running the Starter-kit
A browser should automatically open to `http://localhost:3001`, Make sure your Metamask is currently unlocked. You should be able to see your account balance on both Root chain and Child chain.
From here, you can perform 3 actions:
1. Deposit into the OMG Network: After 12 blocks confirmations, your Rootchain balance will be updated, click on the Refresh button.
2. Transfer the funds on the OMG Network: Fill in the values for the Transfer fields and click Ok. Depending on the network congestion, you may have to wait for a little while for the transaction to be included in a block. Click on the Refresh balances button until your balance has been properly reflected.
3. Exit the funds back to Rootchain: Fill in an address that has funds in the OMG Network and click on OK, your exit period will start. Do note that the exit period will be varied based on the configuration of each `elixir-omg` deployment. After the certain amount of time has passed, you will be able to process the exit and receive your funds back.
NOTE: the current wallet does not offer a way to call `processExit()` yet.

5
babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}

187
config/blockchain.js Normal file
View File

@ -0,0 +1,187 @@
module.exports = {
// applies to all environments
default: {
enabled: true,
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: { // Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
additionalCors: ["http://localhost:3001"] // Additional CORS domains to add to the list. If "auto" is false, only those will be added
},
wsRPC: true, // Enable the WS-RPC server
wsOrigins: { // Same thing as "rpcCorsDomain", but for WS origins
auto: true,
additionalCors: ["http://localhost:3001"]
},
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546, // WS-RPC server listening port (default: 8546)
// Accounts to use as node accounts
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
accounts: [
/*{
nodeAccounts: true, // Accounts use for the node
numAddresses: "1", // Number of addresses/accounts (defaults to 1)
password: "config/development/devpassword" // Password file for the accounts
},
// Below are additional accounts that will count as `nodeAccounts` in the `deployment` section of your contract config
// Those will not be unlocked in the node itself
{
privateKey: "fill this in"
},
{
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
},
{
mnemonic: "",
addressIndex: "0", // Optional. The index to start getting the address
numAddresses: "1", // Optional. The number of addresses to get
hdpath: "m/44'/60'/0'/0/", // Optional. HD derivation path
balance: "100 ether"
}*/
]
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run` and `embark blockchain`
development: {
ethereumClientName: "geth", // Can be geth or parity (default:geth)
//ethereumClientBin: "geth", // path to the client binary. Useful if it is not in the global PATH
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId
networkId: 1337, // Network id used when networkType is custom
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
datadir: ".embark/development/datadir", // Data directory for the databases and keystore (Geth 1.8.15 and Parity 2.0.4 can use the same base folder, till now they does not conflict with each other)
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
proxy: true, // Proxy is used to present meaningful information about transactions
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
simulatorBlocktime: 0 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
},
// merges with the settings in default
// used with "embark run privatenet" and/or "embark blockchain privatenet"
privatenet: {
networkType: "custom",
networkId: 1337,
isDev: false,
datadir: ".embark/privatenet/datadir",
// -- mineWhenNeeded --
// This options is only valid when isDev is false.
// Enabling this option uses our custom script to mine only when needed.
// Embark creates a development account for you (using `geth account new`) and funds the account. This account can be used for
// development (and even imported in to MetaMask). To enable correct usage, a password for this account must be specified
// in the `account > password` setting below.
// NOTE: once `mineWhenNeeded` is enabled, you must run an `embark reset` on your dApp before running
// `embark blockchain` or `embark run` for the first time.
mineWhenNeeded: true,
// -- genesisBlock --
// This option is only valid when mineWhenNeeded is true (which is only valid if isDev is false).
// When enabled, geth uses POW to mine transactions as it would normally, instead of using POA as it does in --dev mode.
// On the first `embark blockchain or embark run` after this option is enabled, geth will create a new chain with a
// genesis block, which can be configured using the `genesisBlock` configuration option below.
genesisBlock: "config/privatenet/genesis.json", // Genesis block to initiate on first creation of a development node
nodiscover: true,
maxpeers: 0,
proxy: true,
accounts: [
{
nodeAccounts: true,
password: "config/privatenet/password" // Password to unlock the account
}
],
targetGasLimit: 8000000,
simulatorBlocktime: 0
},
privateparitynet: {
ethereumClientName: "parity",
networkType: "custom",
networkId: 1337,
isDev: false,
genesisBlock: "config/privatenet/genesis-parity.json", // Genesis block to initiate on first creation of a development node
datadir: ".embark/privatenet/datadir",
mineWhenNeeded: false,
nodiscover: true,
maxpeers: 0,
proxy: true,
accounts: [
{
nodeAccounts: true,
password: "config/privatenet/password"
}
],
targetGasLimit: 8000000,
simulatorBlocktime: 0
},
// merges with the settings in default
// used with "embark run testnet" and/or "embark blockchain testnet"
testnet: {
networkType: "testnet",
syncMode: "light",
accounts: [
{
nodeAccounts: true,
password: "config/testnet/password"
},
/*{
nodeAccounts: true, // Accounts use for the node
numAddresses: "1", // Number of addresses/accounts (defaults to 1)
password: "config/development/devpassword" // Password file for the accounts
},
// Below are additional accounts that will count as `nodeAccounts` in the `deployment` section of your contract config
// Those will not be unlocked in the node itself
{
privateKey: ""
},
{
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
},
{
mnemonic: "",
addressIndex: "0", // Optional. The index to start getting the address
numAddresses: "1", // Optional. The number of addresses to get
hdpath: "m/44'/60'/0'/0/", // Optional. HD derivation path
}
]*/
]
},
// merges with the settings in default
// used with "embark run testnet" and/or "embark blockchain testnet"
rinkeby: {
networkType: "rinkeby",
syncMode: "light",
networkId: 4,
accounts: [
{
nodeAccounts: true,
password: "config/testnet/password"
}
]
},
// merges with the settings in default
// used with "embark run livenet" and/or "embark blockchain livenet"
livenet: {
networkType: "livenet",
syncMode: "light",
rpcCorsDomain: "http://localhost:8000",
wsOrigins: "http://localhost:8000",
accounts: [
{
nodeAccounts: true,
password: "config/livenet/password"
}
]
}
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

46
config/communication.js Normal file
View File

@ -0,0 +1,46 @@
module.exports = {
// default applies to all environments
default: {
enabled: true,
provider: "whisper", // Communication provider. Currently, Embark only supports whisper
available_providers: ["whisper"], // Array of available providers
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
connection: {
host: "localhost", // Host of the blockchain node
port: 8546, // Port of the blockchain node
type: "ws" // Type of connection (ws or rpc)
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name"
//custom_name: {
//}
// Use this section when you need a specific symmetric or private keys in whisper
/*
,keys: {
symmetricKey: "your_symmetric_key",// Symmetric key for message decryption
privateKey: "your_private_key" // Private Key to be used as a signing key and for message decryption
}
*/
//}
};

95
config/contracts.js Normal file
View File

@ -0,0 +1,95 @@
module.exports = {
// default applies to all environments
default: {
// Blockchain node to deploy the contracts
deployment: {
host: "localhost", // Host of the blockchain node
port: 8546, // Port of the blockchain node
type: "ws" // Type of connection (ws or rpc),
// Accounts to use instead of the default account to populate your wallet
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
/*,accounts: [
{
privateKey: "your_private_key",
balance: "5 ether" // You can set the balance of the account in the dev environment
// Balances are in Wei, but you can specify the unit with its name
},
{
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
},
{
mnemonic: "12 word mnemonic",
addressIndex: "0", // Optional. The index to start getting the address
numAddresses: "1", // Optional. The number of addresses to get
hdpath: "m/44'/60'/0'/0/" // Optional. HD derivation path
},
{
"nodeAccounts": true // Uses the Ethereum node's accounts
}
]*/
},
// order of connections the dapp should connect to
dappConnection: [
"$WEB3", // uses pre existing web3 object if available (e.g in Mist)
"ws://localhost:8546",
"http://localhost:8545"
],
// Automatically call `ethereum.enable` if true.
// If false, the following code must run before sending any transaction: `await EmbarkJS.enableEthereum();`
// Default value is true.
// dappAutoEnable: true,
gas: "auto",
// Strategy for the deployment of the contracts:
// - implicit will try to deploy all the contracts located inside the contracts directory
// or the directory configured for the location of the contracts. This is default one
// when not specified
// - explicit will only attempt to deploy the contracts that are explicitly specified inside the
// contracts section.
//strategy: 'implicit',
contracts: {
PlasmaCore: {
address: "0x44de0ec539b8c4a4b530c78620fe8320167f2f74",
abiDefinition: require("@omisego/omg-js-rootchain/src/contracts/RootChain.json").abi
}
}
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
rinkeby: {
contracts: {
PlasmaCore: {
address: "0x44de0ec539b8c4a4b530c78620fe8320167f2f74",
abiDefinition: require("@omisego/omg-js-rootchain/src/contracts/RootChain.json").abi
}
}
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

View File

@ -0,0 +1 @@
dev_password

39
config/namesystem.js Normal file
View File

@ -0,0 +1,39 @@
module.exports = {
// default applies to all environments
default: {
enabled: false,
available_providers: ["ens"],
provider: "ens"
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
register: {
rootDomain: "embark.eth",
subdomains: {
'status': '0x1a2f3b98e434c02363f3dac3174af93c1d690914'
}
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

27
config/pipeline.js Normal file
View File

@ -0,0 +1,27 @@
// Embark has support for Flow enabled by default in its built-in webpack
// config: type annotations will automatically be stripped out of DApp sources
// without any additional configuration. Note that type checking is not
// performed during builds.
// To enable Flow type checking refer to the preconfigured template:
// https://github.com/embark-framework/embark-flow-template
// A new DApp can be created from that template with:
// embark new --template flow
module.exports = {
typescript: false,
// Setting `typescript: true` in this config will disable Flow support in
// Embark's default webpack config and enable TypeScript support: .ts and
// .tsx sources will automatically be transpiled into JavaScript without any
// additional configuration. Note that type checking is not performed during
// builds.
// To enable TypeScript type checking refer to the preconfigured template:
// https://github.com/embark-framework/embark-typescript-template
// A new DApp can be created from that template with:
// embark new --template typescript
enabled: false
// Setting `enabled: false` in this config will disable Embark's built-in Webpack
// pipeline. The developer will need to use a different frontend build tool, such as
// `create-react-app` or Angular CLI to build their dapp
};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,20 @@
{
"config": {
"homesteadBlock": 0,
"byzantiumBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"daoForkSupport": true
},
"nonce": "0x0000000000000042",
"difficulty": "0x0",
"alloc": {
"0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x7a1200"
}

View File

@ -0,0 +1 @@
dev_password

59
config/storage.js Normal file
View File

@ -0,0 +1,59 @@
module.exports = {
// default applies to all environments
default: {
enabled: false,
ipfs_bin: "ipfs",
available_providers: ["ipfs"],
upload: {
provider: "ipfs",
host: "localhost",
port: 5001
},
dappConnection: [
{
provider: "ipfs",
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
]
// Configuration to start Swarm in the same terminal as `embark run`
/*,account: {
address: "YOUR_ACCOUNT_ADDRESS", // Address of account accessing Swarm
password: "PATH/TO/PASSWORD/FILE" // File containing the password of the account
},
swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
enabled: false,
upload: {
provider: "ipfs",
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name"
//custom_name: {
//}
};

1
config/testnet/password Normal file
View File

@ -0,0 +1 @@
test_password

6
config/webserver.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
enabled: false,
host: "localhost",
openBrowser: true,
port: 8000
};

0
contracts/.gitkeep Normal file
View File

29
embark.json Normal file
View File

@ -0,0 +1,29 @@
{
"contracts": [
"contracts/**"
],
"app": {},
"buildDir": "dist/",
"config": "config/",
"versions": {
"web3": "1.0.0-beta",
"solc": "0.5.0",
"ipfs-api": "17.2.4"
},
"plugins": {
"embarkjs-connector-web3": {},
"embark-plasma": {
"WATCHER_URL": "http://watcher.samrong.omg.network/",
"CHILDCHAIN_URL": "http://samrong.omg.network/",
"CHILDCHAIN_EXPLORER_URL": "http://quest.samrong.omg.network/",
"PLASMA_CONTRACT_ADDRESS": "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7"
}
},
"options": {
"solc": {
"optimize": true,
"optimize-runs": 200
}
},
"generationDir": "src/embarkArtifacts"
}

16
index.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="/assets/favicon.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500,700,400italic|Material+Icons">
<title>vue-wallet</title>
</head>
<body>
<div id="app"></div>
<script src="/dist/build.js"></script>
</body>
</html>

76
package.json Normal file
View File

@ -0,0 +1,76 @@
{
"name": "embark-plasma-demo",
"description": "OMG JS Starter kit in Vue.js using the Embark-Plasma plugin",
"version": "1.0.1",
"author": "Eric Mastro <eric.mastro@gmail.com>",
"homepage": "https://github.com/embark-framework/embark-plasma-demo/tree/master#readme",
"bugs": "https://github.com/embark-framework/embark-plasma-demo/issues",
"scripts": {
"// dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"// build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"// test": "embark test",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"keywords": [
"Ethereum",
"Embark",
"Plasma"
],
"repository": {
"type": "git",
"url": "https://github.com/embark-framework/embark-plasma-demo.git"
},
"dependencies": {
"core-js": "^2.6.5",
"embark-plasma": "^1.0.1",
"vue": "^2.6.10",
"vue-material": "^1.0.0-beta-11"
},
"devDependencies": {
"@babel/core": "^7.0.0-0",
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"babel-eslint": "^10.0.1",
"embarkjs-connector-web3": "^4.1.0-beta.2",
"embarkjs-plasma": "^1.0.0",
"eslint": "^5.16.0",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": "off",
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
"message": "Unexpected property on console object was called"
}
]
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

17
public/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>embark-plasma-demo-vue3</title>
</head>
<body>
<noscript>
<strong>We're sorry but embark-plasma-demo-vue3 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

337
src/App.vue Normal file
View File

@ -0,0 +1,337 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<div id="app">
<div v-if="hasWeb3">
<md-toolbar class="md-transparent">
<img class="logo md-image" src="./assets/OmiseGO_Logo.svg">
</md-toolbar>
<div class="md-layout md-gutter">
<md-card class="md-layout-item md-size-25 actions">
<md-card-header>
<md-card-header-text>
<div class="md-title">Account</div>
</md-card-header-text>
</md-card-header>
<md-card-content>
<md-list class="md-double-line">
<md-list-item>
<div class="md-list-item-text">
<span>
<b>Wallet Address:</b>
</span>
<span>{{ account.address }}</span>
</div>
</md-list-item>
<md-list-item class="md-size-50">
<div class="md-list-item-text">
<span>
<b>Rootchain Balance:</b>
</span>
<span>
<span class="balance">{{ account.rootBalance }} wei</span>
</span>
</div>
</md-list-item>
<md-list-item class="md-size-50">
<div class="md-list-item-text">
<span>
<b>Childchain Balance:</b>
</span>
<div v-bind:key="balance.currency" v-for="balance in account.childBalances">
<span
class="balance"
>{{ balance.amount }} {{ balance.symbol }} ({{ balance.currency === OmgUtil.transaction.ETH_CURRENCY ? "ETH" : balance.currency}})</span>
</div>
</div>
</md-list-item>
</md-list>
</md-card-content>
<md-card-header>
<md-card-header-text>
<div class="md-title">Actions</div>
</md-card-header-text>
</md-card-header>
<md-card-content>
<div class="md-layout md-alignment-center-center md-gutter">
<div class="md-layout-item md-xsmall-size-100 md-medium-size-50">
<md-button class="md-raised" v-on:click="refresh">Refresh</md-button>
</div>
<div class="md-layout-item md-xsmall-size-100 md-medium-size-50">
<md-button v-on:click="toggleDeposit" class="md-raised md-primary">Deposit</md-button>
</div>
<div class="md-layout-item md-xsmall-size-100 md-medium-size-50">
<md-button v-on:click="toggleTransfer" class="md-raised md-primary">Transfer</md-button>
</div>
<div class="md-layout-item md-xsmall-size-100 md-medium-size-50">
<md-button v-on:click="toggleExit" class="md-raised md-primary">Exit</md-button>
</div>
</div>
</md-card-content>
</md-card>
<md-table md-card class="md-layout-item md-size-75">
<md-table-toolbar>
<span class="md-title">Transaction History</span>
</md-table-toolbar>
<div v-if="transactions.length">
<md-table-row>
<md-table-head class="date">Date</md-table-head>
<md-table-head class="hash">Tx Hash</md-table-head>
<md-table-head>Currency / Value</md-table-head>
</md-table-row>
<div v-bind:key="transaction.txhash" v-for="transaction in transactions">
<md-table-row>
<md-table-cell
class="date"
>{{ new Date(transaction.block.timestamp * 1000).toLocaleString() }}</md-table-cell>
<md-table-cell class="hash">{{ transaction.txhash }}</md-table-cell>
<md-table-cell>
<div
v-bind:key="result.currency + result.value"
class="result"
v-for="result in transaction.results"
>
<div class="txhash">
<b>Currency:</b>
{{ result.currency }}
</div>
<div class="txhash">
<b>Value:</b>
{{ result.value }}
</div>
</div>
</md-table-cell>
</md-table-row>
</div>
</div>
</md-table>
</div>
<EventLog ref="eventLog"/>
<Deposit
v-if="isShowDeposit"
v-on:close="toggleDeposit()"
v-bind:OmgUtil="OmgUtil"
v-bind:rootChain="rootChain"
v-bind:activeAccount="account"
v-bind:plasmaContractAddress="plasmaContractAddress"
v-bind:EmbarkJS="EmbarkJS"
/>
<Transfer
v-if="isShowTransfer"
v-on:close="toggleTransfer()"
v-bind:OmgUtil="OmgUtil"
v-bind:childChain="childChain"
v-bind:rootChain="rootChain"
v-bind:activeAccount="account"
v-bind:EmbarkJS="EmbarkJS"
/>
<Exit
v-if="isShowExit"
v-on:close="toggleExit()"
v-bind:rootChain="rootChain"
v-bind:childChain="childChain"
v-bind:activeAccount="account"
v-bind:utxos="utxos"
v-bind:EmbarkJS="EmbarkJS"
/>
</div>
<div v-else class="load-wallet">
<h2>Enable MetaMask to continue...</h2>
</div>
</div>
</template>
<script>
import EventLog from "./components/EventLog.vue";
import Deposit from "./components/Deposit.vue";
import Transfer from "./components/Transfer.vue";
import Exit from "./components/Exit.vue";
import OmgUtil from "@omisego/omg-js-util";
import EmbarkJS from "./embarkArtifacts/embarkjs";
import web3 from "./embarkArtifacts/modules/web3";
import pify from "pify";
export default {
name: "app",
components: {
EventLog,
Deposit,
Transfer,
Exit
},
data() {
return {
hasWeb3: false,
isShowDeposit: false,
isShowExit: false,
isShowTransfer: false,
rootChain: {},
childChain: {},
OmgUtil: OmgUtil,
EmbarkJS: EmbarkJS,
plasmaContractAddress: "",
utxos: [],
transactions: [],
account: {
rootBalance: 0,
childBalances: []
}
};
},
mounted() {
this.init();
},
methods: {
info: function(message) {
console.log(message);
this.$refs.eventLog.info(message);
},
error: function(message) {
console.error(message);
this.$refs.eventLog.error(message);
},
init: async function() {
try {
await pify(EmbarkJS.onReady)();
await EmbarkJS.Plasma.init(web3);
this.hasWeb3 =
EmbarkJS.Plasma.web3 &&
((EmbarkJS.Plasma.web3.currentProvider &&
EmbarkJS.Plasma.web3.currentProvider.isMetaMask) ||
(EmbarkJS.Plasma.web3.givenProvider &&
EmbarkJS.Plasma.web3.givenProvider.isMetaMask));
const {
rootChain,
childChain,
plasmaContractAddress
} = EmbarkJS.Plasma;
this.rootChain = rootChain;
this.childChain = childChain;
this.plasmaContractAddress = plasmaContractAddress;
this.refresh();
} catch (err) {
this.error(err);
}
},
refresh: async function() {
await EmbarkJS.Plasma.updateState();
const { transactions, account, utxos } = EmbarkJS.Plasma.state;
this.utxos = utxos;
this.transactions = transactions;
this.account = account;
},
toggleDeposit() {
this.isShowDeposit = !this.isShowDeposit;
},
toggleTransfer() {
this.isShowTransfer = !this.isShowTransfer;
},
toggleExit() {
this.isShowExit = !this.isShowExit;
}
}
};
</script>
<style>
span.balance {
display: block;
}
img.logo {
height: 60px;
margin: 20px 0 20px 20px;
}
.md-card-header-text > .md-title {
font-weight: 900;
}
body {
font-family: Verdana, Geneva, Tahoma, sans-serif;
color: black;
}
h2 {
text-align: center;
margin: 8px;
}
.childchain-balance-header {
font-size: 20;
text-align: center;
margin-bottom: 8px;
}
.transaction {
padding: 6px;
}
.txhash {
display: block;
}
.transaction .txhash {
font-size: 10pt;
}
.transaction .date {
font-size: 10pt;
}
.transaction .result {
display: inline-block;
}
.popup-from-address {
font-size: 10pt;
margin-bottom: 10px;
}
.popup-input {
text-align: right;
margin-bottom: 10px;
}
.popup-input input {
width: 200px;
}
.popup-input select {
width: 200px;
}
.actions button.md-button {
width: 100%;
}
.md-table {
height: 100% !important;
}
th.date,
td.date {
width: 140px;
}
th.hash,
td.hash {
width: 380px;
word-break: break-all;
}
</style>

View File

@ -0,0 +1 @@
<svg width="100" height="35" viewBox="0 0 100 35" xmlns="http://www.w3.org/2000/svg"><title>A60C4A4B-D6A9-4CED-AC6F-F16D2B6C4F0F</title><g fill-rule="nonzero" fill="none"><g fill="#2E374D"><path d="M6.983 20.08C3.036 20.08.02 17.598.02 13.144S3.177 6.12 7.153 6.12c3.977 0 6.936 2.538 6.936 6.936s-3.187 7.025-7.106 7.025zM7.04 9.422c-1.805 0-2.707 1.438-2.707 3.694 0 2.256.93 3.637 2.735 3.637 1.805 0 2.706-1.405 2.706-3.665 0-2.23-.93-3.665-2.736-3.665l.002-.001zM32.134 11.932c0-1.579-.677-2.114-1.777-2.114-.874 0-1.58.395-2.114.846v8.993H23.9v-7.725c0-1.579-.705-2.114-1.805-2.114-.776 0-1.527.278-2.114.784v9.05h-4.343V6.387l4.343-.008v1.688c1.156-1.213 2.452-1.946 4.173-1.946 1.66 0 3.045.79 3.694 2.34 1.212-1.438 2.735-2.34 4.54-2.34 2.566 0 4.087 1.72 4.087 4.54v8.994h-4.343l.002-7.723zM40.845 4.685c-1.579 0-2.565-.817-2.565-2.312 0-1.55.986-2.34 2.565-2.34 1.607 0 2.566.79 2.566 2.34 0 1.495-.959 2.312-2.566 2.312zm-2.171 1.706l4.343-.008v13.274h-4.343V6.391zM50.03 20.08c-1.805 0-4.174-.394-5.554-1.156l.845-3.13c1.55.79 3.243 1.241 4.793 1.241 1.184 0 1.777-.367 1.777-1.072 0-.766-.734-1.015-2.228-1.352-3.045-.621-4.99-1.72-4.99-4.286 0-2.453 2.141-4.201 5.78-4.201 1.747 0 4.03.51 5.329 1.128l-.874 3.095c-1.495-.767-3.272-1.184-4.512-1.184-1.072 0-1.607.338-1.607.987 0 .705.818.987 2.256 1.297 3.073.677 4.935 1.69 4.935 4.313-.002 2.379-2.088 4.32-5.95 4.32zM64.493 16.895c1.439 0 2.961-.511 4.286-1.269l.423 3.356c-1.325.677-3.186 1.071-5.11 1.071-4.426 0-7.33-2.452-7.33-6.851 0-4.286 2.937-7.077 7.104-7.077 3.722 0 5.748 2.228 5.748 5.493 0 .705-.084 1.747-.282 2.312l-8.318.14v.056c.153 1.781 1.337 2.769 3.48 2.769zm1.1-5.27c0-1.58-.649-2.51-2.002-2.51-1.494 0-2.396 1.296-2.538 2.79l4.54-.025v-.256z"/></g><g fill="#1A53F0"><path d="M77.718 21.02a6.983 6.983 0 1 0 0 13.967 6.983 6.983 0 0 0 0-13.967zm0 11.854a4.87 4.87 0 1 1 0-9.743 4.87 4.87 0 0 1 0 9.745v-.002zM92.634 6.124a6.983 6.983 0 1 0 0 13.967 6.983 6.983 0 0 0 0-13.967zm0 11.854a4.87 4.87 0 1 1 4.87-4.87 4.877 4.877 0 0 1-4.87 4.87z"/><path d="M77.718 6.124a6.987 6.987 0 1 0 5.002 2.111h1.981V6.124h-6.983zm4.872 6.983a4.87 4.87 0 1 1-4.87-4.872 4.877 4.877 0 0 1 4.87 4.872z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,92 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<modal>
<h2 slot="header">Deposit</h2>
<div slot="body">
<div class="popup-from-address">
From address:
<span class="mono">{{ activeAccount.address }}</span>
</div>
<div style="display: inline-block">
<div class="popup-input">
Token contract address (blank for wei):
<input v-model="depositCurrency" size="30">
</div>
<div class="popup-input">
Amount
<input v-model="depositAmount" size="30">
</div>
<div class="popup-input">
approve ERC20 token before deposit
<input type="checkbox" v-model="approveDeposit">
</div>
</div>
<div>
<md-button v-on:click="deposit(); $emit('close')" class="md-raised">Ok</md-button>
<md-button v-on:click="$emit('close')" class="md-raised">Cancel</md-button>
</div>
</div>
</modal>
</template>
<script>
import modal from "./Modal.vue";
export default {
components: {
modal
},
props: {
OmgUtil: Object,
EmbarkJS: Object,
activeAccount: Object,
rootChain: Object,
plasmaContractAddress: String
},
data() {
return {
depositCurrency: "",
depositAmount: 0,
approveDeposit: false
};
},
methods: {
deposit: async function() {
try {
const tokenContract =
this.depositCurrency || this.OmgUtil.transaction.ETH_CURRENCY;
const from = this.activeAccount.address;
const value = this.depositAmount;
const result = await this.EmbarkJS.Plasma.deposit(
value,
tokenContract,
this.approveDeposit
);
this.approveDeposit = false;
this.$parent.info(result);
} catch (err) {
this.$parent.error(err);
}
}
}
};
</script>

View File

@ -0,0 +1,67 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<md-table md-card class="md-size-100 event-logs">
<md-table-toolbar>
<span class="md-title">Event logs</span>
</md-table-toolbar>
<md-table-row style="height:100%;">
<md-table-head>Log</md-table-head>
</md-table-row>
<div v-if="logs.length" class="logs">
<div v-bind:key="log.message" v-for="log in logs">
<md-table-row style="height:100%;">
<md-table-cell class="log" v-bind:class="log.level">{{ log.message }}</md-table-cell>
</md-table-row>
</div>
</div>
<div v-else>
<md-table-row>
<md-table-cell>No logs</md-table-cell>
</md-table-row>
</div>
</md-table>
</template>
<script>
const MAX_LOGS = 5;
export default {
data() {
return {
logs: []
};
},
methods: {
log(message) {
if (this.logs.length >= MAX_LOGS) {
this.logs.shift();
}
this.logs.push(message);
},
info(message) {
this.log({ message, level: "info" });
},
error(message) {
this.log({ message, level: "error" });
},
removeLog(log) {
this.logs = this.logs.filter(item => item !== log);
}
}
};
</script>

85
src/components/Exit.vue Normal file
View File

@ -0,0 +1,85 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<modal>
<h2 slot="header">Exit</h2>
<div slot="body">
<div class="popup-from-address">
From address:
<span class="mono">{{ activeAccount.address }}</span>
</div>
<div style="display: inline-block">
<div class="popup-input">
<select id="exitUtxo" v-model="utxoToExit">
<option disabled value>Select a UTXO to exit</option>
<option
v-for="utxo in utxos"
v-bind:value="utxo"
>{{ utxo.currency }} : {{ utxo.amount }}</option>
</select>
</div>
</div>
<div>
<md-button v-on:click="exit(); $emit('close')" class="md-raised">Ok</md-button>
<md-button v-on:click="$emit('close')" class="md-raised">Cancel</md-button>
</div>
</div>
</modal>
</template>
<script>
import modal from "./Modal.vue";
export default {
components: {
modal
},
props: {
EmbarkJS: Object,
activeAccount: Object,
rootChain: Object,
childChain: Object,
utxos: Array
},
data() {
return {
utxoToExit: ""
};
},
methods: {
exit: async function() {
const fromAddr = this.activeAccount.address;
const utxoToExit = this.utxoToExit;
try {
const receipt = await this.EmbarkJS.Plasma.exitUtxo(
fromAddr,
utxoToExit
);
this.utxoToExit = "";
this.$parent.info(
`Called RootChain.startExit(): ${receipt.transactionHash}`
);
} catch (err) {
this.$parent.error(err);
}
}
}
};
</script>

101
src/components/Modal.vue Normal file
View File

@ -0,0 +1,101 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-header">
<slot name="header"> header </slot>
</div>
<div class="modal-body">
<slot name="body"> body </slot>
</div>
</div>
</div>
</div>
</transition>
</template>
<style>
.modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: middle;
}
.modal-container {
width: 600px;
margin: 0px auto;
padding: 20px 30px;
background-color: white;
border-radius: 5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
.modal-header h3 {
margin-top: 0;
color: #42b983;
}
.modal-body {
margin: 20px 0;
}
.modal-default-button {
float: right;
}
/*
* The following styles are auto-applied to elements with
* transition="modal" when their visibility is toggled
* by Vue.js.
*
* You can easily play with the modal transition by editing
* these styles.
*/
.modal-enter {
opacity: 0;
}
.modal-leave-active {
opacity: 0;
}
.modal-enter .modal-container,
.modal-leave-active .modal-container {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
</style>

View File

@ -0,0 +1,97 @@
<!--
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<modal>
<h2 slot="header">Transfer</h2>
<div slot="body">
<div class="popup-from-address">
From address:
<span class="mono">{{ activeAccount.address }}</span>
</div>
<div style="display: inline-block">
<div class="popup-input">
Token:
<select id="transferCurrency" v-model="transferCurrency">
<option
v-for="balance in activeAccount.childBalances"
v-bind:value="balance.currency"
>{{ balance.symbol != 'Unknown ERC20' ? balance.symbol : balance.currency }}</option>
</select>
</div>
<div class="popup-input">
To address:
<input v-model="transferToAddress">
</div>
<div class="popup-input">
Amount:
<input v-model="transferAmount">
</div>
</div>
<div>
<md-button v-on:click="transfer(); $emit('close')" class="md-raised">Ok</md-button>
<md-button v-on:click="$emit('close')" class="md-raised">Cancel</md-button>
</div>
</div>
</modal>
</template>
<script>
import modal from "./Modal.vue";
export default {
components: {
modal
},
props: {
OmgUtil: Object,
EmbarkJS: Object,
activeAccount: Object,
childChain: Object,
rootChain: Object
},
data() {
return {
transferCurrency: this.OmgUtil.transaction.ETH_CURRENCY,
transferAmount: 0,
transferToAddress: ""
};
},
methods: {
transfer: async function() {
const tokenContract =
this.transferCurrency || this.OmgUtil.transaction.ETH_CURRENCY;
const fromAddr = this.activeAccount.address;
const toAddr = this.transferToAddress;
const value = this.transferAmount;
try {
const result = await this.EmbarkJS.Plasma.transfer(
toAddr,
value,
tokenContract
);
this.$parent.info(`Submitted transaction: ${JSON.stringify(result)}`);
} catch (err) {
this.$parent.error(err);
}
}
}
};
</script>

37
src/main.js Normal file
View File

@ -0,0 +1,37 @@
/*
Copyright 2019 OmiseGO Pte Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import Vue from "vue";
import App from "./App.vue";
import { MdTable, MdIcon, MdLayout, MdList, MdToolbar, MdCard, MdButton, MdContent, MdTabs } from "vue-material/dist/components";
import "vue-material/dist/vue-material.min.css";
import "vue-material/dist/theme/default.css";
import "vue-material/dist/components/MdIcon/index.css";
Vue.use(MdTable);
Vue.use(MdIcon);
Vue.use(MdList);
Vue.use(MdLayout);
Vue.use(MdToolbar);
Vue.use(MdCard);
Vue.use(MdButton);
Vue.use(MdContent);
Vue.use(MdTabs);
new Vue({
el: '#app',
render: h => h(App)
})

10293
yarn.lock Normal file

File diff suppressed because it is too large Load Diff