diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index e493feb7f8..ebab054478 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -162,6 +162,9 @@ declare module '@solana/web3.js' { static fromConfigData(buffer: Buffer): ?ValidatorInfo; } + // === src/sysvar-rent.js === + declare export var SYSVAR_RENT_PUBKEY; + // === src/vote-account.js === declare export var VOTE_ACCOUNT_KEY; declare export type Lockout = {| diff --git a/web3.js/src/index.js b/web3.js/src/index.js index f719bc00ac..89a57c58cf 100644 --- a/web3.js/src/index.js +++ b/web3.js/src/index.js @@ -9,6 +9,7 @@ export {SystemInstruction, SystemProgram} from './system-program'; export {Transaction, TransactionInstruction} from './transaction'; export {VALIDATOR_INFO_KEY, ValidatorInfo} from './validator-info'; export {VOTE_ACCOUNT_KEY, VoteAccount} from './vote-account'; +export {SYSVAR_RENT_PUBKEY} from './sysvar-rent'; export {sendAndConfirmTransaction} from './util/send-and-confirm-transaction'; export { sendAndConfirmRawTransaction, diff --git a/web3.js/src/loader.js b/web3.js/src/loader.js index 8df496309b..df7b84dbf5 100644 --- a/web3.js/src/loader.js +++ b/web3.js/src/loader.js @@ -6,6 +6,7 @@ import {Account} from './account'; import {PublicKey} from './publickey'; import {NUM_TICKS_PER_SECOND} from './timing'; import {Transaction, PACKET_DATA_SIZE} from './transaction'; +import {SYSVAR_RENT_PUBKEY} from './sysvar-rent'; import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction'; import {sleep} from './util/sleep'; import type {Connection} from './connection'; @@ -123,7 +124,10 @@ export class Loader { ); const transaction = new Transaction().add({ - keys: [{pubkey: program.publicKey, isSigner: true, isDebitable: true}], + keys: [ + {pubkey: program.publicKey, isSigner: true, isDebitable: true}, + {pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isDebitable: false} + ], programId, data, }); diff --git a/web3.js/src/sysvar-rent.js b/web3.js/src/sysvar-rent.js new file mode 100644 index 0000000000..3b9abbe64b --- /dev/null +++ b/web3.js/src/sysvar-rent.js @@ -0,0 +1,6 @@ +// @flow +import {PublicKey} from './publickey'; + +export const SYSVAR_RENT_PUBKEY = new PublicKey( + 'SysvarRent111111111111111111111111111111111', +);