gear icon indicating copy to clipboard operation
gear copied to clipboard

feat(gclient): introduce gear general client

Open clearloop opened this issue 1 year ago • 1 comments

Resolves #3895

This PR basically combines gclient and gtest into the same interface which helps users re-using their code for both testing and client-side operations

The key points of the merge is that frequently used methods should be merged

- some of the methods are not synced ( like event listener, it's actually useless in tests )
- logs are playing a role part in the transaction results since it's useful for developers' centralized indexer instead of message payloads ( need to pay the rent and easy to lose )
- message builder with specified signer from wallet
  • [x] common interfaces of debugging programs based on the design of the interface of gtest
  • [x] gclient implementation
  • [x] gtest implementaion #4032
  • [x] pack the two implementation into the general Client
  • [x] pick a test in examples and apply the Client test
  • [x] tiny consistency test

for expected result:

#[tokio::test]
async fn test_gtest() -> Result<()> {
    test_ping(GTest::client()?).await
}

#[tokio::test]
async fn test_gclient() -> Result<()> {
    let api = GearApi::dev_from_path("../target/release/gear").await?;
    test_ping(Client::<GClient>::new(api)).await
}

fn test_ping<T: Backend>(client: Client<T>) -> Result<()> {
   // ...
}

@gear-tech/dev

clearloop avatar Jun 17 '24 19:06 clearloop

same as https://github.com/gear-tech/gear/pull/4072#issuecomment-2304687014

clearloop avatar Aug 22 '24 13:08 clearloop

Actuality and implementation details will be considered on demand

breathx avatar Feb 10 '25 13:02 breathx