@jpool/bond-sdk 0.8.0-next.1 → 0.8.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -121,6 +121,73 @@ type Jbond = {
121
121
  }
122
122
  ];
123
123
  },
124
+ {
125
+ "name": "configure";
126
+ "docs": [
127
+ "Updates the global program configuration, including authority and reserve fields.",
128
+ "Allows changing the program's authority and updating the reserve account.",
129
+ "",
130
+ "# Arguments",
131
+ "* `data` - Configuration data containing optional new authority and reserve keys.",
132
+ "",
133
+ "# Errors",
134
+ "Fails if the signer is not authorized to update the global configuration."
135
+ ];
136
+ "discriminator": [
137
+ 245,
138
+ 7,
139
+ 108,
140
+ 117,
141
+ 95,
142
+ 196,
143
+ 54,
144
+ 217
145
+ ];
146
+ "accounts": [
147
+ {
148
+ "name": "globalState";
149
+ "writable": true;
150
+ "pda": {
151
+ "seeds": [
152
+ {
153
+ "kind": "const";
154
+ "value": [
155
+ 103,
156
+ 108,
157
+ 111,
158
+ 98,
159
+ 97,
160
+ 108,
161
+ 95,
162
+ 115,
163
+ 116,
164
+ 97,
165
+ 116,
166
+ 101
167
+ ];
168
+ }
169
+ ];
170
+ };
171
+ },
172
+ {
173
+ "name": "authority";
174
+ "signer": true;
175
+ "relations": [
176
+ "globalState"
177
+ ];
178
+ }
179
+ ];
180
+ "args": [
181
+ {
182
+ "name": "data";
183
+ "type": {
184
+ "defined": {
185
+ "name": "configureData";
186
+ };
187
+ };
188
+ }
189
+ ];
190
+ },
124
191
  {
125
192
  "name": "initialize";
126
193
  "docs": [
@@ -289,67 +356,6 @@ type Jbond = {
289
356
  }
290
357
  ];
291
358
  },
