KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
97 stars 88 forks source link

refactor(sia): Sia http client refactor and #2108

Open Alrighttt opened 1 month ago

Alrighttt commented 1 month ago

Changelog

Add Docker Test Framework

Adapted the existed Docker test framework to allow running a self contained "regtest-like" blockchain network including instant block mining, a custom developer subsidy address and v1/v2 activation time frames.

See sia_docker_tests.rs. Currently uses docker.io/alrighttt/walletd-komodo which utilizes my custom fork of walletd, https://github.com/Alrighttt/walletd/tree/Komodo-persistent-testnet.

Refactor http_client moedule and Add http_endpoints Module

Refactors the SiaApiClient significantly for better developer ease of use. Introduces the dispatcher method for SiaApiClient. This method is likely to be the main way a developer can interact with the Sia walletd API. See unit tests in sia_docker_tests.rs for example usage.

Moves the individual endpoint implementations into a seperate http_endpoints module.

Add specifier Module

Adds a small module to initialize the equivalent of Sia Go's "Identifier" encoding. These identifiers are used extensively in the Sia's transaction and block encoding.

See specifier.rs.

Add transaction module

Begin work on transaction encoding and decoding. This module will ultimately implement both Sia v1 and v2 consensus. Adds many unit tests.

See transaction.rs. See https://github.com/Alrighttt/core/blob/rust-port-unit-tests/types/rust_port_test.go .

Add Encodable trait

Adds the Encodable trait to allow better mimicking the code patterns of Sia's Go developers.

See encoding.rs. See transaction.rs unit tests for usage.

Extend Api Client Error Handling

Refactors the fetch_and_parse function of the API client to begin implementing more graceful handling of error messages or

Todo