Skip to content

Commit

Permalink
feat: add margin interface
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-path committed Nov 19, 2024
1 parent d0ba7b7 commit 7e6df20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions data/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DataSource {
throw new Error("Failed to connect server");
}

// eslint-disable-next-line no-useless-catch
try {
const json = await parseResponse(response);
return json;
Expand Down Expand Up @@ -104,6 +105,16 @@ class DataSource {
getTxId(receipt_id) {
return this.callAPI(`/v1/search/?keyword=${receipt_id}`, "GET", null, null, config?.txIdApiUrl);
}

getMarginTradingPosition(params) {
return this.callAPI(
`/v3/margin-trading/position`,
"POST",
null,
params,
config?.marginTradingUrl,
);
}
}

export default DataSource;
1 change: 1 addition & 0 deletions utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const getConfig = (env: string = defaultNetwork) => {
liquidationUrl: "https://dev.data-service.ref-finance.com",
recordsUrl: "https://dev-indexer.ref-finance.com",
txIdApiUrl: "https://api-testnet.nearblocks.io",
marginTradingUrl: " https://testnet-indexer.ref-finance.com",
SPECIAL_REGISTRATION_TOKEN_IDS: [
"3e2210e1184b45b64c8a434c0a7e7b23cc04ea7eb7a6c3c32520d03d4afcb8af",
],
Expand Down

0 comments on commit 7e6df20

Please sign in to comment.