-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
969 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Solnet.Wallet; | ||
using System.Collections.Generic; | ||
|
||
namespace Solnet.Rpc.Models | ||
{ | ||
public class AddressLookupTableState | ||
{ | ||
public long DeactivationSlot { get; set; } | ||
public int LastExtendedSlot { get; set; } | ||
public int LastExtendedSlowStartIndex { get ; set; } | ||
public PublicKey Authority { get; set; } | ||
public List<PublicKey> Addresses { get; set; } | ||
} | ||
|
||
|
||
public class AddressLookupTableAccount | ||
{ | ||
private PublicKey _key; | ||
private AddressLookupTableState _state; | ||
|
||
public AddressLookupTableAccount(PublicKey key, AddressLookupTableState state) | ||
{ | ||
_key = key; | ||
_state = state; | ||
} | ||
|
||
public bool IsActive | ||
{ | ||
get | ||
{ | ||
return _state.DeactivationSlot == long.MaxValue; | ||
} | ||
} | ||
|
||
public static AddressLookupTableState Deserialize(byte[] accountData) | ||
{ | ||
var meta = DecodeData() | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Solnet.Wallet; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Solnet.Rpc.Models | ||
{ | ||
/// <summary> | ||
/// A wrapper around a list of <see cref="AccountMeta"/>s that takes care of deduplication and ordering according to | ||
/// the wire format specification. | ||
/// </summary> | ||
internal class MessageAccountKeys | ||
{ | ||
/// <summary> | ||
/// The static account metas list. | ||
/// </summary> | ||
private readonly List<PublicKey> _staticAccounts; | ||
|
||
private AccountKeysFromLookups _accountKeysFromLookups; | ||
|
||
|
||
internal List<PublicKey> KeySegments | ||
{ | ||
get | ||
{ | ||
var segments = _staticAccounts.ToList(); | ||
if (_accountKeysFromLookups != null) | ||
{ | ||
segments.AddRange(_accountKeysFromLookups.Writables); | ||
segments.AddRange(_accountKeysFromLookups.Readonly); | ||
} | ||
|
||
return segments; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initialize the account keys list for use within transaction building. | ||
/// </summary> | ||
internal MessageAccountKeys(List<PublicKey> staticAccounts, AccountKeysFromLookups accountKeysFromLookups = null) | ||
{ | ||
_staticAccounts = staticAccounts; | ||
_accountKeysFromLookups = accountKeysFromLookups; | ||
} | ||
|
||
public PublicKey Get(int index) | ||
{ | ||
if (index < KeySegments.Count) | ||
{ | ||
return KeySegments[index]; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.