diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 4685f12d68..921c002653 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -27,7 +27,7 @@ declare module '@solana/web3.js' { declare export type AccountInfo = { tokens: number, programId: PublicKey, - userdata: Buffer | null, + userdata: Buffer, } declare export type SignatureStatus = 'Confirmed' | 'SignatureNotFound' | 'ProgramRuntimeError' | 'GenericFailure'; diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 14338ba1b4..fd4bef99eb 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -140,7 +140,7 @@ const SendTokensRpcResult = jsonRpcResult('string'); type AccountInfo = { tokens: number, programId: PublicKey, - userdata: Buffer | null, + userdata: Buffer, } /** @@ -200,14 +200,10 @@ export class Connection { const {result} = res; assert(typeof result !== 'undefined'); - let userdata = null; - if (result.userdata.length > 0) { - userdata = Buffer.from(result.userdata); - } return { tokens: result.tokens, programId: bs58.encode(result.program_id), - userdata, + userdata: Buffer.from(result.userdata), }; }