Bläddra i källkod

Use Kinobi IDL directly

Loris Leiva 1 år sedan
förälder
incheckning
418711fa86
2 ändrade filer med 1039 tillägg och 488 borttagningar
  1. 1037 477
      program/idl.json
  2. 2 11
      scripts/generate-clients.mjs

+ 1037 - 477
program/idl.json

@@ -1,494 +1,1054 @@
 {
-  "version": "0.0.1",
-  "name": "system",
-  "accounts": [
-    {
-      "name": "Nonce",
-      "type": {
-        "kind": "struct",
-        "fields": [
+  "kind": "rootNode",
+  "program": {
+    "kind": "programNode",
+    "pdas": [],
+    "accounts": [
+      {
+        "kind": "accountNode",
+        "data": {
+          "kind": "structTypeNode",
+          "fields": [
+            {
+              "kind": "structFieldTypeNode",
+              "name": "version",
+              "type": { "kind": "definedTypeLinkNode", "name": "nonceVersion" },
+              "docs": []
+            },
+            {
+              "kind": "structFieldTypeNode",
+              "name": "state",
+              "type": { "kind": "definedTypeLinkNode", "name": "nonceState" },
+              "docs": []
+            },
+            {
+              "kind": "structFieldTypeNode",
+              "name": "authority",
+              "type": { "kind": "publicKeyTypeNode" },
+              "docs": []
+            },
+            {
+              "kind": "structFieldTypeNode",
+              "name": "blockhash",
+              "type": { "kind": "publicKeyTypeNode" },
+              "docs": []
+            },
+            {
+              "kind": "structFieldTypeNode",
+              "name": "lamportsPerSignature",
+              "type": {
+                "kind": "numberTypeNode",
+                "format": "u64",
+                "endian": "le"
+              },
+              "docs": []
+            }
+          ]
+        },
+        "name": "nonce",
+        "idlName": "Nonce",
+        "docs": [],
+        "size": 80
+      }
+    ],
+    "instructions": [
+      {
+        "kind": "instructionNode",
+        "accounts": [
           {
-            "name": "version",
-            "type": { "defined": "NonceVersion" }
+            "kind": "instructionAccountNode",
+            "name": "payer",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": { "kind": "payerValueNode" }
           },
           {
-            "name": "state",
-            "type": { "defined": "NonceState" }
+            "kind": "instructionAccountNode",
+            "name": "newAccount",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 0 },
+            "defaultValueStrategy": "omitted"
           },
           {
-            "name": "authority",
-            "type": "publicKey"
+            "kind": "instructionArgumentNode",
+            "name": "lamports",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
           },
           {
-            "name": "blockhash",
-            "type": "publicKey"
+            "kind": "instructionArgumentNode",
+            "name": "space",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
           },
           {
-            "name": "lamportsPerSignature",
-            "type": "u64"
+            "kind": "instructionArgumentNode",
+            "name": "programAddress",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
           }
-        ]
-      }
-    }
-  ],
-  "instructions": [
-    {
-      "name": "CreateAccount",
-      "accounts": [
-        {
-          "name": "payer",
-          "isMut": true,
-          "isSigner": true
-        },
-        {
-          "name": "newAccount",
-          "isMut": true,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "lamports",
-          "type": "u64"
-        },
-        {
-          "name": "space",
-          "type": "u64"
-        },
-        {
-          "name": "programAddress",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 0
-      }
-    },
-    {
-      "name": "Assign",
-      "accounts": [
-        {
-          "name": "account",
-          "isMut": true,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "programAddress",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 1
-      }
-    },
-    {
-      "name": "TransferSol",
-      "accounts": [
-        {
-          "name": "source",
-          "isMut": true,
-          "isSigner": true
-        },
-        {
-          "name": "destination",
-          "isMut": true,
-          "isSigner": false
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 2
-      }
-    },
-    {
-      "name": "CreateAccountWithSeed",
-      "accounts": [
-        {
-          "name": "payer",
-          "isMut": true,
-          "isSigner": true
-        },
-        {
-          "name": "newAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "baseAccount",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "base",
-          "type": "publicKey"
-        },
-        {
-          "name": "seed",
-          "type": "string"
-        },
-        {
-          "name": "amount",
-          "type": "u64"
-        },
-        {
-          "name": "space",
-          "type": "u64"
-        },
-        {
-          "name": "programAddress",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 3
-      }
-    },
-    {
-      "name": "AdvanceNonceAccount",
-      "accounts": [
-        {
-          "name": "nonceAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "recentBlockhashesSysvar",
-          "isMut": false,
-          "isSigner": false
-        },
-        {
-          "name": "nonceAuthority",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [],
-      "discriminant": {
-        "type": "u32",
-        "value": 4
-      }
-    },
-    {
-      "name": "WithdrawNonceAccount",
-      "accounts": [
-        {
-          "name": "nonceAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "recipientAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "recentBlockhashesSysvar",
-          "isMut": false,
-          "isSigner": false
-        },
-        {
-          "name": "rentSysvar",
-          "isMut": false,
-          "isSigner": false
-        },
-        {
-          "name": "nonceAuthority",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "withdrawAmount",
-          "type": "u64"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 5
-      }
-    },
-    {
-      "name": "InitializeNonceAccount",
-      "accounts": [
-        {
-          "name": "nonceAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "recentBlockhashesSysvar",
-          "isMut": false,
-          "isSigner": false
-        },
-        {
-          "name": "rentSysvar",
-          "isMut": false,
-          "isSigner": false
-        }
-      ],
-      "args": [
-        {
-          "name": "nonceAuthority",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 6
-      }
-    },
-    {
-      "name": "AuthorizeNonceAccount",
-      "accounts": [
-        {
-          "name": "nonceAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "nonceAuthority",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "newNonceAuthority",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 7
-      }
-    },
-    {
-      "name": "Allocate",
-      "accounts": [
-        {
-          "name": "newAccount",
-          "isMut": true,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "space",
-          "type": "u64"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 8
-      }
-    },
-    {
-      "name": "AllocateWithSeed",
-      "accounts": [
-        {
-          "name": "newAccount",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "baseAccount",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "base",
-          "type": "publicKey"
-        },
-        {
-          "name": "seed",
-          "type": "string"
-        },
-        {
-          "name": "space",
-          "type": "u64"
-        },
-        {
-          "name": "programAddress",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 9
-      }
-    },
-    {
-      "name": "AssignWithSeed",
-      "accounts": [
-        {
-          "name": "account",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "baseAccount",
-          "isMut": false,
-          "isSigner": true
-        }
-      ],
-      "args": [
-        {
-          "name": "base",
-          "type": "publicKey"
-        },
-        {
-          "name": "seed",
-          "type": "string"
-        },
-        {
-          "name": "programAddress",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 10
+        ],
+        "byteDeltas": [
+          {
+            "kind": "instructionByteDeltaNode",
+            "value": { "kind": "argumentValueNode", "name": "space" },
+            "withHeader": true
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "createAccount",
+        "idlName": "CreateAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "account",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 1 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "programAddress",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "assign",
+        "idlName": "Assign",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "source",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "destination",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 2 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "amount",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "transferSol",
+        "idlName": "TransferSol",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "payer",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": { "kind": "payerValueNode" }
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "newAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "baseAccount",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 3 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "base",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "seed",
+            "type": {
+              "kind": "sizePrefixTypeNode",
+              "type": { "kind": "stringTypeNode", "encoding": "utf8" },
+              "prefix": {
+                "kind": "numberTypeNode",
+                "format": "u32",
+                "endian": "le"
+              }
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "amount",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "space",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "programAddress",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "createAccountWithSeed",
+        "idlName": "CreateAccountWithSeed",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "recentBlockhashesSysvar",
+            "isWritable": false,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": {
+              "kind": "publicKeyValueNode",
+              "publicKey": "SysvarRecentB1ockHashes11111111111111111111"
+            }
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAuthority",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 4 },
+            "defaultValueStrategy": "omitted"
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "advanceNonceAccount",
+        "idlName": "AdvanceNonceAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "recipientAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "recentBlockhashesSysvar",
+            "isWritable": false,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": {
+              "kind": "publicKeyValueNode",
+              "publicKey": "SysvarRecentB1ockHashes11111111111111111111"
+            }
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "rentSysvar",
+            "isWritable": false,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": {
+              "kind": "publicKeyValueNode",
+              "publicKey": "SysvarRent111111111111111111111111111111111"
+            }
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAuthority",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 5 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "withdrawAmount",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "withdrawNonceAccount",
+        "idlName": "WithdrawNonceAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "recentBlockhashesSysvar",
+            "isWritable": false,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": {
+              "kind": "publicKeyValueNode",
+              "publicKey": "SysvarRecentB1ockHashes11111111111111111111"
+            }
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "rentSysvar",
+            "isWritable": false,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": [],
+            "defaultValue": {
+              "kind": "publicKeyValueNode",
+              "publicKey": "SysvarRent111111111111111111111111111111111"
+            }
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 6 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "nonceAuthority",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "initializeNonceAccount",
+        "idlName": "InitializeNonceAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAuthority",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 7 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "newNonceAuthority",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "authorizeNonceAccount",
+        "idlName": "AuthorizeNonceAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "newAccount",
+            "isWritable": true,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 8 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "space",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "allocate",
+        "idlName": "Allocate",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "newAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "baseAccount",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 9 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "base",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "seed",
+            "type": {
+              "kind": "sizePrefixTypeNode",
+              "type": { "kind": "stringTypeNode", "encoding": "utf8" },
+              "prefix": {
+                "kind": "numberTypeNode",
+                "format": "u32",
+                "endian": "le"
+              }
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "space",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "programAddress",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "allocateWithSeed",
+        "idlName": "AllocateWithSeed",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "account",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "baseAccount",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 10 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "base",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "seed",
+            "type": {
+              "kind": "sizePrefixTypeNode",
+              "type": { "kind": "stringTypeNode", "encoding": "utf8" },
+              "prefix": {
+                "kind": "numberTypeNode",
+                "format": "u32",
+                "endian": "le"
+              }
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "programAddress",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "assignWithSeed",
+        "idlName": "AssignWithSeed",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "source",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "baseAccount",
+            "isWritable": false,
+            "isSigner": true,
+            "isOptional": false,
+            "docs": []
+          },
+          {
+            "kind": "instructionAccountNode",
+            "name": "destination",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 11 },
+            "defaultValueStrategy": "omitted"
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "amount",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u64",
+              "endian": "le"
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "fromSeed",
+            "type": {
+              "kind": "sizePrefixTypeNode",
+              "type": { "kind": "stringTypeNode", "encoding": "utf8" },
+              "prefix": {
+                "kind": "numberTypeNode",
+                "format": "u32",
+                "endian": "le"
+              }
+            },
+            "docs": []
+          },
+          {
+            "kind": "instructionArgumentNode",
+            "name": "fromOwner",
+            "type": { "kind": "publicKeyTypeNode" },
+            "docs": []
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "transferSolWithSeed",
+        "idlName": "TransferSolWithSeed",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
+      },
+      {
+        "kind": "instructionNode",
+        "accounts": [
+          {
+            "kind": "instructionAccountNode",
+            "name": "nonceAccount",
+            "isWritable": true,
+            "isSigner": false,
+            "isOptional": false,
+            "docs": []
+          }
+        ],
+        "arguments": [
+          {
+            "kind": "instructionArgumentNode",
+            "name": "discriminator",
+            "type": {
+              "kind": "numberTypeNode",
+              "format": "u32",
+              "endian": "le"
+            },
+            "docs": [],
+            "defaultValue": { "kind": "numberValueNode", "number": 12 },
+            "defaultValueStrategy": "omitted"
+          }
+        ],
+        "discriminators": [
+          {
+            "kind": "fieldDiscriminatorNode",
+            "name": "discriminator",
+            "offset": 0
+          }
+        ],
+        "name": "upgradeNonceAccount",
+        "idlName": "UpgradeNonceAccount",
+        "docs": [],
+        "optionalAccountStrategy": "programId"
       }
-    },
-    {
-      "name": "TransferSolWithSeed",
-      "accounts": [
-        {
-          "name": "source",
-          "isMut": true,
-          "isSigner": false
-        },
-        {
-          "name": "baseAccount",
-          "isMut": false,
-          "isSigner": true
-        },
-        {
-          "name": "destination",
-          "isMut": true,
-          "isSigner": false
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
+    ],
+    "definedTypes": [
+      {
+        "kind": "definedTypeNode",
+        "name": "nonceVersion",
+        "type": {
+          "kind": "enumTypeNode",
+          "variants": [
+            { "kind": "enumEmptyVariantTypeNode", "name": "legacy" },
+            { "kind": "enumEmptyVariantTypeNode", "name": "current" }
+          ],
+          "size": { "kind": "numberTypeNode", "format": "u32", "endian": "le" }
         },
-        {
-          "name": "fromSeed",
-          "type": "string"
+        "idlName": "NonceVersion",
+        "docs": []
+      },
+      {
+        "kind": "definedTypeNode",
+        "name": "nonceState",
+        "type": {
+          "kind": "enumTypeNode",
+          "variants": [
+            { "kind": "enumEmptyVariantTypeNode", "name": "uninitialized" },
+            { "kind": "enumEmptyVariantTypeNode", "name": "initialized" }
+          ],
+          "size": { "kind": "numberTypeNode", "format": "u32", "endian": "le" }
         },
-        {
-          "name": "fromOwner",
-          "type": "publicKey"
-        }
-      ],
-      "discriminant": {
-        "type": "u32",
-        "value": 11
+        "idlName": "NonceState",
+        "docs": []
       }
-    },
-    {
-      "name": "UpgradeNonceAccount",
-      "accounts": [
-        {
-          "name": "nonceAccount",
-          "isMut": true,
-          "isSigner": false
-        }
-      ],
-      "args": [],
-      "discriminant": {
-        "type": "u32",
-        "value": 12
-      }
-    }
-  ],
-  "types": [
-    {
-      "name": "NonceVersion",
-      "type": {
-        "kind": "enum",
-        "size": "u32",
-        "variants": [{ "name": "Legacy" }, { "name": "Current" }]
-      }
-    },
-    {
-      "name": "NonceState",
-      "type": {
-        "kind": "enum",
-        "size": "u32",
-        "variants": [{ "name": "Uninitialized" }, { "name": "Initialized" }]
+    ],
+    "errors": [
+      {
+        "kind": "errorNode",
+        "name": "accountAlreadyInUse",
+        "idlName": "AccountAlreadyInUse",
+        "code": 0,
+        "message": "an account with the same address already exists",
+        "docs": [
+          "AccountAlreadyInUse: an account with the same address already exists"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "resultWithNegativeLamports",
+        "idlName": "ResultWithNegativeLamports",
+        "code": 1,
+        "message": "account does not have enough SOL to perform the operation",
+        "docs": [
+          "ResultWithNegativeLamports: account does not have enough SOL to perform the operation"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "invalidProgramId",
+        "idlName": "InvalidProgramId",
+        "code": 2,
+        "message": "cannot assign account to this program id",
+        "docs": ["InvalidProgramId: cannot assign account to this program id"]
+      },
+      {
+        "kind": "errorNode",
+        "name": "invalidAccountDataLength",
+        "idlName": "InvalidAccountDataLength",
+        "code": 3,
+        "message": "cannot allocate account data of this length",
+        "docs": [
+          "InvalidAccountDataLength: cannot allocate account data of this length"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "maxSeedLengthExceeded",
+        "idlName": "MaxSeedLengthExceeded",
+        "code": 4,
+        "message": "length of requested seed is too long",
+        "docs": ["MaxSeedLengthExceeded: length of requested seed is too long"]
+      },
+      {
+        "kind": "errorNode",
+        "name": "addressWithSeedMismatch",
+        "idlName": "AddressWithSeedMismatch",
+        "code": 5,
+        "message": "provided address does not match addressed derived from seed",
+        "docs": [
+          "AddressWithSeedMismatch: provided address does not match addressed derived from seed"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "nonceNoRecentBlockhashes",
+        "idlName": "NonceNoRecentBlockhashes",
+        "code": 6,
+        "message": "advancing stored nonce requires a populated RecentBlockhashes sysvar",
+        "docs": [
+          "NonceNoRecentBlockhashes: advancing stored nonce requires a populated RecentBlockhashes sysvar"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "nonceBlockhashNotExpired",
+        "idlName": "NonceBlockhashNotExpired",
+        "code": 7,
+        "message": "stored nonce is still in recent_blockhashes",
+        "docs": [
+          "NonceBlockhashNotExpired: stored nonce is still in recent_blockhashes"
+        ]
+      },
+      {
+        "kind": "errorNode",
+        "name": "nonceUnexpectedBlockhashValue",
+        "idlName": "NonceUnexpectedBlockhashValue",
+        "code": 8,
+        "message": "specified nonce does not match stored nonce",
+        "docs": [
+          "NonceUnexpectedBlockhashValue: specified nonce does not match stored nonce"
+        ]
       }
-    }
-  ],
-  "errors": [
-    {
-      "code": 0,
-      "name": "AccountAlreadyInUse",
-      "msg": "an account with the same address already exists"
-    },
-    {
-      "code": 1,
-      "name": "ResultWithNegativeLamports",
-      "msg": "account does not have enough SOL to perform the operation"
-    },
-    {
-      "code": 2,
-      "name": "InvalidProgramId",
-      "msg": "cannot assign account to this program id"
-    },
-    {
-      "code": 3,
-      "name": "InvalidAccountDataLength",
-      "msg": "cannot allocate account data of this length"
-    },
-    {
-      "code": 4,
-      "name": "MaxSeedLengthExceeded",
-      "msg": "length of requested seed is too long"
-    },
-    {
-      "code": 5,
-      "name": "AddressWithSeedMismatch",
-      "msg": "provided address does not match addressed derived from seed"
-    },
-    {
-      "code": 6,
-      "name": "NonceNoRecentBlockhashes",
-      "msg": "advancing stored nonce requires a populated RecentBlockhashes sysvar"
-    },
-    {
-      "code": 7,
-      "name": "NonceBlockhashNotExpired",
-      "msg": "stored nonce is still in recent_blockhashes"
-    },
-    {
-      "code": 8,
-      "name": "NonceUnexpectedBlockhashValue",
-      "msg": "specified nonce does not match stored nonce"
-    }
-  ],
-  "metadata": {
-    "origin": "shank",
-    "address": "11111111111111111111111111111111",
-    "binaryVersion": "0.0.1",
-    "libVersion": "0.0.1"
-  }
+    ],
+    "name": "system",
+    "prefix": "",
+    "publicKey": "11111111111111111111111111111111",
+    "version": "0.0.1",
+    "origin": "shank"
+  },
+  "additionalPrograms": [],
+  "standard": "kinobi",
+  "version": "0.19.0"
 }

+ 2 - 11
scripts/generate-clients.mjs

@@ -4,17 +4,8 @@ import * as k from "@metaplex-foundation/kinobi";
 import { workingDirectory } from "./utils.mjs";
 
 // Instanciate Kinobi.
-const kinobi = k.createFromIdl(
-  path.join(workingDirectory, "program", "idl.json")
-);
-
-// Update instructions.
-kinobi.update(
-  k.updateInstructionsVisitor({
-    createAccount: {
-      byteDeltas: [k.instructionByteDeltaNode(k.argumentValueNode("space"))],
-    },
-  })
+const kinobi = k.createFromRoot(
+  require(path.join(workingDirectory, "program", "idl.json"))
 );
 
 // Render JavaScript.