Update @solana/web3.js to v0.42.2

This commit is contained in:
Justin Starry 2020-04-06 18:54:29 +08:00 committed by Michael Vines
parent 8eabff3911
commit 0f0b0a20eb
3 changed files with 15 additions and 15 deletions

View File

@ -1269,9 +1269,9 @@
"integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw==" "integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw=="
}, },
"@solana/web3.js": { "@solana/web3.js": {
"version": "0.41.2", "version": "0.42.2",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.41.2.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.42.2.tgz",
"integrity": "sha512-KHHnKNJLkleSFc8kj+SvhlchlBScQHUEoD/M8idzhL067sqa/EsPMnrcXMKwp8Ro4t2QiyFMmmqkVaZbTMhEWQ==", "integrity": "sha512-Dci8Nju2IUgGCNqY8tAzpnXLgCOTtAZ/EsxjjF+jCj2jKhIZGzgv/rNdVkWFfK/sKh+A1Jr6q09yk6bNTctBHQ==",
"requires": { "requires": {
"@babel/runtime": "^7.3.1", "@babel/runtime": "^7.3.1",
"bn.js": "^5.0.0", "bn.js": "^5.0.0",

View File

@ -3,7 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@solana/web3.js": "^0.41.2", "@solana/web3.js": "^0.42.2",
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2", "@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2", "@testing-library/user-event": "^7.1.2",

View File

@ -178,6 +178,10 @@ export async function fetchAccountInfo(
const result = await new Connection(url).getAccountInfo( const result = await new Connection(url).getAccountInfo(
new PublicKey(address) new PublicKey(address)
); );
if (result === null) {
lamports = 0;
status = Status.NotFound;
} else {
lamports = result.lamports; lamports = result.lamports;
details = { details = {
space: result.data.length, space: result.data.length,
@ -185,15 +189,11 @@ export async function fetchAccountInfo(
owner: result.owner owner: result.owner
}; };
status = Status.Success; status = Status.Success;
}
} catch (error) { } catch (error) {
if (error.toString() === "Error: Invalid request") {
lamports = 0;
status = Status.NotFound;
} else {
console.error("Failed to fetch account info", error); console.error("Failed to fetch account info", error);
status = Status.CheckFailed; status = Status.CheckFailed;
} }
}
dispatch({ type: ActionType.Update, status, lamports, details, address }); dispatch({ type: ActionType.Update, status, lamports, details, address });
} }