-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added event handler for saving ibc channels #10
Conversation
if (!packetSrcPortAttr || packetSrcPortAttr.value !== TRANSFER_PORT_VALUE) { | ||
logger.warn("packet_src_port is not transfer"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that event attributes are not encoded? While working on indexing balances, I noticed that some events had attributes that were not encoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is possible. in fact, packet_src_port is not encoded
schema.graphql
Outdated
channel: IBCChannel! | ||
srcAccount: Account! | ||
destAccount: Account! | ||
denomination: String! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to denom
src/mappings/mappingHandlers.ts
Outdated
amount, | ||
TransferType.SEND, | ||
); | ||
transferRecord.save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should await on the returned value of .save()
otherwise the record might not get saved.
src/mappings/mappingHandlers.ts
Outdated
amount, | ||
TransferType.RECEIVE, | ||
); | ||
transferRecord.save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must await on .save()
.
src/mappings/mappingHandlers.ts
Outdated
const generatedEscrowAddress = getEscrowAddress(TRANSFER_PORT_VALUE, channelName); | ||
|
||
const channelRecord = new IBCChannel(channelName, channelName, generatedEscrowAddress); | ||
channelRecord.save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await on .save()
return value.
1349849
to
61f86a4
Compare
This PR adds two new handlers that check for IBC send and recieve transactions.
On each IBC transaction, we save the data for the transaction as well as data about the channel the tranaction occurred on
It introduces two models for this purpose
IBCChannel
andIBCTransfer
IBCChannel
IBCTransfer