Comments (7)
Hey guys I'm here because @irisdv opened xJonathanLEI/starknet-rs#508 on starknet-rs
.
@yair-starkware I'm afraid that's not correct according to the specs. The spec says there are 2 params: request
and block_id
.
JSON-RPC allows params to be named or positional. For them to be positional:
[
{
"contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
"calldata": [
"0x061b6c0a78f9edf13cea17b50719f3344533fadd470b8cb29c2b4318014f52d3"
]
},
"latest"
]
and for them to be named:
{
"request": {
"contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
"calldata": [
"0x061b6c0a78f9edf13cea17b50719f3344533fadd470b8cb29c2b4318014f52d3"
]
},
"block_id": "latest"
}
The structure expected by Papyrus is neither of these two. Papyrus is not compliant with the specs here.
from papyrus.
Hey, I am adding a simple curl example so you can reproduce it. With my alchemy RPC endpoint, I can do:
❯ curl --location 'https://starknet-goerli.g.alchemy.com/v2/MY_ALCHEMY_KEY' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "starknet_call",
"params": [
{
"contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
"calldata": ["0x061b6c0a78f9edf13cea17b50719f3344533fadd470b8cb29c2b4318014f52d3"]
},
"latest"
]
}'
Which returns:
{"jsonrpc":"2.0","result":["0x9c51c4521e0000","0x0"],"id":1}
When trying this with my endpoint, it unfortunately doesn't work (using /rpc/v0_5 and /rpc/v0_4):
❯ curl --location 'https://goerli.rpc.starknet.id/rpc/v0_5' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "starknet_call",
"params": [
{
"contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
"calldata": ["0x061b6c0a78f9edf13cea17b50719f3344533fadd470b8cb29c2b4318014f52d3"]
},
"latest"
]
}'
I get:
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params","data":"invalid type: map, expected a string at line 2 column 8"},"id":1}
from papyrus.
Hi,
Here is a valid curl cmd:
curl --location 'https://goerli.rpc.starknet.id/rpc/v0_5' --header 'Content-Type: application/json' --data '{
"jsonrpc": "2.0",
"id": 0,
"method": "starknet_call",
"params": {
"contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
"calldata": ["0x061b6c0a78f9edf13cea17b50719f3344533fadd470b8cb29c2b4318014f52d3"],
"block_id": "latest"
}
}'
from papyrus.
same issue in starknet.py,I have asked for help in papyrus channel in discord,but noone answered
line 122, in _get_balance\n'
' balance = await account.get_balance(\n'
low, high = await self._client.call_contract(\n'
res = await self._client.call(\n'
self.handle_rpc_error(result)\n'
raise ClientError(\n'
'starknet_py.net.client_errors.ClientError: Client failed with code -32602: '
'Invalid params.\n'
Using alchemy or infura is okay, but Papyrus went wrong
# this is correct
client = FullNodeClient('https://starknet-mainnet.g.alchemy.com/v2/..')
# this went wrong
node_url = 'http://ip:8080/rpc/v0_5_0'
client = FullNodeClient(node_url)
account = get_account(wallet.private_key, wallet.address)
balance = await get_balance(account, starknet_usdc_address)
usdc_balance_readable = balance / 1e6
print(f"USDC balance:{usdc_balance_readable}")
papyrus serve is running normal
ubuntu@server:~$ curl --location 'http://localhost:8080/rpc/v0_5_0' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0","id":0,"method":"starknet_blockHashAndNumber"}'
{"jsonrpc":"2.0","result":{"block_hash":"0x7f60cfed49727d4288068234704cd18e09386cb87f54fb12b51b213901c7a74","block_number":458230},"id":0}
I checked starknet_getStorageAt and starknet_getClass is ok
but methods 'starknet_call' went wrong
http_method HttpMethod.POST
address http://ip:8080/rpc/v0_4_0
payload {'jsonrpc': '2.0', 'method': 'starknet_call', 'params': {'request': {'contract_address': '...', 'entry_point_selector': '...', 'calldata': ['..']}, 'block_id': 'pending'}, 'id': 0}
the params r all the same ,but it went wrong
ubuntu@server:~$ curl --location 'http://localhost:8080/rpc/v0_5_0' --header 'Content-Type: application/json' --data-raw '{"jsonrpc": "2.0","method": "starknet_call","params": {"request":{"contract_address":"...","entry_point_selector":"...","calldata":["..."]},"block_id":"pending"},"id":0}'
curl: (52) Empty reply from server
from papyrus.
Thanks for pointing it out! We'll fix it.
from papyrus.
Thanks for pointing it out! We'll fix it.
hello, it has been a month
from papyrus.
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍
Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!
from papyrus.
Related Issues (20)
- feat: expose `papyrus_common` as a crate HOT 1
- bug: Docker build failing for Mac M1 HOT 2
- bug: unable to specify on which chain papyrus should start HOT 3
- Feat: Docker build failing for Mac M1 #1436 HOT 1
- feat: adding CORS support HOT 1
- bug: RPC is not responding anything HOT 1
- feat: syncing HOT 1
- feat: pendingTransactions HOT 1
- feat: Fix the readme file for LICENSE
- feat: Hardware and bandwidth requirements HOT 8
- bug: compile and run error HOT 1
- Papyrus config refactor HOT 12
- Adding a user agent HOT 12
- dev:Ram insanly stimulated HOT 2
- Interested in participating, rust lovers HOT 1
- Refactoring structures HOT 1
- thread 'tokio-runtime-worker' panicked at 'Missing header for block {block_number}.' HOT 1
- bug: StarkErrorCode.SCHEMA_VALIDATION_ERROR is missing in StarkErrorCode enum HOT 1
- Vulnerability disclosure form doesn't lead to any valid contact address
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from papyrus.