dydxprotocol / v4-clients Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
post.py working with fix #99 (comment)
any fix for get.py?
tried many formats for VALIDATOR_GRPC_MAINNET and supported nodes from list
VALIDATOR_GRPC_MAINNET = 'grpc+https://dydx-ops-grpc.kingnodes.com:443'
# VALIDATOR_GRPC_MAINNET = 'https://dydx-ops-grpc.kingnodes.com:443'
# VALIDATOR_GRPC_MAINNET = 'https://dydx-ops-grpc.kingnodes.com'
NETWORK_ID_MAINNET = 'dydx-mainnet-1'
INDEXER_API_HOST_MAINNET = 'https://indexer.dydx.trade'
INDEXER_WS_HOST_MAINNET = 'wss://indexer.dydx.trade'
NETWORK=Network(
env='mainnet',
validator_config=ValidatorConfig(
grpc_endpoint=VALIDATOR_GRPC_MAINNET,
chain_id=NETWORK_ID_MAINNET,
ssl_enabled=True
),
indexer_config=IndexerConfig(
rest_endpoint=INDEXER_API_HOST_MAINNET,
websocket_endpoint=INDEXER_WS_HOST_MAINNET,
),
faucet_endpoint='',
)
client = CompositeClient(
NETWORK,
)
client.validator_client.get.bank_balance(subaccount.address, 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5')
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "DNS resolution failed for grpc+https://dydx-ops-grpc.kingnodes.com:443: UNAVAILABLE: WSA Error"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"DNS resolution failed for grpc+https://dydx-ops-grpc.kingnodes.com:443: UNAVAILABLE: WSA Error", grpc_status:14, created_time:"2024-03-12T03:10:48.338824+00:00"}"
python3 examples/composite_example.py
return
E1205 11:14:25.853674000 4689714624 hpack_parser.cc:999] Error parsing 'content-type' metadata: invalid value
**Order Failed**
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Stream removed"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-12-05T11:14:25.853876+08:00", grpc_status:2, grpc_message:"Stream removed"}"
>
E1205 11:14:32.285944000 4689714624 hpack_parser.cc:999] Error parsing 'content-type' metadata: invalid value
**Order Failed**
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Stream removed"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Stream removed", grpc_status:2, created_time:"2023-12-05T11:14:32.286025+08:00"}"
>
E1205 11:14:38.746211000 4689714624 hpack_parser.cc:999] Error parsing 'content-type' metadata: invalid value
**Order Failed**
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Stream removed"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-12-05T11:14:38.746286+08:00", grpc_status:2, grpc_message:"Stream removed"}"
>
E1205 11:14:45.148782000 4689714624 hpack_parser.cc:999] Error parsing 'content-type' metadata: invalid value
**Order Failed**
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Stream removed"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-12-05T11:14:45.148867+08:00", grpc_status:2, grpc_message:"Stream removed"}"
>
E1205 11:14:51.021330000 4689714624 hpack_parser.cc:999] Error parsing 'content-type' metadata: invalid value
Package version details
"@dydxprotocol/v4-client-js": "^1.1.4",
"react-native": "0.72.7"
Hermes engine is enabled
Device iOS simulator
When just write import line code
import {
ValidatorClient,
Network,
LocalWallet,
BECH32_PREFIX,
} from '@dydxprotocol/v4-client-js';
getting following error. Did not get details log.
Restricted in strict mode
from v4_client_py.clients import IndexerClient
from v4_client_py.clients.constants import Network
client = IndexerClient(
config=Network.config_network().indexer_config,
)
def get_market():
try:
markets_response = client.markets.get_perpetual_markets()
print(markets_response.data)
except Exception as e:
print(f"failed to get markets: {e}")
config=Network.config_network().indexer_config,
AttributeError: type object 'Network' has no attribute 'config_network'
As shown in your example: https://github.com/kaloureyes3/v4-clients/blob/main/v4-client-py/examples/markets_endpoints.py
Repo requires @dydxprotocol/v4-proto as dependencies.
Though this package is not available from the npm registry
educeonly in sending orders as soon as possible
educeonly in sending orders as soon as possible
educeonly in sending orders as soon as possible
源代码如下:
1 async getOrder(orderId: string) : Promise {
2 const uri = /v4/orders${orderId}
;
3 return this.get(uri);
4 }
第2行错误,应该为 const uri = /v4/orders/${orderId}
; 漏掉了一个"/"
How avoid this?
[ERROR] **Long Term Order Failed**
[ERROR] The GoodTilBlock 5671920 exceeds the current blockHeight 5671897 plus ShortBlockWindow 20: The GoodTilBlock of the message is further than ShortBlockWindow blocks into the future
{'error': BroadcastError('The GoodTilBlock 5671920 exceeds the current blockHeight 5671897 plus ShortBlockWindow 20: The GoodTilBlock of the message is further than ShortBlockWindow blocks into the future')}
It happens time to time. Eventually the order passes through.
This thing with GoodTilBlock is driving me nuts to get in sync...
Cheers.
We want to derive a user's dydx account using an evm signer(like ethers), and also verify a user's evm account using their dydx address programmatically. Pls help here.
also, possible providing some docs explaining how secp256k1 private key derives dydx signing key; and what is the signing algorithm used in dydx trading
After placing an order, how do I get the orderId? Used to call the function getOrder
Will mainnet will be supported anytime soon, to make real orders and use stop losses?
V3 has a Rust sdk (Python wrapper):
https://github.com/junta/dydx-v3-rust
https://www.dydxgrants.com/grants/rust-sdk
Will there be a Rust sdk for v4?
Versions:
"@dydxprotocol/v4-client-js": "1.0.25"
"@nestjs": "9.1.6",
"docker-image": "node:16.18.0-alpine3.16"
I got this error
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/assets/genesis'
Require stack:
- /home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/clients/modules/proto-includes.js
- /home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/clients/types.js
- /home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/types.js
- /home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/index.js
- /home/node/app/dist/modules/dydx/dydx-order.service.js
- /home/node/app/dist/modules/dydx/dydx-order.module.js
- /home/node/app/dist/app.module.js
- /home/node/app/dist/main.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/clients/modules/proto-includes.js:52:14)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/clients/modules/proto-includes.js',
'/home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/clients/types.js',
'/home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/types.js',
'/home/node/app/node_modules/@dydxprotocol/v4-client-js/build/src/index.js',
'/home/node/app/dist/modules/dydx/dydx-order.service.js',
'/home/node/app/dist/modules/dydx/dydx-order.module.js',
'/home/node/app/dist/app.module.js',
'/home/node/app/dist/main.js'
]
}
Tried to upgrade node to 18.20.1 but the same issue has been happened
Having trouble with the python composite client... I am unable to even do a simple operation like getting the current block: compositeClient.get_current_block()
current_block = compositeClient.get_current_block()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/v4_client_py/clients/dydx_composite_client.py", line 45, in get_current_block
response = self.validator_client.get.latest_block()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/v4_client_py/clients/modules/get.py", line 116, in latest_block
return self.stubCosmosTendermint.GetLatestBlock(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/grpc/_channel.py", line 1160, in __call__
return _end_unary_response_blocking(state, call, False, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "DNS resolution failed for https://dydx-rpc.publicnode.com:443: C-ares status is not ARES_SUCCESS qtype=A name=https://dydx-rpc.publicnode.com:443 is_balancer=0: Domain name not found"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"--omitted--", grpc_status:14, grpc_message:"DNS resolution failed for https://dydx-rpc.publicnode.com:443: C-ares status is not ARES_SUCCESS qtype=A name=https://dydx-rpc.publicnode.com:443 is_balancer=0: Domain name not found"}"
I've tried multiple RPC endpoints from https://docs.dydx.trade/networks/network1/resources but keep on getting the same error.
This is how I am instantiating my CompositeClient:
indexerConfig = IndexerConfig(
rest_endpoint='https://indexer.dydx.trade',
websocket_endpoint='wss://indexer.dydx.trade/v4/ws',
)
compositeClient = CompositeClient(
network=Network(
env='mainnet',
validator_config=ValidatorConfig(
grpc_endpoint='https://dydx-rpc.publicnode.com:443',
chain_id='dydx-mainnet-1',
ssl_enabled=True
),
indexer_config=indexerConfig,
faucet_endpoint=None,
)
)
Any help would be much appreciated.
Hello,
I can't find precise information on that function : does it always return the last 100 candles of the given resolution ?
Thanks !
Edit : I also wonder if there is a plan to add mainnet api urls as there are only the testnet ones in the Netwokr constants.
(venv) ➜ DYDX python -V
Python 3.11.2
pip install v4-client-py
....
Downloading cbor2-5.5.1-cp311-cp311-macosx_11_0_arm64.whl (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 6.4 MB/s eta 0:00:00
Downloading eth_abi-4.2.1-py3-none-any.whl (28 kB)
Downloading eth_typing-3.5.2-py3-none-any.whl (14 kB)
Downloading eth_utils-2.3.1-py3-none-any.whl (77 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.8/77.8 kB 8.4 MB/s eta 0:00:00
Building wheels for collected packages: ed25519-blake2b
Building wheel for ed25519-blake2b (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for ed25519-blake2b (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use sudo xcode-select --switch path/to/Xcode.app
to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install
to install the standalone command line developer tools.
See man xcode-select
for more details.
UPDATING build/lib.macosx-10.9-universal2-cpython-311/ed25519_blake2b/_version.py
set build/lib.macosx-10.9-universal2-cpython-311/ed25519_blake2b/_version.py to '1.4'
error: command '/Users/quinn/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ed25519-blake2b
Failed to build ed25519-blake2b
ERROR: Could not build wheels for ed25519-blake2b, which is required to install pyproject.toml-based projects
Hey,
I'm currently exploring what's stored on the chain with a goal to do some analysis (and maybe make my own indexer later).
I've successfully established the connection with some mainnet validators and checked a few blocks so far.
It looks like all blocks contain these four messages
"/dydxprotocol.clob.MsgProposedOperations"
"/dydxprotocol.bridge.MsgAcknowledgeBridges"
"/dydxprotocol.perpetuals.MsgAddPremiumVotes"
"/dydxprotocol.prices.MsgUpdateMarketPrices"
I'm wondering, what's the correct way to decode them?
This is what i came up with so far https://github.com/miran248/dydx-v4-test/blob/a6581251eacfa488c85f564287fb1955097a0555/validator-client.ts#L6
Feels wrong, and MsgProposedOperations
was not fully decoded
Are there any other ways to replay the events?
Indexer has some functions but there i can't target a specific block height.
(didn't know where to ask this question, hence the issue)
Thanks,
Miran
EDIT: It looks like i'll have to do the mapping myself, like here https://github.com/dydxprotocol/v4-clients/blob/c94bcbf4fc91bb896ea716ccd02ace32b0cb50d0/v4-client-js/src/clients/lib/registry.ts
After installing the Python package via pip install v4-client-py
and running a basic initialize the client example from the docs:
from v4_client_py.clients import CompositeClient
from v4_client_py.clients.constants import Network
client = CompositeClient(
Network.testnet(),
)
I am getting the errors below:
Traceback (most recent call last):
File "d:\work\dydx-v4\execution\utils\dydx_v4_utils.py", line 1, in <module>
from v4_client_py import IndexerClient
File "D:\miniconda3\envs\dydx\lib\site-packages\v4_client_py\__init__.py", line 1, in <module>
from v4_client_py.clients.dydx_indexer_client import IndexerClient
File "D:\miniconda3\envs\dydx\lib\site-packages\v4_client_py\clients\__init__.py", line 4, in <module>
from .dydx_validator_client import ValidatorClient
File "D:\miniconda3\envs\dydx\lib\site-packages\v4_client_py\clients\dydx_validator_client.py", line 4, in <module>
from .modules.get import Get
File "D:\miniconda3\envs\dydx\lib\site-packages\v4_client_py\clients\modules\get.py", line 9, in <module>
from v4_proto.dydxprotocol.clob.order_pb2 import *
ModuleNotFoundError: No module named 'v4_proto'
What could be the issue?
SDK and docs does not contain any info for dydx-mainnet-1
https://github.com/dydxprotocol/v4-clients/blob/main/v4-client-js/src/clients/constants.ts
https://docs.dydx.exchange/networks/network1/network_constants
Please create a Golang SDK
For v3, this was most commonly used: https://github.com/go-numb/go-dydx
Would really appreciate a Golang SDK for V4!
I'm unable to add a simple socket.on('error') handler, since the custom socket object exported by v4-client-js doesn't support it.
node:events:497
throw er; // Unhandled 'error' event
^
Error: Unexpected server response: 503
at ClientRequest.<anonymous> (/home/node_modules/@dydxprotocol/v4-client-js/node_modules/ws/lib/websocket.js:912:7)
at ClientRequest.emit (node:events:519:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:693:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:535:22)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/home/node_modules/@dydxprotocol/v4-client-js/node_modules/ws/lib/websocket.js:1033:13)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Hello,
https://dydx-testnet-archive.allthatnode.com
(link). Currently, if I run the following query (via HTTP), I get that this RPC is 11 hours behind.curl -X GET \
-H "accept: application/json" \
"https://dydx-testnet-archive.allthatnode.com/block" \
| python3 -m json.tool
https:/test-dydx.kingnodes.com
in the above curl command, but we can't use it as a GRPC validator, since it doesn't open up a GRPC port.curl -X GET \
-H "accept: application/json" \
"https://test-dydx.kingnodes.com/block" \
| python3 -m json.tool
I request that this repository maintain a list of viable testnet validator GRPCs, OR that it modify the python client to broadcast via HTTP rather than GRPC.
Getting the following error while placing an error using Composite client example.
rpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Stream removed"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-12-21T08:49:46.070181+00:00", grpc_status:2, grpc_message:"Stream removed"}"
>
What could be the issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.