Skip to content

Commit 8aef9af

Browse files
authored
chore: bump pyth staking sdk (#2724)
* chore: bump sdks * add transfer account * commit
1 parent c9f4aa1 commit 8aef9af

File tree

4 files changed

+187
-3
lines changed

4 files changed

+187
-3
lines changed

governance/pyth_staking_sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/staking-sdk",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "Pyth staking SDK",
55
"type": "module",
66
"exports": {

governance/pyth_staking_sdk/src/idl/staking.json

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"address": "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ",
33
"metadata": {
44
"name": "staking",
5-
"version": "2.0.0",
5+
"version": "2.1.0",
66
"spec": "0.1.0",
77
"description": "Created with Anchor"
88
},
@@ -1120,6 +1120,79 @@
11201120
}
11211121
]
11221122
},
1123+
{
1124+
"name": "transfer_account",
1125+
"docs": [
1126+
"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."
1127+
],
1128+
"discriminator": [219, 120, 55, 105, 3, 139, 205, 6],
1129+
"accounts": [
1130+
{
1131+
"name": "governance_authority",
1132+
"signer": true,
1133+
"relations": ["config"]
1134+
},
1135+
{
1136+
"name": "new_owner",
1137+
"docs": [
1138+
"CHECK : A new arbitrary owner provided by the governance_authority"
1139+
]
1140+
},
1141+
{
1142+
"name": "stake_account_positions",
1143+
"writable": true
1144+
},
1145+
{
1146+
"name": "stake_account_metadata",
1147+
"writable": true,
1148+
"pda": {
1149+
"seeds": [
1150+
{
1151+
"kind": "const",
1152+
"value": [
1153+
115, 116, 97, 107, 101, 95, 109, 101, 116, 97, 100, 97, 116,
1154+
97
1155+
]
1156+
},
1157+
{
1158+
"kind": "account",
1159+
"path": "stake_account_positions"
1160+
}
1161+
]
1162+
}
1163+
},
1164+
{
1165+
"name": "voter_record",
1166+
"writable": true,
1167+
"pda": {
1168+
"seeds": [
1169+
{
1170+
"kind": "const",
1171+
"value": [
1172+
118, 111, 116, 101, 114, 95, 119, 101, 105, 103, 104, 116
1173+
]
1174+
},
1175+
{
1176+
"kind": "account",
1177+
"path": "stake_account_positions"
1178+
}
1179+
]
1180+
}
1181+
},
1182+
{
1183+
"name": "config",
1184+
"pda": {
1185+
"seeds": [
1186+
{
1187+
"kind": "const",
1188+
"value": [99, 111, 110, 102, 105, 103]
1189+
}
1190+
]
1191+
}
1192+
}
1193+
],
1194+
"args": []
1195+
},
11231196
{
11241197
"name": "update_agreement_hash",
11251198
"discriminator": [86, 232, 181, 137, 158, 110, 129, 238],

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,21 @@ export class PythStakingClient {
902902
.instruction();
903903
}
904904

905+
public async getTransferAccountInstruction(
906+
stakeAccountPositions: PublicKey,
907+
governanceAuthority: PublicKey,
908+
newOwner: PublicKey,
909+
): Promise<TransactionInstruction> {
910+
return this.stakingProgram.methods
911+
.transferAccount()
912+
.accountsPartial({
913+
stakeAccountPositions,
914+
governanceAuthority,
915+
newOwner,
916+
})
917+
.instruction();
918+
}
919+
905920
public async getUpdatePoolAuthorityInstruction(
906921
governanceAuthority: PublicKey,
907922
poolAuthority: PublicKey,

governance/pyth_staking_sdk/src/types/staking.ts

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type Staking = {
88
address: "pytS9TjG1qyAZypk7n8rw8gfW9sUaqqYyMhJQ4E7JCQ";
99
metadata: {
1010
name: "staking";
11-
version: "2.0.0";
11+
version: "2.1.0";
1212
spec: "0.1.0";
1313
description: "Created with Anchor";
1414
};
@@ -1296,6 +1296,102 @@ export type Staking = {
12961296
},
12971297
];
12981298
},
1299+
{
1300+
name: "transferAccount";
1301+
docs: [
1302+
"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.",
1303+
];
1304+
discriminator: [219, 120, 55, 105, 3, 139, 205, 6];
1305+
accounts: [
1306+
{
1307+
name: "governanceAuthority";
1308+
signer: true;
1309+
relations: ["config"];
1310+
},
1311+
{
1312+
name: "newOwner";
1313+
docs: [
1314+
"CHECK : A new arbitrary owner provided by the governance_authority",
1315+
];
1316+
},
1317+
{
1318+
name: "stakeAccountPositions";
1319+
writable: true;
1320+
},
1321+
{
1322+
name: "stakeAccountMetadata";
1323+
writable: true;
1324+
pda: {
1325+
seeds: [
1326+
{
1327+
kind: "const";
1328+
value: [
1329+
115,
1330+
116,
1331+
97,
1332+
107,
1333+
101,
1334+
95,
1335+
109,
1336+
101,
1337+
116,
1338+
97,
1339+
100,
1340+
97,
1341+
116,
1342+
97,
1343+
];
1344+
},
1345+
{
1346+
kind: "account";
1347+
path: "stakeAccountPositions";
1348+
},
1349+
];
1350+
};
1351+
},
1352+
{
1353+
name: "voterRecord";
1354+
writable: true;
1355+
pda: {
1356+
seeds: [
1357+
{
1358+
kind: "const";
1359+
value: [
1360+
118,
1361+
111,
1362+
116,
1363+
101,
1364+
114,
1365+
95,
1366+
119,
1367+
101,
1368+
105,
1369+
103,
1370+
104,
1371+
116,
1372+
];
1373+
},
1374+
{
1375+
kind: "account";
1376+
path: "stakeAccountPositions";
1377+
},
1378+
];
1379+
};
1380+
},
1381+
{
1382+
name: "config";
1383+
pda: {
1384+
seeds: [
1385+
{
1386+
kind: "const";
1387+
value: [99, 111, 110, 102, 105, 103];
1388+
},
1389+
];
1390+
};
1391+
},
1392+
];
1393+
args: [];
1394+
},
12991395
{
13001396
name: "updateAgreementHash";
13011397
discriminator: [86, 232, 181, 137, 158, 110, 129, 238];

0 commit comments

Comments
 (0)