Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
cinojosa0705 committed Feb 29, 2024
1 parent 9b8a3ab commit e08013c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@coral-xyz/anchor": "^0.29.0",
"@hxronetwork/dexterity-ts": "^1.6.33",
"@solana/web3.js": "^1.90.0",
"dotenv": "^16.4.5",
"node-telegram-bot-api": "^0.64.0"
}
}
19 changes: 19 additions & 0 deletions src/bot-utils/cancelTraderSubHandler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
export async function cancelTraderSub() {
const baseUrl = process.env.TRADING_API_URL || "http://localhost:3000";
const url = `${baseUrl}/cancel-subscription`;

try {
const response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();
return data;
} catch (error) {
console.error("Error making request:", error);
}
}
24 changes: 22 additions & 2 deletions src/bot-utils/newTraderSubHandler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
export async function newTraderSubHandler(trader: string) {

}
const baseUrl = process.env.TRADING_API_URL || 'http://localhost:3000';
const url = `${baseUrl}/new-subscription?trg=${trader}`;

try {
const response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();
return data;
} catch (error) {
console.error("Error making request:", error);
}
}

2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
handleNewSubscription,
} from "./api-utils/subscritionHandler";
import { tradeHandler } from "./api-utils/tradeHandler";
import * as dotenv from 'dotenv';
dotenv.config();

const AppState = new Map<string, any>();

Expand Down

0 comments on commit e08013c

Please sign in to comment.