292
- {
293
- "name": "setAuthority";
294
- "docs": [
295
- "Sets a new withdrawal authority for a validator's bond account.",
296
- "Allows changing who can withdraw collateral in the future.",
297
- "",
298
- "# Arguments",
299
- "* `new_authority` - Optional new authority key (None to restrict to identity).",
300
- "",
301
- "# Errors",
302
- "Fails if the signer is not authorized to change the authority."
303
- ];
304
- "discriminator": [
305
- 133,
306
- 250,
307
- 37,
308
- 21,
309
- 110,
310
- 163,
311
- 26,
312
- 121
313
- ];
314
- "accounts": [
315
- {
316
- "name": "globalState";
317
- "writable": true;
318
- "pda": {
319
- "seeds": [
320
- {
321
- "kind": "const";
322
- "value": [
323
- 103,
324
- 108,
325
- 111,
326
- 98,
327
- 97,
328
- 108,
329
- 95,
330
- 115,
331
- 116,
332
- 97,
333
- 116,
334
- 101
335
- ];
336
- }
337
- ];
338
- };
339
- },
340
- {
341
- "name": "authority";
342
- "signer": true;
343
- "relations": [
344
- "globalState"
345
- ];
346
- },
347
- {
348
- "name": "newAuthority";
349
- }
350
- ];
351
- "args": [];
352
- },
353
359
  {
354
360
  "name": "setWithdrawAuthority";
355
361
  "docs": [
@@ -357,7 +363,8 @@ type Jbond = {
357
363
  "Allows changing who can withdraw collateral in the future.",
358
364
  "",
359
365
  "# Arguments",
360
- "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to identity).",
366
+ "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to",
367
+ "identity).",
361
368
  "",
362
369
  "# Errors",
363
370
  "Fails if the signer is not authorized to change the withdrawal authority."
@@ -783,6 +790,26 @@ type Jbond = {
783
790
  ];
784
791
  };
785
792
  },
793
+ {
794
+ "name": "configureData";
795
+ "type": {
796
+ "kind": "struct";
797
+ "fields": [
798
+ {
799
+ "name": "newAuthority";
800
+ "type": {
801
+ "option": "pubkey";
802
+ };
803
+ },
804
+ {
805
+ "name": "newReserve";
806
+ "type": {
807
+ "option": "pubkey";
808
+ };
809
+ }
810
+ ];
811
+ };
812
+ },
786
813
  {
787
814
  "name": "globalState";
788
815
  "type": {
@@ -982,9 +1009,10 @@ type GetHistoryGroupedProps = {
982
1009
  voteAccount: PublicKey;
983
1010
  epochsCount?: number;
984
1011
  };
985
- type SetAuthorityProps = {
986
- newAuthority: PublicKey;
1012
+ type ConfigureProps = {
987
1013
  authority?: PublicKey;
1014
+ newAuthority?: PublicKey;
1015
+ newReserve?: PublicKey;
988
1016
  };
989
1017
  type SetWithdrawAuthorityProps = {
990
1018
  voteAccount: PublicKey;
@@ -1077,7 +1105,7 @@ declare class JBondClient {
1077
1105
  /**
1078
1106
  * Configure a specific option.
1079
1107
  */
1080
- configure<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1108
+ configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1081
1109
  /**
1082
1110
  * Program Derived Addresses (PDAs)
1083
1111
  */
@@ -1114,11 +1142,12 @@ declare class JBondClient {
1114
1142
  */
1115
1143
  claimCompensation(props: ClaimProps): Promise<string>;
1116
1144
  /**
1117
- * Set a new authority for the program
1145
+ * Update global configuration for the program
1118
1146
  * Default authority is the provider's wallet
1147
+ * Only the current authority can call this
1119
1148
  * @return Transaction signature
1120
1149
  */
1121
- setAuthority(props: SetAuthorityProps): Promise<string>;
1150
+ configure(props: ConfigureProps): Promise<string>;
1122
1151
  /**
1123
1152
  * Set withdrawal authority for validator bond
1124
1153
  * Only the validator identity can call this
@@ -1147,9 +1176,9 @@ declare class JBondClient {
1147
1176
  */
1148
1177
  buildClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1149
1178
  /**
1150
- * Build set authority instruction
1179
+ * Build configure instruction
1151
1180
  */
1152
- buildSetAuthorityInstruction(props: SetAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
1181
+ buildConfigureInstruction(props: ConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1153
1182
  /**
1154
1183
  * Build set withdraw authority instruction
1155
1184
  */
@@ -1221,4 +1250,4 @@ declare class JBondClient {
1221
1250
  */
1222
1251
  declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
1223
1252
 
1224
- export { BondClientEnv, BondTransactionType, type ClaimProps, type ClientOptions, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalState, type InitializeProps, JBondClient, type Jbond, NodeWallet, type RegisterValidatorProps, type SetAuthorityProps, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
1253
+ export { BondClientEnv, BondTransactionType, type ClaimProps, type ClientOptions, type ConfigureProps, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalState, type InitializeProps, JBondClient, type Jbond, NodeWallet, type RegisterValidatorProps, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
package/dist/index.d.ts CHANGED
@@ -121,6 +121,73 @@ type Jbond = {
121
121
  }
122
122
  ];
123
123
  },
124
+ {
125
+ "name": "configure";
126
+ "docs": [
127
+ "Updates the global program configuration, including authority and reserve fields.",
128
+ "Allows changing the program's authority and updating the reserve account.",
129
+ "",
130
+ "# Arguments",
131
+ "* `data` - Configuration data containing optional new authority and reserve keys.",
132
+ "",
133
+ "# Errors",
134
+ "Fails if the signer is not authorized to update the global configuration."
135
+ ];
136
+ "discriminator": [
137
+ 245,
138
+ 7,
139
+ 108,
140
+ 117,
141
+ 95,
142
+ 196,
143
+ 54,
144
+ 217
145
+ ];
146
+ "accounts": [
147
+ {
148
+ "name": "globalState";
149
+ "writable": true;
150
+ "pda": {
151
+ "seeds": [
152
+ {
153
+ "kind": "const";
154
+ "value": [
155
+ 103,
156
+ 108,
157
+ 111,
158
+ 98,
159
+ 97,
160
+ 108,
161
+ 95,
162
+ 115,
163
+ 116,
164
+ 97,
165
+ 116,
166
+ 101
167
+ ];
168
+ }
169
+ ];
170
+ };
171
+ },
172
+ {
173
+ "name": "authority";
174
+ "signer": true;
175
+ "relations": [
176
+ "globalState"
177
+ ];
178
+ }
179
+ ];
180
+ "args": [
181
+ {
182
+ "name": "data";
183
+ "type": {
184
+ "defined": {
185
+ "name": "configureData";
186
+ };
187
+ };
188
+ }
189
+ ];
190
+ },
124
191
  {
125
192
  "name": "initialize";
126
193
  "docs": [
@@ -289,67 +356,6 @@ type Jbond = {
289
356
  }
290
357
  ];
291
358
  },
292
- {
293
- "name": "setAuthority";
294
- "docs": [
295
- "Sets a new withdrawal authority for a validator's bond account.",
296
- "Allows changing who can withdraw collateral in the future.",
297
- "",
298
- "# Arguments",
299
- "* `new_authority` - Optional new authority key (None to restrict to identity).",
300
- "",
301
- "# Errors",
302
- "Fails if the signer is not authorized to change the authority."
303
- ];
304
- "discriminator": [
305
- 133,
306
- 250,
307
- 37,
308
- 21,
309
- 110,
310
- 163,
311
- 26,
312
- 121
313
- ];
314
- "accounts": [
315
- {
316
- "name": "globalState";
317
- "writable": true;
318
- "pda": {
319
- "seeds": [
320
- {
321
- "kind": "const";
322
- "value": [
323
- 103,
324
- 108,
325
- 111,
326
- 98,
327
- 97,
328
- 108,
329
- 95,
330
- 115,
331
- 116,
332
- 97,
333
- 116,
334
- 101
335
- ];
336
- }
337
- ];
338
- };
339
- },
340
- {
341
- "name": "authority";
342
- "signer": true;
343
- "relations": [
344
- "globalState"
345
- ];
346
- },
347
- {
348
- "name": "newAuthority";
349
- }
350
- ];
351
- "args": [];
352
- },
353
359
  {
354
360
  "name": "setWithdrawAuthority";
355
361
  "docs": [
@@ -357,7 +363,8 @@ type Jbond = {
357
363
  "Allows changing who can withdraw collateral in the future.",
358
364
  "",
359
365
  "# Arguments",
360
- "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to identity).",
366
+ "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to",
367
+ "identity).",
361
368
  "",
362
369
  "# Errors",
363
370
  "Fails if the signer is not authorized to change the withdrawal authority."
@@ -783,6 +790,26 @@ type Jbond = {
783
790
  ];
784
791
  };
785
792
  },
793
+ {
794
+ "name": "configureData";
795
+ "type": {
796
+ "kind": "struct";
797
+ "fields": [
798
+ {
799
+ "name": "newAuthority";
800
+ "type": {
801
+ "option": "pubkey";
802
+ };
803
+ },
804
+ {
805
+ "name": "newReserve";
806
+ "type": {
807
+ "option": "pubkey";
808
+ };
809
+ }
810
+ ];
811
+ };
812
+ },
786
813
  {
787
814
  "name": "globalState";
788
815
  "type": {
@@ -982,9 +1009,10 @@ type GetHistoryGroupedProps = {
982
1009
  voteAccount: PublicKey;
983
1010
  epochsCount?: number;
984
1011
  };
985
- type SetAuthorityProps = {
986
- newAuthority: PublicKey;
1012
+ type ConfigureProps = {
987
1013
  authority?: PublicKey;
1014
+ newAuthority?: PublicKey;
1015
+ newReserve?: PublicKey;
988
1016
  };
989
1017
  type SetWithdrawAuthorityProps = {
990
1018
  voteAccount: PublicKey;
@@ -1077,7 +1105,7 @@ declare class JBondClient {
1077
1105
  /**
1078
1106
  * Configure a specific option.
1079
1107
  */
1080
- configure<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1108
+ configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1081
1109
  /**
1082
1110
  * Program Derived Addresses (PDAs)
1083
1111
  */
@@ -1114,11 +1142,12 @@ declare class JBondClient {
1114
1142
  */
1115
1143
  claimCompensation(props: ClaimProps): Promise<string>;
1116
1144
  /**
1117
- * Set a new authority for the program
1145
+ * Update global configuration for the program
1118
1146
  * Default authority is the provider's wallet
1147
+ * Only the current authority can call this
1119
1148
  * @return Transaction signature
1120
1149
  */
1121
- setAuthority(props: SetAuthorityProps): Promise<string>;
1150
+ configure(props: ConfigureProps): Promise<string>;
1122
1151
  /**
1123
1152
  * Set withdrawal authority for validator bond
1124
1153
  * Only the validator identity can call this
@@ -1147,9 +1176,9 @@ declare class JBondClient {
1147
1176
  */
1148
1177
  buildClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1149
1178
  /**
1150
- * Build set authority instruction
1179
+ * Build configure instruction
1151
1180
  */
1152
- buildSetAuthorityInstruction(props: SetAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
1181
+ buildConfigureInstruction(props: ConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1153
1182
  /**
1154
1183
  * Build set withdraw authority instruction
1155
1184
  */
@@ -1221,4 +1250,4 @@ declare class JBondClient {
1221
1250
  */
1222
1251
  declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
1223
1252
 
1224
- export { BondClientEnv, BondTransactionType, type ClaimProps, type ClientOptions, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalState, type InitializeProps, JBondClient, type Jbond, NodeWallet, type RegisterValidatorProps, type SetAuthorityProps, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
1253
+ export { BondClientEnv, BondTransactionType, type ClaimProps, type ClientOptions, type ConfigureProps, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalState, type InitializeProps, JBondClient, type Jbond, NodeWallet, type RegisterValidatorProps, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
package/dist/index.js CHANGED
@@ -129,6 +129,73 @@ var jbond_default = {
129
129
  }
130
130
  ]
131
131
  },
132
+ {
133
+ name: "configure",
134
+ docs: [
135
+ "Updates the global program configuration, including authority and reserve fields.",
136
+ "Allows changing the program's authority and updating the reserve account.",
137
+ "",
138
+ "# Arguments",
139
+ "* `data` - Configuration data containing optional new authority and reserve keys.",
140
+ "",
141
+ "# Errors",
142
+ "Fails if the signer is not authorized to update the global configuration."
143
+ ],
144
+ discriminator: [
145
+ 245,
146
+ 7,
147
+ 108,
148
+ 117,
149
+ 95,
150
+ 196,
151
+ 54,
152
+ 217
153
+ ],
154
+ accounts: [
155
+ {
156
+ name: "global_state",
157
+ writable: true,
158
+ pda: {
159
+ seeds: [
160
+ {
161
+ kind: "const",
162
+ value: [
163
+ 103,
164
+ 108,
165
+ 111,
166
+ 98,
167
+ 97,
168
+ 108,
169
+ 95,
170
+ 115,
171
+ 116,
172
+ 97,
173
+ 116,
174
+ 101
175
+ ]
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ name: "authority",
182
+ signer: true,
183
+ relations: [
184
+ "global_state"
185
+ ]
186
+ }
187
+ ],
188
+ args: [
189
+ {
190
+ name: "data",
191
+ type: {
192
+ defined: {
193
+ name: "ConfigureData"
194
+ }
195
+ }
196
+ }
197
+ ]
198
+ },
132
199
  {
133
200
  name: "initialize",
134
201
  docs: [
@@ -297,67 +364,6 @@ var jbond_default = {
297
364
  }
298
365
  ]
299
366
  },
300
- {
301
- name: "set_authority",
302
- docs: [
303
- "Sets a new withdrawal authority for a validator's bond account.",
304
- "Allows changing who can withdraw collateral in the future.",
305
- "",
306
- "# Arguments",
307
- "* `new_authority` - Optional new authority key (None to restrict to identity).",
308
- "",
309
- "# Errors",
310
- "Fails if the signer is not authorized to change the authority."
311
- ],
312
- discriminator: [
313
- 133,
314
- 250,
315
- 37,
316
- 21,
317
- 110,
318
- 163,
319
- 26,
320
- 121
321
- ],
322
- accounts: [
323
- {
324
- name: "global_state",
325
- writable: true,
326
- pda: {
327
- seeds: [
328
- {
329
- kind: "const",
330
- value: [
331
- 103,
332
- 108,
333
- 111,
334
- 98,
335
- 97,
336
- 108,
337
- 95,
338
- 115,
339
- 116,
340
- 97,
341
- 116,
342
- 101
343
- ]
344
- }
345
- ]
346
- }
347
- },
348
- {
349
- name: "authority",
350
- signer: true,
351
- relations: [
352
- "global_state"
353
- ]
354
- },
355
- {
356
- name: "new_authority"
357
- }
358
- ],
359
- args: []
360
- },
361
367
  {
362
368
  name: "set_withdraw_authority",
363
369
  docs: [
@@ -365,7 +371,8 @@ var jbond_default = {
365
371
  "Allows changing who can withdraw collateral in the future.",
366
372
  "",
367
373
  "# Arguments",
368
- "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to identity).",
374
+ "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to",
375
+ "identity).",
369
376
  "",
370
377
  "# Errors",
371
378
  "Fails if the signer is not authorized to change the withdrawal authority."
@@ -791,6 +798,26 @@ var jbond_default = {
791
798
  ]
792
799
  }
793
800
  },
801
+ {
802
+ name: "ConfigureData",
803
+ type: {
804
+ kind: "struct",
805
+ fields: [
806
+ {
807
+ name: "new_authority",
808
+ type: {
809
+ option: "pubkey"
810
+ }
811
+ },
812
+ {
813
+ name: "new_reserve",
814
+ type: {
815
+ option: "pubkey"
816
+ }
817
+ }
818
+ ]
819
+ }
820
+ },
794
821
  {
795
822
  name: "GlobalState",
796
823
  type: {
@@ -1038,12 +1065,12 @@ var JBondClient = class _JBondClient {
1038
1065
  * Set the environment.
1039
1066
  */
1040
1067
  env(env) {
1041
- return this.configure("programId", ENV_PROGRAM_ID[env]);
1068
+ return this.configureEnv("programId", ENV_PROGRAM_ID[env]);
1042
1069
  }
1043
1070
  /**
1044
1071
  * Configure a specific option.
1045
1072
  */
1046
- configure(key, val) {
1073
+ configureEnv(key, val) {
1047
1074
  this.options[key] = val;
1048
1075
  return this;
1049
1076
  }
@@ -1111,12 +1138,13 @@ var JBondClient = class _JBondClient {
1111
1138
  return await this.provider.sendAndConfirm(new web3_js.Transaction().add(ix));
1112
1139
  }
1113
1140
  /**
1114
- * Set a new authority for the program
1141
+ * Update global configuration for the program
1115
1142
  * Default authority is the provider's wallet
1143
+ * Only the current authority can call this
1116
1144
  * @return Transaction signature
1117
1145
  */
1118
- async setAuthority(props) {
1119
- const ix = await this.buildSetAuthorityInstruction(props);
1146
+ async configure(props) {
1147
+ const ix = await this.buildConfigureInstruction(props);
1120
1148
  return await this.provider.sendAndConfirm(new web3_js.Transaction().add(ix));
1121
1149
  }
1122
1150
  /**
@@ -1212,15 +1240,17 @@ var JBondClient = class _JBondClient {
1212
1240
  }).instruction();
1213
1241
  }
1214
1242
  /**
1215
- * Build set authority instruction
1243
+ * Build configure instruction
1216
1244
  */
1217
- async buildSetAuthorityInstruction(props) {
1245
+ async buildConfigureInstruction(props) {
1218
1246
  const [globalState] = this.pda.globalState();
1219
1247
  const authority = props.authority ?? this.provider.wallet.publicKey;
1220
- return this.program.methods.setAuthority().accountsStrict({
1248
+ return this.program.methods.configure({
1249
+ newAuthority: props.newAuthority ?? null,
1250
+ newReserve: props.newReserve ?? null
1251
+ }).accountsStrict({
1221
1252
  globalState,
1222
- authority,
1223
- newAuthority: props.newAuthority
1253
+ authority
1224
1254
  }).instruction();
1225
1255
  }
1226
1256
  /**