File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 CustomFixedFee ,
1313 TokenId ,
1414} from '@hashgraph/sdk' ;
15+ import * as Hashgraph from '@hashgraph/sdk' ;
1516import {
1617 buildTopicCreateTx ,
1718 buildMessageTx ,
@@ -385,15 +386,18 @@ export function buildHcs16ScheduleAccountDeleteTx(params: {
385386 transferAccountId : string ;
386387 memo ?: string ;
387388} ) : ScheduleCreateTransaction {
388- const inner = new AccountUpdateTransaction ( ) as any ; // AccountDeleteTransaction not imported in current SDK typings set
389- // Fallback: construct via new proto if needed in future; here we use typed import when available
390- // Replace when AccountDeleteTransaction is exported in the used SDK version
391- ( inner as any ) . setAccountId ?.( AccountId . fromString ( params . floraAccountId ) ) ;
389+ // Use real AccountDeleteTransaction; access via namespace import to avoid typing gaps in some SDK versions
390+ const DeleteCtor = ( Hashgraph as any ) . AccountDeleteTransaction ;
391+ if ( ! DeleteCtor ) {
392+ throw new Error (
393+ 'AccountDeleteTransaction is not available in @hashgraph/sdk' ,
394+ ) ;
395+ }
396+ const inner = new DeleteCtor ( ) ;
397+ inner . setAccountId ( AccountId . fromString ( params . floraAccountId ) ) ;
398+ inner . setTransferAccountId ( AccountId . fromString ( params . transferAccountId ) ) ;
392399 if ( params . memo ) {
393- ( inner as any ) . setTransactionMemo ?. ( params . memo ) ;
400+ inner . setTransactionMemo ( params . memo ) ;
394401 }
395- ( inner as any ) . setTransferAccountId ?.(
396- AccountId . fromString ( params . transferAccountId ) ,
397- ) ;
398402 return new ScheduleCreateTransaction ( ) . setScheduledTransaction ( inner ) ;
399403}
You can’t perform that action at this time.
0 commit comments