Skip to content

Commit

Permalink
remove activity filter (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
comountainclimber authored Jan 25, 2022
1 parent 4b040b8 commit 5feb350
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 66 deletions.
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/Settings.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ exports[`Settings renders without crashing 1`] = `
Manage your neon wallet
</FormattedMessage>
- v
2.12.1
2.12.2
</div>
<div
className="settingsPanelHeaderItem"
Expand Down
123 changes: 59 additions & 64 deletions app/actions/transactionHistoryActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,74 +87,69 @@ export async function computeN3Activity(
const results = []
if (!data.items) return results
for (const item of data.items) {
const unresolved = item.invocations
.filter(i => {
const { from, to } = i.metadata
return from === currentUserAddress || to === currentUserAddress
})
.map(async invocation => {
let image
let assets
let endpoint
const unresolved = item.invocations.map(async invocation => {
let image
let assets
let endpoint

try {
switch (invocation.type) {
case 'nep17_transfer':
image = getImageBySymbol(invocation.metadata.symbol)
break
case 'nep11_transfer':
invocation.metadata.time = item.time
// Get the properties of the token
endpoint = await getNode(net)
if (!endpoint) {
endpoint = await getRPCEndpoint(net)
try {
switch (invocation.type) {
case 'nep17_transfer':
image = getImageBySymbol(invocation.metadata.symbol)
break
case 'nep11_transfer':
invocation.metadata.time = item.time
// Get the properties of the token
endpoint = await getNode(net)
if (!endpoint) {
endpoint = await getRPCEndpoint(net)
}
invocation.metadata.tokenName = Buffer.from(
invocation.metadata.token_id,
'hex',
).toString()
assets = await new n3Rpc.RPCClient(endpoint).invokeFunction(
invocation.metadata.scripthash,
'properties',
[sc.ContractParam.string(invocation.metadata.tokenName)],
)
assets.stack[0].value.some(property => {
const key = u.HexString.fromBase64(property.key.value).toAscii()
if (key === 'image') {
image = u.HexString.fromBase64(property.value.value).toAscii()
return true
}
invocation.metadata.tokenName = Buffer.from(
invocation.metadata.token_id,
'hex',
).toString()
assets = await new n3Rpc.RPCClient(endpoint).invokeFunction(
invocation.metadata.scripthash,
'properties',
[sc.ContractParam.string(invocation.metadata.tokenName)],
)
assets.stack[0].value.some(property => {
const key = u.HexString.fromBase64(property.key.value).toAscii()
if (key === 'image') {
image = u.HexString.fromBase64(property.value.value).toAscii()
return true
}
return false
})
break
default:
break
}
// flatten the invocations into individual events to support existing components
invocation.metadata.image = image
invocation.hash = item.hash
invocation.sender = item.sender
invocation.sysfee = item.sysfee
invocation.netfee = item.netfee
invocation.block = item.block
invocation.time = item.time
invocation.vmstate = item.vmstate
return false
})
break
default:
break
}
// flatten the invocations into individual events to support existing components
invocation.metadata.image = image
invocation.hash = item.hash
invocation.sender = item.sender
invocation.sysfee = item.sysfee
invocation.netfee = item.netfee
invocation.block = item.block
invocation.time = item.time
invocation.vmstate = item.vmstate

if (
invocation.metadata.scripthash !==
'0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5'
) {
// BUG: this will display incorrect data if the token does not have
// 8 decimals but this is a compromise to reduce network request overhead.
invocation.metadata.amount = toBigNumber(
(invocation.metadata.amount /= 10 ** 8),
).toString()
}
} catch (e) {
console.warn('invocation error:', invocation, e)
if (
invocation.metadata.scripthash !==
'0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5'
) {
// BUG: this will display incorrect data if the token does not have
// 8 decimals but this is a compromise to reduce network request overhead.
invocation.metadata.amount = toBigNumber(
(invocation.metadata.amount /= 10 ** 8),
).toString()
}
return invocation
})
} catch (e) {
console.warn('invocation error:', invocation, e)
}
return invocation
})
item.invocations = await Promise.all(unresolved)
results.push(...item.invocations)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Neon",
"version": "2.12.1",
"version": "2.12.2",
"main": "./main.js",
"description": "Light wallet for NEO blockchain",
"homepage": "https://github.com/CityOfZion/neon-wallet",
Expand Down

0 comments on commit 5feb350

Please sign in to comment.