diff --git a/packages/backend/src/payment-method/ilp/connector/core/rafiki.ts b/packages/backend/src/payment-method/ilp/connector/core/rafiki.ts index f0a7efb7c9..16e58f8e69 100644 --- a/packages/backend/src/payment-method/ilp/connector/core/rafiki.ts +++ b/packages/backend/src/payment-method/ilp/connector/core/rafiki.ts @@ -5,15 +5,9 @@ import { Errors } from 'ilp-packet' import { Redis } from 'ioredis' import Koa, { Middleware } from 'koa' import { Logger } from 'pino' -//import { Router } from './services/router' -import { - CreateAccountError, - TransferError -} from '../../../../accounting/errors' import { LiquidityAccount, - LiquidityAccountType, - Transaction + AccountingService } from '../../../../accounting/service' import { AssetOptions } from '../../../../asset/service' import { IncomingPaymentService } from '../../../../open_payments/payment/incoming/service' @@ -61,14 +55,6 @@ export interface TransferOptions { timeout: number } -export interface AccountingService { - createTransfer(options: TransferOptions): Promise - createLiquidityAccount( - account: LiquidityAccount, - type: LiquidityAccountType - ): Promise -} - export interface RafikiServices { //router: Router accounting: AccountingService @@ -115,7 +101,6 @@ export type ILPContext = { } export class Rafiki { - //private _router?: Router private streamServer: StreamServer private redis: Redis @@ -125,21 +110,13 @@ export class Rafiki { private config: RafikiServices, private routes: ILPMiddleware ) { - //this._router = config && config.router ? config.router : undefined this.redis = config.redis const logger = config.logger - //const routerOrThrow = (): Router => { - // if (this._router) return this._router - // throw new Error('No router service provided to the app') - //} this.streamServer = config.streamServer const { redis, streamServer } = this // Set global context that exposes services this.publicServer.context.services = { - //get router(): Router { - // return routerOrThrow() - //}, get incomingPayments(): IncomingPaymentService { return config.incomingPayments }, @@ -164,7 +141,6 @@ export class Rafiki { get telemetry(): TelemetryService | undefined { return config.telemetry }, - logger } @@ -210,14 +186,6 @@ export class Rafiki { return response.rawReply } - //public get router(): Router | undefined { - // return this._router - //} - - //public set router(router: Router | undefined) { - // this._router = router - //} - public get logger(): Logger { return this.publicServer.context.services.logger } diff --git a/packages/backend/src/payment-method/ilp/connector/core/test/mocks/accounting-service.ts b/packages/backend/src/payment-method/ilp/connector/core/test/mocks/accounting-service.ts index a5c7ad8e7f..60aa5cf783 100644 --- a/packages/backend/src/payment-method/ilp/connector/core/test/mocks/accounting-service.ts +++ b/packages/backend/src/payment-method/ilp/connector/core/test/mocks/accounting-service.ts @@ -1,15 +1,17 @@ +import { IncomingAccount, OutgoingAccount } from '../../rafiki' + import { + Transaction, AccountingService, - IncomingAccount, - OutgoingAccount -} from '../../rafiki' - -import { Transaction } from '../../../../../../accounting/service' + Deposit, + Withdrawal +} from '../../../../../../accounting/service' import { CreateAccountError, TransferError } from '../../../../../../accounting/errors' import { CreateAccountError as CreateAccountErrorCode } from 'tigerbeetle-node' +import { TransactionOrKnex } from 'objection' interface MockAccount { id: string @@ -133,4 +135,78 @@ export class MockAccountingService implements AccountingService { } return account } + + createDeposit( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + deposit: Deposit, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + trx?: TransactionOrKnex + ): Promise { + throw new Error('Not implemented!') + } + + createSettlementAccount( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ledger: number, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + trx?: TransactionOrKnex + ): Promise { + throw new Error('Not implemented!') + } + + createWithdrawal( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + withdrawal: Withdrawal + ): Promise { + throw new Error('Not implemented!') + } + + getAccountsTotalReceived( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ids: string[] + ): Promise<(bigint | undefined)[]> { + throw new Error('Not implemented!') + } + + getAccountsTotalSent( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ids: string[] + ): Promise<(bigint | undefined)[]> { + throw new Error('Not implemented!') + } + + getSettlementBalance( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ledger: number + ): Promise { + throw new Error('Not implemented!') + } + + getTotalReceived( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + id: string + ): Promise { + throw new Error('Not implemented!') + } + + getTotalSent( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + id: string + ): Promise { + throw new Error('Not implemented!') + } + + postWithdrawal( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + id: string + ): Promise { + throw new Error('Not implemented!') + } + + voidWithdrawal( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + id: string + ): Promise { + throw new Error('Not implemented!') + } }