From d3f08e2381462ec4e70cadf85933060c6cef530b Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 22 May 2025 15:33:19 +0100 Subject: [PATCH 1/3] chore: bump sdks --- .../pyth_staking_sdk/src/idl/staking.json | 75 +++++++++++++- .../pyth_staking_sdk/src/types/staking.ts | 98 ++++++++++++++++++- 2 files changed, 171 insertions(+), 2 deletions(-) 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/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]; From ca725eb623450fe6398f8f9848dd8d7b4dfc82e3 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 23 May 2025 15:11:37 +0100 Subject: [PATCH 2/3] add transfer account --- .../pyth_staking_sdk/src/pyth-staking-client.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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, From 357cc92e5c1c44f772b6f7e2124d1e14d4aceff2 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 30 May 2025 12:27:45 +0100 Subject: [PATCH 3/3] commit --- governance/pyth_staking_sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": {