Explorar el Código

fix(build-ts-package): fixed the typings mapping generated

benduran hace 4 semanas
padre
commit
3f7af8e4e4

+ 118 - 22
governance/pyth_staking_sdk/package.json

@@ -4,25 +4,121 @@
   "description": "Pyth staking SDK",
   "type": "module",
   "exports": {
-    ".": "./dist/esm/index.js",
-    "./constants": "./dist/esm/constants.js",
-    "./pdas": "./dist/esm/pdas.js",
-    "./pyth-staking-client": "./dist/esm/pyth-staking-client.js",
-    "./pythnet-client": "./dist/esm/pythnet-client.js",
-    "./types": "./dist/esm/types.js",
-    "./types/integrity-pool": "./dist/esm/types/integrity-pool.js",
-    "./types/publisher-caps": "./dist/esm/types/publisher-caps.js",
-    "./types/stake-caps-parameters": "./dist/esm/types/stake-caps-parameters.js",
-    "./types/staking": "./dist/esm/types/staking.js",
-    "./utils/apy": "./dist/esm/utils/apy.js",
-    "./utils/bigint": "./dist/esm/utils/bigint.js",
-    "./utils/bn": "./dist/esm/utils/bn.js",
-    "./utils/clock": "./dist/esm/utils/clock.js",
-    "./utils/pool": "./dist/esm/utils/pool.js",
-    "./utils/position": "./dist/esm/utils/position.js",
-    "./utils/transaction": "./dist/esm/utils/transaction.js",
-    "./utils/vesting": "./dist/esm/utils/vesting.js",
-    "./utils/wallet": "./dist/esm/utils/wallet.js",
+    "./constants": {
+      "import": "./dist/esm/constants.js",
+      "types": "./dist/esm/constants.d.ts",
+      "require": "./dist/cjs/constants.js"
+    },
+    "./idl/integrity-pool": {
+      "import": "./dist/esm/idl/integrity-pool.js",
+      "types": "./dist/esm/idl/integrity-pool.d.ts",
+      "require": "./dist/cjs/idl/integrity-pool.js"
+    },
+    "./idl/publisher-caps": {
+      "import": "./dist/esm/idl/publisher-caps.js",
+      "types": "./dist/esm/idl/publisher-caps.d.ts",
+      "require": "./dist/cjs/idl/publisher-caps.js"
+    },
+    "./idl/stake-caps-parameters": {
+      "import": "./dist/esm/idl/stake-caps-parameters.js",
+      "types": "./dist/esm/idl/stake-caps-parameters.d.ts",
+      "require": "./dist/cjs/idl/stake-caps-parameters.js"
+    },
+    "./idl/staking": {
+      "import": "./dist/esm/idl/staking.js",
+      "types": "./dist/esm/idl/staking.d.ts",
+      "require": "./dist/cjs/idl/staking.js"
+    },
+    ".": {
+      "import": "./dist/esm/index.js",
+      "types": "./dist/esm/index.d.ts",
+      "require": "./dist/cjs/index.js"
+    },
+    "./pdas": {
+      "import": "./dist/esm/pdas.js",
+      "types": "./dist/esm/pdas.d.ts",
+      "require": "./dist/cjs/pdas.js"
+    },
+    "./pyth-staking-client": {
+      "import": "./dist/esm/pyth-staking-client.js",
+      "types": "./dist/esm/pyth-staking-client.d.ts",
+      "require": "./dist/cjs/pyth-staking-client.js"
+    },
+    "./pythnet-client": {
+      "import": "./dist/esm/pythnet-client.js",
+      "types": "./dist/esm/pythnet-client.d.ts",
+      "require": "./dist/cjs/pythnet-client.js"
+    },
+    "./types": {
+      "import": "./dist/esm/types.js",
+      "types": "./dist/esm/types.d.ts",
+      "require": "./dist/cjs/types.js"
+    },
+    "./types/integrity-pool": {
+      "import": "./dist/esm/types/integrity-pool.js",
+      "types": "./dist/esm/types/integrity-pool.d.ts",
+      "require": "./dist/cjs/types/integrity-pool.js"
+    },
+    "./types/publisher-caps": {
+      "import": "./dist/esm/types/publisher-caps.js",
+      "types": "./dist/esm/types/publisher-caps.d.ts",
+      "require": "./dist/cjs/types/publisher-caps.js"
+    },
+    "./types/stake-caps-parameters": {
+      "import": "./dist/esm/types/stake-caps-parameters.js",
+      "types": "./dist/esm/types/stake-caps-parameters.d.ts",
+      "require": "./dist/cjs/types/stake-caps-parameters.js"
+    },
+    "./types/staking": {
+      "import": "./dist/esm/types/staking.js",
+      "types": "./dist/esm/types/staking.d.ts",
+      "require": "./dist/cjs/types/staking.js"
+    },
+    "./utils/apy": {
+      "import": "./dist/esm/utils/apy.js",
+      "types": "./dist/esm/utils/apy.d.ts",
+      "require": "./dist/cjs/utils/apy.js"
+    },
+    "./utils/bigint": {
+      "import": "./dist/esm/utils/bigint.js",
+      "types": "./dist/esm/utils/bigint.d.ts",
+      "require": "./dist/cjs/utils/bigint.js"
+    },
+    "./utils/bn": {
+      "import": "./dist/esm/utils/bn.js",
+      "types": "./dist/esm/utils/bn.d.ts",
+      "require": "./dist/cjs/utils/bn.js"
+    },
+    "./utils/clock": {
+      "import": "./dist/esm/utils/clock.js",
+      "types": "./dist/esm/utils/clock.d.ts",
+      "require": "./dist/cjs/utils/clock.js"
+    },
+    "./utils/pool": {
+      "import": "./dist/esm/utils/pool.js",
+      "types": "./dist/esm/utils/pool.d.ts",
+      "require": "./dist/cjs/utils/pool.js"
+    },
+    "./utils/position": {
+      "import": "./dist/esm/utils/position.js",
+      "types": "./dist/esm/utils/position.d.ts",
+      "require": "./dist/cjs/utils/position.js"
+    },
+    "./utils/transaction": {
+      "import": "./dist/esm/utils/transaction.js",
+      "types": "./dist/esm/utils/transaction.d.ts",
+      "require": "./dist/cjs/utils/transaction.js"
+    },
+    "./utils/vesting": {
+      "import": "./dist/esm/utils/vesting.js",
+      "types": "./dist/esm/utils/vesting.d.ts",
+      "require": "./dist/cjs/utils/vesting.js"
+    },
+    "./utils/wallet": {
+      "import": "./dist/esm/utils/wallet.js",
+      "types": "./dist/esm/utils/wallet.d.ts",
+      "require": "./dist/cjs/utils/wallet.js"
+    },
     "./package.json": "./package.json"
   },
   "files": [
@@ -67,7 +163,7 @@
     "zod": "catalog:"
   },
   "packageManager": "pnpm@10.19.0",
-  "main": "./dist/cjs/index.js",
-  "module": "./dist/esm/index.js",
-  "types": "./dist/esm/index.d.ts"
+  "main": "./cjs/index.js",
+  "module": "./esm/index.js",
+  "types": "./cjs/index.d.ts"
 }

+ 0 - 1577
governance/pyth_staking_sdk/src/idl/integrity-pool.json

@@ -1,1577 +0,0 @@
-{
-  "address": "pyti8TM4zRVBjmarcgAPmTNNAXYKJv7WVHrkrm6woLN",
-  "metadata": {
-    "name": "integrity_pool",
-    "version": "1.0.0",
-    "spec": "0.1.0",
-    "description": "Created with Anchor"
-  },
-  "instructions": [
-    {
-      "name": "advance",
-      "discriminator": [7, 56, 108, 201, 36, 20, 57, 89],
-      "accounts": [
-        {
-          "name": "signer",
-          "signer": true
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "publisher_caps"
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pool_reward_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "account",
-                "path": "pool_config"
-              },
-              {
-                "kind": "const",
-                "value": [
-                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
-                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
-                  245, 133, 126, 255, 0, 169
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "pool_config.pyth_token_mint",
-                "account": "PoolConfig"
-              }
-            ],
-            "program": {
-              "kind": "const",
-              "value": [
-                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
-                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
-                219, 233, 248, 89
-              ]
-            }
-          }
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "advance_delegation_record",
-      "discriminator": [155, 43, 226, 175, 227, 115, 33, 88],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pool_reward_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "account",
-                "path": "pool_config"
-              },
-              {
-                "kind": "const",
-                "value": [
-                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
-                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
-                  245, 133, 126, 255, 0, 169
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "pool_config.pyth_token_mint",
-                "account": "PoolConfig"
-              }
-            ],
-            "program": {
-              "kind": "const",
-              "value": [
-                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
-                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
-                219, 233, 248, 89
-              ]
-            }
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "publisher_stake_account_positions",
-          "optional": true
-        },
-        {
-          "name": "publisher_stake_account_custody",
-          "writable": true,
-          "optional": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "publisher_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "delegation_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
-                  99, 111, 114, 100
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "publisher"
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [],
-      "returns": "u64"
-    },
-    {
-      "name": "create_slash_event",
-      "discriminator": [7, 214, 12, 127, 239, 247, 253, 117],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "reward_program_authority",
-          "signer": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "slash_custody",
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "slash_event",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [115, 108, 97, 115, 104, 95, 101, 118, 101, 110, 116]
-              },
-              {
-                "kind": "account",
-                "path": "publisher"
-              },
-              {
-                "kind": "arg",
-                "path": "index"
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "index",
-          "type": "u64"
-        },
-        {
-          "name": "slash_ratio",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "delegate",
-      "discriminator": [90, 147, 75, 178, 85, 88, 4, 137],
-      "accounts": [
-        {
-          "name": "owner",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "config_account",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "stake_account_positions",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it will checked in staking program"
-          ],
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "staking_program",
-          "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "initialize_pool",
-      "discriminator": [95, 180, 10, 172, 84, 174, 232, 40],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "config_account",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ],
-            "program": {
-              "kind": "const",
-              "value": [
-                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
-                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
-                70, 231, 183, 19, 217
-              ]
-            }
-          }
-        },
-        {
-          "name": "pool_data",
-          "writable": true
-        },
-        {
-          "name": "pool_config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "slash_custody"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "reward_program_authority",
-          "type": "pubkey"
-        },
-        {
-          "name": "y",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "merge_delegation_positions",
-      "discriminator": [111, 59, 199, 177, 50, 231, 133, 228],
-      "accounts": [
-        {
-          "name": "owner",
-          "docs": [
-            "CHECK : This instruction is permissionless, this account will be checked against",
-            "stake_account_metadata in the CPI"
-          ],
-          "writable": true
-        },
-        {
-          "name": "pool_data",
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "delegation_record",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
-                  99, 111, 114, 100
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "publisher"
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config_account",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "stake_account_positions",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it will checked in staking program"
-          ],
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "staking_program",
-          "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ"
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "set_publisher_stake_account",
-      "discriminator": [99, 46, 72, 132, 100, 235, 211, 117],
-      "accounts": [
-        {
-          "name": "signer",
-          "signer": true
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "new_stake_account_positions_option",
-          "optional": true
-        },
-        {
-          "name": "current_stake_account_positions_option",
-          "optional": true
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "slash",
-      "discriminator": [204, 141, 18, 161, 8, 177, 92, 142],
-      "accounts": [
-        {
-          "name": "signer",
-          "signer": true
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "slash_event",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [115, 108, 97, 115, 104, 95, 101, 118, 101, 110, 116]
-              },
-              {
-                "kind": "account",
-                "path": "publisher"
-              },
-              {
-                "kind": "arg",
-                "path": "index"
-              }
-            ]
-          }
-        },
-        {
-          "name": "delegation_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
-                  99, 111, 114, 100
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "publisher"
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked in the staking program"
-          ]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "const",
-              "value": [
-                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
-                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
-                70, 231, 183, 19, 217
-              ]
-            }
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "const",
-              "value": [
-                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
-                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
-                70, 231, 183, 19, 217
-              ]
-            }
-          }
-        },
-        {
-          "name": "config_account",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "governance_target_account",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "slash_custody",
-          "writable": true,
-          "relations": ["slash_event"]
-        },
-        {
-          "name": "custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "staking_program",
-          "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ"
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        }
-      ],
-      "args": [
-        {
-          "name": "index",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "undelegate",
-      "discriminator": [131, 148, 180, 198, 91, 104, 42, 238],
-      "accounts": [
-        {
-          "name": "owner",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : The publisher will be checked against data in the pool_data"
-          ]
-        },
-        {
-          "name": "config_account",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ],
-            "program": {
-              "kind": "account",
-              "path": "staking_program"
-            }
-          }
-        },
-        {
-          "name": "staking_program",
-          "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "position_index",
-          "type": "u8"
-        },
-        {
-          "name": "amount",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "update_delegation_fee",
-      "discriminator": [197, 184, 73, 246, 24, 137, 184, 208],
-      "accounts": [
-        {
-          "name": "reward_program_authority",
-          "signer": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_data",
-          "writable": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "delegation_fee",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "update_reward_program_authority",
-      "discriminator": [105, 58, 166, 4, 99, 253, 115, 225],
-      "accounts": [
-        {
-          "name": "reward_program_authority",
-          "signer": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "reward_program_authority",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "update_y",
-      "discriminator": [224, 14, 232, 96, 41, 230, 183, 18],
-      "accounts": [
-        {
-          "name": "reward_program_authority",
-          "signer": true,
-          "relations": ["pool_config"]
-        },
-        {
-          "name": "pool_config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "y",
-          "type": "u64"
-        }
-      ]
-    }
-  ],
-  "accounts": [
-    {
-      "name": "DelegationRecord",
-      "discriminator": [203, 185, 161, 226, 129, 251, 132, 155]
-    },
-    {
-      "name": "GlobalConfig",
-      "discriminator": [149, 8, 156, 202, 160, 252, 176, 217]
-    },
-    {
-      "name": "PoolConfig",
-      "discriminator": [26, 108, 14, 123, 116, 230, 129, 43]
-    },
-    {
-      "name": "PoolData",
-      "discriminator": [155, 28, 220, 37, 221, 242, 70, 167]
-    },
-    {
-      "name": "PositionData",
-      "discriminator": [85, 195, 241, 79, 124, 192, 79, 11]
-    },
-    {
-      "name": "PublisherCaps",
-      "discriminator": [5, 87, 155, 44, 121, 90, 35, 134]
-    },
-    {
-      "name": "SlashEvent",
-      "discriminator": [60, 32, 32, 44, 93, 234, 234, 89]
-    },
-    {
-      "name": "TargetMetadata",
-      "discriminator": [157, 23, 139, 117, 181, 44, 197, 130]
-    }
-  ],
-  "errors": [
-    {
-      "code": 6000,
-      "name": "PublisherNotFound"
-    },
-    {
-      "code": 6001,
-      "name": "PublisherOrRewardAuthorityNeedsToSign"
-    },
-    {
-      "code": 6002,
-      "name": "StakeAccountOwnerNeedsToSign"
-    },
-    {
-      "code": 6003,
-      "name": "OutdatedPublisherAccounting"
-    },
-    {
-      "code": 6004,
-      "name": "TooManyPublishers"
-    },
-    {
-      "code": 6005,
-      "name": "UnexpectedPositionState"
-    },
-    {
-      "code": 6006,
-      "name": "PoolDataAlreadyUpToDate"
-    },
-    {
-      "code": 6007,
-      "name": "OutdatedPublisherCaps"
-    },
-    {
-      "code": 6008,
-      "name": "OutdatedDelegatorAccounting"
-    },
-    {
-      "code": 6009,
-      "name": "CurrentStakeAccountShouldBeUndelegated"
-    },
-    {
-      "code": 6010,
-      "name": "NewStakeAccountShouldBeUndelegated"
-    },
-    {
-      "code": 6011,
-      "name": "PublisherStakeAccountMismatch"
-    },
-    {
-      "code": 6012,
-      "name": "ThisCodeShouldBeUnreachable"
-    },
-    {
-      "code": 6013,
-      "name": "InsufficientRewards"
-    },
-    {
-      "code": 6014,
-      "name": "InvalidStartEpoch",
-      "msg": "Start epoch of the reward program is before the current epoch"
-    },
-    {
-      "code": 6015,
-      "name": "UnverifiedPublisherCaps"
-    },
-    {
-      "code": 6016,
-      "name": "InvalidSlashEventIndex",
-      "msg": "Slash event indexes must be sequential and start at 0"
-    },
-    {
-      "code": 6017,
-      "name": "InvalidRewardProgramAuthority"
-    },
-    {
-      "code": 6018,
-      "name": "InvalidPoolDataAccount"
-    },
-    {
-      "code": 6019,
-      "name": "WrongSlashEventOrder",
-      "msg": "Slashes must be executed in order of slash event index"
-    },
-    {
-      "code": 6020,
-      "name": "PublisherCustodyAccountRequired",
-      "msg": "Publisher custody account required"
-    },
-    {
-      "code": 6021,
-      "name": "InvalidDelegationFee",
-      "msg": "Delegation fee must not be greater than 100%"
-    },
-    {
-      "code": 6022,
-      "name": "InvalidPublisher"
-    },
-    {
-      "code": 6023,
-      "name": "InvalidY",
-      "msg": "Y should not be greater than 1%"
-    },
-    {
-      "code": 6024,
-      "name": "InvalidSlashCustodyAccount"
-    }
-  ],
-  "types": [
-    {
-      "name": "DelegationRecord",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "last_epoch",
-            "type": "u64"
-          },
-          {
-            "name": "next_slash_event_index",
-            "type": "u64"
-          }
-        ]
-      }
-    },
-    {
-      "name": "DelegationState",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "total_delegation",
-            "type": "u64"
-          },
-          {
-            "name": "delta_delegation",
-            "type": "i64"
-          }
-        ]
-      }
-    },
-    {
-      "name": "Event",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "epoch",
-            "type": "u64"
-          },
-          {
-            "name": "y",
-            "type": "u64"
-          },
-          {
-            "name": "extra_space",
-            "type": {
-              "array": ["u64", 7]
-            }
-          },
-          {
-            "name": "event_data",
-            "type": {
-              "array": [
-                {
-                  "defined": {
-                    "name": "PublisherEventData"
-                  }
-                },
-                1024
-              ]
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "GlobalConfig",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "bump",
-            "type": "u8"
-          },
-          {
-            "name": "governance_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_token_mint",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_governance_realm",
-            "type": "pubkey"
-          },
-          {
-            "name": "removed_unlocking_duration",
-            "type": "u8"
-          },
-          {
-            "name": "epoch_duration",
-            "type": "u64"
-          },
-          {
-            "name": "freeze",
-            "type": "bool"
-          },
-          {
-            "name": "pda_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "governance_program",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_token_list_time",
-            "docs": [
-              "Once the pyth token is listed, governance can update the config to set this value.",
-              "Once this value is set, vesting schedules that depend on the token list date can start",
-              "vesting."
-            ],
-            "type": {
-              "option": "i64"
-            }
-          },
-          {
-            "name": "agreement_hash",
-            "type": {
-              "array": ["u8", 32]
-            }
-          },
-          {
-            "name": "mock_clock_time",
-            "type": "i64"
-          },
-          {
-            "name": "pool_authority",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "PoolConfig",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "pool_data",
-            "type": "pubkey"
-          },
-          {
-            "name": "reward_program_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_token_mint",
-            "type": "pubkey"
-          },
-          {
-            "name": "y",
-            "type": "u64"
-          },
-          {
-            "name": "slash_custody",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "PoolData",
-      "serialization": "bytemuck",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "last_updated_epoch",
-            "type": "u64"
-          },
-          {
-            "name": "claimable_rewards",
-            "type": "u64"
-          },
-          {
-            "name": "publishers",
-            "type": {
-              "array": ["pubkey", 1024]
-            }
-          },
-          {
-            "name": "del_state",
-            "type": {
-              "array": [
-                {
-                  "defined": {
-                    "name": "DelegationState"
-                  }
-                },
-                1024
-              ]
-            }
-          },
-          {
-            "name": "self_del_state",
-            "type": {
-              "array": [
-                {
-                  "defined": {
-                    "name": "DelegationState"
-                  }
-                },
-                1024
-              ]
-            }
-          },
-          {
-            "name": "publisher_stake_accounts",
-            "type": {
-              "array": ["pubkey", 1024]
-            }
-          },
-          {
-            "name": "events",
-            "type": {
-              "array": [
-                {
-                  "defined": {
-                    "name": "Event"
-                  }
-                },
-                52
-              ]
-            }
-          },
-          {
-            "name": "num_events",
-            "type": "u64"
-          },
-          {
-            "name": "num_slash_events",
-            "type": {
-              "array": ["u64", 1024]
-            }
-          },
-          {
-            "name": "delegation_fees",
-            "type": {
-              "array": ["u64", 1024]
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "PositionData",
-      "docs": ["The header of DynamicPositionArray"],
-      "serialization": "bytemuck",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "owner",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "PublisherCaps",
-      "serialization": "bytemuck",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "write_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "is_verified",
-            "type": "u8"
-          },
-          {
-            "name": "padding",
-            "type": {
-              "array": ["u8", 4]
-            }
-          },
-          {
-            "name": "publisher_caps_message_buffer",
-            "type": {
-              "array": ["u8", 40971]
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "PublisherEventData",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "self_reward_ratio",
-            "type": "u64"
-          },
-          {
-            "name": "other_reward_ratio",
-            "type": "u64"
-          },
-          {
-            "name": "delegation_fee",
-            "type": "u64"
-          }
-        ]
-      }
-    },
-    {
-      "name": "SlashEvent",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "epoch",
-            "type": "u64"
-          },
-          {
-            "name": "slash_ratio",
-            "type": "u64"
-          },
-          {
-            "name": "slash_custody",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "TargetMetadata",
-      "docs": [
-        "This represents a target that users can stake to",
-        "Currently we store the last time the target account was updated, the current locked balance",
-        "and the amount by which the locked balance will change in the next epoch"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "bump",
-            "type": "u8"
-          },
-          {
-            "name": "last_update_at",
-            "type": "u64"
-          },
-          {
-            "name": "prev_epoch_locked",
-            "type": "u64"
-          },
-          {
-            "name": "locked",
-            "type": "u64"
-          },
-          {
-            "name": "delta_locked",
-            "type": "i64"
-          }
-        ]
-      }
-    }
-  ]
-}

