mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
update transaction seed account for structure chance in dlt-connector
This commit is contained in:
parent
a70cfa88eb
commit
495622d55d
@ -36,8 +36,10 @@ async function checkDltConnectorResult(dltTransaction: DbDltTransaction, clientR
|
|||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
dltTransaction.error = e.message
|
dltTransaction.error = e.message
|
||||||
|
logger.error('Error from dlt-connector', e)
|
||||||
} else if (typeof e === 'string') {
|
} else if (typeof e === 'string') {
|
||||||
dltTransaction.error = e
|
dltTransaction.error = e
|
||||||
|
logger.error('error from dlt-connector', e)
|
||||||
} else {
|
} else {
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
|
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
|
||||||
import { IdentifierSeed } from './IdentifierSeed'
|
|
||||||
|
|
||||||
export class AccountIdentifier {
|
export class AccountIdentifier {
|
||||||
communityTopicId: string
|
communityTopicId: string
|
||||||
account?: CommunityAccountIdentifier
|
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) {
|
if (input instanceof CommunityAccountIdentifier) {
|
||||||
this.account = input
|
this.account = input
|
||||||
} else if (input instanceof IdentifierSeed) {
|
} else {
|
||||||
this.seed = input
|
this.seed = input
|
||||||
}
|
}
|
||||||
this.communityTopicId = communityTopicId
|
this.communityTopicId = communityTopicId
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
// https://www.npmjs.com/package/@apollo/protobufjs
|
|
||||||
|
|
||||||
export class IdentifierSeed {
|
|
||||||
seed: string
|
|
||||||
|
|
||||||
constructor(seed: string) {
|
|
||||||
this.seed = seed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -12,7 +12,6 @@ import {
|
|||||||
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
|
import { CommunityAccountIdentifier } from './CommunityAccountIdentifier'
|
||||||
import { getLogger } from 'log4js'
|
import { getLogger } from 'log4js'
|
||||||
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
|
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
|
||||||
import { IdentifierSeed } from './IdentifierSeed'
|
|
||||||
import { CODE_VALID_DAYS_DURATION } from '@/graphql/resolver/const/const'
|
import { CODE_VALID_DAYS_DURATION } from '@/graphql/resolver/const/const'
|
||||||
|
|
||||||
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dltConnector.model.TransactionDraft`)
|
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dltConnector.model.TransactionDraft`)
|
||||||
@ -94,7 +93,7 @@ export class TransactionDraft {
|
|||||||
}
|
}
|
||||||
const draft = new TransactionDraft()
|
const draft = new TransactionDraft()
|
||||||
draft.user = new AccountIdentifier(senderUserTopic, new CommunityAccountIdentifier(sendingUser.gradidoID))
|
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.type = TransactionType.GRADIDO_DEFERRED_TRANSFER
|
||||||
draft.createdAt = transactionLink.createdAt.toISOString()
|
draft.createdAt = transactionLink.createdAt.toISOString()
|
||||||
draft.amount = transactionLink.amount.toString()
|
draft.amount = transactionLink.amount.toString()
|
||||||
@ -119,7 +118,7 @@ export class TransactionDraft {
|
|||||||
throw new Error(`missing topicId for community ${recipientUser.community.id}`)
|
throw new Error(`missing topicId for community ${recipientUser.community.id}`)
|
||||||
}
|
}
|
||||||
const draft = new TransactionDraft()
|
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.linkedUser = new AccountIdentifier(recipientUserTopic, new CommunityAccountIdentifier(recipientUser.gradidoID))
|
||||||
draft.type = TransactionType.GRADIDO_REDEEM_DEFERRED_TRANSFER
|
draft.type = TransactionType.GRADIDO_REDEEM_DEFERRED_TRANSFER
|
||||||
draft.createdAt = createdAt.toISOString()
|
draft.createdAt = createdAt.toISOString()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user