Skip to content

Commit

Permalink
Fix after big merge (broken wax package)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek555 committed Feb 28, 2024
1 parent 88d0cec commit 9658b64
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@hive/transaction": "*",
"@hive/tsconfig": "*",
"@hive/ui": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@hiveio/dhive": "^1.2.8",
"@hookform/resolvers": "^3.3.1",
"@tanstack/react-query": "^4.36.1",
Expand Down
33 changes: 29 additions & 4 deletions apps/auth/pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { verifySignature } from '@smart-signer/lib/utils';
import { vote, createHiveChain, BroadcastTransactionRequest } from '@hive/wax/web';
import { waxToKeychainOperation } from '@smart-signer/lib/signer/signer-keychain';
import { KeyTypes } from '@smart-signer/types/common';
import { fetchJson } from '@smart-signer/lib/fetch-json';

import { getLogger } from '@ui/lib/logging';
const logger = getLogger('app');
Expand All @@ -33,8 +34,8 @@ export default function Profile() {
voter: user.username,
author: 'gtg',

// permlink: 'power-to-the-hive-but-just-a-little',
permlink: 'non-existing-permlink-q523-73867',
permlink: 'power-to-the-hive-but-just-a-little',
// permlink: 'non-existing-permlink-q523-73867',

weight: 10000
};
Expand Down Expand Up @@ -63,10 +64,34 @@ export default function Profile() {
});
logger.info('broadcast signature: %s', signature);
txBuilder.build(signature);
const request = new BroadcastTransactionRequest(txBuilder);
logger.info('broadcast txBuilder: %o', txBuilder);

const trx = {
trx: JSON.parse(txBuilder.toApi()),
max_block_age: -1,
};

logger.info('broadcast transaction: %o', trx);
const data = {
jsonrpc: "2.0",
method: "network_broadcast_api.broadcast_transaction",
params: trx,
id: 1
};
logger.info('broadcast data: %o', data);

const fetchResult = await fetchJson('https://api.hive.blog', {
method: 'POST',
body: JSON.stringify(data, null, 0)
});
logger.info('broadcast fetchResult: %o', fetchResult);

const broadcastReq = new BroadcastTransactionRequest(txBuilder);
logger.info('broadcast broadcastReq: %o', broadcastReq);
logger.info('broadcast JSON.stringify(broadcastReq): %o', JSON.stringify(broadcastReq));

// Transmit
const result = await hiveChain.api.network_broadcast_api.broadcast_transaction(request);
const result = await hiveChain.api.network_broadcast_api.broadcast_transaction(broadcastReq);
logger.info('broadcast result: %o', result);
} catch (error) {
logger.error(error);
Expand Down
2 changes: 1 addition & 1 deletion apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@hive/transaction": "*",
"@hive/tsconfig": "*",
"@hive/ui": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@hiveio/content-renderer": "^2.0.0",
"@hiveio/dhive": "^1.2.8",
"@hookform/resolvers": "^3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@hive/transaction": "*",
"@hive/tsconfig": "*",
"@hive/ui": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@hiveio/dhive": "^1.2.8",
"@hookform/resolvers": "^3.3.2",
"@next/bundle-analyzer": "^14.0.4",
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/smart-signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"lint": "eslint ."
},
"dependencies": {
"@hive/hb-auth": "^0.0.1-stable.240223093642",
"@hive/hb-auth": "^0.0.1-stable.240228104557",
"@hive/ui": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@hiveio/dhive": "^1.2.8",
"@hiveio/hive-js": "^2.0.7",
"@tanstack/react-query": "^4.36.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@hive/smart-signer": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@hiveio/dhive": "^1.2.8",
"@hiveio/hive-js": "^2.0.7",
"secure-random": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@hive/prettier-config-custom": "*",
"@hive/tailwindcss-config": "*",
"@hive/tsconfig": "*",
"@hive/wax": "^0.3.8-240222134308",
"@hive/wax": "^0.3.8-240228091712",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-avatar": "^1.0.3",
Expand Down
37 changes: 37 additions & 0 deletions scripts/update-wax.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -euo pipefail

WAX_VERSION=${1} # prefixed with @
HBAUTH_VERSION=${2} # prefixed with @

uninstall_packages() {
echo "Uninstalling packages"

npm uninstall --save @hive/hb-auth --workspace=packages/smart-signer

npm uninstall --save @hive/wax --workspace=packages/smart-signer
npm uninstall --save @hive/wax --workspace=packages/transaction
npm uninstall --save @hive/wax --workspace=packages/ui

npm uninstall --save @hive/wax --workspace=apps/auth
npm uninstall --save @hive/wax --workspace=apps/blog
npm uninstall --save @hive/wax --workspace=apps/wallet
}

install_packages() {
echo "Installing packages"

npm install --save "@hive/wax${WAX_VERSION}" --workspace=apps/auth
npm install --save "@hive/wax${WAX_VERSION}" --workspace=apps/blog
npm install --save "@hive/wax${WAX_VERSION}" --workspace=apps/wallet

npm install --save "@hive/wax${WAX_VERSION}" --workspace=packages/smart-signer
npm install --save "@hive/wax${WAX_VERSION}" --workspace=packages/transaction
npm install --save "@hive/wax${WAX_VERSION}" --workspace=packages/ui

npm install --save "@hive/hb-auth${HBAUTH_VERSION}" --workspace=packages/smart-signer
}

uninstall_packages
install_packages

0 comments on commit 9658b64

Please sign in to comment.