txnhelper.plugin.ts•1.04 kB
import { type Chain, PluginBase } from "@goat-sdk/core";
import { TransactionHelperApi } from "./api";
import { TransactionHelperService } from "./txnhelper.service";
import { SolanaWalletClient } from "@goat-sdk/wallet-solana";
export interface TransactionHelperOptions {
apiKey?: string;
}
export class TransactionHelperPlugin extends PluginBase<SolanaWalletClient> {
/**
* Initializes the TransactionHelperPlugin by invoking the PluginBase constructor
* with the identifier "txnhelper" and an instance of TransactionHelperService
* using the provided parameters and a new TransactionHelperApi instance.
*/
constructor(params?: TransactionHelperOptions) {
super("txnhelper", [new TransactionHelperService(new TransactionHelperApi(), params)]);
}
supportsChain(chain: Chain): boolean {
return chain.type === "solana";
}
}
/**
* Factory function to create a new Transaction Helper plugin instance
*/
export function txnhelper() {
return new TransactionHelperPlugin();
}