-
Notifications
You must be signed in to change notification settings - Fork 210
/
key.go
43 lines (38 loc) · 946 Bytes
/
key.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package keeper
import (
"bytes"
types "github.com/akash-network/akash-api/go/node/escrow/v1beta3"
)
func accountKey(id types.AccountID) []byte {
// TODO: validate scope, xid
buf := bytes.Buffer{}
buf.Write(types.AccountKeyPrefix())
buf.WriteRune('/')
buf.WriteString(id.Scope)
buf.WriteRune('/')
buf.WriteString(id.XID)
return buf.Bytes()
}
func accountPaymentsKey(id types.AccountID) []byte {
// TODO: validate scope, xid, pid
buf := bytes.Buffer{}
buf.Write(types.PaymentKeyPrefix())
buf.WriteRune('/')
buf.WriteString(id.Scope)
buf.WriteRune('/')
buf.WriteString(id.XID)
buf.WriteRune('/')
return buf.Bytes()
}
func paymentKey(id types.AccountID, pid string) []byte {
// TODO: validate scope, xid, pid
buf := bytes.Buffer{}
buf.Write(types.PaymentKeyPrefix())
buf.WriteRune('/')
buf.WriteString(id.Scope)
buf.WriteRune('/')
buf.WriteString(id.XID)
buf.WriteRune('/')
buf.WriteString(pid)
return buf.Bytes()
}