+ 1555 - 0
governance/pyth_staking_sdk/src/idl/integrity-pool.ts

@@ -0,0 +1,1555 @@
+export const INTEGRITY_POOL = {
+  address: "pyti8TM4zRVBjmarcgAPmTNNAXYKJv7WVHrkrm6woLN",
+  metadata: {
+    name: "integrity_pool",
+    version: "1.0.0",
+    spec: "0.1.0",
+    description: "Created with Anchor",
+  },
+  instructions: [
+    {
+      name: "advance",
+      discriminator: [7, 56, 108, 201, 36, 20, 57, 89],
+      accounts: [
+        {
+          name: "signer",
+          signer: true,
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "publisher_caps",
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pool_reward_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "account",
+                path: "pool_config",
+              },
+              {
+                kind: "const",
+                value: [
+                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
+                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
+                  245, 133, 126, 255, 0, 169,
+                ],
+              },
+              {
+                kind: "account",
+                path: "pool_config.pyth_token_mint",
+                account: "PoolConfig",
+              },
+            ],
+            program: {
+              kind: "const",
+              value: [
+                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
+                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
+                219, 233, 248, 89,
+              ],
+            },
+          },
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "advance_delegation_record",
+      discriminator: [155, 43, 226, 175, 227, 115, 33, 88],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pool_reward_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "account",
+                path: "pool_config",
+              },
+              {
+                kind: "const",
+                value: [
+                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
+                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
+                  245, 133, 126, 255, 0, 169,
+                ],
+              },
+              {
+                kind: "account",
+                path: "pool_config.pyth_token_mint",
+                account: "PoolConfig",
+              },
+            ],
+            program: {
+              kind: "const",
+              value: [
+                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
+                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
+                219, 233, 248, 89,
+              ],
+            },
+          },
+        },
+        {
+          name: "stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "publisher_stake_account_positions",
+          optional: true,
+        },
+        {
+          name: "publisher_stake_account_custody",
+          writable: true,
+          optional: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "publisher_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "delegation_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
+                  99, 111, 114, 100,
+                ],
+              },
+              {
+                kind: "account",
+                path: "publisher",
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [],
+      returns: "u64",
+    },
+    {
+      name: "create_slash_event",
+      discriminator: [7, 214, 12, 127, 239, 247, 253, 117],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "reward_program_authority",
+          signer: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "slash_custody",
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "slash_event",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [115, 108, 97, 115, 104, 95, 101, 118, 101, 110, 116],
+              },
+              {
+                kind: "account",
+                path: "publisher",
+              },
+              {
+                kind: "arg",
+                path: "index",
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "index",
+          type: "u64",
+        },
+        {
+          name: "slash_ratio",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "delegate",
+      discriminator: [90, 147, 75, 178, 85, 88, 4, 137],
+      accounts: [
+        {
+          name: "owner",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "config_account",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "stake_account_positions",
+          docs: [
+            "CHECK : This AccountInfo is safe because it will checked in staking program",
+          ],
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "stake_account_custody",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "staking_program",
+          address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "amount",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "initialize_pool",
+      discriminator: [95, 180, 10, 172, 84, 174, 232, 40],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "config_account",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+            program: {
+              kind: "const",
+              value: [
+                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
+                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
+                70, 231, 183, 19, 217,
+              ],
+            },
+          },
+        },
+        {
+          name: "pool_data",
+          writable: true,
+        },
+        {
+          name: "pool_config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "slash_custody",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "reward_program_authority",
+          type: "pubkey",
+        },
+        {
+          name: "y",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "merge_delegation_positions",
+      discriminator: [111, 59, 199, 177, 50, 231, 133, 228],
+      accounts: [
+        {
+          name: "owner",
+          docs: [
+            "CHECK : This instruction is permissionless, this account will be checked against",
+            "stake_account_metadata in the CPI",
+          ],
+          writable: true,
+        },
+        {
+          name: "pool_data",
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "delegation_record",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
+                  99, 111, 114, 100,
+                ],
+              },
+              {
+                kind: "account",
+                path: "publisher",
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config_account",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "stake_account_positions",
+          docs: [
+            "CHECK : This AccountInfo is safe because it will checked in staking program",
+          ],
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "staking_program",
+          address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "set_publisher_stake_account",
+      discriminator: [99, 46, 72, 132, 100, 235, 211, 117],
+      accounts: [
+        {
+          name: "signer",
+          signer: true,
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "new_stake_account_positions_option",
+          optional: true,
+        },
+        {
+          name: "current_stake_account_positions_option",
+          optional: true,
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "slash",
+      discriminator: [204, 141, 18, 161, 8, 177, 92, 142],
+      accounts: [
+        {
+          name: "signer",
+          signer: true,
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "slash_event",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [115, 108, 97, 115, 104, 95, 101, 118, 101, 110, 116],
+              },
+              {
+                kind: "account",
+                path: "publisher",
+              },
+              {
+                kind: "arg",
+                path: "index",
+              },
+            ],
+          },
+        },
+        {
+          name: "delegation_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 95, 114, 101,
+                  99, 111, 114, 100,
+                ],
+              },
+              {
+                kind: "account",
+                path: "publisher",
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked in the staking program",
+          ],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "const",
+              value: [
+                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
+                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
+                70, 231, 183, 19, 217,
+              ],
+            },
+          },
+        },
+        {
+          name: "stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "const",
+              value: [
+                12, 74, 158, 192, 43, 86, 104, 29, 164, 155, 4, 186, 155, 36,
+                207, 137, 253, 128, 249, 44, 241, 145, 227, 125, 189, 51, 111,
+                70, 231, 183, 19, 217,
+              ],
+            },
+          },
+        },
+        {
+          name: "config_account",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "governance_target_account",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "slash_custody",
+          writable: true,
+          relations: ["slash_event"],
+        },
+        {
+          name: "custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "staking_program",
+          address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+      ],
+      args: [
+        {
+          name: "index",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "undelegate",
+      discriminator: [131, 148, 180, 198, 91, 104, 42, 238],
+      accounts: [
+        {
+          name: "owner",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : The publisher will be checked against data in the pool_data",
+          ],
+        },
+        {
+          name: "config_account",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "stake_account_custody",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+            program: {
+              kind: "account",
+              path: "staking_program",
+            },
+          },
+        },
+        {
+          name: "staking_program",
+          address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "position_index",
+          type: "u8",
+        },
+        {
+          name: "amount",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "update_delegation_fee",
+      discriminator: [197, 184, 73, 246, 24, 137, 184, 208],
+      accounts: [
+        {
+          name: "reward_program_authority",
+          signer: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_data",
+          writable: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "delegation_fee",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "update_reward_program_authority",
+      discriminator: [105, 58, 166, 4, 99, 253, 115, 225],
+      accounts: [
+        {
+          name: "reward_program_authority",
+          signer: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "reward_program_authority",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "update_y",
+      discriminator: [224, 14, 232, 96, 41, 230, 183, 18],
+      accounts: [
+        {
+          name: "reward_program_authority",
+          signer: true,
+          relations: ["pool_config"],
+        },
+        {
+          name: "pool_config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 111, 111, 108, 95, 99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "y",
+          type: "u64",
+        },
+      ],
+    },
+  ],
+  accounts: [
+    {
+      name: "DelegationRecord",
+      discriminator: [203, 185, 161, 226, 129, 251, 132, 155],
+    },
+    {
+      name: "GlobalConfig",
+      discriminator: [149, 8, 156, 202, 160, 252, 176, 217],
+    },
+    {
+      name: "PoolConfig",
+      discriminator: [26, 108, 14, 123, 116, 230, 129, 43],
+    },
+    {
+      name: "PoolData",
+      discriminator: [155, 28, 220, 37, 221, 242, 70, 167],
+    },
+    {
+      name: "PositionData",
+      discriminator: [85, 195, 241, 79, 124, 192, 79, 11],
+    },
+    {
+      name: "PublisherCaps",
+      discriminator: [5, 87, 155, 44, 121, 90, 35, 134],
+    },
+    {
+      name: "SlashEvent",
+      discriminator: [60, 32, 32, 44, 93, 234, 234, 89],
+    },
+    {
+      name: "TargetMetadata",
+      discriminator: [157, 23, 139, 117, 181, 44, 197, 130],
+    },
+  ],
+  errors: [
+    {
+      code: 6000,
+      name: "PublisherNotFound",
+    },
+    {
+      code: 6001,
+      name: "PublisherOrRewardAuthorityNeedsToSign",
+    },
+    {
+      code: 6002,
+      name: "StakeAccountOwnerNeedsToSign",
+    },
+    {
+      code: 6003,
+      name: "OutdatedPublisherAccounting",
+    },
+    {
+      code: 6004,
+      name: "TooManyPublishers",
+    },
+    {
+      code: 6005,
+      name: "UnexpectedPositionState",
+    },
+    {
+      code: 6006,
+      name: "PoolDataAlreadyUpToDate",
+    },
+    {
+      code: 6007,
+      name: "OutdatedPublisherCaps",
+    },
+    {
+      code: 6008,
+      name: "OutdatedDelegatorAccounting",
+    },
+    {
+      code: 6009,
+      name: "CurrentStakeAccountShouldBeUndelegated",
+    },
+    {
+      code: 6010,
+      name: "NewStakeAccountShouldBeUndelegated",
+    },
+    {
+      code: 6011,
+      name: "PublisherStakeAccountMismatch",
+    },
+    {
+      code: 6012,
+      name: "ThisCodeShouldBeUnreachable",
+    },
+    {
+      code: 6013,
+      name: "InsufficientRewards",
+    },
+    {
+      code: 6014,
+      name: "InvalidStartEpoch",
+      msg: "Start epoch of the reward program is before the current epoch",
+    },
+    {
+      code: 6015,
+      name: "UnverifiedPublisherCaps",
+    },
+    {
+      code: 6016,
+      name: "InvalidSlashEventIndex",
+      msg: "Slash event indexes must be sequential and start at 0",
+    },
+    {
+      code: 6017,
+      name: "InvalidRewardProgramAuthority",
+    },
+    {
+      code: 6018,
+      name: "InvalidPoolDataAccount",
+    },
+    {
+      code: 6019,
+      name: "WrongSlashEventOrder",
+      msg: "Slashes must be executed in order of slash event index",
+    },
+    {
+      code: 6020,
+      name: "PublisherCustodyAccountRequired",
+      msg: "Publisher custody account required",
+    },
+    {
+      code: 6021,
+      name: "InvalidDelegationFee",
+      msg: "Delegation fee must not be greater than 100%",
+    },
+    {
+      code: 6022,
+      name: "InvalidPublisher",
+    },
+    {
+      code: 6023,
+      name: "InvalidY",
+      msg: "Y should not be greater than 1%",
+    },
+    {
+      code: 6024,
+      name: "InvalidSlashCustodyAccount",
+    },
+  ],
+  types: [
+    {
+      name: "DelegationRecord",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "last_epoch",
+            type: "u64",
+          },
+          {
+            name: "next_slash_event_index",
+            type: "u64",
+          },
+        ],
+      },
+    },
+    {
+      name: "DelegationState",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "total_delegation",
+            type: "u64",
+          },
+          {
+            name: "delta_delegation",
+            type: "i64",
+          },
+        ],
+      },
+    },
+    {
+      name: "Event",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "epoch",
+            type: "u64",
+          },
+          {
+            name: "y",
+            type: "u64",
+          },
+          {
+            name: "extra_space",
+            type: {
+              array: ["u64", 7],
+            },
+          },
+          {
+            name: "event_data",
+            type: {
+              array: [
+                {
+                  defined: {
+                    name: "PublisherEventData",
+                  },
+                },
+                1024,
+              ],
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "GlobalConfig",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "bump",
+            type: "u8",
+          },
+          {
+            name: "governance_authority",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_token_mint",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_governance_realm",
+            type: "pubkey",
+          },
+          {
+            name: "removed_unlocking_duration",
+            type: "u8",
+          },
+          {
+            name: "epoch_duration",
+            type: "u64",
+          },
+          {
+            name: "freeze",
+            type: "bool",
+          },
+          {
+            name: "pda_authority",
+            type: "pubkey",
+          },
+          {
+            name: "governance_program",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_token_list_time",
+            docs: [
+              "Once the pyth token is listed, governance can update the config to set this value.",
+              "Once this value is set, vesting schedules that depend on the token list date can start",
+              "vesting.",
+            ],
+            type: {
+              option: "i64",
+            },
+          },
+          {
+            name: "agreement_hash",
+            type: {
+              array: ["u8", 32],
+            },
+          },
+          {
+            name: "mock_clock_time",
+            type: "i64",
+          },
+          {
+            name: "pool_authority",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "PoolConfig",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "pool_data",
+            type: "pubkey",
+          },
+          {
+            name: "reward_program_authority",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_token_mint",
+            type: "pubkey",
+          },
+          {
+            name: "y",
+            type: "u64",
+          },
+          {
+            name: "slash_custody",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "PoolData",
+      serialization: "bytemuck",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "last_updated_epoch",
+            type: "u64",
+          },
+          {
+            name: "claimable_rewards",
+            type: "u64",
+          },
+          {
+            name: "publishers",
+            type: {
+              array: ["pubkey", 1024],
+            },
+          },
+          {
+            name: "del_state",
+            type: {
+              array: [
+                {
+                  defined: {
+                    name: "DelegationState",
+                  },
+                },
+                1024,
+              ],
+            },
+          },
+          {
+            name: "self_del_state",
+            type: {
+              array: [
+                {
+                  defined: {
+                    name: "DelegationState",
+                  },
+                },
+                1024,
+              ],
+            },
+          },
+          {
+            name: "publisher_stake_accounts",
+            type: {
+              array: ["pubkey", 1024],
+            },
+          },
+          {
+            name: "events",
+            type: {
+              array: [
+                {
+                  defined: {
+                    name: "Event",
+                  },
+                },
+                52,
+              ],
+            },
+          },
+          {
+            name: "num_events",
+            type: "u64",
+          },
+          {
+            name: "num_slash_events",
+            type: {
+              array: ["u64", 1024],
+            },
+          },
+          {
+            name: "delegation_fees",
+            type: {
+              array: ["u64", 1024],
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "PositionData",
+      docs: ["The header of DynamicPositionArray"],
+      serialization: "bytemuck",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "owner",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "PublisherCaps",
+      serialization: "bytemuck",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "write_authority",
+            type: "pubkey",
+          },
+          {
+            name: "is_verified",
+            type: "u8",
+          },
+          {
+            name: "padding",
+            type: {
+              array: ["u8", 4],
+            },
+          },
+          {
+            name: "publisher_caps_message_buffer",
+            type: {
+              array: ["u8", 40_971],
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "PublisherEventData",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "self_reward_ratio",
+            type: "u64",
+          },
+          {
+            name: "other_reward_ratio",
+            type: "u64",
+          },
+          {
+            name: "delegation_fee",
+            type: "u64",
+          },
+        ],
+      },
+    },
+    {
+      name: "SlashEvent",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "epoch",
+            type: "u64",
+          },
+          {
+            name: "slash_ratio",
+            type: "u64",
+          },
+          {
+            name: "slash_custody",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "TargetMetadata",
+      docs: [
+        "This represents a target that users can stake to",
+        "Currently we store the last time the target account was updated, the current locked balance",
+        "and the amount by which the locked balance will change in the next epoch",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "bump",
+            type: "u8",
+          },
+          {
+            name: "last_update_at",
+            type: "u64",
+          },
+          {
+            name: "prev_epoch_locked",
+            type: "u64",
+          },
+          {
+            name: "locked",
+            type: "u64",
+          },
+          {
+            name: "delta_locked",
+            type: "i64",
+          },
+        ],
+      },
+    },
+  ],
+};

