@@ -12,7 +12,7 @@ import { errorCodes as lndErrorCodes } from '../lndclient/errors';
1212import { LndInfo } from '../lndclient/types' ;
1313import { SwapSuccess , SwapFailure } from '../swaps/types' ;
1414import { SwapFailureReason } from '../constants/enums' ;
15- import { TradeInstance , OrderInstance } from '../db/types' ;
15+ import { TradeInstance , OrderInstance , CurrencyInstance } from '../db/types' ;
1616
1717/**
1818 * Creates an xudrpc Order message from an [[Order]].
@@ -227,7 +227,7 @@ class GrpcService {
227227 /**
228228 * See [[Service.addCurrency]]
229229 */
230- public addCurrency : grpc . handleUnaryCall < xudrpc . AddCurrencyRequest , xudrpc . AddCurrencyResponse > = async ( call , callback ) => {
230+ public addCurrency : grpc . handleUnaryCall < xudrpc . Currency , xudrpc . AddCurrencyResponse > = async ( call , callback ) => {
231231 try {
232232 await this . service . addCurrency ( call . request . toObject ( ) ) ;
233233 const response = new xudrpc . AddCurrencyResponse ( ) ;
@@ -499,9 +499,17 @@ class GrpcService {
499499 */
500500 public listCurrencies : grpc . handleUnaryCall < xudrpc . ListCurrenciesRequest , xudrpc . ListCurrenciesResponse > = ( _ , callback ) => {
501501 try {
502- const listCurrenciesResponse = this . service . listCurrencies ( ) ;
502+ const currencies = this . service . listCurrencies ( ) ;
503503 const response = new xudrpc . ListCurrenciesResponse ( ) ;
504- response . setCurrenciesList ( listCurrenciesResponse ) ;
504+
505+ currencies . forEach ( ( currency : CurrencyInstance ) => {
506+ const resultCurrency = new xudrpc . Currency ( ) ;
507+ resultCurrency . setDecimalPlaces ( currency . decimalPlaces ) ;
508+ resultCurrency . setCurrency ( currency . id ) ;
509+ resultCurrency . setTokenAddress ( currency . tokenAddress ) ;
510+ resultCurrency . setSwapClient ( currency . swapClient as number ) ;
511+ response . getCurrenciesList ( ) . push ( resultCurrency ) ;
512+ } ) ;
505513
506514 callback ( null , response ) ;
507515 } catch ( err ) {
0 commit comments