@@ -10,7 +10,7 @@ export class AllocationAllocateBuilder extends TransactionBuilder {
1010 private _amount : number ;
1111 private _token : string ;
1212 private _operatorId : string ;
13- private _contractId : string ;
13+ private _contractId : string | null | undefined ;
1414 private _tradeId : string ;
1515 private _transferLegId : string ;
1616 private _allocateBefore : string ;
@@ -116,11 +116,11 @@ export class AllocationAllocateBuilder extends TransactionBuilder {
116116 * @returns The current builder instance for chaining.
117117 * @throws Error if id is empty.
118118 */
119- contractId ( id : string ) : this {
120- if ( ! id || ! id . trim ( ) ) {
119+ contractId ( id : string | null ) : this {
120+ if ( id !== null && ( ! id || ! id . trim ( ) ) ) {
121121 throw new Error ( 'contractId must be a non-empty string' ) ;
122122 }
123- this . _contractId = id . trim ( ) ;
123+ this . _contractId = id === null ? null : id . trim ( ) ;
124124 return this ;
125125 }
126126
@@ -231,7 +231,7 @@ export class AllocationAllocateBuilder extends TransactionBuilder {
231231 amount : this . _amount ,
232232 token : this . _token ,
233233 operatorId : this . _operatorId ,
234- contractId : this . _contractId ,
234+ ... ( this . _contractId !== null && this . _contractId !== undefined && { contractId : this . _contractId } ) ,
235235 tradeId : this . _tradeId ,
236236 transferLegId : this . _transferLegId ,
237237 allocateBefore : this . _allocateBefore ,
@@ -256,7 +256,7 @@ export class AllocationAllocateBuilder extends TransactionBuilder {
256256 if ( ! this . _amount ) throw new Error ( 'amount is missing' ) ;
257257 if ( ! this . _token ) throw new Error ( 'token is missing' ) ;
258258 if ( ! this . _operatorId ) throw new Error ( 'operatorId is missing' ) ;
259- if ( ! this . _contractId ) throw new Error ( 'contractId is missing' ) ;
259+ if ( this . _contractId === undefined ) throw new Error ( 'contractId is missing' ) ;
260260 if ( ! this . _tradeId ) throw new Error ( 'tradeId is missing' ) ;
261261 if ( ! this . _transferLegId ) throw new Error ( 'transferLegId is missing' ) ;
262262 if ( ! this . _allocateBefore ) throw new Error ( 'allocateBefore is missing' ) ;
0 commit comments