Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Candidate v1.6.4 #206

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions db/migrations/20250110194443-increase-network-size.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
await queryInterface.changeColumn('version_data', 'network', {
type: Sequelize.STRING(32),
allowNull: false,
});
},

async down (queryInterface, Sequelize) {
await queryInterface.changeColumn('version_data', 'network', {
type: Sequelize.STRING(8),
allowNull: false,
});
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hathor-wallet-service",
"version": "1.6.3",
"version": "1.6.4",
"workspaces": [
"packages/common",
"packages/daemon",
Expand Down
13 changes: 4 additions & 9 deletions packages/daemon/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
getFullnodeHttpUrl,
sendMessageSQS,
generateAddresses,
sendRealtimeTx,
} from '../utils';
import {
getDbConnection,
Expand Down Expand Up @@ -169,7 +170,6 @@ export const handleVertexAccepted = async (context: Context, _event: Event) => {
NETWORK,
STAGE,
PUSH_NOTIFICATION_ENABLED,
NEW_TX_SQS,
} = getConfig();

try {
Expand Down Expand Up @@ -381,15 +381,10 @@ export const handleVertexAccepted = async (context: Context, _event: Event) => {

try {
if (seenWallets.length > 0) {
const queueUrl = NEW_TX_SQS;
if (!queueUrl) {
throw new Error('Queue URL is invalid');
}

await sendMessageSQS(JSON.stringify({
wallets: Array.from(seenWallets),
await sendRealtimeTx(
Array.from(seenWallets),
txData,
}), queueUrl);
);
}
} catch (e) {
logger.error('Failed to send transaction to SQS queue');
Expand Down
21 changes: 20 additions & 1 deletion packages/daemon/src/utils/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SendMessageCommand, SendMessageCommandOutput, SQSClient, MessageAttribu
import { StringMap } from '../types';
import getConfig from '../config';
import logger from '../logger';
import { addAlert } from '@wallet-service/common';
import { addAlert, Transaction } from '@wallet-service/common';

export function buildFunctionName(functionName: string): string {
const { STAGE } = getConfig();
Expand Down Expand Up @@ -56,6 +56,25 @@ export const invokeOnTxPushNotificationRequestedLambda = async (walletBalanceVal
}
}

/**
* Sends a message to the real-time wallet-service SQS queue.
*
* @param wallets - A list of wallets to notify
* @param tx - The transaction details to send to the clients
*/
export const sendRealtimeTx = async (wallets: string[], tx: Transaction): Promise<void> => {
const { NEW_TX_SQS } = getConfig();

if (!NEW_TX_SQS) {
throw new Error('Queue URL is invalid');
}

await sendMessageSQS(JSON.stringify({
wallets,
tx,
}), NEW_TX_SQS);
}

/**
* Sends a message to a specific SQS queue
*
Expand Down
Loading