Skip to content

Commit

Permalink
refactor: clean up unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho112 committed Sep 6, 2022
1 parent a89f33e commit 4f77940
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/near-api-js/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,7 @@ export class Account {
finality: 'optimistic'
});
// Replace raw nonce into a new BN
const newResponse = { keys: response?.keys?.map((key) => ({ ...key, access_key: { ...key.access_key, nonce: new BN(key.access_key.nonce) } }))};
// A breaking API change introduced extra information into the
// response, so it now returns an object with a `keys` field instead
// of an array: https://github.com/nearprotocol/nearcore/pull/1789
if (Array.isArray(newResponse)) {
return newResponse;
}
return newResponse.keys;
return response?.keys?.map((key) => ({ ...key, access_key: { ...key.access_key, nonce: new BN(key.access_key.nonce) } }));
}

/**
Expand Down

0 comments on commit 4f77940

Please sign in to comment.