Skip to content

Commit

Permalink
Merge pull request #417 from Adamant-im/stage
Browse files Browse the repository at this point in the history
Stage v2.14.0
  • Loading branch information
dev-adamant-im authored Sep 1, 2021
2 parents 8e9c0e0 + 9d50f92 commit c3bcded
Show file tree
Hide file tree
Showing 24 changed files with 219 additions and 42 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# ADAMANT Messenger Progressive Web Application (PWA)

It is a messaging application client for ADAMANT Blockchain. See ADAMANT Project at [adamant.im](https://adamant.im).
A messaging application client for ADAMANT Blockchain. See ADAMANT Project at [adamant.im](https://adamant.im).

ADAMANT is a decentralized anonymous messenger based on the blockchain system. It’s independent of any governments or corporations, and even developers due to the distributed network infrastructure that contains an open-source code.

The ADAMANT blockchain system belongs to its users. Nobody can control, block, deactivate, restrict or censor accounts. Users take full responsibility for their content, messages, media, and goals and intentions of using the messenger.

Privacy is the main concept of ADAMANT: neither phone numbers nor emails are required. Apps have no access to the contact list or geotags, IPs are hidden from chatters and paranoids can use [Tor app](http://adamantmsg72ixni.onion).
Privacy is the main concept of ADAMANT: neither phone numbers nor emails are required. Apps have no access to the contact list or geotags, IPs are hidden from chatters and paranoids can use [Tor app](http://adamant6457join2rxdkr2y7iqatar7n4n72lordxeknj435i4cjhpyd.onion).

All the messages are encrypted with the Diffie-Hellman Curve25519, Salsa20, Poly1305 algorithms and signed by SHA-256 + Ed25519 EdDSA. Private keys are never transferred to the network. The sequence of messages and their authenticity is guaranteed by the blockchain.

ADAMANT includes crypto wallets for ADAMANT (ADM), Bitcoin (BTC), Ethereum (ETH), Lisk (LSK), Dogecoin (DOGE) and Dash (DASH). Private keys for the wallets are derived from an ADAMANT passphrase. You can export the keys and use them in other wallets.

This application deployed at [msg.adamant.im](https://msg.adamant.im). Feel free to run your own messenger using this code and Build Setup.

## Project setup
Expand All @@ -18,7 +20,7 @@ This application deployed at [msg.adamant.im](https://msg.adamant.im). Feel free
yarn install
```

Note: some dependencies may ask for specific Node.js version, you can ignore this with `yarn install --ignore-engines`.
Note: Lisk libraries may ask for specific Node.js version, you can ignore this with `yarn install --ignore-engines`.

### Compiles and hot-reloads for development

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adamant-im",
"version": "2.13.0",
"version": "2.14.0",
"author": "ADAMANT Foundation <[email protected]>",
"license": "GPLv3",
"description": "Decentralized Messenger",
Expand Down Expand Up @@ -31,7 +31,7 @@
"bitcoinjs-lib": "^5.2.0",
"bytebuffer": "^5.0.1",
"coininfo": "^5.1.0",
"core-js": "^3.15.2",
"core-js": "^3.16.2",
"dayjs": "^1.10.6",
"deepmerge": "^4.2.2",
"detect-browser": "^5.2.0",
Expand All @@ -43,7 +43,7 @@
"js-base64": "^3.6.1",
"js-md5": "^0.7.3",
"lodash": "^4.17.21",
"marked": "^2.1.3",
"marked": "^3.0.0",
"notifyjs": "^3.0.0",
"pbkdf2": "^3.1.2",
"promise-queue": "^2.2.5",
Expand All @@ -67,7 +67,7 @@
"web3-utils": "^1.4.0"
},
"devDependencies": {
"@babel/core": "7.14.8",
"@babel/core": "7.15.0",
"@babel/eslint-parser": "^7.14.7",
"@intlify/vue-i18n-loader": "^1.1.0",
"@vue/babel-preset-app": "^4.5.13",
Expand All @@ -86,7 +86,7 @@
"electron": "^3.0.0",
"eslint": "^7.31.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.14.0",
Expand Down
12 changes: 12 additions & 0 deletions src/components/AppSnackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@
:color="color"
:class="className"
bottom
:multi-line="message.length > 50"
>
{{ message }}
<v-btn
v-if="timeout === 0 || timeout > 2000"
@click="show = false"
>
<v-icon
:class="`${className}__icon`"
size="20"
>
mdi-close
</v-icon>
</v-btn>
</v-snackbar>
</template>

Expand Down
13 changes: 9 additions & 4 deletions src/components/SendFundsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ import partnerName from '@/mixins/partnerName'
import WarningOnPartnerAddressDialog from '@/components/WarningOnPartnerAddressDialog'
import { isStringEqualCI } from '@/lib/textHelpers'
import { formatSendTxError } from '@/lib/txVerify'
/**
* @returns {string | boolean}
Expand Down Expand Up @@ -627,10 +628,14 @@ export default {
this.$emit('send', transactionId, this.currency)
})
.catch(err => {
let message = err.message
if (/dust/i.test(message) || get(err, 'response.data.error.code') === -26) {
.catch(error => {
const formattedError = formatSendTxError(error)
console.log('Error while sending transaction', formattedError)
let message = formattedError.errorMessage
if (/dust/i.test(message) || get(error, 'response.data.error.code') === -26) {
message = this.$t('transfer.error_dust_amount')
} else if (/minimum remaining balance requirement/i.test(message)) {
message = this.$t('transfer.recipient_minimum_balance')
} else if (/Invalid JSON RPC Response/i.test(message)) {
message = this.$t('transfer.error_unknown')
}
Expand Down Expand Up @@ -728,7 +733,7 @@ export default {
},
validateMinAmount (amount, currency) {
const min = getMinAmount(currency)
return amount > min
return amount >= min
},
validateNaturalUnits (amount, currency) {
const units = CryptoNaturalUnits[currency]
Expand Down
10 changes: 9 additions & 1 deletion src/components/transactions/AdmTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:confirmations="transaction.confirmations || NaN"
:sender="sender || '' "
:recipient="recipient || '' "
:sender-formatted="senderFormatted || '' "
:recipient-formatted="recipientFormatted|| '' "
:explorer-link="explorerLink"
:partner="transaction.partner || '' "
:status="getTransactionStatus(admTx)"
Expand Down Expand Up @@ -45,9 +47,15 @@ export default {
return this.$store.state.adm.transactions[this.id] || { }
},
sender () {
return this.formatAddress(this.transaction.senderId) || ''
return this.transaction.senderId || ''
},
recipient () {
return this.transaction.recipientId || ''
},
senderFormatted () {
return this.formatAddress(this.transaction.senderId) || ''
},
recipientFormatted () {
return this.formatAddress(this.transaction.recipientId) || ''
},
admTx () {
Expand Down
26 changes: 25 additions & 1 deletion src/components/transactions/BtcTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
:confirmations="confirmations || NaN"
:sender="sender || '' "
:recipient="recipient || '' "
:sender-formatted="senderFormatted || '' "
:recipient-formatted="recipientFormatted|| '' "
:explorer-link="explorerLink"
:partner="partner || '' "
:status="getTransactionStatus(admTx, transaction)"
Expand Down Expand Up @@ -46,6 +48,28 @@ export default {
return this.$store.getters[`${this.cryptoKey}/transaction`](this.id) || { }
},
sender () {
const { senders, senderId } = this.transaction
const onlySender = senderId && (!senders || senders.length === 1)
if (onlySender) {
return senderId
} else if (senders) {
return senders.join(', ')
} else {
return undefined
}
},
recipient () {
const { recipientId, recipients } = this.transaction
const onlyRecipient = recipientId && (!recipients || recipients.length === 1)
if (onlyRecipient) {
return recipientId
} else if (recipients) {
return recipients.join(', ')
} else {
return undefined
}
},
senderFormatted () {
const { senders, senderId } = this.transaction
const onlySender = senderId && (!senders || senders.length === 1)
if (onlySender) {
Expand All @@ -56,7 +80,7 @@ export default {
return undefined
}
},
recipient () {
recipientFormatted () {
const { recipientId, recipients } = this.transaction
const onlyRecipient = recipientId && (!recipients || recipients.length === 1)
if (onlyRecipient) {
Expand Down
10 changes: 9 additions & 1 deletion src/components/transactions/Erc20Transaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:confirmations="confirmations || NaN"
:sender="sender || '' "
:recipient="recipient || '' "
:sender-formatted="senderFormatted || '' "
:recipient-formatted="recipientFormatted|| '' "
:explorer-link="explorerLink"
:partner="partner || '' "
:status="getTransactionStatus(admTx, transaction)"
Expand Down Expand Up @@ -51,9 +53,15 @@ export default {
return this.$store.getters[prefix + '/transaction'](this.id) || { }
},
sender () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
return this.transaction.senderId || ''
},
recipient () {
return this.transaction.recipientId || ''
},
senderFormatted () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
},
recipientFormatted () {
return this.transaction.recipientId ? this.formatAddress(this.transaction.recipientId) : ''
},
partner () {
Expand Down
10 changes: 9 additions & 1 deletion src/components/transactions/EthTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:confirmations="confirmations || NaN"
:sender="sender || '' "
:recipient="recipient || '' "
:sender-formatted="senderFormatted || '' "
:recipient-formatted="recipientFormatted|| '' "
:explorer-link="explorerLink"
:partner="partner || '' "
:status="getTransactionStatus(admTx, transaction)"
Expand Down Expand Up @@ -50,9 +52,15 @@ export default {
return this.$store.state.eth.transactions[this.id] || { }
},
sender () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
return this.transaction.senderId || ''
},
recipient () {
return this.transaction.recipientId || ''
},
senderFormatted () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
},
recipientFormatted () {
return this.transaction.recipientId ? this.formatAddress(this.transaction.recipientId) : ''
},
partner () {
Expand Down
10 changes: 9 additions & 1 deletion src/components/transactions/LskTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:confirmations="confirmations || NaN"
:sender="sender || '' "
:recipient="recipient || '' "
:sender-formatted="senderFormatted || '' "
:recipient-formatted="recipientFormatted|| '' "
:explorer-link="explorerLink"
:partner="partner || '' "
:status="getTransactionStatus(admTx, transaction)"
Expand Down Expand Up @@ -54,9 +56,15 @@ export default {
return this.$store.getters[`${this.cryptoKey}/transaction`](this.id) || { }
},
sender () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
return this.transaction.senderId || ''
},
recipient () {
return this.transaction.recipientId || ''
},
senderFormatted () {
return this.transaction.senderId ? this.formatAddress(this.transaction.senderId) : ''
},
recipientFormatted () {
return this.transaction.recipientId ? this.formatAddress(this.transaction.recipientId) : ''
},
partner () {
Expand Down
43 changes: 38 additions & 5 deletions src/components/transactions/TransactionTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{{ $t('transaction.status') }}
<v-icon
v-if="statusUpdatable"
ref="updateButton"
size="20"
@click="updateStatus()"
>
Expand Down Expand Up @@ -106,7 +107,10 @@

<v-divider />

<v-list-tile :title="id || placeholder">
<v-list-tile
:title="id || placeholder"
@click="copyToClipboard(id)"
>
<v-list-tile-title :class="`${className}__title`">
{{ $t('transaction.txid') }}
</v-list-tile-title>
Expand All @@ -118,25 +122,31 @@

<v-divider />

<v-list-tile :title="sender || placeholder">
<v-list-tile
:title="sender || placeholder"
@click="copyToClipboard(sender)"
>
<v-list-tile-title :class="`${className}__title`">
{{ $t('transaction.sender') }}
</v-list-tile-title>

<div :class="`${className}__value`">
{{ sender || placeholder }}
{{ senderFormatted || placeholder }}
</div>
</v-list-tile>

<v-divider />

<v-list-tile :title="recipient || placeholder">
<v-list-tile
:title="recipient || placeholder"
@click="copyToClipboard(recipient)"
>
<v-list-tile-title :class="`${className}__title`">
{{ $t('transaction.recipient') }}
</v-list-tile-title>

<div :class="`${className}__value`">
{{ recipient || placeholder }}
{{ recipientFormatted || placeholder }}
</div>
</v-list-tile>

Expand Down Expand Up @@ -221,6 +231,7 @@ import { Symbols, tsUpdatable } from '@/lib/constants'
import AppToolbarCentered from '@/components/AppToolbarCentered'
import transaction from '@/mixins/transaction'
import { copyToClipboard } from '@/lib/textHelpers'
export default {
name: 'TransactionTemplate',
Expand Down Expand Up @@ -265,6 +276,14 @@ export default {
required: true,
type: String
},
recipientFormatted: {
required: true,
type: String
},
senderFormatted: {
required: true,
type: String
},
status: {
required: true,
type: Object
Expand Down Expand Up @@ -314,6 +333,15 @@ export default {
}
},
methods: {
copyToClipboard: function (key) {
if (key) {
copyToClipboard(key)
this.$store.dispatch('snackbar/show', {
message: this.$t('home.copied'),
timeout: 2000
})
}
},
openInExplorer: function () {
if (this.explorerLink) {
window.open(this.explorerLink, '_blank', 'resizable,scrollbars,status,noopener')
Expand All @@ -323,6 +351,11 @@ export default {
this.$router.push('/chats/' + this.partner + '/')
},
updateStatus () {
const el = this.$refs.updateButton.$el
el.rotate = (el.rotate || 0) + 400
el.style.transform = `rotate(${el.rotate}grad)`
el.style['transition-duration'] = '1s'
if (this.crypto && this.statusUpdatable) {
this.$store.dispatch(this.crypto.toLowerCase() + '/updateTransaction', { hash: this.id, force: true, updateOnly: false, dropStatus: true })
}
Expand Down
Loading

0 comments on commit c3bcded

Please sign in to comment.