1193: Fix example errata (#3138)

This PR fixes two errata in the EIP-1193 examples section, special thanks to @enolan for noting in https://github.com/ethereum/EIPs/issues/2319#issuecomment-734159349 and https://github.com/ethereum/EIPs/issues/2319#issuecomment-734169215.
This commit is contained in:
Ryan Ghods 2020-12-01 22:42:40 -08:00 committed by GitHub
parent cc0c882df5
commit c13bb718e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -464,7 +464,7 @@ ethereum
ethereum
.request({
method: 'eth_getBlockByNumber',
params: ['latest', 'true'],
params: ['latest', true],
})
.then((block) => {
console.log(`Block ${block.number}:`, block);
@ -500,7 +500,7 @@ ethereum
if (message.type === 'eth_subscription') {
const { data } = message;
if (data.subscription === subscriptionId) {
if (typeof data.result === 'string' && data.result) {
if ('result' in data && typeof data.result === 'object') {
const block = data.result;
console.log(`New block ${block.number}:`, block);
} else {