From 1ba48a0dae0c9667f39a20bb26445ded413e2ffa Mon Sep 17 00:00:00 2001 From: feruz Date: Mon, 7 Sep 2020 09:43:13 +0300 Subject: [PATCH] library update --- package.json | 2 +- src/providers/steem/dsteem.js | 65 +++++++++++++++-------------------- yarn.lock | 31 +++++++++++------ 3 files changed, 48 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index f34106b5c..91f5b7e26 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ }, "dependencies": { "@babel/runtime": "^7.5.5", - "@esteemapp/dhive": "0.14.15", + "@esteemapp/dhive": "0.15.0", "@esteemapp/esteem-render-helpers": "^1.5.9", "@esteemapp/react-native-autocomplete-input": "^4.2.1", "@esteemapp/react-native-modal-popover": "^0.0.15", diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 64406c7f9..e169437af 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -2,12 +2,8 @@ // import '../../../shim'; // import * as bitcoin from 'bitcoinjs-lib'; -import { Client } from '@hiveio/dhive'; -import { - Client as Client2, - PrivateKey as PrivateKey2, - cryptoUtils as cryptoUtils2, -} from '@esteemapp/dhive'; +import { Client, cryptoUtils } from '@hiveio/dhive'; +import { PrivateKey } from '@esteemapp/dhive'; import hivesigner from 'hivesigner'; import Config from 'react-native-config'; @@ -41,9 +37,6 @@ const DEFAULT_SERVER = [ let client = new Client(DEFAULT_SERVER, { timeout: 5000, }); -let client2 = new Client2(DEFAULT_SERVER, { - timeout: 5000, -}); export const checkClient = async () => { let selectedServer = DEFAULT_SERVER; @@ -57,10 +50,7 @@ export const checkClient = async () => { client = new Client(selectedServer, { timeout: 5000, }); - client2 = new Client2(selectedServer, { - timeout: 5000, - }); - /* + client.database.getVersion().then((res) => { if (res.blockchain_version !== '0.23.0') { // true: eclipse rebranded rpc nodes @@ -68,7 +58,6 @@ export const checkClient = async () => { client.updateOperations(true); } }); - */ }; checkClient(); @@ -358,7 +347,7 @@ export const ignoreUser = async (currentAccount, pin, data) => { } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const json = { id: 'follow', @@ -523,7 +512,7 @@ export const deleteComment = (currentAccount, pin, permlink) => { ], ]; - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); return client.broadcast.sendOperations(opArray, privateKey); } @@ -584,9 +573,9 @@ export const signImage = async (file, currentAccount, pin) => { authors: [currentAccount.name], timestamp: parseInt(new Date().getTime() / 1000, 10), }; - const hash = cryptoUtils2.sha256(JSON.stringify(message)); + const hash = cryptoUtils.sha256(JSON.stringify(message)); - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const signature = privateKey.sign(hash).toString(); message.signatures = [signature]; return b64uEnc(JSON.stringify(message)); @@ -629,7 +618,7 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => { } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const voter = currentAccount.name; const args = { voter, @@ -686,7 +675,7 @@ export const transferToken = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = { from: get(data, 'from'), to: get(data, 'destination'), @@ -723,7 +712,7 @@ export const convert = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ @@ -765,7 +754,7 @@ export const transferToSavings = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ @@ -806,7 +795,7 @@ export const transferFromSavings = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ 'transfer_from_savings', @@ -847,7 +836,7 @@ export const transferToVesting = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ 'transfer_to_vesting', @@ -886,7 +875,7 @@ export const withdrawVesting = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ 'withdraw_vesting', @@ -924,7 +913,7 @@ export const delegateVestingShares = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ 'delegate_vesting_shares', @@ -963,7 +952,7 @@ export const setWithdrawVestingRoute = (currentAccount, pin, data) => { ); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const args = [ [ 'set_withdraw_vesting_route', @@ -1010,7 +999,7 @@ export const followUser = async (currentAccount, pin, data) => { } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const json = { id: 'follow', json: jsonStringify([ @@ -1056,7 +1045,7 @@ export const unfollowUser = async (currentAccount, pin, data) => { } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const json = { id: 'follow', @@ -1230,7 +1219,7 @@ const _postContent = async ( opArray.push(e); } - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); return new Promise((resolve, reject) => { client.broadcast @@ -1276,7 +1265,7 @@ const _reblog = async (account, pinCode, author, permlink) => { } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const follower = account.name; const json = { @@ -1315,7 +1304,7 @@ export const claimRewardBalance = (account, pinCode, rewardSteem, rewardSbd, rew } if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const opArray = [ [ @@ -1350,7 +1339,7 @@ export const transferPoint = (currentAccount, pinCode, data) => { }); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const op = { id: 'esteem_point_transfer', @@ -1372,7 +1361,7 @@ export const promote = (currentAccount, pinCode, duration, permlink, author) => const key = getActiveKey(get(currentAccount, 'local'), pin); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const user = get(currentAccount, 'name'); const json = { @@ -1400,7 +1389,7 @@ export const boost = (currentAccount, pinCode, point, permlink, author) => { const key = getActiveKey(get(currentAccount, 'local'), pin); if (key && point) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const user = get(currentAccount, 'name'); const json = { @@ -1472,7 +1461,7 @@ export const grantPostingPermission = async (json, pin, currentAccount) => { }, ], ]; - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); return new Promise((resolve, reject) => { client.broadcast @@ -1532,7 +1521,7 @@ export const profileUpdate = async (params, pin, currentAccount) => { ], ]; - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); return new Promise((resolve, reject) => { client.broadcast @@ -1565,7 +1554,7 @@ export const subscribeCommunity = (currentAccount, pinCode, data) => { ]); if (key) { - const privateKey = PrivateKey2.fromString(key); + const privateKey = PrivateKey.fromString(key); const op = { id: 'community', diff --git a/yarn.lock b/yarn.lock index 469d1b853..8d4926244 100644 --- a/yarn.lock +++ b/yarn.lock @@ -705,19 +705,18 @@ dependencies: "@types/hammerjs" "^2.0.36" -"@esteemapp/dhive@0.14.15": - version "0.14.15" - resolved "https://registry.yarnpkg.com/@esteemapp/dhive/-/dhive-0.14.15.tgz#d974f11c00a6cea9be9ade251b51c90e4f6a0674" - integrity sha512-xFa8MPM1RAbmo7pxp+3EBMw76/JwslIVelza4jpCGRZj3XpzyJCKdjDhZTqSWJzjsE/IZRMXEz885RB/YMb6hA== +"@esteemapp/dhive@0.15.0": + version "0.15.0" + resolved "https://registry.yarnpkg.com/@esteemapp/dhive/-/dhive-0.15.0.tgz#aff9a0bae3c03c37bf9633e81757d32f91c28be6" + integrity sha512-8Ty7ke7pjNbpVUiut0B/C20EVK/Fx8n7HJoGLdQGnIHg0+Y7HFJFWmj+ZsewfQRwNgjdtHPWMD+2qKXg92SmkA== dependencies: bs58 "^4.0.1" bytebuffer "^5.0.1" - core-js "^3.6.4" - cross-fetch "^3.0.4" - node-fetch "^2.6.0" - secp256k1 "^3.8.0" + core-js "^2.5.0" + node-fetch "^2.1.2" + secp256k1 "^3.3.1" verror "^1.10.0" - whatwg-fetch "^3.0.0" + whatwg-fetch "^2.0.3" "@esteemapp/esteem-render-helpers@^1.5.9": version "1.5.9" @@ -2654,7 +2653,7 @@ core-js@^1.0.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.2.2, core-js@^2.4.0, core-js@^2.4.1: +core-js@^2.2.2, core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0: version "2.6.11" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== @@ -6557,6 +6556,11 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-fetch@^2.1.2: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -8330,7 +8334,7 @@ scheduler@0.15.0, scheduler@^0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" -secp256k1@^3.8.0: +secp256k1@^3.3.1, secp256k1@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.0.tgz#28f59f4b01dbee9575f56a47034b7d2e3b3b352d" integrity sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw== @@ -9426,6 +9430,11 @@ whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.3.1.tgz#6c1acf37dec176b0fd6bc9a74b616bec2f612935" integrity sha512-faXTmGDcLuEPBpJwb5LQfyxvubKiE+RlbmmweFGKjvIPFj4uHTTfdtTIkdTRhC6OSH9S9eyYbx8kZ0UEaQqYTA== +whatwg-fetch@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" + integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== + whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"