diff --git a/governance/pyth_staking_sdk/package.json b/governance/pyth_staking_sdk/package.json index a9b2a0b3da..5d476b1b7f 100644 --- a/governance/pyth_staking_sdk/package.json +++ b/governance/pyth_staking_sdk/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/staking-sdk", - "version": "0.2.2", + "version": "0.2.3", "description": "Pyth staking SDK", "type": "module", "exports": { diff --git a/governance/pyth_staking_sdk/src/idl/staking.json b/governance/pyth_staking_sdk/src/idl/staking.json index 3e3cd67643..b618416d3d 100644 --- a/governance/pyth_staking_sdk/src/idl/staking.json +++ b/governance/pyth_staking_sdk/src/idl/staking.json @@ -2,7 +2,7 @@ "address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ", "metadata": { "name": "staking", - "version": "2.0.0", + "version": "2.1.0", "spec": "0.1.0", "description": "Created with Anchor" }, @@ -1120,6 +1120,79 @@ } ] }, + { + "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], diff --git a/governance/pyth_staking_sdk/src/pyth-staking-client.ts b/governance/pyth_staking_sdk/src/pyth-staking-client.ts index 809c7ba53a..e3ed66eb6f 100644 --- a/governance/pyth_staking_sdk/src/pyth-staking-client.ts +++ b/governance/pyth_staking_sdk/src/pyth-staking-client.ts @@ -902,6 +902,21 @@ export class PythStakingClient { .instruction(); } + public async getTransferAccountInstruction( + stakeAccountPositions: PublicKey, + governanceAuthority: PublicKey, + newOwner: PublicKey, + ): Promise { + return this.stakingProgram.methods + .transferAccount() + .accountsPartial({ + stakeAccountPositions, + governanceAuthority, + newOwner, + }) + .instruction(); + } + public async getUpdatePoolAuthorityInstruction( governanceAuthority: PublicKey, poolAuthority: PublicKey, diff --git a/governance/pyth_staking_sdk/src/types/staking.ts b/governance/pyth_staking_sdk/src/types/staking.ts index d1493cc464..b12ee48f72 100644 --- a/governance/pyth_staking_sdk/src/types/staking.ts +++ b/governance/pyth_staking_sdk/src/types/staking.ts @@ -8,7 +8,7 @@ export type Staking = { address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ"; metadata: { name: "staking"; - version: "2.0.0"; + version: "2.1.0"; spec: "0.1.0"; description: "Created with Anchor"; }; @@ -1296,6 +1296,102 @@ export type Staking = { }, ]; }, + { + name: "transferAccount"; + 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: "governanceAuthority"; + signer: true; + relations: ["config"]; + }, + { + name: "newOwner"; + docs: [ + "CHECK : A new arbitrary owner provided by the governance_authority", + ]; + }, + { + name: "stakeAccountPositions"; + writable: true; + }, + { + name: "stakeAccountMetadata"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 115, + 116, + 97, + 107, + 101, + 95, + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97, + ]; + }, + { + kind: "account"; + path: "stakeAccountPositions"; + }, + ]; + }; + }, + { + name: "voterRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 118, + 111, + 116, + 101, + 114, + 95, + 119, + 101, + 105, + 103, + 104, + 116, + ]; + }, + { + kind: "account"; + path: "stakeAccountPositions"; + }, + ]; + }; + }, + { + name: "config"; + pda: { + seeds: [ + { + kind: "const"; + value: [99, 111, 110, 102, 105, 103]; + }, + ]; + }; + }, + ]; + args: []; + }, { name: "updateAgreementHash"; discriminator: [86, 232, 181, 137, 158, 110, 129, 238];