Skip to content

Commit

Permalink
Merge pull request #8 from planethouki/cow
Browse files Browse the repository at this point in the history
Cow
  • Loading branch information
planethouki committed Mar 10, 2019
2 parents 9b25092 + 85137f0 commit b1e663e
Show file tree
Hide file tree
Showing 53 changed files with 15,395 additions and 12,102 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
root = true

[*]
indent_size = 2
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
8 changes: 1 addition & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ module.exports = {
parser: 'babel-eslint'
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential'
],
// required to lint *.vue files
plugins: [
'vue'
'@nuxtjs'
],
// add your custom rules here
rules: {}
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ No save accounts. Reload(F5) initialize all.

``` bash
# install dependencies
$ npm install # Or yarn install
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev
Expand All @@ -23,11 +23,11 @@ $ npm start
$ npm run generate
```

For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js).
For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org).

## Demo

http://wallet48gh23s.z31.web.core.windows.net/
http://walletcow.z31.web.core.windows.net/

## Function

Expand All @@ -42,3 +42,9 @@ http://wallet48gh23s.z31.web.core.windows.net/
- Escrow with Aggregate Bonded Transaction
- Cosignature Transaction
- Cosignature Transaction of Multisig
- Mosaic Alias Transaction
- Address Alias Transaction
- Account Property Address Transaction
- Account Property Mosaic Transaction
- Account Property EntityType Transaction
- Account Link Transaction
8 changes: 3 additions & 5 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# ASSETS

This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.

More information about the usage of this directory in the documentation:
https://nuxtjs.org/guide/assets#webpacked

**This directory is not required, you can delete it if you don't want to use it.**

This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.

More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
2 changes: 2 additions & 0 deletions assets/style/app.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Import Vuetify styling
@require '~vuetify/src/stylus/app.styl'
1 change: 1 addition & 0 deletions assets/style/variables.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@require '~vuetify/src/stylus/settings/_variables.styl'
52 changes: 52 additions & 0 deletions components/AccountLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template lang="pug">
v-flex(mb-5 v-if="wallet.address" v-bind:id="navTargetId")
v-card
v-card-title
div.title Account Link (Not yet)
v-card-text
v-radio-group(label="Link Type" row)
v-radio(label="Link")
v-radio(label="Unlink")
v-text-field(
label="Remote Account Public Key"
v-model="remoteAccountKey")
v-text-field(
label="Max Fee"
v-model="fee")
v-card-text
tx-history(v-bind:history="history")
</template>

<script>
import { Account } from 'nem2-sdk'
import TxHistory from './TxHistory.vue'
export default {
name: 'AccountLink',
components: {
TxHistory
},
props: [
'endpoint',
'wallet',
'walletPassword',
'navTargetId'
],
data() {
return {
remoteAccountKey: '',
fee: 0,
history: []
}
},
mounted: function () {
this.remoteAccountKey = Account.generateNewAccount(this.wallet.network).publicKey
},
methods: {
}
}
</script>

<style scoped>
</style>
144 changes: 144 additions & 0 deletions components/AccountPropertyAddress.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<template lang="pug">
v-flex(mb-5 v-if="wallet.address" v-bind:id="navTargetId")
v-card
v-card-title
div.title Account Property Address
v-card-text
v-radio-group(label="Property Type" v-model="propertyType" row)
v-radio(
v-for="pt in propertyTypes"
:key="pt.type"
:label="pt.label"
:value="pt.type")
v-flex.pt-4
v-layout(v-for="(modification, index) in modifications" v-bind:key="modification.rawAddress" row wrap)
v-flex
v-layout(align-baseline)
span.grey--text.mr-1.pr-1 {{ modification.isAdd ? 'Add' : 'Remove' }}
v-flex
v-text-field(
v-bind:label="`${modification.isAdd ? 'Add' : 'Remove'}` + ' Modification Address: ' + (index + 1)"
v-bind:value="modification.rawAddress"
disabled)
v-btn(
fab
small
flat
v-on:click="deleteModification(index)")
v-icon delete_forever
v-flex
v-layout(align-baseline)
div.mr-1.pr-1
v-checkbox(
v-bind:label="`${additionalModification.isAdd ? 'Add' : 'Remove'}`"
hide-details
off-icon="remove_circle"
on-icon="add_circle"
v-model="additionalModification.isAdd")
v-flex
v-text-field(
v-bind:label="`Address Modification: ${additionalModification.isAdd ? 'Add' : 'Remove'}`"
v-model="additionalModification.rawAddress"
placeholder="ex). SCCVQQ-3N3AOW-DOL6FD-TLSQZY-UHL4SH-XKJEJX-2URE")
v-btn(
fab
small
flat
v-on:click="addModification")
v-icon add_box
v-text-field(
label="Max Fee"
v-model="fee")
v-card-actions
v-btn(
color="blue"
class="white--text"
@click="announceHandler") announce
v-card-text
tx-history(v-bind:history="history")
</template>

<script>
import { Address, Account, Deadline, UInt64, PropertyType, TransactionHttp,
PropertyModificationType, AccountPropertyTransaction, ModifyAccountPropertyAddressTransaction } from 'nem2-sdk'
import TxHistory from './TxHistory.vue'
export default {
name: 'AccountPropertyAddress',
components: {
TxHistory
},
props: [
'endpoint',
'wallet',
'walletPassword',
'navTargetId'
],
data() {
return {
propertyType: PropertyType.AllowAddress,
propertyTypes: [
{ type: PropertyType.AllowAddress, label: 'Allow' },
{ type: PropertyType.BlockAddress, label: 'Block' }
],
modifications: [
{
isAdd: true,
rawAddress: ''
}
],
additionalModification: {
isAdd: true,
rawAddress: ''
},
fee: 0,
history: []
}
},
mounted: function () {
this.additionalModification.rawAddress = Account.generateNewAccount(this.wallet.network).address.pretty()
this.modifications[0].rawAddress = Account.generateNewAccount(this.wallet.network).address.pretty()
},
methods: {
deleteModification: function (index) {
this.modifications.splice(index, 1)
},
addModification: function () {
this.modifications.push({
rawAddress: this.additionalModification.rawAddress,
isAdd: this.additionalModification.isAdd
})
this.additionalModification.rawAddress = 'SCCVQQ-3N3AOW-DOL6FD-TLSQZY-UHL4SH-XKJEJX-2URE'
},
announceHandler: function (event) {
const account = this.wallet.open(this.walletPassword)
const endpoint = this.endpoint
const modifyAccountPropertyAddressTransaction = new ModifyAccountPropertyAddressTransaction(
this.wallet.network,
this.$TransactionVersion.MODIFY_ACCOUNT_PROPERTY_ADDRESS,
Deadline.create(),
UInt64.fromUint(this.fee),
this.propertyType,
this.modifications.map((modification) => {
return AccountPropertyTransaction.createAddressFilter(
modification.isAdd ? PropertyModificationType.Add : PropertyModificationType.Remove,
Address.createFromRawAddress(modification.rawAddress)
)
})
)
const signedTx = account.sign(modifyAccountPropertyAddressTransaction)
const txHttp = new TransactionHttp(endpoint)
txHttp.announce(signedTx)
const historyData = {
hash: signedTx.hash,
apiStatusUrl: `${endpoint}/transaction/${signedTx.hash}/status`
}
this.history.push(historyData)
}
}
}
</script>

<style scoped>
</style>
Loading

0 comments on commit b1e663e

Please sign in to comment.