import { Block, Cursor, Page, Validator, Reward, Stake, CraftedTransaction, TransactionIntent, AlpacaApi, } from "@ledgerhq/coin-framework/api/index"; import coinConfig, { type AlgorandCoinConfig } from "../config"; import { broadcast, combine, craftApiTransaction, estimateFees, getBalance, getBlockInfo, lastBlock, validateIntent, listOperations, } from "../logic"; import type { AlgorandMemo } from "../types"; import { validateAddress } from "../validateAddress"; export function createApi(config: AlgorandCoinConfig): AlpacaApi { coinConfig.setCoinConfig(() => ({ ...config, status: { type: "active" } })); return { broadcast, combine, craftTransaction: craftApiTransaction, estimateFees: (_transactionIntent: TransactionIntent) => estimateFees(), getBalance, getBlockInfo, lastBlock, listOperations, validateIntent, getBlock(_height: number): Promise { throw new Error("getBlock is not supported for Algorand"); }, getNextSequence(_address: string): Promise { throw new Error("getNextSequence is not applicable for Algorand"); }, getStakes(_address: string, _cursor?: Cursor): Promise> { throw new Error("getStakes is not supported for Algorand"); }, getRewards(_address: string, _cursor?: Cursor): Promise> { throw new Error("getRewards is not supported for Algorand"); }, getValidators(_cursor?: Cursor): Promise> { throw new Error("getValidators is not supported for Algorand"); }, craftRawTransaction: ( _transaction: string, _sender: string, _publicKey: string, _sequence: bigint, ): Promise => { throw new Error("craftRawTransaction is not supported for Algorand"); }, validateAddress, }; }