// Copyright Abridged, Inc. 2021,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 {FunctionCall} from '../models/function-call.model.js'; /** * The service interface is generated from OpenAPI spec with operations tagged * by NearIndexerController. */ export interface NearIndexerService { /** * @param receiptId * @param include * @returns OK */ getReceipt( receiptId: string, include?: string, ): Promise<{ included_in_block_hash?: string; included_in_block_timestamp?: number; included_in_chunk_hash?: string; index_in_chunk?: number; originated_from_transaction_hash?: string; predecessor_account_id?: string; receipt_id?: string; receipt_kind?: 'ACTION' | 'DATA'; receiver_account_id?: string; }>; /** * @param txHash * @param include * @returns OK */ getTransaction( txHash: string, include?: string, ): Promise<{ block_timestamp?: number; converted_into_receipt_id?: string; included_in_block_hash?: string; included_in_chunk_hash?: string; index_in_chunk?: number; nonce?: number; receipt_conversion_gas_burnt?: number; receipt_conversion_tokens_burnt?: number; receiver_account_id?: string; signature?: string; signer_account_id?: string; signer_public_key?: string; status?: 'FAILURE' | 'SUCCESS_RECEIPT_ID' | 'SUCCESS_VALUE' | 'UNKNOWN'; transaction_hash?: string; }>; /** * @param contract * @param caller * @param limit * @param offset * @returns OK */ getTransactions( contract?: string, caller?: string, limit?: number, offset?: number, ): Promise; /** * @param parentAccount * @param type * @param limit * @param offset * @returns OK */ getChildAccounts( parentAccount: string, type?: string, limit?: number, offset?: number, ): Promise; /** * @param accountId * @returns OK */ findLikelyTokens(accountId: string): Promise; /** * @param contract * @param caller * @param limit * @param offset * @returns OK */ getFunctionCalls( contract: string, caller?: string, limit?: number, offset?: number, ): Promise; /** * @param accountId * @returns OK */ findLikelyNfTs(accountId: string): Promise; /** * @param contract * @param tokenId * @param limit * @param offset * @returns OK */ getTransactionHistoryForToken( contract: string, tokenId: string, limit?: number, offset?: number, ): Promise; /** * @param contract * @param account * @param limit * @param offset * @returns OK */ getTransactionHistoryForAccount( contract: string, account: string, limit?: number, offset?: number, ): Promise; } export class NearIndexerServiceProvider 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: {NearIndexerController: NearIndexerService}; }>(this.dataSource); return service.apis['NearIndexerController']; } }