Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import assert from "assert"
import { fromJS, Map, List, Set } from "immutable"
import { PrivateKey, PublicKey, Aes, brainKey, hash, key } from "@graphene/ecc"
import { fetchChain, config, chain_types, Apis, TransactionBuilder, number_utils } from "@graphene/chain"
import { ops, Serializer } from "@graphene/serializer"
import AddressIndex from "./AddressIndex"
import ByteBuffer from "bytebuffer"
var bs58 = require("bs58")
let { stealth_memo_data, stealth_confirmation, blind_transfer, transfer_from_blind } = ops
let { toImpliedDecimal } = number_utils
let Long = ByteBuffer.Long
/** This class is used for stealth transfers.
Anytime you send to an external stealth address, you will need to capture the `confirmation_receipt` hex in the returned promise. This must be sent to the recipient so they may claim their balance.
separated out change_receipts and confirmation receipts. So, only if your sending to another blind address do you need to grab the 1 and only "confirmation_receipt" .. The wallet should store everything so you normally would not need any change_receipts.
Serilizable persisterent state (JSON serilizable types only).. This is the data used by this class and kept in walletStorage.wallet_object:
```js
const empty_wallet = fromJS({
blind_receipts: [ see this.receiveBlindTransfer() ],
keys: {
"pubkey": {
// No two keys can have the same label, no two labels can have the same key
label: t.maybe(t.Str),
import secureRandom from 'secure-random';
import ByteBuffer from 'bytebuffer';
import crypto from 'browserify-aes';
import assert from 'assert';
import PublicKey from './key_public';
import PrivateKey from './key_private';
import hash from './hash';
const Long = ByteBuffer.Long;
/**
Spec: http://localhost:3002/steem/@dantheman/how-to-encrypt-a-memo-when-transferring-steem
@throws {Error|TypeError} - "Invalid Key, ..."
@arg {PrivateKey} private_key - required and used for decryption
@arg {PublicKey} public_key - required and used to calcualte the shared secret
@arg {string} [nonce = uniqueNonce()] - assigned a random unique uint64
@return {object}
@property {string} nonce - random or unique uint64, provides entropy when re-using the same private/public keys.
@property {Buffer} message - Plain text message
@property {number} checksum - shared secret checksum
*/
export function encrypt(private_key, public_key, message, nonce = uniqueNonce()) {
return crypt(private_key, public_key, nonce, message)
}
SteamID.prototype.encode = function() {
return new Long(this.accountID, this.accountInstance | this.accountType << 20 | this.accountUniverse << 24);
};
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import links from 'app/utils/Links';
import Icon from 'app/components/elements/Icon';
import * as transactionActions from 'app/redux/TransactionReducer';
import ByteBuffer from 'bytebuffer';
import { is, Set } from 'immutable';
import * as globalActions from 'app/redux/GlobalReducer';
import tt from 'counterpart';
const Long = ByteBuffer.Long;
const { string, func, object } = PropTypes;
const DISABLED_SIGNING_KEY = 'STM1111111111111111111111111111111114T1Anm';
function _blockGap(head_block, last_block) {
if (!last_block || last_block < 1) return 'forever';
const secs = (head_block - last_block) * 3;
if (secs < 120) return 'recently';
const mins = Math.floor(secs / 60);
if (mins < 120) return mins + ' mins ago';
const hrs = Math.floor(mins / 60);
if (hrs < 48) return hrs + ' hrs ago';
const days = Math.floor(hrs / 24);
if (days < 14) return days + ' days ago';
const weeks = Math.floor(days / 7);
if (weeks < 104) return weeks + ' weeks ago';