// Copyright Abridged, Inc. 2024. All Rights Reserved. // Node module: @collabland/sdk // This file is licensed under the MIT License. // License text available at https://opensource.org/license/mit/ import {inject, Provider} from '@loopback/core'; import {getService, RestDataSource} from '../datasources/index.js'; import {EthereumBalanceRequest} from '../models/ethereum-balance-request.model.js'; import {EthereumBalanceResponse} from '../models/ethereum-balance-response.model.js'; import {EthereumTransactionResponse} from '../models/ethereum-transaction-response.model.js'; /** * The service interface is generated from OpenAPI spec with operations tagged * by EthereumBalanceController. */ export interface EthereumBalanceService { /** * @param _requestBody * @returns OK */ getBalances( _requestBody: EthereumBalanceRequest, ): Promise; /** * @param chainId * @param txHash * @returns OK */ getTransactionStatus( chainId: string, txHash: string, ): Promise; } export class EthereumBalanceServiceProvider implements Provider { constructor( // rest must match the name property in the datasource json file @inject('datasources.rest') protected dataSource: RestDataSource = new RestDataSource(), ) {} async value(): Promise { const service = await getService<{ apis: {EthereumBalanceController: EthereumBalanceService}; }>(this.dataSource); return service.apis['EthereumBalanceController']; } }