-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Research transaction logging #37
Comments
Ethereum Transaction Receipt트랜잭션이 채굴될 때까지는 null을 반환하기 때문이 트랜잭션의 상태를 tracking하는데 사용될 수 있다. The structure of transaction receiptTransaction receipt의 구조는 다음과 같다. A simple use of receipt is to find out a new contract's |
Near Transaction ReceiptTransaction statusquery result는 다음의 것들을 보여준다.
Example of the query results
각각의
RPC APIRPC API를 통해 send transaction/query status를 할 수 있다. Send transaction (async)
Send transaction (await)
Transaction status
외에도 Transaction Status with Receipts, Receipt by ID query 존재 Error HandlingAPI request가 실패했을 때, RPC server는 structured error response를 반환한다. 따라서 client code가 모든 error case를 handling할 수 있도록 한다. JSON-RPC 에러로 verror convention를 따른다.
각각의 query에 대한 error case는 참고자료에서 확인할 수 있다. [NEAR Docs-RPC Endpoints-transaction] |
LogMacro near_sdk::log
panic
log for debugLog a debug message to the console
위의 코드는 아무것도 출력하지 않지만 다음 커멘드를 통해 log level을 debug level로 낮추어 사용할 수 있다 Log an error message to the console
Log to stdout instead of stderr
Log 확인
[Crate near_sdk-Macros-log] |
Log at VM context/full nodenear_sdk::env::log_str
위 docs에서 연결된 source 파일을 확인해보면
동일 파일의 line 17에서 Macro std::eprintln
줄바꿈과 함께 표준 오류로 인쇄한다. std::io::stderr
near_sys::log_utf8
Real TIme Events개발 과정에서 실시간으로 특정 event를 tracking한다. contract가 event 발생을 실시간으로 알려주기 위해 standard events format인 NEP-297을 이용한다. 공공적인 event에 대하여 websocket을 이용하여 실시간적으로 tracking 서비스를 빌드한다. NEP-297-Eventscontarct의 표준적인 log capability를 사용한다.
Thus, to emit an event, you only need to log a string following the rules above. Here is a barebones example using Rust SDK near_sdk::log! macro (security note: prefer using serde_json or alternatives to serialize the JSON string to avoid potential injections and corrupted events):
Listening to Event
[Module " sdk-core/assemply/contract] |
No description provided.
The text was updated successfully, but these errors were encountered: