Skip to content

Commit

Permalink
fix: don't submit order with negative output (#300)
Browse files Browse the repository at this point in the history
* fix: don't submit order with negative output

* fix: don't submit order with negative output

* fix: mention anchor explicitly
  • Loading branch information
guibescos authored Dec 17, 2024
1 parent 0062806 commit 91a00a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/limonade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "limonade",
"version": "0.3.0",
"version": "0.3.1",
"description": "This script is used to submit new opportunities fetched from the limo program to the express relay.",
"main": "index.js",
"scripts": {
Expand Down
11 changes: 8 additions & 3 deletions scripts/limonade/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const argv = yargs(hideBin(process.argv))
description:
"API key to authenticate with the express relay server for publishing opportunities.",
type: "string",
demandOption: true,
})
.option("number-of-concurrent-submissions", {
description: "Number of concurrent submissions to the express relay server",
Expand Down Expand Up @@ -141,7 +140,11 @@ async function run() {
e.message.includes("Same opportunity is submitted recently")
)
) {
console.error("Failed to submit opportunity", e);
console.error(
"Failed to submit opportunity",
e,
e.message ? e.message : ""
);
}
};
const setHermesConnectionTimeout = () => {
Expand Down Expand Up @@ -187,7 +190,9 @@ async function run() {
try {
await client.submitOpportunity(payload);
} catch (e) {
handleSubmitError(e);
if (e instanceof ClientError && e.message.includes("422")) {
console.log(payload);
}
}
})
);
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/express-relay-js",
"version": "0.16.0",
"version": "0.16.1",
"description": "Utilities for interacting with the express relay protocol",
"homepage": "https://github.com/pyth-network/per/tree/main/sdk/js",
"author": "Douro Labs",
Expand Down
6 changes: 4 additions & 2 deletions sdk/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ export class Client {
encoded_order,
Order.discriminator.length
);
const remainingOutputAmount =
const remainingOutputAmount = anchor.BN.max(
opportunity.order.state.expectedOutputAmount.sub(
opportunity.order.state.filledOutputAmount
);
),
new anchor.BN(0)
);
body = {
chain_id: opportunity.chainId,
version: "v1" as const,
Expand Down

0 comments on commit 91a00a9

Please sign in to comment.