Add getter to AccountMetaSlice
This commit is contained in:
parent
838b9c4428
commit
4a1d072b7a
|
@ -120,6 +120,15 @@ func (slice AccountMetaSlice) GetAccounts() (out []*AccountMeta) {
|
|||
return out
|
||||
}
|
||||
|
||||
// Get returns the AccountMeta at the desired index.
|
||||
// If the index is not present, it returns nil.
|
||||
func (slice AccountMetaSlice) Get(index int) *AccountMeta {
|
||||
if len(slice) > index {
|
||||
return slice[index]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSigners returns the accounts that are signers.
|
||||
func (slice AccountMetaSlice) GetSigners() []*AccountMeta {
|
||||
signers := make([]*AccountMeta, 0)
|
||||
|
|
|
@ -48,6 +48,9 @@ func Account(name string, pubKey solana.PublicKey) string {
|
|||
}
|
||||
|
||||
func Meta(name string, meta *solana.AccountMeta) string {
|
||||
if meta == nil {
|
||||
return Shakespeare(name) + ": " + "<nil>"
|
||||
}
|
||||
out := Shakespeare(name) + ": " + text.ColorizeBG(meta.PublicKey.String())
|
||||
out += " ["
|
||||
if meta.IsWritable {
|
||||
|
|
Loading…
Reference in New Issue