Browse Source

add plugin update (#395)

* add plugin update

* fix

* add plugin link

* Code Rabbit
MarkSackerberg 1 month ago
parent
commit
e80aa298c9
2 changed files with 100 additions and 6 deletions
  1. 4 0
      src/components/products/cli/index.js
  2. 96 6
      src/pages/cli/core/plugins.md

+ 4 - 0
src/components/products/cli/index.js

@@ -69,6 +69,10 @@ export const cli = {
               title: 'Fetch Asset or Collection',
               href: '/cli/core/fetch',
             },
+            {
+              title: 'Add and Update Plugins',
+              href: '/cli/core/plugins',
+            },
           ],
         },
         {

+ 96 - 6
src/pages/cli/core/plugins.md

@@ -36,12 +36,14 @@ mplx core plugins add <assetId> ./plugin.json
 ```
 The JSON file should contain the plugin configuration in the following format:
 ```json
-{
-  "pluginType": {
-    "property1": "value1",
-    "property2": "value2"
+[
+  {
+    "pluginType": {
+      "property1": "value1",
+      "property2": "value2"
+    }
   }
-}
+]
 ```
 
 ### Examples
@@ -83,4 +85,92 @@ After a successful plugin addition, the command will display:
   - Plugin type validation
   - Configuration validation
   - Transaction signing and confirmation
-  - Authority verification 
+  - Authority verification
+
+## Update Plugin
+
+Update existing plugins on an asset or collection.
+
+### Basic Usage
+
+```bash
+mplx core plugins update <assetId> [options]
+```
+
+### Options
+- `--wizard`: Interactive wizard mode to select and configure plugins to update
+- `--collection`: Flag to indicate if the target is a collection (default: false)
+
+### Methods
+
+#### 1. Using Wizard Mode
+```bash
+mplx core plugins update <assetId> --wizard
+```
+This will:
+1. Launch an interactive wizard to select which plugin(s) to update
+2. Guide you through the updated plugin configuration
+3. Apply the changes to the asset/collection
+
+#### 2. Using JSON File
+```bash
+mplx core plugins update <assetId> ./plugin.json
+```
+The JSON file should contain the updated plugin configuration in the same format as the JSON file used for adding plugins.
+```
+
+### Examples
+
+#### Update Plugin on Asset
+```bash
+mplx core plugins update 5avjMVza8SuMhgTfzEGNWJskDELMCQk9juAAc8zeQoNa --wizard
+```
+
+#### Update Plugin on Collection
+```bash
+mplx core plugins update 5avjMVza8SuMhgTfzEGNWJskDELMCQk9juAAc8zeQoNa --wizard --collection
+```
+
+#### Update Plugin Using JSON
+```bash
+mplx core plugins update 5avjMVza8SuMhgTfzEGNWJskDELMCQk9juAAc8zeQoNa ./updated-plugin.json
+```
+
+### Example: Update Royalties Plugin on Collection
+
+```bash
+mplx core plugins update collectionPublicKey ./royalties.json --collection
+```
+
+Where `royalties.json` contains:
+```json
+[
+  {
+    "type": "Royalties",
+    "authority": {
+      "type": "UpdateAuthority"
+    },
+    "basisPoints": 1000,
+    "creators": [
+      {
+        "address": "4xbJp9sjeTEhheUDg8M1nJUomZcGmFZsjt9Gg3RQZAWp",
+        "percentage": 100
+      }
+    ],
+    "ruleSet": {"type": "None"}
+  }
+]
+```
+
+## Output (Update)
+
+After a successful plugin update, the command will display:
+
+```text
+--------------------------------
+  Asset: <assetId>
+  Signature: <transactionSignature>
+  Explorer: <explorerUrl>
+  Core Explorer: https://core.metaplex.com/explorer/<assetId>
+--------------------------------
+```