Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion governance/pyth_staking_sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/staking-sdk",
"version": "0.2.2",
"version": "0.2.3",
"description": "Pyth staking SDK",
"type": "module",
"exports": {
Expand Down
75 changes: 74 additions & 1 deletion governance/pyth_staking_sdk/src/idl/staking.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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],
Expand Down
15 changes: 15 additions & 0 deletions governance/pyth_staking_sdk/src/pyth-staking-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,21 @@ export class PythStakingClient {
.instruction();
}

public async getTransferAccountInstruction(
stakeAccountPositions: PublicKey,
governanceAuthority: PublicKey,
newOwner: PublicKey,
): Promise<TransactionInstruction> {
return this.stakingProgram.methods
.transferAccount()
.accountsPartial({
stakeAccountPositions,
governanceAuthority,
newOwner,
})
.instruction();
}

public async getUpdatePoolAuthorityInstruction(
governanceAuthority: PublicKey,
poolAuthority: PublicKey,
Expand Down
98 changes: 97 additions & 1 deletion governance/pyth_staking_sdk/src/types/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Expand Down Expand Up @@ -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];
Expand Down
Loading