From 69ad13b077205ef02253d7e98d3fde0b350dfd90 Mon Sep 17 00:00:00 2001 From: GentlemansKiller <30847729+GentlemansKiller@users.noreply.github.com> Date: Wed, 7 Jul 2021 21:23:36 -0500 Subject: [PATCH] chore: tweak docs for account creation methods (#18507) * doc tweaks" PublicKey.createWithSeed() and system-program's CreateAccountWithSeedParams obj * Update web3.js/src/system-program.ts * Update web3.js/src/system-program.ts * Update web3.js/src/system-program.ts Co-authored-by: GentlemansKiller Co-authored-by: Justin Starry --- web3.js/src/publickey.ts | 2 ++ web3.js/src/system-program.ts | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web3.js/src/publickey.ts b/web3.js/src/publickey.ts index 38d72bbc1d..3f1b1857e0 100644 --- a/web3.js/src/publickey.ts +++ b/web3.js/src/publickey.ts @@ -111,6 +111,8 @@ export class PublicKey extends Struct { /** * Derive a public key from another key, a seed, and a program ID. + * The program ID will also serve as the owner of the public key, giving + * it permission to write data to the account. */ static async createWithSeed( fromPublicKey: PublicKey, diff --git a/web3.js/src/system-program.ts b/web3.js/src/system-program.ts index 391e3205bc..e1bf34a151 100644 --- a/web3.js/src/system-program.ts +++ b/web3.js/src/system-program.ts @@ -52,11 +52,11 @@ export type AssignParams = { export type CreateAccountWithSeedParams = { /** The account that will transfer lamports to the created account */ fromPubkey: PublicKey; - /** Public key of the created account */ + /** Public key of the created account. Must be pre-calculated with PublicKey.createWithSeed() */ newAccountPubkey: PublicKey; - /** Base public key to use to derive the address of the created account */ + /** Base public key to use to derive the address of the created account. Must be the same as the base key used to create `newAccountPubkey` */ basePubkey: PublicKey; - /** Seed to use to derive the address of the created account */ + /** Seed to use to derive the address of the created account. Must be the same as the seed used to create `newAccountPubkey` */ seed: string; /** Amount of lamports to transfer to the created account */ lamports: number;