@@ -5,12 +5,8 @@ import { TransactionBuilder } from './transactionBuilder';
55import { Transaction } from './transaction/transaction' ;
66
77export class OneStepPreApprovalBuilder extends TransactionBuilder {
8- private _synchronizerId : string ;
98 private _commandId : string ;
10- private _templateId : string ;
119 private _receiverPartyId : string ;
12- private _providerPartyId : string ;
13- private _expectedDso : string ;
1410 constructor ( _coinConfig : Readonly < CoinConfig > ) {
1511 super ( _coinConfig ) ;
1612 }
@@ -32,21 +28,6 @@ export class OneStepPreApprovalBuilder extends TransactionBuilder {
3228 this . transaction . prepareCommand = transaction ;
3329 }
3430
35- /**
36- * Sets the synchronizer ID for the pre-approval builder.
37- *
38- * @param id - The synchronizer identifier (must be a non-empty string).
39- * @returns The current builder instance for chaining.
40- * @throws Error if the synchronizer ID is empty.
41- */
42- synchronizerId ( id : string ) : this {
43- if ( ! id . trim ( ) ) {
44- throw new Error ( 'synchronizer must be a non-empty string' ) ;
45- }
46- this . _synchronizerId = id . trim ( ) ;
47- return this ;
48- }
49-
5031 /**
5132 * Sets the unique id for the 1-step enablement
5233 * Also sets the _id of the transaction
@@ -65,21 +46,6 @@ export class OneStepPreApprovalBuilder extends TransactionBuilder {
6546 return this ;
6647 }
6748
68- /**
69- * Sets the template id for the 1-step enablement
70- *
71- * @param id - the template if of the form `#splice-wallet:Splice.Wallet.TransferPreapproval:TransferPreapprovalProposal`
72- * @returns The current builder instance for chaining.
73- * @throws Error if id is empty.
74- */
75- templateId ( id : string ) : this {
76- if ( ! id . trim ( ) ) {
77- throw new Error ( 'templateId must be a non-empty string' ) ;
78- }
79- this . _templateId = id . trim ( ) ;
80- return this ;
81- }
82-
8349 /**
8450 * Sets the receiver for the 1-step enablement
8551 *
@@ -95,36 +61,6 @@ export class OneStepPreApprovalBuilder extends TransactionBuilder {
9561 return this ;
9662 }
9763
98- /**
99- * Sets the provider for the 1-step enablement
100- *
101- * @param id - the validator party id (address)
102- * @returns The current builder instance for chaining.
103- * @throws Error if id is empty.
104- */
105- providerPartyId ( id : string ) : this {
106- if ( ! id . trim ( ) ) {
107- throw new Error ( 'providerPartyId must be a non-empty string' ) ;
108- }
109- this . _providerPartyId = id . trim ( ) ;
110- return this ;
111- }
112-
113- /**
114- * Sets the dso id for the 1-step enablement
115- *
116- * @param id - the dso id of the validator
117- * @returns The current builder instance for chaining.
118- * @throws Error if id is empty.
119- */
120- expectedDso ( id : string ) : this {
121- if ( ! id . trim ( ) ) {
122- throw new Error ( 'expectedDso must be a non-empty string' ) ;
123- }
124- this . _expectedDso = id . trim ( ) ;
125- return this ;
126- }
127-
12864 /**
12965 * Builds and returns the OneStepEnablementRequest object from the builder's internal state.
13066 *
@@ -139,24 +75,10 @@ export class OneStepPreApprovalBuilder extends TransactionBuilder {
13975
14076 return {
14177 commandId : this . _commandId ,
142- commands : [
143- {
144- CreateCommand : {
145- templateId : this . _templateId ,
146- createArguments : {
147- receiver : this . _receiverPartyId ,
148- provider : this . _providerPartyId ,
149- expectedDso : this . _expectedDso ,
150- } ,
151- } ,
152- } ,
153- ] ,
154- disclosedContracts : [ ] ,
155- synchronizerId : this . _synchronizerId ,
78+ receiverId : this . _receiverPartyId ,
15679 verboseHashing : false ,
15780 actAs : [ this . _receiverPartyId ] ,
15881 readAs : [ ] ,
159- packageIdSelectionPreference : [ ] ,
16082 } ;
16183 }
16284
@@ -167,11 +89,7 @@ export class OneStepPreApprovalBuilder extends TransactionBuilder {
16789 * @throws {Error } If any required field is missing or invalid.
16890 */
16991 private validate ( ) : void {
170- if ( ! this . _receiverPartyId ) throw new Error ( 'receiver partyId is missing' ) ;
171- if ( ! this . _providerPartyId ) throw new Error ( 'provider partyId is missing' ) ;
172- if ( ! this . _expectedDso ) throw new Error ( 'expectedDso is missing' ) ;
17392 if ( ! this . _commandId ) throw new Error ( 'commandId is missing' ) ;
174- if ( ! this . _templateId ) throw new Error ( 'templateId is missing' ) ;
175- if ( ! this . _synchronizerId ) throw new Error ( 'synchronizerId is missing' ) ;
93+ if ( ! this . _receiverPartyId ) throw new Error ( 'receiver partyId is missing' ) ;
17694 }
17795}
0 commit comments