+ 0 - 173
governance/pyth_staking_sdk/src/idl/publisher-caps.json

@@ -1,173 +0,0 @@
-{
-  "address": "pytcD8uUjPxSLMsNqoVnm9dXQw9tKJJf3CQnGwa8oL7",
-  "metadata": {
-    "name": "publisher_caps",
-    "version": "1.0.0",
-    "spec": "0.1.0",
-    "description": "Created with Anchor"
-  },
-  "instructions": [
-    {
-      "name": "close_publisher_caps",
-      "discriminator": [36, 234, 184, 214, 76, 203, 153, 144],
-      "accounts": [
-        {
-          "name": "write_authority",
-          "signer": true,
-          "relations": ["publisher_caps"]
-        },
-        {
-          "name": "publisher_caps",
-          "writable": true
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "init_publisher_caps",
-      "discriminator": [193, 208, 32, 97, 144, 247, 246, 168],
-      "accounts": [
-        {
-          "name": "signer",
-          "signer": true
-        },
-        {
-          "name": "publisher_caps",
-          "writable": true
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "verify_publisher_caps",
-      "discriminator": [13, 139, 213, 135, 4, 154, 93, 138],
-      "accounts": [
-        {
-          "name": "signer",
-          "signer": true
-        },
-        {
-          "name": "publisher_caps",
-          "writable": true
-        },
-        {
-          "name": "encoded_vaa",
-          "docs": ["which is the recommended way"]
-        }
-      ],
-      "args": [
-        {
-          "name": "proof",
-          "type": {
-            "vec": {
-              "array": ["u8", 20]
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "write_publisher_caps",
-      "discriminator": [142, 26, 237, 82, 9, 200, 27, 97],
-      "accounts": [
-        {
-          "name": "write_authority",
-          "signer": true,
-          "relations": ["publisher_caps"]
-        },
-        {
-          "name": "publisher_caps",
-          "writable": true
-        }
-      ],
-      "args": [
-        {
-          "name": "index",
-          "type": "u32"
-        },
-        {
-          "name": "data",
-          "type": "bytes"
-        }
-      ]
-    }
-  ],
-  "accounts": [
-    {
-      "name": "PublisherCaps",
-      "discriminator": [5, 87, 155, 44, 121, 90, 35, 134]
-    }
-  ],
-  "errors": [
-    {
-      "code": 6000,
-      "name": "InvalidWormholeMessage"
-    },
-    {
-      "code": 6001,
-      "name": "InvalidMerkleProof"
-    },
-    {
-      "code": 6002,
-      "name": "CantMutateVerifiedPublisherCaps"
-    },
-    {
-      "code": 6003,
-      "name": "DataOverflow"
-    },
-    {
-      "code": 6004,
-      "name": "WrongVaaOwner"
-    },
-    {
-      "code": 6005,
-      "name": "WrongWriteAuthority"
-    },
-    {
-      "code": 6006,
-      "name": "WrongEmitterAddress"
-    },
-    {
-      "code": 6007,
-      "name": "WrongEmitterChain"
-    },
-    {
-      "code": 6008,
-      "name": "WrongDiscriminator"
-    }
-  ],
-  "types": [
-    {
-      "name": "PublisherCaps",
-      "serialization": "bytemuck",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "write_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "is_verified",
-            "type": "u8"
-          },
-          {
-            "name": "padding",
-            "type": {
-              "array": ["u8", 4]
-            }
-          },
-          {
-            "name": "publisher_caps_message_buffer",
-            "type": {
-              "array": ["u8", 40971]
-            }
-          }
-        ]
-      }
-    }
-  ]
-}

+ 173 - 0
governance/pyth_staking_sdk/src/idl/publisher-caps.ts

@@ -0,0 +1,173 @@
+export const PUBLISHER_CAPS = {
+  address: "pytcD8uUjPxSLMsNqoVnm9dXQw9tKJJf3CQnGwa8oL7",
+  metadata: {
+    name: "publisher_caps",
+    version: "1.0.0",
+    spec: "0.1.0",
+    description: "Created with Anchor",
+  },
+  instructions: [
+    {
+      name: "close_publisher_caps",
+      discriminator: [36, 234, 184, 214, 76, 203, 153, 144],
+      accounts: [
+        {
+          name: "write_authority",
+          signer: true,
+          relations: ["publisher_caps"],
+        },
+        {
+          name: "publisher_caps",
+          writable: true,
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "init_publisher_caps",
+      discriminator: [193, 208, 32, 97, 144, 247, 246, 168],
+      accounts: [
+        {
+          name: "signer",
+          signer: true,
+        },
+        {
+          name: "publisher_caps",
+          writable: true,
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "verify_publisher_caps",
+      discriminator: [13, 139, 213, 135, 4, 154, 93, 138],
+      accounts: [
+        {
+          name: "signer",
+          signer: true,
+        },
+        {
+          name: "publisher_caps",
+          writable: true,
+        },
+        {
+          name: "encoded_vaa",
+          docs: ["which is the recommended way"],
+        },
+      ],
+      args: [
+        {
+          name: "proof",
+          type: {
+            vec: {
+              array: ["u8", 20],
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "write_publisher_caps",
+      discriminator: [142, 26, 237, 82, 9, 200, 27, 97],
+      accounts: [
+        {
+          name: "write_authority",
+          signer: true,
+          relations: ["publisher_caps"],
+        },
+        {
+          name: "publisher_caps",
+          writable: true,
+        },
+      ],
+      args: [
+        {
+          name: "index",
+          type: "u32",
+        },
+        {
+          name: "data",
+          type: "bytes",
+        },
+      ],
+    },
+  ],
+  accounts: [
+    {
+      name: "PublisherCaps",
+      discriminator: [5, 87, 155, 44, 121, 90, 35, 134],
+    },
+  ],
+  errors: [
+    {
+      code: 6000,
+      name: "InvalidWormholeMessage",
+    },
+    {
+      code: 6001,
+      name: "InvalidMerkleProof",
+    },
+    {
+      code: 6002,
+      name: "CantMutateVerifiedPublisherCaps",
+    },
+    {
+      code: 6003,
+      name: "DataOverflow",
+    },
+    {
+      code: 6004,
+      name: "WrongVaaOwner",
+    },
+    {
+      code: 6005,
+      name: "WrongWriteAuthority",
+    },
+    {
+      code: 6006,
+      name: "WrongEmitterAddress",
+    },
+    {
+      code: 6007,
+      name: "WrongEmitterChain",
+    },
+    {
+      code: 6008,
+      name: "WrongDiscriminator",
+    },
+  ],
+  types: [
+    {
+      name: "PublisherCaps",
+      serialization: "bytemuck",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "write_authority",
+            type: "pubkey",
+          },
+          {
+            name: "is_verified",
+            type: "u8",
+          },
+          {
+            name: "padding",
+            type: {
+              array: ["u8", 4],
+            },
+          },
+          {
+            name: "publisher_caps_message_buffer",
+            type: {
+              array: ["u8", 40_971],
+            },
+          },
+        ],
+      },
+    },
+  ],
+};

+ 0 - 76
governance/pyth_staking_sdk/src/idl/stake-caps-parameters.json

@@ -1,76 +0,0 @@
-{
-  "address": "ujSFv8q8woXW5PUnby52PQyxYGUudxkrvgN6A631Qmm",
-  "metadata": {
-    "name": "stake_caps_parameters",
-    "version": "0.1.0",
-    "spec": "0.1.0",
-    "description": "Created with Anchor"
-  },
-  "instructions": [
-    {
-      "name": "set_parameters",
-      "discriminator": [218, 114, 41, 75, 208, 237, 97, 28],
-      "accounts": [
-        {
-          "name": "signer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "parameters",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [112, 97, 114, 97, 109, 101, 116, 101, 114, 115]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "parameters",
-          "type": {
-            "defined": {
-              "name": "Parameters"
-            }
-          }
-        }
-      ]
-    }
-  ],
-  "accounts": [
-    {
-      "name": "Parameters",
-      "discriminator": [233, 2, 25, 109, 70, 228, 206, 228]
-    }
-  ],
-  "types": [
-    {
-      "name": "Parameters",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "current_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "m",
-            "type": "u64"
-          },
-          {
-            "name": "z",
-            "type": "u64"
-          }
-        ]
-      }
-    }
-  ]
-}

+ 76 - 0
governance/pyth_staking_sdk/src/idl/stake-caps-parameters.ts

@@ -0,0 +1,76 @@
+export const STAKE_CAPS_PARAMETERS = {
+  address: "ujSFv8q8woXW5PUnby52PQyxYGUudxkrvgN6A631Qmm",
+  metadata: {
+    name: "stake_caps_parameters",
+    version: "0.1.0",
+    spec: "0.1.0",
+    description: "Created with Anchor",
+  },
+  instructions: [
+    {
+      name: "set_parameters",
+      discriminator: [218, 114, 41, 75, 208, 237, 97, 28],
+      accounts: [
+        {
+          name: "signer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "parameters",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [112, 97, 114, 97, 109, 101, 116, 101, 114, 115],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "parameters",
+          type: {
+            defined: {
+              name: "Parameters",
+            },
+          },
+        },
+      ],
+    },
+  ],
+  accounts: [
+    {
+      name: "Parameters",
+      discriminator: [233, 2, 25, 109, 70, 228, 206, 228],
+    },
+  ],
+  types: [
+    {
+      name: "Parameters",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "current_authority",
+            type: "pubkey",
+          },
+          {
+            name: "m",
+            type: "u64",
+          },
+          {
+            name: "z",
+            type: "u64",
+          },
+        ],
+      },
+    },
+  ],
+};

+ 0 - 2304
governance/pyth_staking_sdk/src/idl/staking.json

@@ -1,2304 +0,0 @@
-{
-  "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
-  "metadata": {
-    "name": "staking",
-    "version": "2.1.0",
-    "spec": "0.1.0",
-    "description": "Created with Anchor"
-  },
-  "instructions": [
-    {
-      "name": "accept_split",
-      "docs": [
-        "* A split request can only be accepted by the `pda_authority` from\n     * the config account. If accepted, `amount` tokens are transferred to a new stake account\n     * owned by the `recipient` and the split request is reset (by setting `amount` to 0).\n     * The recipient of a transfer can't vote during the epoch of the transfer.\n     *\n     * The `pda_authority` must explicitly approve both the amount of tokens and recipient, and\n     * these parameters must match the request (in the `split_request` account)."
-      ],
-      "discriminator": [177, 172, 17, 93, 193, 86, 54, 222],
-      "accounts": [
-        {
-          "name": "pda_authority",
-          "writable": true,
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "source_stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "source_stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "source_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "source_stake_account_split_request",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 112, 108, 105, 116, 95, 114, 101, 113, 117, 101, 115, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "source_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "source_stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "source_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "source_custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "source_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "new_stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "new_stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "new_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "new_stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "new_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "new_custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "new_stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pyth_token_mint",
-          "relations": ["config"]
-        },
-        {
-          "name": "rent",
-          "address": "SysvarRent111111111111111111111111111111111"
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
-        },
-        {
-          "name": "recipient",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "advance_clock",
-      "discriminator": [52, 57, 147, 111, 56, 227, 33, 127],
-      "accounts": [
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "seconds",
-          "type": "i64"
-        }
-      ]
-    },
-    {
-      "name": "close_position",
-      "discriminator": [123, 134, 81, 0, 49, 68, 98, 98],
-      "accounts": [
-        {
-          "name": "owner",
-          "writable": true,
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "target_account",
-          "writable": true,
-          "optional": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pool_authority",
-          "signer": true,
-          "optional": true
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "index",
-          "type": "u8"
-        },
-        {
-          "name": "amount",
-          "type": "u64"
-        },
-        {
-          "name": "target_with_parameters",
-          "type": {
-            "defined": {
-              "name": "TargetWithParameters"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "create_position",
-      "docs": [
-        "Creates a position",
-        "Looks for the first available place in the array, fails if array is full",
-        "Computes risk and fails if new positions exceed risk limit"
-      ],
-      "discriminator": [48, 215, 197, 153, 96, 203, 180, 133],
-      "accounts": [
-        {
-          "name": "owner",
-          "writable": true,
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "target_account",
-          "writable": true,
-          "optional": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pool_authority",
-          "signer": true,
-          "optional": true
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "target_with_parameters",
-          "type": {
-            "defined": {
-              "name": "TargetWithParameters"
-            }
-          }
-        },
-        {
-          "name": "amount",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "create_stake_account",
-      "docs": [
-        "Trustless instruction that creates a stake account for a user",
-        "The main account i.e. the position accounts needs to be initialized outside of the program",
-        "otherwise we run into stack limits"
-      ],
-      "discriminator": [105, 24, 131, 19, 201, 250, 157, 73],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pyth_token_mint",
-          "relations": ["config"]
-        },
-        {
-          "name": "rent",
-          "address": "SysvarRent111111111111111111111111111111111"
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "owner",
-          "type": "pubkey"
-        },
-        {
-          "name": "lock",
-          "type": {
-            "defined": {
-              "name": "VestingSchedule"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "create_target",
-      "discriminator": [76, 144, 128, 239, 121, 210, 123, 39],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "target_account",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "create_voter_record",
-      "discriminator": [3, 12, 113, 222, 177, 4, 152, 165],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "voter_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "export_position_type",
-      "discriminator": [219, 172, 149, 212, 103, 230, 164, 179],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "config_account",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "rent",
-          "address": "SysvarRent111111111111111111111111111111111"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "_position",
-          "type": {
-            "defined": {
-              "name": "Position"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "init_config",
-      "discriminator": [23, 235, 115, 232, 168, 96, 1, 231],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "config_account",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "rent",
-          "address": "SysvarRent111111111111111111111111111111111"
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "global_config",
-          "type": {
-            "defined": {
-              "name": "GlobalConfig"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "join_dao_llc",
-      "docs": [
-        "* Accept to join the DAO LLC\n     * This must happen before create_position or update_voter_weight\n     * The user signs a hash of the agreement and the program checks that the hash matches the\n     * agreement"
-      ],
-      "discriminator": [79, 241, 203, 177, 232, 143, 124, 14],
-      "accounts": [
-        {
-          "name": "owner",
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "_agreement_hash",
-          "type": {
-            "array": ["u8", 32]
-          }
-        }
-      ]
-    },
-    {
-      "name": "merge_target_positions",
-      "discriminator": [21, 136, 57, 2, 204, 219, 242, 141],
-      "accounts": [
-        {
-          "name": "owner",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's checked against stake_account_metadata"
-          ],
-          "writable": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "pool_authority",
-          "signer": true,
-          "optional": true
-        }
-      ],
-      "args": [
-        {
-          "name": "target_with_parameters",
-          "type": {
-            "defined": {
-              "name": "TargetWithParameters"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "recover_account",
-      "docs": [
-        "Recovers a user's `stake account` ownership by transferring ownership\n     * from a token account to the `owner` of that token account.\n     *\n     * This functionality addresses the scenario where a user mistakenly\n     * created a stake account using their token account address as the owner."
-      ],
-      "discriminator": [240, 223, 246, 118, 26, 121, 34, 128],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "owner",
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "voter_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "request_split",
-      "docs": [
-        "* Any user of the staking program can request to split their account and\n     * give a part of it to another user.\n     * This is mostly useful to transfer unvested tokens. Each user can only have one active\n     * request at a time.\n     * In the first step, the user requests a split by specifying the `amount` of tokens\n     * they want to give to the other user and the `recipient`'s pubkey."
-      ],
-      "discriminator": [133, 146, 228, 165, 251, 207, 146, 23],
-      "accounts": [
-        {
-          "name": "owner",
-          "writable": true,
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "stake_account_metadata",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_split_request",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 112, 108, 105, 116, 95, 114, 101, 113, 117, 101, 115, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
-        },
-        {
-          "name": "recipient",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "slash_account",
-      "discriminator": [185, 97, 8, 208, 118, 205, 166, 2],
-      "accounts": [
-        {
-          "name": "pool_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "publisher",
-          "docs": [
-            "CHECK : This AccountInfo is just used to construct the target that will get slashed"
-          ]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "governance_target_account",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "destination",
-          "writable": true
-        },
-        {
-          "name": "custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        }
-      ],
-      "args": [
-        {
-          "name": "slash_ratio",
-          "type": "u64"
-        }
-      ]
-    },
-    {
-      "name": "transfer_account",
-      "docs": [
-        "Transfers a user's stake account to a new owner provided by the `governance_authority`.\n     *\n     * This functionality addresses the scenario where a user doesn't have access to their owner\n     * key. Only accounts without any staked tokens can be transferred."
-      ],
-      "discriminator": [219, 120, 55, 105, 3, 139, 205, 6],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "new_owner",
-          "docs": [
-            "CHECK : A new arbitrary owner provided by the governance_authority"
-          ]
-        },
-        {
-          "name": "stake_account_positions",
-          "writable": true
-        },
-        {
-          "name": "stake_account_metadata",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "voter_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "update_agreement_hash",
-      "discriminator": [86, 232, 181, 137, 158, 110, 129, 238],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "agreement_hash",
-          "type": {
-            "array": ["u8", 32]
-          }
-        }
-      ]
-    },
-    {
-      "name": "update_governance_authority",
-      "discriminator": [11, 185, 227, 55, 39, 32, 168, 14],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "new_authority",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "update_max_voter_weight",
-      "discriminator": [248, 36, 229, 234, 11, 132, 145, 20],
-      "accounts": [
-        {
-          "name": "payer",
-          "writable": true,
-          "signer": true
-        },
-        {
-          "name": "max_voter_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [109, 97, 120, 95, 118, 111, 116, 101, 114]
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "system_program",
-          "address": "11111111111111111111111111111111"
-        }
-      ],
-      "args": []
-    },
-    {
-      "name": "update_pda_authority",
-      "discriminator": [178, 112, 199, 196, 59, 40, 140, 61],
-      "accounts": [
-        {
-          "name": "pda_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "new_authority",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "update_pool_authority",
-      "discriminator": [160, 162, 113, 9, 99, 187, 23, 239],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "pool_authority",
-          "type": "pubkey"
-        }
-      ]
-    },
-    {
-      "name": "update_token_list_time",
-      "discriminator": [38, 217, 99, 222, 253, 253, 31, 83],
-      "accounts": [
-        {
-          "name": "governance_authority",
-          "signer": true,
-          "relations": ["config"]
-        },
-        {
-          "name": "config",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "token_list_time",
-          "type": {
-            "option": "i64"
-          }
-        }
-      ]
-    },
-    {
-      "name": "update_voter_weight",
-      "discriminator": [92, 35, 133, 94, 230, 70, 14, 157],
-      "accounts": [
-        {
-          "name": "owner",
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "stake_account_metadata",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "voter_record",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "governance_target",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [116, 97, 114, 103, 101, 116]
-              },
-              {
-                "kind": "const",
-                "value": [118, 111, 116, 105, 110, 103]
-              }
-            ]
-          }
-        }
-      ],
-      "args": [
-        {
-          "name": "action",
-          "type": {
-            "defined": {
-              "name": "VoterWeightAction"
-            }
-          }
-        }
-      ]
-    },
-    {
-      "name": "withdraw_stake",
-      "discriminator": [153, 8, 22, 138, 105, 176, 87, 66],
-      "accounts": [
-        {
-          "name": "owner",
-          "signer": true,
-          "relations": ["stake_account_metadata"]
-        },
-        {
-          "name": "destination",
-          "writable": true
-        },
-        {
-          "name": "stake_account_positions"
-        },
-        {
-          "name": "stake_account_metadata",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [
-                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
-                  97
-                ]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "stake_account_custody",
-          "writable": true,
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 117, 115, 116, 111, 100, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "custody_authority",
-          "docs": [
-            "CHECK : This AccountInfo is safe because it's a checked PDA"
-          ],
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [97, 117, 116, 104, 111, 114, 105, 116, 121]
-              },
-              {
-                "kind": "account",
-                "path": "stake_account_positions"
-              }
-            ]
-          }
-        },
-        {
-          "name": "config",
-          "pda": {
-            "seeds": [
-              {
-                "kind": "const",
-                "value": [99, 111, 110, 102, 105, 103]
-              }
-            ]
-          }
-        },
-        {
-          "name": "token_program",
-          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
-        }
-      ],
-      "args": [
-        {
-          "name": "amount",
-          "type": "u64"
-        }
-      ]
-    }
-  ],
-  "accounts": [
-    {
-      "name": "GlobalConfig",
-      "discriminator": [149, 8, 156, 202, 160, 252, 176, 217]
-    },
-    {
-      "name": "MaxVoterWeightRecord",
-      "discriminator": [157, 95, 242, 151, 16, 98, 26, 118]
-    },
-    {
-      "name": "PositionData",
-      "discriminator": [85, 195, 241, 79, 124, 192, 79, 11]
-    },
-    {
-      "name": "SplitRequest",
-      "discriminator": [80, 85, 187, 143, 62, 147, 234, 248]
-    },
-    {
-      "name": "StakeAccountMetadataV2",
-      "discriminator": [192, 51, 203, 19, 76, 177, 136, 97]
-    },
-    {
-      "name": "TargetMetadata",
-      "discriminator": [157, 23, 139, 117, 181, 44, 197, 130]
-    },
-    {
-      "name": "VoterWeightRecord",
-      "discriminator": [46, 249, 155, 75, 153, 248, 116, 9]
-    }
-  ],
-  "errors": [
-    {
-      "code": 6000,
-      "name": "TooMuchExposureToIntegrityPool",
-      "msg": "Too much exposure to integrity pool"
-    },
-    {
-      "code": 6001,
-      "name": "TooMuchExposureToGovernance",
-      "msg": "Too much exposure to governance"
-    },
-    {
-      "code": 6002,
-      "name": "TokensNotYetVested",
-      "msg": "Tokens not yet vested"
-    },
-    {
-      "code": 6003,
-      "name": "RiskLimitExceeded",
-      "msg": "Risk limit exceeded"
-    },
-    {
-      "code": 6004,
-      "name": "TooManyPositions",
-      "msg": "Number of position limit reached"
-    },
-    {
-      "code": 6005,
-      "name": "PositionNotInUse",
-      "msg": "Position not in use"
-    },
-    {
-      "code": 6006,
-      "name": "CreatePositionWithZero",
-      "msg": "New position needs to have positive balance"
-    },
-    {
-      "code": 6007,
-      "name": "ClosePositionWithZero",
-      "msg": "Closing a position of 0 is not allowed"
-    },
-    {
-      "code": 6008,
-      "name": "InvalidPosition",
-      "msg": "Invalid product/publisher pair"
-    },
-    {
-      "code": 6009,
-      "name": "AmountBiggerThanPosition",
-      "msg": "Amount to unlock bigger than position"
-    },
-    {
-      "code": 6010,
-      "name": "AlreadyUnlocking",
-      "msg": "Position already unlocking"
-    },
-    {
-      "code": 6011,
-      "name": "ZeroEpochDuration",
-      "msg": "Epoch duration is 0"
-    },
-    {
-      "code": 6012,
-      "name": "WithdrawToUnauthorizedAccount",
-      "msg": "Owner needs to own destination account"
-    },
-    {
-      "code": 6013,
-      "name": "InsufficientWithdrawableBalance",
-      "msg": "Insufficient balance to cover the withdrawal"
-    },
-    {
-      "code": 6014,
-      "name": "WrongTarget",
-      "msg": "Target in position doesn't match target in instruction data"
-    },
-    {
-      "code": 6015,
-      "name": "GenericOverflow",
-      "msg": "An arithmetic operation unexpectedly overflowed"
-    },
-    {
-      "code": 6016,
-      "name": "NegativeBalance",
-      "msg": "Locked balance must be positive"
-    },
-    {
-      "code": 6017,
-      "name": "Frozen",
-      "msg": "Protocol is frozen"
-    },
-    {
-      "code": 6018,
-      "name": "DebuggingOnly",
-      "msg": "Not allowed when not debugging"
-    },
-    {
-      "code": 6019,
-      "name": "ProposalTooLong",
-      "msg": "Proposal too long"
-    },
-    {
-      "code": 6020,
-      "name": "InvalidVotingEpoch",
-      "msg": "Voting epoch is either too old or hasn't started"
-    },
-    {
-      "code": 6021,
-      "name": "ProposalNotActive",
-      "msg": "Voting hasn't started"
-    },
-    {
-      "code": 6022,
-      "name": "NoRemainingAccount",
-      "msg": "Extra governance account required"
-    },
-    {
-      "code": 6023,
-      "name": "Unauthorized",
-      "msg": "Unauthorized caller"
-    },
-    {
-      "code": 6024,
-      "name": "AccountUpgradeFailed",
-      "msg": "Precondition to upgrade account violated"
-    },
-    {
-      "code": 6025,
-      "name": "NotImplemented",
-      "msg": "Not implemented"
-    },
-    {
-      "code": 6026,
-      "name": "PositionSerDe",
-      "msg": "Error deserializing position"
-    },
-    {
-      "code": 6027,
-      "name": "PositionOutOfBounds",
-      "msg": "Position out of bounds"
-    },
-    {
-      "code": 6028,
-      "name": "VoteDuringTransferEpoch",
-      "msg": "Can't vote during an account's transfer epoch"
-    },
-    {
-      "code": 6029,
-      "name": "NotLlcMember",
-      "msg": "You need to be an LLC member to perform this action"
-    },
-    {
-      "code": 6030,
-      "name": "InvalidLlcAgreement",
-      "msg": "Invalid LLC agreement"
-    },
-    {
-      "code": 6031,
-      "name": "SplitZeroTokens",
-      "msg": "Can't split 0 tokens from an account"
-    },
-    {
-      "code": 6032,
-      "name": "SplitTooManyTokens",
-      "msg": "Can't split more tokens than are in the account"
-    },
-    {
-      "code": 6033,
-      "name": "SplitWithStake",
-      "msg": "Can't split a token account with staking positions. Unstake your tokens first."
-    },
-    {
-      "code": 6034,
-      "name": "InvalidApproval",
-      "msg": "The approval arguments do not match the split request."
-    },
-    {
-      "code": 6035,
-      "name": "RecoverWithStake",
-      "msg": "Can't recover account with staking positions. Unstake your tokens first."
-    },
-    {
-      "code": 6036,
-      "name": "InvalidPoolAuthority",
-      "msg": "The pool authority hasn't been passed or doesn't match the target"
-    },
-    {
-      "code": 6037,
-      "name": "MissingTargetAccount",
-      "msg": "The target account is missing"
-    },
-    {
-      "code": 6038,
-      "name": "InvalidSlashRatio",
-      "msg": "The slash ratio should be between 0 and 1"
-    },
-    {
-      "code": 6039,
-      "name": "UnexpectedTargetAccount",
-      "msg": "The target account is only expected when dealing with the governance target"
-    },
-    {
-      "code": 6040,
-      "name": "Other",
-      "msg": "Other"
-    }
-  ],
-  "types": [
-    {
-      "name": "GlobalConfig",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "bump",
-            "type": "u8"
-          },
-          {
-            "name": "governance_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_token_mint",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_governance_realm",
-            "type": "pubkey"
-          },
-          {
-            "name": "removed_unlocking_duration",
-            "type": "u8"
-          },
-          {
-            "name": "epoch_duration",
-            "type": "u64"
-          },
-          {
-            "name": "freeze",
-            "type": "bool"
-          },
-          {
-            "name": "pda_authority",
-            "type": "pubkey"
-          },
-          {
-            "name": "governance_program",
-            "type": "pubkey"
-          },
-          {
-            "name": "pyth_token_list_time",
-            "docs": [
-              "Once the pyth token is listed, governance can update the config to set this value.",
-              "Once this value is set, vesting schedules that depend on the token list date can start",
-              "vesting."
-            ],
-            "type": {
-              "option": "i64"
-            }
-          },
-          {
-            "name": "agreement_hash",
-            "type": {
-              "array": ["u8", 32]
-            }
-          },
-          {
-            "name": "mock_clock_time",
-            "type": "i64"
-          },
-          {
-            "name": "pool_authority",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "MaxVoterWeightRecord",
-      "docs": [
-        "Copied this struct from https://github.com/solana-labs/solana-program-library/blob/master/governance/addin-api/src/max_voter_weight.rs"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "realm",
-            "docs": ["The Realm the MaxVoterWeightRecord belongs to"],
-            "type": "pubkey"
-          },
-          {
-            "name": "governing_token_mint",
-            "docs": [
-              "Governing Token Mint the MaxVoterWeightRecord is associated with",
-              "Note: The addin can take deposits of any tokens and is not restricted to the community or",
-              "council tokens only"
-            ],
-            "type": "pubkey"
-          },
-          {
-            "name": "max_voter_weight",
-            "docs": [
-              "Max voter weight",
-              "The max voter weight provided by the addin for the given realm and governing_token_mint"
-            ],
-            "type": "u64"
-          },
-          {
-            "name": "max_voter_weight_expiry",
-            "docs": [
-              "The slot when the max voting weight expires",
-              "It should be set to None if the weight never expires",
-              "If the max vote weight decays with time, for example for time locked based weights, then",
-              "the expiry must be set As a pattern Revise instruction to update the max weight should",
-              "be invoked before governance instruction within the same transaction and the expiry set",
-              "to the current slot to provide up to date weight"
-            ],
-            "type": {
-              "option": "u64"
-            }
-          },
-          {
-            "name": "reserved",
-            "docs": ["Reserved space for future versions"],
-            "type": {
-              "array": ["u8", 8]
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "Position",
-      "docs": [
-        "This represents a staking position, i.e. an amount that someone has staked to a particular",
-        "target. This is one of the core pieces of our staking design, and stores all",
-        "of the state related to a position The voting position is a position where the",
-        "target_with_parameters is VOTING"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "amount",
-            "type": "u64"
-          },
-          {
-            "name": "activation_epoch",
-            "type": "u64"
-          },
-          {
-            "name": "unlocking_start",
-            "type": {
-              "option": "u64"
-            }
-          },
-          {
-            "name": "target_with_parameters",
-            "type": {
-              "defined": {
-                "name": "TargetWithParameters"
-              }
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "PositionData",
-      "docs": ["The header of DynamicPositionArray"],
-      "serialization": "bytemuck",
-      "repr": {
-        "kind": "c"
-      },
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "owner",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "SplitRequest",
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "amount",
-            "type": "u64"
-          },
-          {
-            "name": "recipient",
-            "type": "pubkey"
-          }
-        ]
-      }
-    },
-    {
-      "name": "StakeAccountMetadataV2",
-      "docs": [
-        "This is the metadata account for each staker",
-        "It is derived from the positions account with seeds \"stake_metadata\" and the positions account",
-        "pubkey It stores some PDA bumps, the owner of the account and the vesting schedule"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "metadata_bump",
-            "type": "u8"
-          },
-          {
-            "name": "custody_bump",
-            "type": "u8"
-          },
-          {
-            "name": "authority_bump",
-            "type": "u8"
-          },
-          {
-            "name": "voter_bump",
-            "type": "u8"
-          },
-          {
-            "name": "owner",
-            "type": "pubkey"
-          },
-          {
-            "name": "lock",
-            "type": {
-              "defined": {
-                "name": "VestingSchedule"
-              }
-            }
-          },
-          {
-            "name": "next_index",
-            "type": "u8"
-          },
-          {
-            "name": "_deprecated",
-            "type": {
-              "option": "u64"
-            }
-          },
-          {
-            "name": "signed_agreement_hash",
-            "type": {
-              "option": {
-                "array": ["u8", 32]
-              }
-            }
-          }
-        ]
-      }
-    },
-    {
-      "name": "TargetMetadata",
-      "docs": [
-        "This represents a target that users can stake to",
-        "Currently we store the last time the target account was updated, the current locked balance",
-        "and the amount by which the locked balance will change in the next epoch"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "bump",
-            "type": "u8"
-          },
-          {
-            "name": "last_update_at",
-            "type": "u64"
-          },
-          {
-            "name": "prev_epoch_locked",
-            "type": "u64"
-          },
-          {
-            "name": "locked",
-            "type": "u64"
-          },
-          {
-            "name": "delta_locked",
-            "type": "i64"
-          }
-        ]
-      }
-    },
-    {
-      "name": "TargetWithParameters",
-      "type": {
-        "kind": "enum",
-        "variants": [
-          {
-            "name": "Voting"
-          },
-          {
-            "name": "IntegrityPool",
-            "fields": [
-              {
-                "name": "publisher",
-                "type": "pubkey"
-              }
-            ]
-          }
-        ]
-      }
-    },
-    {
-      "name": "VestingSchedule",
-      "docs": [
-        "Represents how a given initial balance vests over time",
-        "It is unit-less, but units must be consistent"
-      ],
-      "repr": {
-        "kind": "rust"
-      },
-      "type": {
-        "kind": "enum",
-        "variants": [
-          {
-            "name": "FullyVested"
-          },
-          {
-            "name": "PeriodicVesting",
-            "fields": [
-              {
-                "name": "initial_balance",
-                "type": "u64"
-              },
-              {
-                "name": "start_date",
-                "type": "i64"
-              },
-              {
-                "name": "period_duration",
-                "type": "u64"
-              },
-              {
-                "name": "num_periods",
-                "type": "u64"
-              }
-            ]
-          },
-          {
-            "name": "PeriodicVestingAfterListing",
-            "fields": [
-              {
-                "name": "initial_balance",
-                "type": "u64"
-              },
-              {
-                "name": "period_duration",
-                "type": "u64"
-              },
-              {
-                "name": "num_periods",
-                "type": "u64"
-              }
-            ]
-          }
-        ]
-      }
-    },
-    {
-      "name": "VoterWeightAction",
-      "docs": ["The governance action VoterWeight is evaluated for"],
-      "type": {
-        "kind": "enum",
-        "variants": [
-          {
-            "name": "CastVote"
-          },
-          {
-            "name": "CommentProposal"
-          },
-          {
-            "name": "CreateGovernance"
-          },
-          {
-            "name": "CreateProposal"
-          },
-          {
-            "name": "SignOffProposal"
-          }
-        ]
-      }
-    },
-    {
-      "name": "VoterWeightRecord",
-      "docs": [
-        "Copied this struct from https://github.com/solana-labs/solana-program-library/blob/master/governance/addin-api/src/voter_weight.rs",
-        "Anchor has a macro (vote_weight_record) that is supposed to generate this struct, but it doesn't",
-        "work because the error's macros are not updated for anchor 0.22.0.",
-        "Even if it did work, the type wouldn't show up in the IDL. SPL doesn't produce an API, which",
-        "means that means we'd need the equivalent of this code on the client side.",
-        "If Anchor fixes the macro, we might consider changing it"
-      ],
-      "type": {
-        "kind": "struct",
-        "fields": [
-          {
-            "name": "realm",
-            "docs": [
-              "VoterWeightRecord discriminator sha256(\"account:VoterWeightRecord\")[..8]",
-              "Note: The discriminator size must match the addin implementing program discriminator size",
-              "to ensure it's stored in the private space of the account data and it's unique",
-              "pub account_discriminator: [u8; 8],",
-              "The Realm the VoterWeightRecord belongs to"
-            ],
-            "type": "pubkey"
-          },
-          {
-            "name": "governing_token_mint",
-            "docs": [
-              "Governing Token Mint the VoterWeightRecord is associated with",
-              "Note: The addin can take deposits of any tokens and is not restricted to the community or",
-              "council tokens only"
-            ],
-            "type": "pubkey"
-          },
-          {
-            "name": "governing_token_owner",
-            "docs": [
-              "The owner of the governing token and voter",
-              "This is the actual owner (voter) and corresponds to TokenOwnerRecord.governing_token_owner"
-            ],
-            "type": "pubkey"
-          },
-          {
-            "name": "voter_weight",
-            "docs": [
-              "Voter's weight",
-              "The weight of the voter provided by the addin for the given realm, governing_token_mint and",
-              "governing_token_owner (voter)"
-            ],
-            "type": "u64"
-          },
-          {
-            "name": "voter_weight_expiry",
-            "docs": [
-              "The slot when the voting weight expires",
-              "It should be set to None if the weight never expires",
-              "If the voter weight decays with time, for example for time locked based weights, then the",
-              "expiry must be set As a common pattern Revise instruction to update the weight should",
-              "be invoked before governance instruction within the same transaction and the expiry set",
-              "to the current slot to provide up to date weight"
-            ],
-            "type": {
-              "option": "u64"
-            }
-          },
-          {
-            "name": "weight_action",
-            "docs": [
-              "The governance action the voter's weight pertains to",
-              "It allows to provided voter's weight specific to the particular action the weight is",
-              "evaluated for When the action is provided then the governance program asserts the",
-              "executing action is the same as specified by the addin"
-            ],
-            "type": {
-              "option": {
-                "defined": {
-                  "name": "VoterWeightAction"
-                }
-              }
-            }
-          },
-          {
-            "name": "weight_action_target",
-            "docs": [
-              "The target the voter's weight  action pertains to",
-              "It allows to provided voter's weight specific to the target the weight is evaluated for",
-              "For example when addin supplies weight to vote on a particular proposal then it must",
-              "specify the proposal as the action target When the target is provided then the",
-              "governance program asserts the target is the same as specified by the addin"
-            ],
-            "type": {
-              "option": "pubkey"
-            }
-          },
-          {
-            "name": "reserved",
-            "docs": ["Reserved space for future versions"],
-            "type": {
-              "array": ["u8", 8]
-            }
-          }
-        ]
-      }
-    }
-  ]
-}

+ 2296 - 0
governance/pyth_staking_sdk/src/idl/staking.ts

@@ -0,0 +1,2296 @@
+export const STAKING_IDK = {
+  address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
+  metadata: {
+    name: "staking",
+    version: "2.1.0",
+    spec: "0.1.0",
+    description: "Created with Anchor",
+  },
+  instructions: [
+    {
+      name: "accept_split",
+      docs: [
+        "* A split request can only be accepted by the `pda_authority` from\n     * the config account. If accepted, `amount` tokens are transferred to a new stake account\n     * owned by the `recipient` and the split request is reset (by setting `amount` to 0).\n     * The recipient of a transfer can't vote during the epoch of the transfer.\n     *\n     * The `pda_authority` must explicitly approve both the amount of tokens and recipient, and\n     * these parameters must match the request (in the `split_request` account).",
+      ],
+      discriminator: [177, 172, 17, 93, 193, 86, 54, 222],
+      accounts: [
+        {
+          name: "pda_authority",
+          writable: true,
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "source_stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "source_stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "source_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "source_stake_account_split_request",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 112, 108, 105, 116, 95, 114, 101, 113, 117, 101, 115,
+                  116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "source_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "source_stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "source_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "source_custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "source_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "new_stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "new_stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "new_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "new_stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "new_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "new_custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "new_stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pyth_token_mint",
+          relations: ["config"],
+        },
+        {
+          name: "rent",
+          address: "SysvarRent111111111111111111111111111111111",
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "amount",
+          type: "u64",
+        },
+        {
+          name: "recipient",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "advance_clock",
+      discriminator: [52, 57, 147, 111, 56, 227, 33, 127],
+      accounts: [
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "seconds",
+          type: "i64",
+        },
+      ],
+    },
+    {
+      name: "close_position",
+      discriminator: [123, 134, 81, 0, 49, 68, 98, 98],
+      accounts: [
+        {
+          name: "owner",
+          writable: true,
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "target_account",
+          writable: true,
+          optional: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pool_authority",
+          signer: true,
+          optional: true,
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "index",
+          type: "u8",
+        },
+        {
+          name: "amount",
+          type: "u64",
+        },
+        {
+          name: "target_with_parameters",
+          type: {
+            defined: {
+              name: "TargetWithParameters",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "create_position",
+      docs: [
+        "Creates a position",
+        "Looks for the first available place in the array, fails if array is full",
+        "Computes risk and fails if new positions exceed risk limit",
+      ],
+      discriminator: [48, 215, 197, 153, 96, 203, 180, 133],
+      accounts: [
+        {
+          name: "owner",
+          writable: true,
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "target_account",
+          writable: true,
+          optional: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pool_authority",
+          signer: true,
+          optional: true,
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "target_with_parameters",
+          type: {
+            defined: {
+              name: "TargetWithParameters",
+            },
+          },
+        },
+        {
+          name: "amount",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "create_stake_account",
+      docs: [
+        "Trustless instruction that creates a stake account for a user",
+        "The main account i.e. the position accounts needs to be initialized outside of the program",
+        "otherwise we run into stack limits",
+      ],
+      discriminator: [105, 24, 131, 19, 201, 250, 157, 73],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pyth_token_mint",
+          relations: ["config"],
+        },
+        {
+          name: "rent",
+          address: "SysvarRent111111111111111111111111111111111",
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "owner",
+          type: "pubkey",
+        },
+        {
+          name: "lock",
+          type: {
+            defined: {
+              name: "VestingSchedule",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "create_target",
+      discriminator: [76, 144, 128, 239, 121, 210, 123, 39],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "target_account",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "create_voter_record",
+      discriminator: [3, 12, 113, 222, 177, 4, 152, 165],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "voter_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "export_position_type",
+      discriminator: [219, 172, 149, 212, 103, 230, 164, 179],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "config_account",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "rent",
+          address: "SysvarRent111111111111111111111111111111111",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "_position",
+          type: {
+            defined: {
+              name: "Position",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "init_config",
+      discriminator: [23, 235, 115, 232, 168, 96, 1, 231],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "config_account",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "rent",
+          address: "SysvarRent111111111111111111111111111111111",
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "global_config",
+          type: {
+            defined: {
+              name: "GlobalConfig",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "join_dao_llc",
+      docs: [
+        "* Accept to join the DAO LLC\n     * This must happen before create_position or update_voter_weight\n     * The user signs a hash of the agreement and the program checks that the hash matches the\n     * agreement",
+      ],
+      discriminator: [79, 241, 203, 177, 232, 143, 124, 14],
+      accounts: [
+        {
+          name: "owner",
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "_agreement_hash",
+          type: {
+            array: ["u8", 32],
+          },
+        },
+      ],
+    },
+    {
+      name: "merge_target_positions",
+      discriminator: [21, 136, 57, 2, 204, 219, 242, 141],
+      accounts: [
+        {
+          name: "owner",
+          docs: [
+            "CHECK : This AccountInfo is safe because it's checked against stake_account_metadata",
+          ],
+          writable: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "pool_authority",
+          signer: true,
+          optional: true,
+        },
+      ],
+      args: [
+        {
+          name: "target_with_parameters",
+          type: {
+            defined: {
+              name: "TargetWithParameters",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "recover_account",
+      docs: [
+        "Recovers a user's `stake account` ownership by transferring ownership\n     * from a token account to the `owner` of that token account.\n     *\n     * This functionality addresses the scenario where a user mistakenly\n     * created a stake account using their token account address as the owner.",
+      ],
+      discriminator: [240, 223, 246, 118, 26, 121, 34, 128],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "owner",
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "voter_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "request_split",
+      docs: [
+        "* Any user of the staking program can request to split their account and\n     * give a part of it to another user.\n     * This is mostly useful to transfer unvested tokens. Each user can only have one active\n     * request at a time.\n     * In the first step, the user requests a split by specifying the `amount` of tokens\n     * they want to give to the other user and the `recipient`'s pubkey.",
+      ],
+      discriminator: [133, 146, 228, 165, 251, 207, 146, 23],
+      accounts: [
+        {
+          name: "owner",
+          writable: true,
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "stake_account_metadata",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_split_request",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 112, 108, 105, 116, 95, 114, 101, 113, 117, 101, 115,
+                  116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [
+        {
+          name: "amount",
+          type: "u64",
+        },
+        {
+          name: "recipient",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "slash_account",
+      discriminator: [185, 97, 8, 208, 118, 205, 166, 2],
+      accounts: [
+        {
+          name: "pool_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "publisher",
+          docs: [
+            "CHECK : This AccountInfo is just used to construct the target that will get slashed",
+          ],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "governance_target_account",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "destination",
+          writable: true,
+        },
+        {
+          name: "custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+      ],
+      args: [
+        {
+          name: "slash_ratio",
+          type: "u64",
+        },
+      ],
+    },
+    {
+      name: "transfer_account",
+      docs: [
+        "Transfers a user's stake account to a new owner provided by the `governance_authority`.\n     *\n     * This functionality addresses the scenario where a user doesn't have access to their owner\n     * key. Only accounts without any staked tokens can be transferred.",
+      ],
+      discriminator: [219, 120, 55, 105, 3, 139, 205, 6],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "new_owner",
+          docs: [
+            "CHECK : A new arbitrary owner provided by the governance_authority",
+          ],
+        },
+        {
+          name: "stake_account_positions",
+          writable: true,
+        },
+        {
+          name: "stake_account_metadata",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "voter_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "update_agreement_hash",
+      discriminator: [86, 232, 181, 137, 158, 110, 129, 238],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "agreement_hash",
+          type: {
+            array: ["u8", 32],
+          },
+        },
+      ],
+    },
+    {
+      name: "update_governance_authority",
+      discriminator: [11, 185, 227, 55, 39, 32, 168, 14],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "new_authority",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "update_max_voter_weight",
+      discriminator: [248, 36, 229, 234, 11, 132, 145, 20],
+      accounts: [
+        {
+          name: "payer",
+          writable: true,
+          signer: true,
+        },
+        {
+          name: "max_voter_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [109, 97, 120, 95, 118, 111, 116, 101, 114],
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "system_program",
+          address: "11111111111111111111111111111111",
+        },
+      ],
+      args: [],
+    },
+    {
+      name: "update_pda_authority",
+      discriminator: [178, 112, 199, 196, 59, 40, 140, 61],
+      accounts: [
+        {
+          name: "pda_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "new_authority",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "update_pool_authority",
+      discriminator: [160, 162, 113, 9, 99, 187, 23, 239],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "pool_authority",
+          type: "pubkey",
+        },
+      ],
+    },
+    {
+      name: "update_token_list_time",
+      discriminator: [38, 217, 99, 222, 253, 253, 31, 83],
+      accounts: [
+        {
+          name: "governance_authority",
+          signer: true,
+          relations: ["config"],
+        },
+        {
+          name: "config",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "token_list_time",
+          type: {
+            option: "i64",
+          },
+        },
+      ],
+    },
+    {
+      name: "update_voter_weight",
+      discriminator: [92, 35, 133, 94, 230, 70, 14, 157],
+      accounts: [
+        {
+          name: "owner",
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "stake_account_metadata",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "voter_record",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "governance_target",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [116, 97, 114, 103, 101, 116],
+              },
+              {
+                kind: "const",
+                value: [118, 111, 116, 105, 110, 103],
+              },
+            ],
+          },
+        },
+      ],
+      args: [
+        {
+          name: "action",
+          type: {
+            defined: {
+              name: "VoterWeightAction",
+            },
+          },
+        },
+      ],
+    },
+    {
+      name: "withdraw_stake",
+      discriminator: [153, 8, 22, 138, 105, 176, 87, 66],
+      accounts: [
+        {
+          name: "owner",
+          signer: true,
+          relations: ["stake_account_metadata"],
+        },
+        {
+          name: "destination",
+          writable: true,
+        },
+        {
+          name: "stake_account_positions",
+        },
+        {
+          name: "stake_account_metadata",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [
+                  115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
+                  97,
+                ],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "stake_account_custody",
+          writable: true,
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 117, 115, 116, 111, 100, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "custody_authority",
+          docs: ["CHECK : This AccountInfo is safe because it's a checked PDA"],
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [97, 117, 116, 104, 111, 114, 105, 116, 121],
+              },
+              {
+                kind: "account",
+                path: "stake_account_positions",
+              },
+            ],
+          },
+        },
+        {
+          name: "config",
+          pda: {
+            seeds: [
+              {
+                kind: "const",
+                value: [99, 111, 110, 102, 105, 103],
+              },
+            ],
+          },
+        },
+        {
+          name: "token_program",
+          address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
+        },
+      ],
+      args: [
+        {
+          name: "amount",
+          type: "u64",
+        },
+      ],
+    },
+  ],
+  accounts: [
+    {
+      name: "GlobalConfig",
+      discriminator: [149, 8, 156, 202, 160, 252, 176, 217],
+    },
+    {
+      name: "MaxVoterWeightRecord",
+      discriminator: [157, 95, 242, 151, 16, 98, 26, 118],
+    },
+    {
+      name: "PositionData",
+      discriminator: [85, 195, 241, 79, 124, 192, 79, 11],
+    },
+    {
+      name: "SplitRequest",
+      discriminator: [80, 85, 187, 143, 62, 147, 234, 248],
+    },
+    {
+      name: "StakeAccountMetadataV2",
+      discriminator: [192, 51, 203, 19, 76, 177, 136, 97],
+    },
+    {
+      name: "TargetMetadata",
+      discriminator: [157, 23, 139, 117, 181, 44, 197, 130],
+    },
+    {
+      name: "VoterWeightRecord",
+      discriminator: [46, 249, 155, 75, 153, 248, 116, 9],
+    },
+  ],
+  errors: [
+    {
+      code: 6000,
+      name: "TooMuchExposureToIntegrityPool",
+      msg: "Too much exposure to integrity pool",
+    },
+    {
+      code: 6001,
+      name: "TooMuchExposureToGovernance",
+      msg: "Too much exposure to governance",
+    },
+    {
+      code: 6002,
+      name: "TokensNotYetVested",
+      msg: "Tokens not yet vested",
+    },
+    {
+      code: 6003,
+      name: "RiskLimitExceeded",
+      msg: "Risk limit exceeded",
+    },
+    {
+      code: 6004,
+      name: "TooManyPositions",
+      msg: "Number of position limit reached",
+    },
+    {
+      code: 6005,
+      name: "PositionNotInUse",
+      msg: "Position not in use",
+    },
+    {
+      code: 6006,
+      name: "CreatePositionWithZero",
+      msg: "New position needs to have positive balance",
+    },
+    {
+      code: 6007,
+      name: "ClosePositionWithZero",
+      msg: "Closing a position of 0 is not allowed",
+    },
+    {
+      code: 6008,
+      name: "InvalidPosition",
+      msg: "Invalid product/publisher pair",
+    },
+    {
+      code: 6009,
+      name: "AmountBiggerThanPosition",
+      msg: "Amount to unlock bigger than position",
+    },
+    {
+      code: 6010,
+      name: "AlreadyUnlocking",
+      msg: "Position already unlocking",
+    },
+    {
+      code: 6011,
+      name: "ZeroEpochDuration",
+      msg: "Epoch duration is 0",
+    },
+    {
+      code: 6012,
+      name: "WithdrawToUnauthorizedAccount",
+      msg: "Owner needs to own destination account",
+    },
+    {
+      code: 6013,
+      name: "InsufficientWithdrawableBalance",
+      msg: "Insufficient balance to cover the withdrawal",
+    },
+    {
+      code: 6014,
+      name: "WrongTarget",
+      msg: "Target in position doesn't match target in instruction data",
+    },
+    {
+      code: 6015,
+      name: "GenericOverflow",
+      msg: "An arithmetic operation unexpectedly overflowed",
+    },
+    {
+      code: 6016,
+      name: "NegativeBalance",
+      msg: "Locked balance must be positive",
+    },
+    {
+      code: 6017,
+      name: "Frozen",
+      msg: "Protocol is frozen",
+    },
+    {
+      code: 6018,
+      name: "DebuggingOnly",
+      msg: "Not allowed when not debugging",
+    },
+    {
+      code: 6019,
+      name: "ProposalTooLong",
+      msg: "Proposal too long",
+    },
+    {
+      code: 6020,
+      name: "InvalidVotingEpoch",
+      msg: "Voting epoch is either too old or hasn't started",
+    },
+    {
+      code: 6021,
+      name: "ProposalNotActive",
+      msg: "Voting hasn't started",
+    },
+    {
+      code: 6022,
+      name: "NoRemainingAccount",
+      msg: "Extra governance account required",
+    },
+    {
+      code: 6023,
+      name: "Unauthorized",
+      msg: "Unauthorized caller",
+    },
+    {
+      code: 6024,
+      name: "AccountUpgradeFailed",
+      msg: "Precondition to upgrade account violated",
+    },
+    {
+      code: 6025,
+      name: "NotImplemented",
+      msg: "Not implemented",
+    },
+    {
+      code: 6026,
+      name: "PositionSerDe",
+      msg: "Error deserializing position",
+    },
+    {
+      code: 6027,
+      name: "PositionOutOfBounds",
+      msg: "Position out of bounds",
+    },
+    {
+      code: 6028,
+      name: "VoteDuringTransferEpoch",
+      msg: "Can't vote during an account's transfer epoch",
+    },
+    {
+      code: 6029,
+      name: "NotLlcMember",
+      msg: "You need to be an LLC member to perform this action",
+    },
+    {
+      code: 6030,
+      name: "InvalidLlcAgreement",
+      msg: "Invalid LLC agreement",
+    },
+    {
+      code: 6031,
+      name: "SplitZeroTokens",
+      msg: "Can't split 0 tokens from an account",
+    },
+    {
+      code: 6032,
+      name: "SplitTooManyTokens",
+      msg: "Can't split more tokens than are in the account",
+    },
+    {
+      code: 6033,
+      name: "SplitWithStake",
+      msg: "Can't split a token account with staking positions. Unstake your tokens first.",
+    },
+    {
+      code: 6034,
+      name: "InvalidApproval",
+      msg: "The approval arguments do not match the split request.",
+    },
+    {
+      code: 6035,
+      name: "RecoverWithStake",
+      msg: "Can't recover account with staking positions. Unstake your tokens first.",
+    },
+    {
+      code: 6036,
+      name: "InvalidPoolAuthority",
+      msg: "The pool authority hasn't been passed or doesn't match the target",
+    },
+    {
+      code: 6037,
+      name: "MissingTargetAccount",
+      msg: "The target account is missing",
+    },
+    {
+      code: 6038,
+      name: "InvalidSlashRatio",
+      msg: "The slash ratio should be between 0 and 1",
+    },
+    {
+      code: 6039,
+      name: "UnexpectedTargetAccount",
+      msg: "The target account is only expected when dealing with the governance target",
+    },
+    {
+      code: 6040,
+      name: "Other",
+      msg: "Other",
+    },
+  ],
+  types: [
+    {
+      name: "GlobalConfig",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "bump",
+            type: "u8",
+          },
+          {
+            name: "governance_authority",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_token_mint",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_governance_realm",
+            type: "pubkey",
+          },
+          {
+            name: "removed_unlocking_duration",
+            type: "u8",
+          },
+          {
+            name: "epoch_duration",
+            type: "u64",
+          },
+          {
+            name: "freeze",
+            type: "bool",
+          },
+          {
+            name: "pda_authority",
+            type: "pubkey",
+          },
+          {
+            name: "governance_program",
+            type: "pubkey",
+          },
+          {
+            name: "pyth_token_list_time",
+            docs: [
+              "Once the pyth token is listed, governance can update the config to set this value.",
+              "Once this value is set, vesting schedules that depend on the token list date can start",
+              "vesting.",
+            ],
+            type: {
+              option: "i64",
+            },
+          },
+          {
+            name: "agreement_hash",
+            type: {
+              array: ["u8", 32],
+            },
+          },
+          {
+            name: "mock_clock_time",
+            type: "i64",
+          },
+          {
+            name: "pool_authority",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "MaxVoterWeightRecord",
+      docs: [
+        "Copied this struct from https://github.com/solana-labs/solana-program-library/blob/master/governance/addin-api/src/max_voter_weight.rs",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "realm",
+            docs: ["The Realm the MaxVoterWeightRecord belongs to"],
+            type: "pubkey",
+          },
+          {
+            name: "governing_token_mint",
+            docs: [
+              "Governing Token Mint the MaxVoterWeightRecord is associated with",
+              "Note: The addin can take deposits of any tokens and is not restricted to the community or",
+              "council tokens only",
+            ],
+            type: "pubkey",
+          },
+          {
+            name: "max_voter_weight",
+            docs: [
+              "Max voter weight",
+              "The max voter weight provided by the addin for the given realm and governing_token_mint",
+            ],
+            type: "u64",
+          },
+          {
+            name: "max_voter_weight_expiry",
+            docs: [
+              "The slot when the max voting weight expires",
+              "It should be set to None if the weight never expires",
+              "If the max vote weight decays with time, for example for time locked based weights, then",
+              "the expiry must be set As a pattern Revise instruction to update the max weight should",
+              "be invoked before governance instruction within the same transaction and the expiry set",
+              "to the current slot to provide up to date weight",
+            ],
+            type: {
+              option: "u64",
+            },
+          },
+          {
+            name: "reserved",
+            docs: ["Reserved space for future versions"],
+            type: {
+              array: ["u8", 8],
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "Position",
+      docs: [
+        "This represents a staking position, i.e. an amount that someone has staked to a particular",
+        "target. This is one of the core pieces of our staking design, and stores all",
+        "of the state related to a position The voting position is a position where the",
+        "target_with_parameters is VOTING",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "amount",
+            type: "u64",
+          },
+          {
+            name: "activation_epoch",
+            type: "u64",
+          },
+          {
+            name: "unlocking_start",
+            type: {
+              option: "u64",
+            },
+          },
+          {
+            name: "target_with_parameters",
+            type: {
+              defined: {
+                name: "TargetWithParameters",
+              },
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "PositionData",
+      docs: ["The header of DynamicPositionArray"],
+      serialization: "bytemuck",
+      repr: {
+        kind: "c",
+      },
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "owner",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "SplitRequest",
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "amount",
+            type: "u64",
+          },
+          {
+            name: "recipient",
+            type: "pubkey",
+          },
+        ],
+      },
+    },
+    {
+      name: "StakeAccountMetadataV2",
+      docs: [
+        "This is the metadata account for each staker",
+        'It is derived from the positions account with seeds "stake_metadata" and the positions account',
+        "pubkey It stores some PDA bumps, the owner of the account and the vesting schedule",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "metadata_bump",
+            type: "u8",
+          },
+          {
+            name: "custody_bump",
+            type: "u8",
+          },
+          {
+            name: "authority_bump",
+            type: "u8",
+          },
+          {
+            name: "voter_bump",
+            type: "u8",
+          },
+          {
+            name: "owner",
+            type: "pubkey",
+          },
+          {
+            name: "lock",
+            type: {
+              defined: {
+                name: "VestingSchedule",
+              },
+            },
+          },
+          {
+            name: "next_index",
+            type: "u8",
+          },
+          {
+            name: "_deprecated",
+            type: {
+              option: "u64",
+            },
+          },
+          {
+            name: "signed_agreement_hash",
+            type: {
+              option: {
+                array: ["u8", 32],
+              },
+            },
+          },
+        ],
+      },
+    },
+    {
+      name: "TargetMetadata",
+      docs: [
+        "This represents a target that users can stake to",
+        "Currently we store the last time the target account was updated, the current locked balance",
+        "and the amount by which the locked balance will change in the next epoch",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "bump",
+            type: "u8",
+          },
+          {
+            name: "last_update_at",
+            type: "u64",
+          },
+          {
+            name: "prev_epoch_locked",
+            type: "u64",
+          },
+          {
+            name: "locked",
+            type: "u64",
+          },
+          {
+            name: "delta_locked",
+            type: "i64",
+          },
+        ],
+      },
+    },
+    {
+      name: "TargetWithParameters",
+      type: {
+        kind: "enum",
+        variants: [
+          {
+            name: "Voting",
+          },
+          {
+            name: "IntegrityPool",
+            fields: [
+              {
+                name: "publisher",
+                type: "pubkey",
+              },
+            ],
+          },
+        ],
+      },
+    },
+    {
+      name: "VestingSchedule",
+      docs: [
+        "Represents how a given initial balance vests over time",
+        "It is unit-less, but units must be consistent",
+      ],
+      repr: {
+        kind: "rust",
+      },
+      type: {
+        kind: "enum",
+        variants: [
+          {
+            name: "FullyVested",
+          },
+          {
+            name: "PeriodicVesting",
+            fields: [
+              {
+                name: "initial_balance",
+                type: "u64",
+              },
+              {
+                name: "start_date",
+                type: "i64",
+              },
+              {
+                name: "period_duration",
+                type: "u64",
+              },
+              {
+                name: "num_periods",
+                type: "u64",
+              },
+            ],
+          },
+          {
+            name: "PeriodicVestingAfterListing",
+            fields: [
+              {
+                name: "initial_balance",
+                type: "u64",
+              },
+              {
+                name: "period_duration",
+                type: "u64",
+              },
+              {
+                name: "num_periods",
+                type: "u64",
+              },
+            ],
+          },
+        ],
+      },
+    },
+    {
+      name: "VoterWeightAction",
+      docs: ["The governance action VoterWeight is evaluated for"],
+      type: {
+        kind: "enum",
+        variants: [
+          {
+            name: "CastVote",
+          },
+          {
+            name: "CommentProposal",
+          },
+          {
+            name: "CreateGovernance",
+          },
+          {
+            name: "CreateProposal",
+          },
+          {
+            name: "SignOffProposal",
+          },
+        ],
+      },
+    },
+    {
+      name: "VoterWeightRecord",
+      docs: [
+        "Copied this struct from https://github.com/solana-labs/solana-program-library/blob/master/governance/addin-api/src/voter_weight.rs",
+        "Anchor has a macro (vote_weight_record) that is supposed to generate this struct, but it doesn't",
+        "work because the error's macros are not updated for anchor 0.22.0.",
+        "Even if it did work, the type wouldn't show up in the IDL. SPL doesn't produce an API, which",
+        "means that means we'd need the equivalent of this code on the client side.",
+        "If Anchor fixes the macro, we might consider changing it",
+      ],
+      type: {
+        kind: "struct",
+        fields: [
+          {
+            name: "realm",
+            docs: [
+              'VoterWeightRecord discriminator sha256("account:VoterWeightRecord")[..8]',
+              "Note: The discriminator size must match the addin implementing program discriminator size",
+              "to ensure it's stored in the private space of the account data and it's unique",
+              "pub account_discriminator: [u8; 8],",
+              "The Realm the VoterWeightRecord belongs to",
+            ],
+            type: "pubkey",
+          },
+          {
+            name: "governing_token_mint",
+            docs: [
+              "Governing Token Mint the VoterWeightRecord is associated with",
+              "Note: The addin can take deposits of any tokens and is not restricted to the community or",
+              "council tokens only",
+            ],
+            type: "pubkey",
+          },
+          {
+            name: "governing_token_owner",
+            docs: [
+              "The owner of the governing token and voter",
+              "This is the actual owner (voter) and corresponds to TokenOwnerRecord.governing_token_owner",
+            ],
+            type: "pubkey",
+          },
+          {
+            name: "voter_weight",
+            docs: [
+              "Voter's weight",
+              "The weight of the voter provided by the addin for the given realm, governing_token_mint and",
+              "governing_token_owner (voter)",
+            ],
+            type: "u64",
+          },
+          {
+            name: "voter_weight_expiry",
+            docs: [
+              "The slot when the voting weight expires",
+              "It should be set to None if the weight never expires",
+              "If the voter weight decays with time, for example for time locked based weights, then the",
+              "expiry must be set As a common pattern Revise instruction to update the weight should",
+              "be invoked before governance instruction within the same transaction and the expiry set",
+              "to the current slot to provide up to date weight",
+            ],
+            type: {
+              option: "u64",
+            },
+          },
+          {
+            name: "weight_action",
+            docs: [
+              "The governance action the voter's weight pertains to",
+              "It allows to provided voter's weight specific to the particular action the weight is",
+              "evaluated for When the action is provided then the governance program asserts the",
+              "executing action is the same as specified by the addin",
+            ],
+            type: {
+              option: {
+                defined: {
+                  name: "VoterWeightAction",
+                },
+              },
+            },
+          },
+          {
+            name: "weight_action_target",
+            docs: [
+              "The target the voter's weight  action pertains to",
+              "It allows to provided voter's weight specific to the target the weight is evaluated for",
+              "For example when addin supplies weight to vote on a particular proposal then it must",
+              "specify the proposal as the action target When the target is provided then the",
+              "governance program asserts the target is the same as specified by the addin",
+            ],
+            type: {
+              option: "pubkey",
+            },
+          },
+          {
+            name: "reserved",
+            docs: ["Reserved space for future versions"],
+            type: {
+              array: ["u8", 8],
+            },
+          },
+        ],
+      },
+    },
+  ],
+};

+ 6 - 6
governance/pyth_staking_sdk/src/pyth-staking-client.ts

@@ -31,9 +31,9 @@ import {
   ONE_YEAR_IN_SECONDS,
   POSITIONS_ACCOUNT_SIZE,
 } from "./constants.js";
-import IntegrityPoolIdl from "./idl/integrity-pool.json" with { type: "json" };
-import PublisherCapsIdl from "./idl/publisher-caps.json" with { type: "json" };
-import StakingIdl from "./idl/staking.json" with { type: "json" };
+import { INTEGRITY_POOL } from "./idl/integrity-pool.js";
+import { PUBLISHER_CAPS } from "./idl/publisher-caps.js";
+import { STAKING_IDK } from "./idl/staking.js";
 import {
   getConfigAddress,
   getDelegationRecordAddress,
@@ -91,13 +91,13 @@ export class PythStakingClient {
     this.provider = new AnchorProvider(this.connection, this.wallet, {
       skipPreflight: true,
     });
-    this.stakingProgram = new Program(StakingIdl as Staking, this.provider);
+    this.stakingProgram = new Program(STAKING_IDK as Staking, this.provider);
     this.integrityPoolProgram = new Program(
-      IntegrityPoolIdl as IntegrityPool,
+      INTEGRITY_POOL as IntegrityPool,
       this.provider,
     );
     this.publisherCapsProgram = new Program(
-      PublisherCapsIdl as PublisherCaps,
+      PUBLISHER_CAPS as PublisherCaps,
       this.provider,
     );
   }

+ 2 - 2
governance/pyth_staking_sdk/src/pythnet-client.ts

@@ -7,7 +7,7 @@ import {
 } from "@pythnetwork/client";
 import { Connection } from "@solana/web3.js";
 
-import StakeCapsParametersIdl from "./idl/stake-caps-parameters.json" with { type: "json" };
+import { STAKE_CAPS_PARAMETERS } from "./idl/stake-caps-parameters.js";
 import { getStakeCapsParametersAddress } from "./pdas.js";
 import type { StakeCapsParameters } from "./types/stake-caps-parameters.js";
 import { convertBNToBigInt } from "./utils/bn.js";
@@ -21,7 +21,7 @@ export class PythnetClient {
     this.connection = connection;
     this.provider = new AnchorProvider(connection, DummyWallet);
     this.stakeCapParametersProgram = new Program<StakeCapsParameters>(
-      StakeCapsParametersIdl as StakeCapsParameters,
+      STAKE_CAPS_PARAMETERS as StakeCapsParameters,
       this.provider,
     );
   }

+ 10 - 0
governance/pyth_staking_sdk/tsconfig.build.json

@@ -0,0 +1,10 @@
+{
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "declaration": true,
+    "incremental": false,
+    "noEmit": false,
+    "verbatimModuleSyntax": false
+  },
+  "exclude": ["dist", "node_modules"]
+}

+ 1 - 1
governance/pyth_staking_sdk/tsconfig.json

@@ -1,4 +1,4 @@
 {
-  "extends": "@cprussin/tsconfig/base.json",
+  "extends": "@cprussin/tsconfig/nextjs.json",
   "exclude": ["node_modules", "dist"]
 }

+ 5 - 5
lazer/sdk/js-solana/package.json

@@ -56,27 +56,27 @@
   "exports": {
     "./ed25519": {
       "import": "./dist/esm/ed25519.js",
-      "types": "./dist/cjs/ed25519.d.ts",
+      "types": "./dist/esm/ed25519.d.ts",
       "require": "./dist/cjs/ed25519.js"
     },
     "./idl/pyth-lazer-solana-contract-data": {
       "import": "./dist/esm/idl/pyth-lazer-solana-contract-data.js",
-      "types": "./dist/cjs/idl/pyth-lazer-solana-contract-data.d.ts",
+      "types": "./dist/esm/idl/pyth-lazer-solana-contract-data.d.ts",
       "require": "./dist/cjs/idl/pyth-lazer-solana-contract-data.js"
     },
     "./idl/pyth-lazer-solana-contract": {
       "import": "./dist/esm/idl/pyth-lazer-solana-contract.js",
-      "types": "./dist/cjs/idl/pyth-lazer-solana-contract.d.ts",
+      "types": "./dist/esm/idl/pyth-lazer-solana-contract.d.ts",
       "require": "./dist/cjs/idl/pyth-lazer-solana-contract.js"
     },
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }

+ 11 - 11
lazer/sdk/js/package.json

@@ -62,57 +62,57 @@
   "exports": {
     "./client": {
       "import": "./dist/esm/client.js",
-      "types": "./dist/cjs/client.d.ts",
+      "types": "./dist/esm/client.d.ts",
       "require": "./dist/cjs/client.js"
     },
     "./constants": {
       "import": "./dist/esm/constants.js",
-      "types": "./dist/cjs/constants.d.ts",
+      "types": "./dist/esm/constants.d.ts",
       "require": "./dist/cjs/constants.js"
     },
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./protocol": {
       "import": "./dist/esm/protocol.js",
-      "types": "./dist/cjs/protocol.d.ts",
+      "types": "./dist/esm/protocol.d.ts",
       "require": "./dist/cjs/protocol.js"
     },
     "./socket/resilient-websocket": {
       "import": "./dist/esm/socket/resilient-websocket.js",
-      "types": "./dist/cjs/socket/resilient-websocket.d.ts",
+      "types": "./dist/esm/socket/resilient-websocket.d.ts",
       "require": "./dist/cjs/socket/resilient-websocket.js"
     },
     "./socket/websocket-pool": {
       "import": "./dist/esm/socket/websocket-pool.js",
-      "types": "./dist/cjs/socket/websocket-pool.d.ts",
+      "types": "./dist/esm/socket/websocket-pool.d.ts",
       "require": "./dist/cjs/socket/websocket-pool.js"
     },
     "./util/buffer-util": {
       "import": "./dist/esm/util/buffer-util.js",
-      "types": "./dist/cjs/util/buffer-util.d.ts",
+      "types": "./dist/esm/util/buffer-util.d.ts",
       "require": "./dist/cjs/util/buffer-util.js"
     },
     "./util/env-util": {
       "import": "./dist/esm/util/env-util.js",
-      "types": "./dist/cjs/util/env-util.d.ts",
+      "types": "./dist/esm/util/env-util.d.ts",
       "require": "./dist/cjs/util/env-util.js"
     },
     "./util": {
       "import": "./dist/esm/util/index.js",
-      "types": "./dist/cjs/util/index.d.ts",
+      "types": "./dist/esm/util/index.d.ts",
       "require": "./dist/cjs/util/index.js"
     },
     "./util/url-util": {
       "import": "./dist/esm/util/url-util.js",
-      "types": "./dist/cjs/util/url-util.d.ts",
+      "types": "./dist/esm/util/url-util.d.ts",
       "require": "./dist/cjs/util/url-util.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }

+ 1 - 0
packages/build-ts-package/package.json

@@ -21,6 +21,7 @@
     "type-fest": "catalog:"
   },
   "dependencies": {
+    "chalk": "^5.6.2",
     "fast-glob": "^3.3.3",
     "fs-extra": "^11.3.2",
     "typescript": "catalog:",

+ 99 - 78
packages/build-ts-package/src/build-ts-package.js

@@ -9,6 +9,8 @@ import { hideBin } from "yargs/helpers";
 import { findTsconfigFile } from "./find-tsconfig-file.js";
 import { execAsync } from "./exec-async.js";
 import { generateTsconfigs } from "./generate-tsconfigs.js";
+import { Logger } from "./logger.js";
+import chalk from "chalk";
 
 /**
  * @typedef {'cjs' | 'esm'} ModuleType
@@ -111,91 +113,110 @@ export async function buildTsPackage(argv = process.argv) {
   // always freshly reset the exports and let the tool take over
   pjson.exports = {};
 
-  console.info("building package", pjson.name);
+  Logger.info("building package", chalk.magenta(pjson.name));
   for (const format of formats) {
-    console.info(`building ${format} variant in ${cwd}`);
-    console.info(`  tsconfig: ${tsconfig}`);
-
-    const outDir = numFormats <= 1 ? outDirPath : path.join(outDirPath, format);
-
-    let cmd =
-      `pnpm tsc --project ${tsconfig} --outDir ${outDir} --declaration ${!noDts} --module ${format === "cjs" ? "commonjs" : "esnext"} --target esnext --resolveJsonModule false ${format === "cjs" ? "--moduleResolution node" : ""}`.trim();
-    if (watch) cmd += ` --watch`;
-
-    await execAsync(cmd, { cwd, stdio: "inherit", verbose: true });
-
-    const builtFiles = (
-      await glob(
-        [
-          path.join(outDir, "**", "*.d.ts"),
-          path.join(outDir, "**", "*.js"),
-          path.join(outDir, "**", "*.cjs"),
-          path.join(outDir, "**", "*.mjs"),
-        ],
-        { absolute: true, onlyFiles: true },
+    try {
+      Logger.info("building", chalk.magenta(format), "variant in", cwd);
+      Logger.info("  tsconfig", chalk.magenta(tsconfig));
+
+      const outDir =
+        numFormats <= 1 ? outDirPath : path.join(outDirPath, format);
+
+      let cmd =
+        `pnpm tsc --project ${tsconfig} --outDir ${outDir} --declaration ${!noDts} --module ${format === "cjs" ? "nodenext" : "esnext"} --target esnext --resolveJsonModule false ${format === "cjs" ? "--moduleResolution nodenext" : ""}`.trim();
+      if (watch) cmd += ` --watch`;
+
+      await execAsync(cmd, { cwd, stdio: "inherit", verbose: true });
+
+      const builtFiles = (
+        await glob(
+          [
+            path.join(outDir, "**", "*.d.ts"),
+            path.join(outDir, "**", "*.js"),
+            path.join(outDir, "**", "*.cjs"),
+            path.join(outDir, "**", "*.mjs"),
+          ],
+          { absolute: true, onlyFiles: true },
+        )
       )
-    )
-      .map((fp) => {
-        const relPath = path.relative(outDir, fp);
-        if (numFormats <= 1) return `.${path.sep}${relPath}`;
-        return `.${path.sep}${path.join(format, relPath)}`;
-      })
-      .sort();
-
-    const indexFile = builtFiles.find((fp) => {
-      const r = /^\.(\/|\\)((cjs|esm)(\/|\\))?index\.(c|m)?js$/;
-      return r.test(fp);
-    });
-
-    if (indexFile) {
-      console.info("index file detected");
-      if (format === "esm" || numFormats <= 1) {
-        pjson.types = indexFile.replace(path.extname(indexFile), ".d.ts");
+        .map((fp) => {
+          const relPath = path.relative(outDir, fp);
+          if (numFormats <= 1) return `.${path.sep}${relPath}`;
+          return `.${path.sep}${path.join(format, relPath)}`;
+        })
+        .sort();
+
+      const indexFile = builtFiles.find((fp) => {
+        const r = /^\.(\/|\\)((cjs|esm)(\/|\\))?index\.(c|m)?js$/;
+        return r.test(fp);
+      });
+
+      if (indexFile) {
+        Logger.info("index file detected");
+        if (format === "cjs" || numFormats <= 1) {
+          // we use the legacy type of typing exports for the top-level
+          // typings
+          pjson.types = indexFile.replace(path.extname(indexFile), ".d.ts");
+        }
+        if (format === "esm") {
+          pjson.module = indexFile;
+        } else {
+          pjson.main = indexFile;
+        }
       }
-      if (format === "esm") {
-        pjson.module = indexFile;
-      } else {
-        pjson.main = indexFile;
-      }
-    }
 
-    const exports =
-      Array.isArray(pjson.exports) || typeof pjson.exports === "string"
-        ? {}
-        : (pjson.exports ?? {});
-
-    const outDirBasename = path.basename(outDirPath);
-
-    for (const fp of builtFiles) {
-      const fpWithNoExt = fp
-        .replace(/(\.d)?\.(c|m)?(js|ts)$/, "")
-        .replaceAll(/\\/g, "/");
-      const key = fpWithNoExt
-        .replace(/(\/|\\)?index$/, "")
-        .replace(/^\.(\/|\\)(cjs|esm)/, ".")
-        .replaceAll(/\\/g, "/");
-      const fpWithBasename = `./${path
-        .join(outDirBasename, fp)
-        .replaceAll(/\\/g, "/")}`;
-
-      // Ensure key object exists
-      const tempExports = exports[key] ?? {};
-
-      // Add require/import entry without nuking the other
-      if (format === "cjs") {
-        tempExports.require = fpWithBasename;
-      } else {
-        tempExports.import = fpWithBasename;
+      const exports =
+        Array.isArray(pjson.exports) || typeof pjson.exports === "string"
+          ? {}
+          : (pjson.exports ?? {});
+
+      const outDirBasename = path.basename(outDirPath);
+
+      for (const fp of builtFiles) {
+        const fpWithNoExt = fp
+          .replace(/(\.d)?\.(c|m)?(js|ts)$/, "")
+          .replaceAll(/\\/g, "/");
+        const key = fpWithNoExt
+          .replace(/(\/|\\)?index$/, "")
+          .replace(/^\.(\/|\\)(cjs|esm)/, ".")
+          .replaceAll(/\\/g, "/");
+        const fpWithBasename = `./${path
+          .join(outDirBasename, fp)
+          .replaceAll(/\\/g, "/")}`;
+
+        // Ensure key object exists
+        const tempExports = exports[key] ?? {};
+
+        // Add require/import entry without nuking the other
+        if (format === "cjs") {
+          tempExports.require = fpWithBasename;
+        } else {
+          tempExports.import = fpWithBasename;
+        }
+
+        // Also handle types if present
+        if (
+          (format === "esm" || numFormats <= 1) &&
+          !noDts &&
+          fp.endsWith(".d.ts")
+        ) {
+          tempExports.types = fpWithBasename;
+        }
+        exports[key] = tempExports;
       }
 
-      // Also handle types if present
-      if (!noDts && fp.endsWith(".d.ts")) {
-        tempExports.types = fpWithBasename;
-      }
-      exports[key] = tempExports;
+      pjson.exports = exports;
+
+      Logger.info(chalk.green(`${pjson.name} - ${format} has been built!`));
+    } catch (error) {
+      Logger.error(
+        "**building",
+        pjson.name,
+        chalk.underline(format),
+        "variant has failed**",
+      );
+      throw error;
     }
-
-    pjson.exports = exports;
   }
 
   pjson.exports["./package.json"] = "./package.json";

+ 46 - 0
packages/build-ts-package/src/logger.js

@@ -0,0 +1,46 @@
+import chalk from "chalk";
+
+/**
+ * @typedef {import('chalk').ColorName} ColorName
+ */
+
+/**
+ * @typedef {'error' | 'info' | 'warn'} LogLevel
+ */
+
+export const Logger = {
+  /**
+   * Prints a message to the console in whatever color your heart desires ❤️
+   *
+   * @param {ColorName} color
+   * @param {LogLevel} level
+   * @param  {...any} msg
+   */
+  colorful(color, level, ...msg) {
+    console[level](chalk[color](...msg));
+  },
+  /**
+   * Logs an error message
+   *
+   * @param  {...any} msg
+   */
+  error(...msg) {
+    console.error(chalk.red(...msg));
+  },
+  /**
+   * Logs an info message
+   *
+   * @param  {...any} msg
+   */
+  info(...msg) {
+    console.info(chalk.blue(...msg));
+  },
+  /**
+   * Logs a warning message
+   *
+   * @param  {...any} msg
+   */
+  warn(...msg) {
+    console.warn(chalk.yellow(...msg));
+  },
+};

+ 13 - 10
pnpm-lock.yaml

@@ -2163,6 +2163,9 @@ importers:
 
   packages/build-ts-package:
     dependencies:
+      chalk:
+        specifier: ^5.6.2
+        version: 5.6.2
       fast-glob:
         specifier: ^3.3.3
         version: 3.3.3
@@ -13050,8 +13053,8 @@ packages:
     resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
     engines: {node: '>=10'}
 
-  chalk@5.4.1:
-    resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
+  chalk@5.6.2:
+    resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==}
     engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
 
   change-case@4.1.2:
@@ -33216,36 +33219,36 @@ snapshots:
 
   '@solana/errors@2.0.0(typescript@4.9.5)':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
       typescript: 4.9.5
 
   '@solana/errors@2.0.0(typescript@5.9.3)':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
       typescript: 5.9.3
 
   '@solana/errors@2.0.0-preview.2':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
 
   '@solana/errors@2.0.0-rc.1(typescript@4.9.5)':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
       typescript: 4.9.5
 
   '@solana/errors@2.0.0-rc.1(typescript@5.9.3)':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
       typescript: 5.9.3
 
   '@solana/errors@2.1.0(typescript@5.9.3)':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 13.1.0
       typescript: 5.9.3
 
@@ -37510,7 +37513,7 @@ snapshots:
 
   '@wallet-standard/errors@0.1.0':
     dependencies:
-      chalk: 5.4.1
+      chalk: 5.6.2
       commander: 12.1.0
 
   '@wallet-standard/features@1.1.0':
@@ -39562,7 +39565,7 @@ snapshots:
       ansi-styles: 4.3.0
       supports-color: 7.2.0
 
-  chalk@5.4.1: {}
+  chalk@5.6.2: {}
 
   change-case@4.1.2:
     dependencies:

+ 5 - 5
price_service/sdk/js/package.json

@@ -57,27 +57,27 @@
   "exports": {
     "./AccumulatorUpdateData": {
       "import": "./dist/esm/AccumulatorUpdateData.js",
-      "types": "./dist/cjs/AccumulatorUpdateData.d.ts",
+      "types": "./dist/esm/AccumulatorUpdateData.d.ts",
       "require": "./dist/cjs/AccumulatorUpdateData.js"
     },
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./schemas/PriceFeed": {
       "import": "./dist/esm/schemas/PriceFeed.js",
-      "types": "./dist/cjs/schemas/PriceFeed.d.ts",
+      "types": "./dist/esm/schemas/PriceFeed.d.ts",
       "require": "./dist/cjs/schemas/PriceFeed.js"
     },
     "./types": {
       "import": "./dist/esm/types.js",
-      "types": "./dist/cjs/types.d.ts",
+      "types": "./dist/esm/types.d.ts",
       "require": "./dist/cjs/types.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }

+ 4 - 4
target_chains/solana/sdk/js/solana_utils/package.json

@@ -56,23 +56,23 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js",
   "exports": {
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./jito": {
       "import": "./dist/esm/jito.js",
-      "types": "./dist/cjs/jito.d.ts",
+      "types": "./dist/esm/jito.d.ts",
       "require": "./dist/cjs/jito.js"
     },
     "./transaction": {
       "import": "./dist/esm/transaction.js",
-      "types": "./dist/cjs/transaction.d.ts",
+      "types": "./dist/esm/transaction.d.ts",
       "require": "./dist/cjs/transaction.js"
     },
     "./package.json": "./package.json"

+ 4 - 4
target_chains/starknet/sdk/js/package.json

@@ -54,22 +54,22 @@
   "exports": {
     "./abi/erc20": {
       "import": "./dist/esm/abi/erc20.js",
-      "types": "./dist/cjs/abi/erc20.d.ts",
+      "types": "./dist/esm/abi/erc20.d.ts",
       "require": "./dist/cjs/abi/erc20.js"
     },
     "./abi/pyth": {
       "import": "./dist/esm/abi/pyth.js",
-      "types": "./dist/cjs/abi/pyth.d.ts",
+      "types": "./dist/esm/abi/pyth.d.ts",
       "require": "./dist/cjs/abi/pyth.js"
     },
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }

+ 2 - 2
target_chains/ton/sdk/js/package.json

@@ -56,12 +56,12 @@
   "exports": {
     ".": {
       "import": "./dist/esm/index.js",
-      "types": "./dist/cjs/index.d.ts",
+      "types": "./dist/esm/index.d.ts",
       "require": "./dist/cjs/index.js"
     },
     "./package.json": "./package.json"
   },
-  "types": "./esm/index.d.ts",
+  "types": "./cjs/index.d.ts",
   "module": "./esm/index.js",
   "main": "./cjs/index.js"
 }