diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 8a56c51..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v6.9.5 diff --git a/.travis.yml b/.travis.yml index 68cc485..5122385 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ -sudo: false +sudo: true language: node_js node_js: - - 7 - - 6 + - 15 cache: directories: diff --git a/README.md b/README.md index 6cf008f..fd19cc0 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,30 @@ -![version](https://img.shields.io/github/release/aaroncox/vessel/all.svg) -![issues](https://img.shields.io/github/issues/aaroncox/vessel.svg) -[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/aaroncox/vessel/master/LICENSE) -![downloads](https://img.shields.io/github/downloads/aaroncox/vessel/total.svg) - # Vessel - Hive Desktop Wallet Vessel is a lite wallet for the Hive blockchain that you can run on your desktop computer without needing to run the blockchain itself. **This is experimental and messy software at the moment, please use with caution.** -## Updates - -- [2017/12/09 - 0.2.0 Release Notes](https://hive.blog/vessel/@jesta/vessel-0-2-0-interact-with-steem-securely-from-any-website) -- [2017/11/29 - 0.0.9 Release Notes](https://hive.blog/vessel/@jesta/vessel-009-witness-voting-improved-delegation-controls-auths-and-customjson-ops) -- [2017/10/19 - 0.0.8 Release Notes](https://hive.blog/steem-project/@jesta/vessel-008-configurable-steem-node-new-default-node) -- [2017/09/19 - 0.0.7 Release Notes](https://hive.blog/steem-project/@jesta/vessel-007-account-creation-encrypted-memos-bittrex) -- [2017/05/24 - 0.0.6 Release Notes](https://hive.blog/steem-project/@jesta/vessel-006-steem-power-delegation) -- [2017/05/20 - This app was announced on hive.blog](https://hive.blog/steem-project/@jesta/vessel-pre-release-looking-for-feedback) +# Release Instructions -## Questions or ideas? +To build for release: -We have a [chainBB](https://chainbb.com) forum (powered by the Hive blockchain) running here: +``` +#Install Wine if you want to build for windows +sudo dpkg --add-architecture i386 +wget -nc https://dl.winehq.org/wine-builds/winehq.key +sudo apt-key add winehq.key +sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' +sudo apt update +sudo apt install --install-recommends winehq-stable -[https://chainbb.com/f/vessel](https://chainbb.com/f/vessel) +npm run build +sudo npm i -g electron-builder +electron-builder -mwl +``` -This forum will serve as the primary point of discussion for the Vessel desktop wallet. +Mac releases must be built on a Mac. Can build on intel for M1 thanks to Rosetta. -## Support this App -This project has no monetization features and is supported by donations from the community. If you'd like to donate, feel free to use one of the following methods: - -- STEEM/SBD: [@vessel](https://hive.blog/@vessel) -- Bitcoin: [3NvAcXGpAsmFJRkQ2LUTecvHjkw5XREReU](https://blockchain.info/address/3NvAcXGpAsmFJRkQ2LUTecvHjkw5XREReU) ## No Support & No Warranty @@ -42,3 +35,42 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## Updates + +### 1.0.3 Release + +- Added new Binance exchange address. +- Removed Blocktrades exchange. +- Added Hive Mirrornet display. + +### 1.0.2 Release + +- Added Gate.io exchange +- Removed automatic setting of liquid/savings target when choosing `same_account` +- Reduced columns of the confirmation modal on the `Send` page + + +### 1.0.1 Release + +- Added Conversion (HBD => HIVE) and Collateralized Conversion (HIVE => HBD) +- Improved `Send` page to make it easier to deposit to/withdraw from savings + +### 1.0.0 Release + +- Converted to community owned project +- Fixed Binance & other exchanges not taking correctly saved memo +- Added Binance memo to settings and switched order between HBD => HIVE to HIVE => HBD + +### Before + +- [2017/12/09 - 0.2.0 Release Notes](https://hive.blog/vessel/@jesta/vessel-0-2-0-interact-with-steem-securely-from-any-website) +- [2017/11/29 - 0.0.9 Release Notes](https://hive.blog/vessel/@jesta/vessel-009-witness-voting-improved-delegation-controls-auths-and-customjson-ops) +- [2017/10/19 - 0.0.8 Release Notes](https://hive.blog/steem-project/@jesta/vessel-008-configurable-steem-node-new-default-node) +- [2017/09/19 - 0.0.7 Release Notes](https://hive.blog/steem-project/@jesta/vessel-007-account-creation-encrypted-memos-bittrex) +- [2017/05/24 - 0.0.6 Release Notes](https://hive.blog/steem-project/@jesta/vessel-006-steem-power-delegation) +- [2017/05/20 - This app was announced on hive.blog](https://hive.blog/steem-project/@jesta/vessel-pre-release-looking-for-feedback) + + + + diff --git a/app/actions/account.js b/app/actions/account.js index ffb1102..af1db9e 100644 --- a/app/actions/account.js +++ b/app/actions/account.js @@ -1,97 +1,136 @@ // @flow -import hive from 'hivejs'; -import type { accountStateType } from '../reducers/account'; -import * as ProcessingActions from './processing'; - -export const ACCOUNT_CUSTOM_JSON_STARTED = 'ACCOUNT_CUSTOM_JSON_STARTED'; -export const ACCOUNT_CUSTOM_JSON_RESOLVED = 'ACCOUNT_CUSTOM_JSON_RESOLVED'; -export const ACCOUNT_CUSTOM_JSON_FAILED = 'ACCOUNT_CUSTOM_JSON_FAILED'; -export const ACCOUNT_CUSTOM_JSON_COMPLETED = 'ACCOUNT_CUSTOM_JSON_COMPLETED'; -export const ACCOUNT_CUSTOM_OPS_STARTED = 'ACCOUNT_CUSTOM_OPS_STARTED'; -export const ACCOUNT_CUSTOM_OPS_RESOLVED = 'ACCOUNT_CUSTOM_OPS_RESOLVED'; -export const ACCOUNT_CUSTOM_OPS_FAILED = 'ACCOUNT_CUSTOM_OPS_FAILED'; -export const ACCOUNT_CUSTOM_OPS_COMPLETED = 'ACCOUNT_CUSTOM_OPS_COMPLETED'; -export const ACCOUNT_DATA_MINIMUM_ACCOUNT_DELEGATION = 'ACCOUNT_DATA_MINIMUM_ACCOUNT_DELEGATION'; -export const ACCOUNT_DATA_UPDATE = 'ACCOUNT_DATA_UPDATE'; -export const ACCOUNT_DATA_UPDATE_FAILED = 'ACCOUNT_DATA_UPDATE_FAILED'; -export const ACCOUNT_DATA_UPDATE_PENDING = 'ACCOUNT_DATA_UPDATE_PENDING'; -export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_PENDING = 'ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_PENDING'; -export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_FAILED = 'ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_FAILED'; -export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE = 'ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE'; -export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_PENDING = 'ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_PENDING'; -export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_FAILED = 'ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_FAILED'; -export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE = 'ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE'; -export const ACCOUNT_GET_TRANSACTIONS = 'ACCOUNT_GET_TRANSACTIONS'; -export const ACCOUNT_GET_TRANSACTIONS_RESOLVED = 'ACCOUNT_GET_TRANSACTIONS_RESOLVED'; -export const ACCOUNT_DELEGATE_VESTING_SHARES_STARTED = 'ACCOUNT_DELEGATE_VESTING_SHARES_STARTED'; -export const ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED = 'ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED'; -export const ACCOUNT_DELEGATE_VESTING_SHARES_FAILED = 'ACCOUNT_DELEGATE_VESTING_SHARES_FAILED'; -export const ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED = 'ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED'; -export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_STARTED = 'ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_STARTED'; -export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED = 'ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED'; -export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED = 'ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED'; -export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED = 'ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED'; -export const ACCOUNT_SET_VOTING_PROXY_STARTED = 'ACCOUNT_SET_VOTING_PROXY_STARTED'; -export const ACCOUNT_SET_VOTING_PROXY_FAILED = 'ACCOUNT_SET_VOTING_PROXY_FAILED'; -export const ACCOUNT_SET_VOTING_PROXY_RESOLVED = 'ACCOUNT_SET_VOTING_PROXY_RESOLVED'; -export const ACCOUNT_SET_VOTING_PROXY_COMPLETED = 'ACCOUNT_SET_VOTING_PROXY_COMPLETED'; -export const ACCOUNT_VOTE_WITNESS_STARTED = 'ACCOUNT_VOTE_WITNESS_STARTED'; -export const ACCOUNT_VOTE_WITNESS_FAILED = 'ACCOUNT_VOTE_WITNESS_FAILED'; -export const ACCOUNT_VOTE_WITNESS_RESOLVED = 'ACCOUNT_VOTE_WITNESS_RESOLVED'; -export const ACCOUNT_VOTE_WITNESS_COMPLETED = 'ACCOUNT_VOTE_WITNESS_COMPLETED'; -export const ACCOUNT_VESTING_WITHDRAW_COMPLETED = 'ACCOUNT_VESTING_WITHDRAW_COMPLETED'; -export const ACCOUNT_VESTING_WITHDRAW_STARTED = 'ACCOUNT_VESTING_WITHDRAW_STARTED'; -export const ACCOUNT_VESTING_WITHDRAW_FAILED = 'ACCOUNT_VESTING_WITHDRAW_FAILED'; -export const ACCOUNT_VESTING_WITHDRAW_RESOLVED = 'ACCOUNT_VESTING_WITHDRAW_RESOLVED'; -export const ACCOUNT_POWER_UP_COMPLETED = 'ACCOUNT_POWER_UP_COMPLETED'; -export const ACCOUNT_POWER_UP_STARTED = 'ACCOUNT_POWER_UP_STARTED'; -export const ACCOUNT_POWER_UP_FAILED = 'ACCOUNT_POWER_UP_FAILED'; -export const ACCOUNT_POWER_UP_RESOLVED = 'ACCOUNT_POWER_UP_RESOLVED'; -export const ACCOUNT_TRANSFER_STARTED = 'ACCOUNT_TRANSFER_STARTED'; -export const ACCOUNT_TRANSFER_FAILED = 'ACCOUNT_TRANSFER_FAILED'; -export const ACCOUNT_TRANSFER_RESOLVED = 'ACCOUNT_TRANSFER_RESOLVED'; -export const ACCOUNT_TRANSFER_COMPLETED = 'ACCOUNT_TRANSFER_COMPLETED'; -export const ACCOUNT_TRANSFER_FROM_SAVINGS_STARTED = 'ACCOUNT_TRANSFER_FROM_SAVINGS_STARTED'; -export const ACCOUNT_TRANSFER_FROM_SAVINGS_FAILED = 'ACCOUNT_TRANSFER_FROM_SAVINGS_FAILED'; -export const ACCOUNT_TRANSFER_FROM_SAVINGS_RESOLVED = 'ACCOUNT_TRANSFER_FROM_SAVINGS_RESOLVED'; -export const ACCOUNT_TRANSFER_FROM_SAVINGS_COMPLETED = 'ACCOUNT_TRANSFER_FROM_SAVINGS_COMPLETED'; -export const ACCOUNT_TRANSFER_TO_SAVINGS_STARTED = 'ACCOUNT_TRANSFER_TO_SAVINGS_STARTED'; -export const ACCOUNT_TRANSFER_TO_SAVINGS_FAILED = 'ACCOUNT_TRANSFER_TO_SAVINGS_FAILED'; -export const ACCOUNT_TRANSFER_TO_SAVINGS_RESOLVED = 'ACCOUNT_TRANSFER_TO_SAVINGS_RESOLVED'; -export const ACCOUNT_TRANSFER_TO_SAVINGS_COMPLETED = 'ACCOUNT_TRANSFER_TO_SAVINGS_COMPLETED'; -export const ACCOUNT_CONTACTS_ADD = 'ACCOUNT_CONTACTS_ADD'; -export const ACCOUNT_CONTACTS_REMOVE = 'ACCOUNT_CONTACTS_REMOVE'; +import hive from "@hiveio/hive-js"; +import type { accountStateType } from "../reducers/account"; +import * as ProcessingActions from "./processing"; + +export const ACCOUNT_CUSTOM_JSON_STARTED = "ACCOUNT_CUSTOM_JSON_STARTED"; +export const ACCOUNT_CUSTOM_JSON_RESOLVED = "ACCOUNT_CUSTOM_JSON_RESOLVED"; +export const ACCOUNT_CUSTOM_JSON_FAILED = "ACCOUNT_CUSTOM_JSON_FAILED"; +export const ACCOUNT_CUSTOM_JSON_COMPLETED = "ACCOUNT_CUSTOM_JSON_COMPLETED"; +export const ACCOUNT_CUSTOM_OPS_STARTED = "ACCOUNT_CUSTOM_OPS_STARTED"; +export const ACCOUNT_CUSTOM_OPS_RESOLVED = "ACCOUNT_CUSTOM_OPS_RESOLVED"; +export const ACCOUNT_CUSTOM_OPS_FAILED = "ACCOUNT_CUSTOM_OPS_FAILED"; +export const ACCOUNT_CUSTOM_OPS_COMPLETED = "ACCOUNT_CUSTOM_OPS_COMPLETED"; +export const ACCOUNT_DATA_MINIMUM_ACCOUNT_DELEGATION = + "ACCOUNT_DATA_MINIMUM_ACCOUNT_DELEGATION"; +export const ACCOUNT_DATA_UPDATE = "ACCOUNT_DATA_UPDATE"; +export const ACCOUNT_DATA_UPDATE_FAILED = "ACCOUNT_DATA_UPDATE_FAILED"; +export const ACCOUNT_DATA_UPDATE_PENDING = "ACCOUNT_DATA_UPDATE_PENDING"; +export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_PENDING = + "ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_PENDING"; +export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_FAILED = + "ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE_FAILED"; +export const ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE = + "ACCOUNT_DATA_VESTING_DELEGATIONS_UPDATE"; +export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_PENDING = + "ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_PENDING"; +export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_FAILED = + "ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_FAILED"; +export const ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE = + "ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE"; +export const ACCOUNT_GET_TRANSACTIONS = "ACCOUNT_GET_TRANSACTIONS"; +export const ACCOUNT_GET_TRANSACTIONS_RESOLVED = + "ACCOUNT_GET_TRANSACTIONS_RESOLVED"; +export const ACCOUNT_DELEGATE_VESTING_SHARES_STARTED = + "ACCOUNT_DELEGATE_VESTING_SHARES_STARTED"; +export const ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED = + "ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED"; +export const ACCOUNT_DELEGATE_VESTING_SHARES_FAILED = + "ACCOUNT_DELEGATE_VESTING_SHARES_FAILED"; +export const ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED = + "ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED"; +export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_STARTED = + "ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_STARTED"; +export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED = + "ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED"; +export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED = + "ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED"; +export const ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED = + "ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED"; +export const ACCOUNT_SET_VOTING_PROXY_STARTED = + "ACCOUNT_SET_VOTING_PROXY_STARTED"; +export const ACCOUNT_SET_VOTING_PROXY_FAILED = + "ACCOUNT_SET_VOTING_PROXY_FAILED"; +export const ACCOUNT_SET_VOTING_PROXY_RESOLVED = + "ACCOUNT_SET_VOTING_PROXY_RESOLVED"; +export const ACCOUNT_SET_VOTING_PROXY_COMPLETED = + "ACCOUNT_SET_VOTING_PROXY_COMPLETED"; +export const ACCOUNT_VOTE_WITNESS_STARTED = "ACCOUNT_VOTE_WITNESS_STARTED"; +export const ACCOUNT_VOTE_WITNESS_FAILED = "ACCOUNT_VOTE_WITNESS_FAILED"; +export const ACCOUNT_VOTE_WITNESS_RESOLVED = "ACCOUNT_VOTE_WITNESS_RESOLVED"; +export const ACCOUNT_VOTE_WITNESS_COMPLETED = "ACCOUNT_VOTE_WITNESS_COMPLETED"; +export const ACCOUNT_VESTING_WITHDRAW_COMPLETED = + "ACCOUNT_VESTING_WITHDRAW_COMPLETED"; +export const ACCOUNT_VESTING_WITHDRAW_STARTED = + "ACCOUNT_VESTING_WITHDRAW_STARTED"; +export const ACCOUNT_VESTING_WITHDRAW_FAILED = + "ACCOUNT_VESTING_WITHDRAW_FAILED"; +export const ACCOUNT_VESTING_WITHDRAW_RESOLVED = + "ACCOUNT_VESTING_WITHDRAW_RESOLVED"; +export const ACCOUNT_POWER_UP_COMPLETED = "ACCOUNT_POWER_UP_COMPLETED"; +export const ACCOUNT_POWER_UP_STARTED = "ACCOUNT_POWER_UP_STARTED"; +export const ACCOUNT_POWER_UP_FAILED = "ACCOUNT_POWER_UP_FAILED"; +export const ACCOUNT_POWER_UP_RESOLVED = "ACCOUNT_POWER_UP_RESOLVED"; +export const ACCOUNT_TRANSFER_STARTED = "ACCOUNT_TRANSFER_STARTED"; +export const ACCOUNT_TRANSFER_FAILED = "ACCOUNT_TRANSFER_FAILED"; +export const ACCOUNT_TRANSFER_RESOLVED = "ACCOUNT_TRANSFER_RESOLVED"; +export const ACCOUNT_TRANSFER_COMPLETED = "ACCOUNT_TRANSFER_COMPLETED"; +export const ACCOUNT_CONTACTS_ADD = "ACCOUNT_CONTACTS_ADD"; +export const ACCOUNT_CONTACTS_REMOVE = "ACCOUNT_CONTACTS_REMOVE"; + +export const ACCOUNT_CONVERT_COMPLETED = "ACCOUNT_CONVERT_COMPLETED"; +export const ACCOUNT_CONVERT_STARTED = "ACCOUNT_CONVERT_STARTED"; +export const ACCOUNT_CONVERT_FAILED = "ACCOUNT_CONVERT_FAILED"; +export const ACCOUNT_CONVERT_RESOLVED = "ACCOUNT_CONVERT_RESOLVED"; +export const ACCOUNT_COLLATERALIZED_CONVERT_COMPLETED = "ACCOUNT_COLLATERALIZED_CONVERT_COMPLETED"; +export const ACCOUNT_COLLATERALIZED_CONVERT_STARTED = "ACCOUNT_COLLATERALIZED_CONVERT_STARTED"; +export const ACCOUNT_COLLATERALIZED_CONVERT_FAILED = "ACCOUNT_COLLATERALIZED_CONVERT_FAILED"; +export const ACCOUNT_COLLATERALIZED_CONVERT_RESOLVED = "ACCOUNT_COLLATERALIZED_CONVERT_RESOLVED"; export function claimRewardBalance(wif: string, params: object) { return (dispatch: () => void) => { - const { account, reward_hive, reward_hbd, reward_vests } = params; - let reward_steem = reward_hive.replace("HIVE", "STEEM"); - let reward_sbd = reward_hbd.replace("HBD", "SBD"); + let { account, reward_hive, reward_hbd, reward_vests } = params; + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + reward_hive = reward_hive.replace("HIVE", "TESTS"); + reward_hbd = reward_hbd.replace("HBD", "TBD"); + } const ops = [ - ['claim_reward_balance', { - account, - reward_steem, - reward_sbd, - reward_vests - }] + [ + "claim_reward_balance", + { + account, + reward_hive, + reward_hbd, + reward_vests + } + ] ]; - console.error(JSON.stringify(ops)) - hive.broadcast.send({ - operations: ops, - extensions: [] - }, { - posting: wif - }, () => { - dispatch(ProcessingActions.processingRewardClaimComplete()); - dispatch(refreshAccountData([account])); - }); + console.error(JSON.stringify(ops)); + hive.broadcast.send( + { + operations: ops, + extensions: [] + }, + { + posting: wif + }, + () => { + dispatch(ProcessingActions.processingRewardClaimComplete()); + dispatch(refreshAccountData([account])); + } + ); dispatch(ProcessingActions.processingRewardClaim()); }; } // This function automatically attempts to use the minimal account creation fee // and delegation amount. -export function createAccountDelegated(wif: string, params: object, preferences = {}) { +export function createAccountDelegated( + wif: string, + params: object, + preferences = {} +) { return (dispatch: () => void) => { // const { creator, username, password } = params; // let client @@ -106,7 +145,7 @@ export function createAccountDelegated(wif: string, params: object, preferences // client.broadcast.createAccount({ // creator, username, password // }, creatorKey).then(function(result) { - dispatch(ProcessingActions.processingAccountCreateComplete()); + dispatch(ProcessingActions.processingAccountCreateComplete()); // client.disconnect() // }, function(error) { // dispatch(ProcessingActions.processingAccountCreateFailed(error)); @@ -129,7 +168,7 @@ export function getMinimumAccountDelegation(preferences = {}) { // const creationFee = Asset.from(chainProps.account_creation_fee); // const sharePrice = Praiice.from({ // base: dynamicProps.total_vesting_shares, - // quote: dynamicProps.total_vesting_fund_steem + // quote: dynamicProps.total_vesting_fund_hive // }); // const ratio = constants.HIVE_CREATE_ACCOUNT_DELEGATION_RATIO; @@ -143,7 +182,7 @@ export function getMinimumAccountDelegation(preferences = {}) { // client.disconnect(); dispatch({ type: ACCOUNT_DATA_MINIMUM_ACCOUNT_DELEGATION, - payload: { } + payload: {} }); }; } @@ -175,7 +214,7 @@ export function getTransactionsResolved(payload = {}) { return { type: ACCOUNT_GET_TRANSACTIONS_RESOLVED, payload: payload - } + }; } export function getTransactions(accounts: Array) { @@ -183,10 +222,10 @@ export function getTransactions(accounts: Array) { // const { category, author, permlink } = params; const response = await fetch(`http://localhost:5001`); if (response.ok) { - const result = await response.json() + const result = await response.json(); let payload = { transactions: result.data - } + }; // if(result.forum) { // payload.breadcrumb.unshift({ // name: result.forum.name, @@ -199,7 +238,7 @@ export function getTransactions(accounts: Array) { // network: result.network // } // }) - dispatch(getTransactionsResolved(payload)) + dispatch(getTransactionsResolved(payload)); } else { console.error(response.status); // dispatch(fetchPostResolved()) @@ -212,7 +251,7 @@ export function getWithdrawRoutes(account: string) { dispatch({ type: ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_PENDING }); - hive.api.getWithdrawRoutes(account, 'outgoing', (err, results) => { + hive.api.getWithdrawRoutes(account, "outgoing", (err, results) => { if (err) { dispatch({ type: ACCOUNT_DATA_WITHDRAW_ROUTES_UPDATE_FAILED, @@ -228,7 +267,6 @@ export function getWithdrawRoutes(account: string) { } }); }; - } export function refreshAccountData(accounts: Array) { @@ -244,7 +282,7 @@ export function refreshAccountData(accounts: Array) { }); } else { const payload = {}; - results.forEach((data) => { + results.forEach(data => { payload[data.name] = data; // If we have withdraw routes, update those as well if (data.withdraw_routes > 0) { @@ -264,94 +302,188 @@ export function refreshAccountData(accounts: Array) { }; } -export function transfer(wif, params) { +export function convert(wif, params) { return (dispatch: () => void) => { - var { from, to, amount, memo } = params; - amount = amount.replace("HIVE", "STEEM"); - amount = amount.replace("HBD", "SBD"); + var { owner, requestid, amount } = params; dispatch({ - type: ACCOUNT_TRANSFER_STARTED + type: ACCOUNT_CONVERT_STARTED }); - hive.broadcast.transfer(wif, from, to, amount, memo, (err, result) => { + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + amount = amount.replace("HIVE", "TESTS"); + amount = amount.replace("HBD", "TBD"); + } + if (!requestid) requestid = Math.floor(Date.now() / 1000) + hive.broadcast.convert(wif, owner, requestid, amount, (err, result) => { if (err) { dispatch({ - type: ACCOUNT_TRANSFER_FAILED, + type: ACCOUNT_CONVERT_FAILED, payload: err }); } else { - refreshAccountData([from, to]); + refreshAccountData([owner]); dispatch({ - type: ACCOUNT_TRANSFER_RESOLVED + type: ACCOUNT_CONVERT_RESOLVED }); } }); }; } -export function transferCompleted() { +export function convertCompleted() { return { - type: ACCOUNT_TRANSFER_COMPLETED, - } + type: ACCOUNT_CONVERT_COMPLETED + }; } -export function transferFromSavings(wif, params) { +export function collateralizedConvert(wif, params) { return (dispatch: () => void) => { - var { from, requestId, to, amount, memo } = params; - amount = amount.replace("HIVE", "STEEM"); - amount = amount.replace("HBD", "SBD"); + var { owner, requestid, amount } = params; dispatch({ - type: ACCOUNT_TRANSFER_FROM_SAVINGS_STARTED + type: ACCOUNT_COLLATERALIZED_CONVERT_STARTED }); - hive.broadcast.transferFromSavings(wif, from, requestId, to, amount, memo, (err, result) => { + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + amount = amount.replace("HIVE", "TESTS"); + amount = amount.replace("HBD", "TBD"); + } + if (!requestid) requestid = Math.floor(Date.now() / 1000) + console.log('hive', hive) + hive.broadcast.collateralizedConvert(wif, owner, requestid, amount, (err, result) => { if (err) { dispatch({ - type: ACCOUNT_TRANSFER_FROM_SAVINGS_FAILED, + type: ACCOUNT_COLLATERALIZED_CONVERT_FAILED, payload: err }); } else { - refreshAccountData([from, to]); + refreshAccountData([owner]); dispatch({ - type: ACCOUNT_TRANSFER_FROM_SAVINGS_RESOLVED + type: ACCOUNT_COLLATERALIZED_CONVERT_RESOLVED }); } }); }; } -export function transferFromSavingsCompleted() { +export function collateralizedConvertCompleted() { return { - type: ACCOUNT_TRANSFER_FROM_SAVINGS_COMPLETED, - } + type: ACCOUNT_COLLATERALIZED_CONVERT_COMPLETED + }; } -export function transferToSavings(wif, params) { +export function transfer(wif, params) { return (dispatch: () => void) => { var { from, to, amount, memo } = params; - amount = amount.replace("HIVE", "STEEM"); - amount = amount.replace("HBD", "SBD"); dispatch({ - type: ACCOUNT_TRANSFER_TO_SAVINGS_STARTED + type: ACCOUNT_TRANSFER_STARTED }); - hive.broadcast.transferToSavings(wif, from, to, amount, memo, (err, result) => { + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + amount = amount.replace("HIVE", "TESTS"); + amount = amount.replace("HBD", "TBD"); + } + hive.broadcast.transfer(wif, from, to, amount, memo, (err, result) => { if (err) { dispatch({ - type: ACCOUNT_TRANSFER_TO_SAVINGS_FAILED, + type: ACCOUNT_TRANSFER_FAILED, payload: err }); } else { refreshAccountData([from, to]); dispatch({ - type: ACCOUNT_TRANSFER_TO_SAVINGS_RESOLVED + type: ACCOUNT_TRANSFER_RESOLVED }); } }); }; } +export function transferCompleted() { + return { + type: ACCOUNT_TRANSFER_COMPLETED + }; +} + + +export function transferFromSavings(wif, params) { + return (dispatch: () => void) => { + var { from, requestId, to, amount, memo } = params; + dispatch({ + type: ACCOUNT_TRANSFER_STARTED + }); + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + amount = amount.replace("HIVE", "TESTS"); + amount = amount.replace("HBD", "TBD"); + } + hive.broadcast.transferFromSavings( + wif, + from, + requestId, + to, + amount, + memo, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_TRANSFER_FAILED, + payload: err + }); + } else { + refreshAccountData([from, to]); + dispatch({ + type: ACCOUNT_TRANSFER_RESOLVED + }); + } + } + ); + }; +} + +export function transferFromSavingsCompleted() { + return { + type: ACCOUNT_TRANSFER_COMPLETED + }; +} + +export function transferToSavings(wif, params) { + return (dispatch: () => void) => { + var { from, to, amount, memo } = params; + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + amount = amount.replace("HIVE", "TESTS"); + amount = amount.replace("HBD", "TBD"); + } + dispatch({ + type: ACCOUNT_TRANSFER_STARTED + }); + hive.broadcast.transferToSavings( + wif, + from, + to, + amount, + memo, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_TRANSFER_FAILED, + payload: err + }); + } else { + refreshAccountData([from, to]); + dispatch({ + type: ACCOUNT_TRANSFER_RESOLVED + }); + } + } + ); + }; +} + export function transferToSavingsCompleted() { return { - type: ACCOUNT_TRANSFER_TO_SAVINGS_COMPLETED, - } + type: ACCOUNT_TRANSFER_COMPLETED + }; } export function setDelegateVestingShares(wif, params) { @@ -360,27 +492,36 @@ export function setDelegateVestingShares(wif, params) { dispatch({ type: ACCOUNT_DELEGATE_VESTING_SHARES_STARTED }); - const formattedVestingShares = [parseFloat(vestingShares).toFixed(6), 'VESTS'].join(' '); - hive.broadcast.delegateVestingShares(wif, delegator, delegatee, formattedVestingShares, (err, result) => { - if (err) { - dispatch({ - type: ACCOUNT_DELEGATE_VESTING_SHARES_FAILED, - payload: err - }); - } else { - dispatch(refreshAccountData([delegator])); - dispatch({ - type: ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED - }); + const formattedVestingShares = [ + parseFloat(vestingShares).toFixed(6), + "VESTS" + ].join(" "); + hive.broadcast.delegateVestingShares( + wif, + delegator, + delegatee, + formattedVestingShares, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_DELEGATE_VESTING_SHARES_FAILED, + payload: err + }); + } else { + dispatch(refreshAccountData([delegator])); + dispatch({ + type: ACCOUNT_DELEGATE_VESTING_SHARES_RESOLVED + }); + } } - }); + ); }; } export function setDelegateVestingSharesCompleted() { return { - type: ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED, - } + type: ACCOUNT_DELEGATE_VESTING_SHARES_COMPLETED + }; } export function setWithdrawVestingRoute(wif, params) { @@ -389,26 +530,33 @@ export function setWithdrawVestingRoute(wif, params) { dispatch({ type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_STARTED }); - hive.broadcast.setWithdrawVestingRoute(wif, account, target, percent * 100, autoVest, (err, result) => { - if (err) { - dispatch({ - type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED, - payload: err - }); - } else { - dispatch(refreshAccountData([account])); - dispatch({ - type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED - }); + hive.broadcast.setWithdrawVestingRoute( + wif, + account, + target, + percent * 100, + autoVest, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_FAILED, + payload: err + }); + } else { + dispatch(refreshAccountData([account])); + dispatch({ + type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_RESOLVED + }); + } } - }); + ); }; } export function setWithdrawVestingRouteCompleted() { return { - type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED, - } + type: ACCOUNT_SET_WITHDRAW_VESTING_ROUTE_COMPLETED + }; } export function setVotingProxy(wif, params) { @@ -435,8 +583,8 @@ export function setVotingProxy(wif, params) { export function setVotingProxyCompleted() { return { - type: ACCOUNT_SET_VOTING_PROXY_COMPLETED, - } + type: ACCOUNT_SET_VOTING_PROXY_COMPLETED + }; } export function voteWitness(wif, params) { @@ -445,26 +593,32 @@ export function voteWitness(wif, params) { dispatch({ type: ACCOUNT_VOTE_WITNESS_STARTED }); - hive.broadcast.accountWitnessVote(wif, account, witness, approve, (err, result) => { - if (err) { - dispatch({ - type: ACCOUNT_VOTE_WITNESS_FAILED, - payload: err - }); - } else { - dispatch(refreshAccountData([account])); - dispatch({ - type: ACCOUNT_VOTE_WITNESS_RESOLVED - }); + hive.broadcast.accountWitnessVote( + wif, + account, + witness, + approve, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_VOTE_WITNESS_FAILED, + payload: err + }); + } else { + dispatch(refreshAccountData([account])); + dispatch({ + type: ACCOUNT_VOTE_WITNESS_RESOLVED + }); + } } - }); - } + ); + }; } export function voteWitnessCompleted() { return { - type: ACCOUNT_VOTE_WITNESS_COMPLETED, - } + type: ACCOUNT_VOTE_WITNESS_COMPLETED + }; } export function withdrawVesting(wif, params) { @@ -492,8 +646,8 @@ export function withdrawVesting(wif, params) { export function withdrawVestingCompleted() { return { - type: ACCOUNT_VESTING_WITHDRAW_COMPLETED, - } + type: ACCOUNT_VESTING_WITHDRAW_COMPLETED + }; } export function cancelWithdrawVesting(wif, params) { @@ -502,105 +656,125 @@ export function cancelWithdrawVesting(wif, params) { dispatch({ type: ACCOUNT_VESTING_WITHDRAW_STARTED }); - hive.broadcast.withdrawVesting(wif, account, '0.000000 VESTS', (err, result) => { - if (err) { - dispatch({ - type: ACCOUNT_VESTING_WITHDRAW_FAILED, - payload: err - }); - } else { - dispatch(refreshAccountData([account])); - dispatch({ - type: ACCOUNT_VESTING_WITHDRAW_RESOLVED - }); + hive.broadcast.withdrawVesting( + wif, + account, + "0.000000 VESTS", + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_VESTING_WITHDRAW_FAILED, + payload: err + }); + } else { + dispatch(refreshAccountData([account])); + dispatch({ + type: ACCOUNT_VESTING_WITHDRAW_RESOLVED + }); + } } - }); + ); }; } export function powerUp(wif, params) { return (dispatch: () => void) => { - const { from_account, to_account, hiveAmount } = params; - const hiveFormat = [hiveAmount, "STEEM"].join(" "); + let { from_account, to_account, hiveAmount } = params; + let hiveFormat = [hiveAmount, "HIVE"].join(" "); + if (hive.config.get('address_prefix') === 'TST') { + //if testnet + hiveFormat = hiveFormat.replace("HIVE", "TESTS"); + } dispatch({ type: ACCOUNT_POWER_UP_STARTED }); // fix - hive.broadcast.transferToVesting(wif, from_account, to_account, hiveFormat, (err, result) => { - if (err) { - dispatch({ - type: ACCOUNT_POWER_UP_FAILED, - payload: err - }); - } else { - dispatch(refreshAccountData([from_account])); - dispatch({ - type: ACCOUNT_POWER_UP_RESOLVED - }); + hive.broadcast.transferToVesting( + wif, + from_account, + to_account, + hiveFormat, + (err, result) => { + if (err) { + dispatch({ + type: ACCOUNT_POWER_UP_FAILED, + payload: err + }); + } else { + dispatch(refreshAccountData([from_account])); + dispatch({ + type: ACCOUNT_POWER_UP_RESOLVED + }); + } } - }); + ); }; } export function powerUpCompleted() { return { - type: ACCOUNT_POWER_UP_COMPLETED, - } + type: ACCOUNT_POWER_UP_COMPLETED + }; } export function customJson(wif, params) { return (dispatch: () => void) => { - const { account, id, json, permission } = params - let auths = [] - let postingAuths = [account] - if (permission === 'active') { - auths = [account] - postingAuths = [] + const { account, id, json, permission } = params; + let auths = []; + let postingAuths = [account]; + if (permission === "active") { + auths = [account]; + postingAuths = []; } dispatch({ type: ACCOUNT_CUSTOM_JSON_STARTED - }) - hive.broadcast.customJson(wif, auths, postingAuths, id, json, function(err, result) { - if(result) { + }); + hive.broadcast.customJson(wif, auths, postingAuths, id, json, function ( + err, + result + ) { + if (result) { dispatch({ type: ACCOUNT_CUSTOM_JSON_RESOLVED - }) + }); } - if(err) { + if (err) { dispatch({ type: ACCOUNT_CUSTOM_JSON_FAILED, payload: err - }) + }); } }); }; } - export function customJsonCompleted() { return { - type: ACCOUNT_CUSTOM_JSON_COMPLETED, - } + type: ACCOUNT_CUSTOM_JSON_COMPLETED + }; } export function send(wif, params) { return (dispatch: () => void) => { - const { operations, extensions } = params - console.log(operations, extensions) + const { operations, extensions } = params; + console.log(operations, extensions); dispatch({ type: ACCOUNT_CUSTOM_OPS_STARTED - }) - hive.broadcast.send({ operations, extensions }, { posting: wif }, function(err, result) { - if(result) { + }); + hive.broadcast.send({ operations, extensions }, { posting: wif }, function ( + err, + result + ) { + if (result) { dispatch({ type: ACCOUNT_CUSTOM_OPS_RESOLVED - }) + }); } - if(err) { + if (err) { dispatch({ type: ACCOUNT_CUSTOM_OPS_FAILED, payload: err - }) + }); } }); }; @@ -611,7 +785,7 @@ export function addContact(username) { dispatch({ type: ACCOUNT_CONTACTS_ADD, payload: username - }) + }); }; } @@ -620,6 +794,6 @@ export function removeContact(username) { dispatch({ type: ACCOUNT_CONTACTS_REMOVE, payload: username - }) + }); }; } diff --git a/app/actions/hive.js b/app/actions/hive.js index f0f3fa1..6c64936 100644 --- a/app/actions/hive.js +++ b/app/actions/hive.js @@ -1,5 +1,5 @@ // @flow -import hive from 'hivejs'; +import hive from '@hiveio/hive-js'; import * as ProcessingActions from './processing'; export const HIVE_GLOBALPROPS_UPDATE = 'HIVE_GLOBALPROPS_UPDATE'; @@ -15,9 +15,13 @@ export function refreshGlobalProps() { // }); } else { if(results.virtual_supply.search('HIVE') >= 0){ - results.network = "Hive"; - } else if(results.virtual_supply.search('STEEM') >= 0){ - results.network = "Steem"; + if (hive.config.get('chain_id') === 'beeab0de00000000000000000000000000000000000000000000000000000000'){ + results.network = "Hive"; + } else { + results.network = "Hive Mirrornet"; + } + } else if(results.virtual_supply.search('TESTS') >= 0){ + results.network = "Hive Testnet"; } else { results.network = "Unknown"; } diff --git a/app/actions/keys.js b/app/actions/keys.js index 69dadfc..0645ae6 100644 --- a/app/actions/keys.js +++ b/app/actions/keys.js @@ -1,5 +1,5 @@ // @flow -import hive from 'hivejs'; +import hive from '@hiveio/hive-js'; import type { keysStateType } from '../reducers/keys'; import * as AccountActions from './account'; import { diff --git a/app/app.global.css b/app/app.global.css index 01cabee..9967ea6 100644 --- a/app/app.global.css +++ b/app/app.global.css @@ -140,3 +140,7 @@ a { .hivered { color: #E31337 !important; } + +.hivetestnetpink { + color : #fe5fff !important; +} \ No newline at end of file diff --git a/app/app.html b/app/app.html index 6cd81f2..88f9fa3 100644 --- a/app/app.html +++ b/app/app.html @@ -2,7 +2,7 @@ - Vessel - 0.4.6 + Vessel - 1.0.3