update transaction seed account for structure chance in dlt-connector

This commit is contained in:
einhornimmond 2025-11-13 08:32:42 +01:00
parent a70cfa88eb
commit 495622d55d
4 changed files with 7 additions and 17 deletions

View File

@ -36,8 +36,10 @@ async function checkDltConnectorResult(dltTransaction: DbDltTransaction, clientR
logger.debug(e)
if (e instanceof Error) {
dltTransaction.error = e.message
logger.error('Error from dlt-connector', e)
} else if (typeof e === 'string') {
dltTransaction.error = e
logger.error('error from dlt-connector', e)
} else {
throw e
}

View File

@ -1,15 +1,13 @@
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
import { IdentifierSeed } from './IdentifierSeed'
export class AccountIdentifier {
communityTopicId: string
account?: CommunityAccountIdentifier
seed?: IdentifierSeed // used for deferred transfers
seed?: string // used for deferred transfers
constructor(communityTopicId: string, input: CommunityAccountIdentifier | IdentifierSeed) {
constructor(communityTopicId: string, input: CommunityAccountIdentifier | string) {
if (input instanceof CommunityAccountIdentifier) {
this.account = input
} else if (input instanceof IdentifierSeed) {
} else {
this.seed = input
}
this.communityTopicId = communityTopicId

View File

@ -1,9 +0,0 @@
// https://www.npmjs.com/package/@apollo/protobufjs
export class IdentifierSeed {
seed: string
constructor(seed: string) {
this.seed = seed
}
}

View File

@ -12,7 +12,6 @@ import {
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
import { getLogger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { IdentifierSeed } from './IdentifierSeed'
import { CODE_VALID_DAYS_DURATION } from '@/graphql/resolver/const/const'
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dltConnector.model.TransactionDraft`)
@ -94,7 +93,7 @@ export class TransactionDraft {
}
const draft = new TransactionDraft()
draft.user = new AccountIdentifier(senderUserTopic, new CommunityAccountIdentifier(sendingUser.gradidoID))
draft.linkedUser = new AccountIdentifier(senderUserTopic, new IdentifierSeed(transactionLink.code))
draft.linkedUser = new AccountIdentifier(senderUserTopic, transactionLink.code)
draft.type = TransactionType.GRADIDO_DEFERRED_TRANSFER
draft.createdAt = transactionLink.createdAt.toISOString()
draft.amount = transactionLink.amount.toString()
@ -119,7 +118,7 @@ export class TransactionDraft {
throw new Error(`missing topicId for community ${recipientUser.community.id}`)
}
const draft = new TransactionDraft()
draft.user = new AccountIdentifier(senderUserTopic, new IdentifierSeed(transactionLink.code))
draft.user = new AccountIdentifier(senderUserTopic, transactionLink.code)
draft.linkedUser = new AccountIdentifier(recipientUserTopic, new CommunityAccountIdentifier(recipientUser.gradidoID))
draft.type = TransactionType.GRADIDO_REDEEM_DEFERRED_TRANSFER
draft.createdAt = createdAt.toISOString()