From 70827b7f085f53394c0933039c6109326f587f08 Mon Sep 17 00:00:00 2001 From: ibadia Date: Thu, 7 Sep 2023 10:49:04 +0500 Subject: [PATCH 1/3] adding dms --- README.md | 4 +-- examples/18.dms_api.py | 50 ++++++++++++++++++++++++++++++ src/bluefin_v2_client/constants.py | 4 +-- 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 examples/18.dms_api.py diff --git a/README.md b/README.md index 6acc083..91c2bb2 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ When initializing the client, users must accept [terms and conditions](https://b { "apiGateway": "https://dapi.api.sui-prod.bluefin.io", "socketURL": "wss://dapi.api.sui-prod.bluefin.io", - "dmsURL": "https://dapi.api.sui-prod.bluefin.io", + "dmsURL": "http://api.sui-prod.bluefin.io/dead-man-switch", "webSocketURL": "wss://notifications.api.sui-prod.bluefin.io", - "onboardingUrl": "https://trade.bluefin.io" + "onboardingUrl": "https://trade-sui.bluefin.exchange" } ``` diff --git a/examples/18.dms_api.py b/examples/18.dms_api.py new file mode 100644 index 0000000..cac6217 --- /dev/null +++ b/examples/18.dms_api.py @@ -0,0 +1,50 @@ +import json + +import sys, os + +sys.path.append(os.getcwd() + "/src/") +from config import TEST_ACCT_KEY, TEST_SUB_ACCT_KEY, TEST_NETWORK +from bluefin_v2_client import ( + BluefinClient, + MARKET_SYMBOLS, + ORDER_SIDE, + ORDER_TYPE, + Networks, + OrderSignatureRequest, +) +import asyncio + +from bluefin_client_sui.interfaces import PostTimerAttributes + + +async def main(): + client = BluefinClient(True, Networks[TEST_NETWORK], TEST_ACCT_KEY) + await client.init(True) + + print("User: ", client.get_public_address()) + countDownsObject: PostTimerAttributes = dict() + countDowns = list() + countDowns.append({"symbol": MARKET_SYMBOLS.BTC.value, "countDown": 3 * 1000}) + + countDowns.append({"symbol": MARKET_SYMBOLS.ETH.value, "countDown": 3 * 1000}) + + countDownsObject["countDowns"] = countDowns + try: + # sending post request to reset user's count down timer with MARKET_SYMBOL for auto cancellation of order + postResponse = await client.reset_cancel_on_disconnect_timer(countDownsObject) + print(postResponse) + # get request to get user's count down timer for MARKET_SYMBOL + getResponse = await client.get_cancel_on_disconnect_timer( + {"symbol": MARKET_SYMBOLS.ETH} + ) + print(getResponse) + + except Exception as e: + print(e) + + await client.close_connections() + + +if __name__ == "__main__": + event_loop = asyncio.get_event_loop() + event_loop.run_until_complete(main()) diff --git a/src/bluefin_v2_client/constants.py b/src/bluefin_v2_client/constants.py index aef6c21..3f97bf1 100644 --- a/src/bluefin_v2_client/constants.py +++ b/src/bluefin_v2_client/constants.py @@ -3,7 +3,7 @@ "url": "https://fullnode.testnet.sui.io:443", "apiGateway": "https://dapi.api.sui-staging.bluefin.io", "socketURL": "wss://dapi.api.sui-staging.bluefin.io", - "dmsURL": "https://dapi.api.sui-staging.bluefin.io", + "dmsURL": "https://api.sui-staging.bluefin.io/dead-man-switch", "webSocketURL": "wss://notifications.api.sui-staging.bluefin.io", "onboardingUrl": "https://testnet.bluefin.io", }, @@ -11,7 +11,7 @@ "url": "https://fullnode.testnet.sui.io:443", "apiGateway": "https://dapi.api.sui-prod.bluefin.io", "socketURL": "wss://dapi.api.sui-prod.bluefin.io", - "dmsURL": "https://dapi.api.sui-prod.bluefin.io", + "dmsURL": "http://api.sui-prod.bluefin.io/dead-man-switch", "webSocketURL": "wss://notifications.api.sui-prod.bluefin.io", "onboardingUrl": "https://trade-sui.bluefin.exchange", }, From dd2d605ffa1c3904e17e4388f7e224da61593da7 Mon Sep 17 00:00:00 2001 From: ibadia Date: Thu, 7 Sep 2023 10:50:38 +0500 Subject: [PATCH 2/3] minor type --- README.md | 2 +- src/bluefin_v2_client/constants.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91c2bb2..640d643 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ When initializing the client, users must accept [terms and conditions](https://b { "apiGateway": "https://dapi.api.sui-prod.bluefin.io", "socketURL": "wss://dapi.api.sui-prod.bluefin.io", - "dmsURL": "http://api.sui-prod.bluefin.io/dead-man-switch", + "dmsURL": "https://api.sui-prod.bluefin.io/dead-man-switch", "webSocketURL": "wss://notifications.api.sui-prod.bluefin.io", "onboardingUrl": "https://trade-sui.bluefin.exchange" } diff --git a/src/bluefin_v2_client/constants.py b/src/bluefin_v2_client/constants.py index 3f97bf1..1f95172 100644 --- a/src/bluefin_v2_client/constants.py +++ b/src/bluefin_v2_client/constants.py @@ -11,7 +11,7 @@ "url": "https://fullnode.testnet.sui.io:443", "apiGateway": "https://dapi.api.sui-prod.bluefin.io", "socketURL": "wss://dapi.api.sui-prod.bluefin.io", - "dmsURL": "http://api.sui-prod.bluefin.io/dead-man-switch", + "dmsURL": "https://api.sui-prod.bluefin.io/dead-man-switch", "webSocketURL": "wss://notifications.api.sui-prod.bluefin.io", "onboardingUrl": "https://trade-sui.bluefin.exchange", }, From 37b1461011dce55f0da502da5a3074af956ddab3 Mon Sep 17 00:00:00 2001 From: ibadia Date: Thu, 7 Sep 2023 10:51:04 +0500 Subject: [PATCH 3/3] updaing version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 285f5aa..e090ced 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bluefin_v2_client" -version = "2.0.1" +version = "2.0.2" description = "Library to interact with Bluefin exchange protocol including its off-chain api-gateway and on-chain contracts" readme = "README.md" requires-python = ">=3.8"