11import { BaseCoin as CoinConfig } from '@bitgo/statics' ;
2- import { NotImplementedError , TransactionType } from '@bitgo/sdk-core' ;
32import { AtomicTransactionBuilder } from './atomicTransactionBuilder' ;
4-
5- // Placeholder builders - basic implementations for testing
6- export class ExportTxBuilder extends AtomicTransactionBuilder {
7- protected get transactionType ( ) : TransactionType {
8- return TransactionType . Export ;
9- }
10-
11- constructor ( coinConfig : Readonly < CoinConfig > ) {
12- super ( coinConfig ) ;
13- // Don't throw error, allow placeholder functionality
14- }
15- }
16-
17- export class ImportTxBuilder extends AtomicTransactionBuilder {
18- protected get transactionType ( ) : TransactionType {
19- return TransactionType . Import ;
20- }
21-
22- constructor ( coinConfig : Readonly < CoinConfig > ) {
23- super ( coinConfig ) ;
24- // Don't throw error, allow placeholder functionality
25- }
26- }
27-
28- export class ValidatorTxBuilder extends AtomicTransactionBuilder {
29- protected get transactionType ( ) : TransactionType {
30- return TransactionType . AddValidator ;
31- }
32-
33- constructor ( coinConfig : Readonly < CoinConfig > ) {
34- super ( coinConfig ) ;
35- // Don't throw error, allow placeholder functionality
36- }
37- }
38-
39- export class DelegatorTxBuilder extends AtomicTransactionBuilder {
40- protected get transactionType ( ) : TransactionType {
41- return TransactionType . AddDelegator ;
42- }
43-
44- constructor ( coinConfig : Readonly < CoinConfig > ) {
45- super ( coinConfig ) ;
46- // Don't throw error, allow placeholder functionality
47- }
48- }
3+ import { ImportInCTxBuilder } from './importInCTxBuilder' ;
4+ import { ValidatorTxBuilder } from './validatorTxBuilder' ;
5+ import { PermissionlessValidatorTxBuilder } from './permissionlessValidatorTxBuilder' ;
6+ import { ExportInCTxBuilder } from './exportInCTxBuilder' ;
7+ import { ExportInPTxBuilder } from './exportInPTxBuilder' ;
8+ import { ImportInPTxBuilder } from './importInPTxBuilder' ;
499
5010/**
5111 * Factory for Flare P-chain transaction builders
@@ -70,7 +30,7 @@ export class TransactionBuilderFactory {
7030
7131 // Create a mock export builder for now
7232 // In the future, this will parse the transaction and determine the correct type
73- const builder = new ExportTxBuilder ( this . _coinConfig ) ;
33+ const builder = new ExportInPTxBuilder ( this . _coinConfig ) ;
7434
7535 // Initialize with the hex data (placeholder)
7636 builder . initBuilder ( { txHex } ) ;
@@ -79,21 +39,56 @@ export class TransactionBuilderFactory {
7939 }
8040
8141 /**
82- * Create a transaction builder for a specific type
83- * @param type - Transaction type
42+ * Initialize Validator builder
43+ *
44+ * @returns {ValidatorTxBuilder } the builder initialized
8445 */
85- getBuilder ( type : TransactionType ) : AtomicTransactionBuilder {
86- switch ( type ) {
87- case TransactionType . Export :
88- return new ExportTxBuilder ( this . _coinConfig ) ;
89- case TransactionType . Import :
90- return new ImportTxBuilder ( this . _coinConfig ) ;
91- case TransactionType . AddValidator :
92- return new ValidatorTxBuilder ( this . _coinConfig ) ;
93- case TransactionType . AddDelegator :
94- return new DelegatorTxBuilder ( this . _coinConfig ) ;
95- default :
96- throw new NotImplementedError ( `Transaction type ${ type } not supported` ) ;
97- }
46+ getValidatorBuilder ( ) : ValidatorTxBuilder {
47+ return new ValidatorTxBuilder ( this . _coinConfig ) ;
48+ }
49+
50+ /**
51+ * Initialize Permissionless Validator builder
52+ *
53+ * @returns {PermissionlessValidatorTxBuilder } the builder initialized
54+ */
55+ getPermissionlessValidatorTxBuilder ( ) : PermissionlessValidatorTxBuilder {
56+ return new PermissionlessValidatorTxBuilder ( this . _coinConfig ) ;
57+ }
58+
59+ /**
60+ * Export Cross chain transfer
61+ *
62+ * @returns {ExportInPTxBuilder } the builder initialized
63+ */
64+ getExportBuilder ( ) : ExportInPTxBuilder {
65+ return new ExportInPTxBuilder ( this . _coinConfig ) ;
66+ }
67+
68+ /**
69+ * Import Cross chain transfer
70+ *
71+ * @returns {ImportInPTxBuilder } the builder initialized
72+ */
73+ getImportBuilder ( ) : ImportInPTxBuilder {
74+ return new ImportInPTxBuilder ( this . _coinConfig ) ;
75+ }
76+
77+ /**
78+ * Import in C chain Cross chain transfer
79+ *
80+ * @returns {ImportInCTxBuilder } the builder initialized
81+ */
82+ getImportInCBuilder ( ) : ImportInCTxBuilder {
83+ return new ImportInCTxBuilder ( this . _coinConfig ) ;
84+ }
85+
86+ /**
87+ * Export in C chain Cross chain transfer
88+ *
89+ * @returns {ExportInCTxBuilder } the builder initialized
90+ */
91+ getExportInCBuilder ( ) : ExportInCTxBuilder {
92+ return new ExportInCTxBuilder ( this . _coinConfig ) ;
9893 }
9994}
0 commit comments