forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signer.go
26 lines (22 loc) · 777 Bytes
/
signer.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
package resourceadapter
import (
"context"
. "github.com/andskur/go/protocols/horizon"
"github.com/andskur/go/services/horizon/internal/db2/core"
)
// Populate fills out the fields of the signer, using one of an account's
// secondary signers.
func PopulateSigner(ctx context.Context, dest *Signer, row core.Signer) {
dest.PublicKey = row.Publickey
dest.Weight = row.Weight
dest.Key = row.Publickey
dest.Type = MustKeyTypeFromAddress(dest.PublicKey)
}
// PopulateMaster fills out the fields of the signer, using a stellar account to
// provide the data.
func PopulateMasterSigner(dest *Signer, row core.Account) {
dest.PublicKey = row.Accountid
dest.Weight = int32(row.Thresholds[0])
dest.Key = row.Accountid
dest.Type = MustKeyTypeFromAddress(dest.PublicKey)
}