Skip to content

Commit

Permalink
feat(2756): fix issue with local dev. linked account creation caused …
Browse files Browse the repository at this point in the history
…issues.
  • Loading branch information
koekiebox committed Jul 17, 2024
1 parent 2cf6571 commit f231252
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions localenv/happy-life-bank/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ services:
CONNECTOR_PORT: 3002
OPEN_PAYMENTS_PORT: 80
DATABASE_URL: postgresql://happy_life_bank_backend:happy_life_bank_backend@shared-database/happy_life_bank_backend
USE_TIGERBEETLE: ${USE_TIGERBEETLE-false}
TIGERBEETLE_CLUSTER_ID: ${TIGERBEETLE_CLUSTER_ID-0}
TIGERBEETLE_REPLICA_ADDRESSES: ${TIGERBEETLE_REPLICA_ADDRESSES-''}
USE_TIGERBEETLE: false
AUTH_SERVER_GRANT_URL: ${HAPPY_LIFE_BANK_AUTH_SERVER_DOMAIN:-http://happy-life-bank-auth:3006}
AUTH_SERVER_INTROSPECTION_URL: http://happy-life-bank-auth:3007
ILP_ADDRESS: test.happy-life-bank
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/accounting/psql/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export function createAccountingService(
return {
createLiquidityAccount: (options, accTypeCode, trx) =>
createLiquidityAccount(deps, options, accTypeCode, trx),
createSettlementAccount: (ledger, accountId, trx) =>
createSettlementAccount(deps, ledger, accountId, trx),
createSettlementAccount: (ledger, relatedAccountId, trx) =>
createSettlementAccount(deps, ledger, relatedAccountId, trx),
createLiquidityAndLinkedSettlementAccount: (options, accTypeCode, trx) =>
createLiquidityAndLinkedSettlementAccount(
deps,
Expand Down Expand Up @@ -100,7 +100,7 @@ export async function createLiquidityAccount(
export async function createSettlementAccount(
deps: ServiceDependencies,
ledger: number,
accountId: string | number,
relatedAccountId: string | number,
trx?: TransactionOrKnex
): Promise<void> {
const asset = await Asset.query(trx || deps.knex).findOne({ ledger })
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/accounting/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface AccountingService {
): Promise<LiquidityAccount>
createSettlementAccount(
ledger: number,
accountId: string | number,
relatedAccountId: string | number,
trx?: TransactionOrKnex
): Promise<void>
createLiquidityAndLinkedSettlementAccount(
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/accounting/tigerbeetle/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export function createAccountingService(
// Their account id is the corresponding asset's ledger value.
createLiquidityAccount: (options, accountType) =>
createLiquidityAccount(deps, options, accountType),
createSettlementAccount: (ledger, accountId) =>
createSettlementAccount(deps, ledger, accountId),
createSettlementAccount: (ledger, relatedAccountId) =>
createSettlementAccount(deps, ledger, relatedAccountId),
createLiquidityAndLinkedSettlementAccount: (options, accTypeCode) =>
createLiquidityAndLinkedSettlementAccount(deps, options, accTypeCode),
getBalance: (id) => getAccountBalance(deps, id),
Expand Down Expand Up @@ -151,15 +151,15 @@ export async function createLiquidityAccount(
export async function createSettlementAccount(
deps: ServiceDependencies,
ledger: number,
accountId: string | number
relatedAccountId: string | number
): Promise<void> {
try {
await createAccounts(deps, [
{
id: ledger,
ledger,
code: TigerBeetleAccountCode.SETTLEMENT,
userData128: toTigerBeetleId(accountId)
userData128: toTigerBeetleId(relatedAccountId)
}
])
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class MockAccountingService implements AccountingService {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ledger: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
accountId: string | number,
relatedAccountId: string | number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
trx?: TransactionOrKnex
): Promise<void> {
Expand Down

0 comments on commit f231252

Please sign in to comment.