forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_account.go
32 lines (26 loc) · 935 Bytes
/
simple_account.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
package txnbuild
// SimpleAccount is a minimal implementation of an Account.
type SimpleAccount struct {
AccountID string
Sequence int64
}
// GetAccountID returns the Account ID.
func (sa *SimpleAccount) GetAccountID() string {
return sa.AccountID
}
// IncrementSequenceNumber increments the internal record of the
// account's sequence number by 1.
func (sa *SimpleAccount) IncrementSequenceNumber() (int64, error) {
sa.Sequence++
return sa.Sequence, nil
}
// GetSequenceNumber returns the sequence number of the account.
func (sa *SimpleAccount) GetSequenceNumber() (int64, error) {
return sa.Sequence, nil
}
// NewSimpleAccount is a factory method that creates a SimpleAccount from "accountID" and "sequence".
func NewSimpleAccount(accountID string, sequence int64) SimpleAccount {
return SimpleAccount{accountID, sequence}
}
// ensure that SimpleAccount implements Account interface.
var _ Account = &SimpleAccount{}