-
Notifications
You must be signed in to change notification settings - Fork 16
/
account.go
50 lines (37 loc) · 1.57 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package aptos
import (
"github.com/aptos-labs/aptos-go-sdk/crypto"
"github.com/aptos-labs/aptos-go-sdk/internal/types"
)
// Re-export types so that way the user experience doesn't change
// AccountAddress is a 32 byte address on the Aptos blockchain
// It can represent an Object, an Account, and much more.
type AccountAddress = types.AccountAddress
// Account is a wrapper for a signer, handling the AccountAddress and signing
type Account = types.Account
// AccountZero represents the 0x0 address
var AccountZero = types.AccountZero
// AccountOne represents the 0x1 address
var AccountOne = types.AccountOne
// AccountTwo represents the 0x2 address
var AccountTwo = types.AccountTwo
// AccountThree represents the 0x3 address
var AccountThree = types.AccountThree
// AccountFour represents the 0x4 address
var AccountFour = types.AccountFour
// NewAccountFromSigner creates an account from a Signer, which is most commonly a private key
func NewAccountFromSigner(signer crypto.Signer, authKey ...crypto.AuthenticationKey) (*Account, error) {
return types.NewAccountFromSigner(signer, authKey...)
}
// NewEd25519Account creates a legacy Ed25519 account, this is most commonly used in wallets
func NewEd25519Account() (*Account, error) {
return types.NewEd25519Account()
}
// NewEd25519SingleSenderAccount creates a single signer Ed25519 account
func NewEd25519SingleSenderAccount() (*Account, error) {
return types.NewEd25519SingleSignerAccount()
}
// NewSecp256k1Account creates a Secp256k1 account
func NewSecp256k1Account() (*Account, error) {
return types.NewSecp256k1Account()
}