-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new keys and getter / setter functions (#7378)
* chore: adding keys and keeper getter and setter functions * chore: use BigEndian for sequence in keys
- Loading branch information
Showing
2 changed files
with
125 additions
and
0 deletions.
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
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,24 @@ | ||
package v2 | ||
|
||
import "fmt" | ||
|
||
// PacketReceiptKey returns the store key of under which a packet | ||
// receipt is stored | ||
func PacketReceiptKey(sourceID string, bigEndianSequence []byte) []byte { | ||
return []byte(fmt.Sprintf("receipts/channels/%s/sequences/%s", sourceID, string(bigEndianSequence))) | ||
} | ||
|
||
// PacketAcknowledgementKey returns the store key of under which a packet acknowledgement is stored. | ||
func PacketAcknowledgementKey(sourceID string, bigEndianSequence []byte) []byte { | ||
return []byte(fmt.Sprintf("acks/channels/%s/sequences/%s", sourceID, string(bigEndianSequence))) | ||
} | ||
|
||
// PacketCommitmentKey returns the store key of under which a packet commitment is stored. | ||
func PacketCommitmentKey(sourceID string, bigEndianSequence []byte) []byte { | ||
return []byte(fmt.Sprintf("commitments/channels/%s/sequences/%s", sourceID, string(bigEndianSequence))) | ||
} | ||
|
||
// NextSequenceSendKey returns the store key for the next sequence send of a given sourceID. | ||
func NextSequenceSendKey(sourceID string) []byte { | ||
return []byte(fmt.Sprintf("nextSequenceSend/%s", sourceID)) | ||
} |