From 94405fbb530063075c7eabe3a39406be511064c9 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sun, 26 Apr 2026 15:25:15 +0500 Subject: [PATCH] Add ExecuteBatchAfterCheck method to NFT interface for pre-checking and executing batch commands --- contract/nft.go | 3 +++ nft.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/contract/nft.go b/contract/nft.go index 8b07196..3005751 100644 --- a/contract/nft.go +++ b/contract/nft.go @@ -8,6 +8,9 @@ type NFT interface { // You can execute your raw request. Command() Command + // ExecuteBatchAfterCheck executes a batch of commands after checking the validity of the batch. + ExecuteBatchAfterCheck(batch Batch) error + // ExecuteBatch executes a batch of commands. ExecuteBatch(batch Batch) error diff --git a/nft.go b/nft.go index 6ec9cb7..899d85a 100644 --- a/nft.go +++ b/nft.go @@ -104,6 +104,13 @@ func (n *nft) Command() contract.Command { return n.command } +func (n *nft) ExecuteBatchAfterCheck(batch contract.Batch) error { + if err := batch.Check(n.command); err != nil { + return err + } + return n.command.Run(batch.Args()...) +} + func (n *nft) ExecuteBatch(batch contract.Batch) error { return n.command.Run(batch.Args()...) }