mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
21 lines
469 B
Go
21 lines
469 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hyperledger/fabric-gateway/pkg/client"
|
|
)
|
|
|
|
// cmdDelete deletes an asset from the ledger.
|
|
// Arguments: <assetId>
|
|
func cmdDelete(gw *client.Gateway, args []string) error {
|
|
if len(args) < 1 {
|
|
return fmt.Errorf("arguments: <assetId>")
|
|
}
|
|
|
|
network := gw.GetNetwork(channelName())
|
|
contract := network.GetContract(chaincodeName())
|
|
|
|
smartContract := NewAssetTransfer(contract)
|
|
return smartContract.DeleteAsset(args[0])
|
|
}
|