Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests #26

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 33 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ rand = "0.7.3"
ellipsis-client = "0.1.15"
tokio = { version = "1.8.4", features = ["full"] }
solana-sdk = "=1.14.9"
phoenix-sdk = { git = "https://github.com/Ellipsis-Labs/phoenix-sdk", rev = "adb01a3" }
phoenix-sdk = { git = "https://github.com/Ellipsis-Labs/phoenix-sdk", branch = "update-rust-sdk" }
16 changes: 13 additions & 3 deletions idl/generateClient.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Solita } = require("@metaplex-foundation/solita");
const { spawn } = require("child_process");

const path = require("path");
const idlDir = __dirname;
Expand All @@ -8,7 +9,18 @@ const PROGRAM_NAME = "phoenix_v1";

async function main() {
generateTypeScriptSDK().then(() => {
conoole.log("done");
console.log("Running prettier on generated files...");
// Note: prettier is not a dependency of this package, so it must be installed
// TODO: Add a prettier config file for consistent style
spawn("prettier", ["--write", sdkDir], { stdio: "inherit" })
.on("error", (err) => {
console.error(
"Failed to lint client files. Try installing prettier (`npm install --save-dev --save-exact prettier`)"
);
})
.on("exit", () => {
console.log("Finished linting files.");
});
});
}

Expand All @@ -18,8 +30,6 @@ async function generateTypeScriptSDK() {
const idl = require(generatedIdlPath);
const gen = new Solita(idl, { formatCode: true });
await gen.renderAndWriteTo(sdkDir);
console.error("Success!");
process.exit(0);
}

main().catch((err) => {
Expand Down
104 changes: 104 additions & 0 deletions idl/phoenix_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,58 @@
]
}
},
{
"name": "TimeInForceEvent",
"type": {
"kind": "struct",
"fields": [
{
"name": "index",
"type": "u16"
},
{
"name": "orderSequenceNumber",
"type": "u64"
},
{
"name": "lastValidSlot",
"type": "u64"
},
{
"name": "lastValidUnixTimestampInSeconds",
"type": "u64"
}
]
}
},
{
"name": "ExpiredOrderEvent",
"type": {
"kind": "struct",
"fields": [
{
"name": "index",
"type": "u16"
},
{
"name": "makerId",
"type": "publicKey"
},
{
"name": "orderSequenceNumber",
"type": "u64"
},
{
"name": "priceInTicks",
"type": "u64"
},
{
"name": "baseLotsRemoved",
"type": "u64"
}
]
}
},
{
"name": "CancelUpToParams",
"type": {
Expand Down Expand Up @@ -1950,6 +2002,18 @@
{
"name": "sizeInBaseLots",
"type": "u64"
},
{
"name": "lastValidSlot",
"type": {
"option": "u64"
}
},
{
"name": "lastValidUnixTimestampInSeconds",
"type": {
"option": "u64"
}
}
]
}
Expand Down Expand Up @@ -2156,6 +2220,22 @@
"defined": "FeeEvent"
}
]
},
{
"name": "TimeInForce",
"fields": [
{
"defined": "TimeInForceEvent"
}
]
},
{
"name": "ExpiredOrder",
"fields": [
{
"defined": "ExpiredOrderEvent"
}
]
}
]
}
Expand Down Expand Up @@ -2236,6 +2316,18 @@
{
"name": "use_only_deposited_funds",
"type": "bool"
},
{
"name": "last_valid_slot",
"type": {
"option": "u64"
}
},
{
"name": "last_valid_unix_timestamp_in_seconds",
"type": {
"option": "u64"
}
}
]
},
Expand Down Expand Up @@ -2275,6 +2367,18 @@
{
"name": "use_only_deposited_funds",
"type": "bool"
},
{
"name": "last_valid_slot",
"type": {
"option": "u64"
}
},
{
"name": "last_valid_unix_timestamp_in_seconds",
"type": {
"option": "u64"
}
}
]
},
Expand Down
Loading