Files
prime-sdk-node/src/transactionType.ts
Andrew Miller 98ab2e05a7
Some checks failed
Build and Test / build (16.x) (push) Failing after 12s
Build and Test / build (18.x) (push) Failing after 6s
Build and Test / build (20.x) (push) Failing after 6s
Initial Commit
2025-11-05 15:25:20 -05:00

54 lines
1.3 KiB
TypeScript

/**
* Transaction Type module for managing Dragonchain transaction types
*/
import { DragonchainClient } from './client';
import {
ContentType,
TransactionTypeCreateRequest,
TransactionTypeCreateResponse,
TransactionType,
TransactionListResponse,
SuccessResponse,
} from './types';
export class TransactionTypeClient {
private client: DragonchainClient;
constructor(client: DragonchainClient) {
this.client = client;
}
/**
* Creates a new transaction type
*/
async create(request: TransactionTypeCreateRequest): Promise<TransactionTypeCreateResponse> {
return this.client.post<TransactionTypeCreateResponse>(
'/api/v1/transaction-type',
ContentType.JSON,
request
);
}
/**
* Gets a transaction type by name
*/
async get(txnType: string): Promise<TransactionType> {
return this.client.get<TransactionType>(`/api/v1/transaction-type/${txnType}`);
}
/**
* Lists all transaction types
*/
async list(): Promise<TransactionListResponse> {
return this.client.get<TransactionListResponse>('/api/v1/transaction-types');
}
/**
* Deletes a transaction type
*/
async delete(txnType: string): Promise<SuccessResponse> {
return this.client.delete<SuccessResponse>(`/api/v1/transaction-type/${txnType}`);
}
}