-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new class OpenBookOpenOrdersAccount has been added to retrieve OpenOrdersAccount information. An additional method to OpenBookManager enables fetching this account data. Furthermore, a corresponding unit test has been added to validate this new functionality. Unrelated to these changes, developer organization details have been removed from pom.xml.
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 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
32 changes: 32 additions & 0 deletions
32
openbook/src/main/java/com/mmorrell/openbook/model/OpenBookOpenOrdersAccount.java
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,32 @@ | ||
package com.mmorrell.openbook.model; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import org.p2p.solanaj.core.PublicKey; | ||
import org.p2p.solanaj.utils.ByteUtils; | ||
|
||
@Data | ||
@Builder | ||
public class OpenBookOpenOrdersAccount { | ||
|
||
private PublicKey owner; | ||
private PublicKey market; | ||
private String name; // 32 bytes | ||
private PublicKey delegate; | ||
private int accountNum; | ||
private byte bump; | ||
// 3 bytes of padding | ||
private byte[] padding; | ||
|
||
// position x 1 DTO TBD | ||
// openOrders x 24 DTO TBD | ||
|
||
public static OpenBookOpenOrdersAccount readOpenBookOpenOrdersAccount(byte[] data) { | ||
return OpenBookOpenOrdersAccount.builder() | ||
.owner(PublicKey.readPubkey(data, 8)) | ||
.market(PublicKey.readPubkey(data, 40)) | ||
.name(new String(ByteUtils.readBytes(data, 72, 32))) | ||
.build(); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -25,8 +25,6 @@ | |
<developer> | ||
<name>Michael Morrell</name> | ||
<email>[email protected]</email> | ||
<organization>Openserum</organization> | ||
<organizationUrl>https://openserum.io/</organizationUrl> | ||
</developer> | ||
</developers> | ||
|
||
|