@solana/web3.js 1.34.0 → 1.35.0
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/lib/index.browser.esm.js +49 -11
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +49 -11
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.esm.js +49 -11
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +49 -11
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +19 -0
- package/package.json +1 -1
- package/src/stake-program.ts +65 -15
package/lib/index.d.ts
CHANGED
|
@@ -2278,6 +2278,17 @@ declare module '@solana/web3.js' {
|
|
|
2278
2278
|
splitStakePubkey: PublicKey;
|
|
2279
2279
|
lamports: number;
|
|
2280
2280
|
};
|
|
2281
|
+
/**
|
|
2282
|
+
* Split with seed transaction params
|
|
2283
|
+
*/
|
|
2284
|
+
export type SplitStakeWithSeedParams = {
|
|
2285
|
+
stakePubkey: PublicKey;
|
|
2286
|
+
authorizedPubkey: PublicKey;
|
|
2287
|
+
splitStakePubkey: PublicKey;
|
|
2288
|
+
basePubkey: PublicKey;
|
|
2289
|
+
seed: string;
|
|
2290
|
+
lamports: number;
|
|
2291
|
+
};
|
|
2281
2292
|
/**
|
|
2282
2293
|
* Withdraw stake instruction params
|
|
2283
2294
|
*/
|
|
@@ -2439,6 +2450,11 @@ declare module '@solana/web3.js' {
|
|
|
2439
2450
|
* Generate a Transaction that splits Stake tokens into another stake account
|
|
2440
2451
|
*/
|
|
2441
2452
|
static split(params: SplitStakeParams): Transaction;
|
|
2453
|
+
/**
|
|
2454
|
+
* Generate a Transaction that splits Stake tokens into another account
|
|
2455
|
+
* derived from a base public key and seed
|
|
2456
|
+
*/
|
|
2457
|
+
static splitWithSeed(params: SplitStakeWithSeedParams): Transaction;
|
|
2442
2458
|
/**
|
|
2443
2459
|
* Generate a Transaction that merges Stake accounts.
|
|
2444
2460
|
*/
|
package/lib/index.esm.js
CHANGED
|
@@ -8230,30 +8230,22 @@ class StakeProgram {
|
|
|
8230
8230
|
});
|
|
8231
8231
|
}
|
|
8232
8232
|
/**
|
|
8233
|
-
*
|
|
8233
|
+
* @internal
|
|
8234
8234
|
*/
|
|
8235
8235
|
|
|
8236
8236
|
|
|
8237
|
-
static
|
|
8237
|
+
static splitInstruction(params) {
|
|
8238
8238
|
const {
|
|
8239
8239
|
stakePubkey,
|
|
8240
8240
|
authorizedPubkey,
|
|
8241
8241
|
splitStakePubkey,
|
|
8242
8242
|
lamports
|
|
8243
8243
|
} = params;
|
|
8244
|
-
const transaction = new Transaction();
|
|
8245
|
-
transaction.add(SystemProgram.createAccount({
|
|
8246
|
-
fromPubkey: authorizedPubkey,
|
|
8247
|
-
newAccountPubkey: splitStakePubkey,
|
|
8248
|
-
lamports: 0,
|
|
8249
|
-
space: this.space,
|
|
8250
|
-
programId: this.programId
|
|
8251
|
-
}));
|
|
8252
8244
|
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
|
|
8253
8245
|
const data = encodeData(type, {
|
|
8254
8246
|
lamports
|
|
8255
8247
|
});
|
|
8256
|
-
return
|
|
8248
|
+
return new TransactionInstruction({
|
|
8257
8249
|
keys: [{
|
|
8258
8250
|
pubkey: stakePubkey,
|
|
8259
8251
|
isSigner: false,
|
|
@@ -8271,6 +8263,52 @@ class StakeProgram {
|
|
|
8271
8263
|
data
|
|
8272
8264
|
});
|
|
8273
8265
|
}
|
|
8266
|
+
/**
|
|
8267
|
+
* Generate a Transaction that splits Stake tokens into another stake account
|
|
8268
|
+
*/
|
|
8269
|
+
|
|
8270
|
+
|
|
8271
|
+
static split(params) {
|
|
8272
|
+
const transaction = new Transaction();
|
|
8273
|
+
transaction.add(SystemProgram.createAccount({
|
|
8274
|
+
fromPubkey: params.authorizedPubkey,
|
|
8275
|
+
newAccountPubkey: params.splitStakePubkey,
|
|
8276
|
+
lamports: 0,
|
|
8277
|
+
space: this.space,
|
|
8278
|
+
programId: this.programId
|
|
8279
|
+
}));
|
|
8280
|
+
return transaction.add(this.splitInstruction(params));
|
|
8281
|
+
}
|
|
8282
|
+
/**
|
|
8283
|
+
* Generate a Transaction that splits Stake tokens into another account
|
|
8284
|
+
* derived from a base public key and seed
|
|
8285
|
+
*/
|
|
8286
|
+
|
|
8287
|
+
|
|
8288
|
+
static splitWithSeed(params) {
|
|
8289
|
+
const {
|
|
8290
|
+
stakePubkey,
|
|
8291
|
+
authorizedPubkey,
|
|
8292
|
+
splitStakePubkey,
|
|
8293
|
+
basePubkey,
|
|
8294
|
+
seed,
|
|
8295
|
+
lamports
|
|
8296
|
+
} = params;
|
|
8297
|
+
const transaction = new Transaction();
|
|
8298
|
+
transaction.add(SystemProgram.allocate({
|
|
8299
|
+
accountPubkey: splitStakePubkey,
|
|
8300
|
+
basePubkey,
|
|
8301
|
+
seed,
|
|
8302
|
+
space: this.space,
|
|
8303
|
+
programId: this.programId
|
|
8304
|
+
}));
|
|
8305
|
+
return transaction.add(this.splitInstruction({
|
|
8306
|
+
stakePubkey,
|
|
8307
|
+
authorizedPubkey,
|
|
8308
|
+
splitStakePubkey,
|
|
8309
|
+
lamports
|
|
8310
|
+
}));
|
|
8311
|
+
}
|
|
8274
8312
|
/**
|
|
8275
8313
|
* Generate a Transaction that merges Stake accounts.
|
|
8276
8314
|
*/
|