This repository was archived by the owner on Feb 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Added the handling of begin and end block events #189
Merged
ethanfrey
merged 47 commits into
confio:main
from
desmos-labs:riccardo/block-results-events
Jun 24, 2021
Merged
Changes from 4 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
d671209
Added the handling of begin and end block events
RiccardoM 17b5fb5
Run yarn fix
RiccardoM ec21380
Updated chain requirements to have Cosmos v0.42.4 and PR 9081 merged
RiccardoM 1aefddf
Added changeset entry
RiccardoM a50da75
Add home option to ics20 command
2a955ea
Add changeset
c3f0e81
Merge pull request #191 from iov-one/add-home-to-ics20
ethanfrey dcabf3d
musselnet -> oysternet, remove relayer testnets
ethanfrey a4035b8
Add nyancat testnet
ethanfrey 27de19c
Update README using nyancat
ethanfrey 6f572b5
Test README demo with nyancat
ethanfrey a4c9a31
Add changelog entry
ethanfrey 621c4ed
Prettify README
ethanfrey 20906ca
[skip ci] Point to non-pruning node on nyancat
ethanfrey 72cc9fd
Merge pull request #193 from confio/update-registry-testnets
ethanfrey f82ab96
Update blockchain versions
ethanfrey 9033648
Bump cosmjs to 0.25.4
ethanfrey b8ab8f4
Use standard signing client setup in balances
ethanfrey ae2ebca
Use much faster polling for binary tests
ethanfrey 9e4a5c3
Add changeset
ethanfrey eb30805
Merge pull request #194 from confio/update-deps
ethanfrey ef52b7e
Rough draft cw20 upload
ethanfrey 2a48bf2
Upload script for cw20-base and cw20-ics20
ethanfrey 4401e68
Add contract upload to CI
ethanfrey 1b15924
Prettier js scripts
ethanfrey 0045dab
Instantiate contracts in unit test
ethanfrey efc8ba3
Test channel handshake with ics20 contract
ethanfrey ef2895e
Send packet with contract
ethanfrey e74a38f
Return token over channel
ethanfrey 95b61ca
Expect error on relaying native token over channel
ethanfrey 71d5a36
Refactor and remove need for init script
ethanfrey 752a80a
Merge pull request #195 from confio/use-cw20-ics20-contract
ethanfrey 492f554
Bump to v0.1.6
ethanfrey 25ece0b
add iris installation
chengwenxi a9fba16
Minor cleanup for CI
ethanfrey cfbf4cf
Merge pull request #196 from chengwenxi/vincent-iris
ethanfrey d5f0ccd
Updated CosmJS to 0.25.5
RiccardoM e88fb01
Added the handling of begin and end block events
RiccardoM 004ee47
Run yarn fix
RiccardoM 36afad0
Updated chain requirements to have Cosmos v0.42.4 and PR 9081 merged
RiccardoM b124983
Added changeset entry
RiccardoM b382422
Updated CosmJS to 0.25.5
RiccardoM 5c5252e
Updated CosmJS to 0.25.5
RiccardoM f14a333
Merge remote-tracking branch 'origin/riccardo/block-results-events' i…
RiccardoM ade449b
Reverted custom @cosmjs/tendermint-rpc dependency
RiccardoM 5343358
Run yarn fix:prettier
RiccardoM a502458
Updated simapp environment
RiccardoM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@confio/relayer': patch | ||
--- | ||
|
||
Added the handling of begin and end block events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { fromUtf8, toHex, toUtf8 } from '@cosmjs/encoding'; | ||
import { BroadcastTxFailure, Coin, logs, StdFee } from '@cosmjs/stargate'; | ||
const { parseEvent } = logs; | ||
import { | ||
BlockResultsResponse, | ||
ReadonlyDateWithNanoseconds, | ||
Header as RpcHeader, | ||
ValidatorPubkey as RpcPubKey, | ||
|
@@ -193,6 +195,28 @@ interface ParsedEvent { | |
readonly attributes: readonly ParsedAttribute[]; | ||
} | ||
|
||
function decodeBase64(value: Uint8Array): string { | ||
return Buffer.from(value).toString('binary'); | ||
} | ||
|
||
export function parsePacketsFromBlockResult( | ||
result: BlockResultsResponse | ||
): Packet[] { | ||
const allEvents: ParsedEvent[] = result.beginBlockEvents | ||
.concat(...result.endBlockEvents) | ||
.filter(({ type }) => type === 'send_packet') | ||
.map(({ type, attributes }) => ({ | ||
type, | ||
attributes: attributes.map(({ key, value }) => ({ | ||
key: decodeBase64(key), | ||
value: decodeBase64(value), | ||
})), | ||
})); | ||
|
||
const flatEvents = ([] as ParsedEvent[]).concat(allEvents.map(parseEvent)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In any case, nice you do |
||
return flatEvents.map(parsePacket); | ||
} | ||
|
||
export function parsePacketsFromLogs(logs: readonly logs.Log[]): Packet[] { | ||
// grab all send_packet events from the logs | ||
const allEvents: ParsedEvent[][] = logs.map((log) => | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wow, very nice. I never knew how to import non-tagged releases from lerna monorepos
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.
Nice. But where is the TS -> JS compiled?
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.
@webmaster128 I think you can read more here. It should be compiled by them