app icon indicating copy to clipboard operation
app copied to clipboard

Core: API Mock

Open samparsky opened this issue 7 years ago • 8 comments

Description

Provide API mocks for the following

  • [ ] Post a Transaction
  • [ ] Get Address Balance
  • [ ] Retrieving an address transactions
  • [ ] Buy SMC from exchanges
  • [ ] Get SMC current price
  • [ ] Get SMC from Tap on testnet
  • [ ] Get transaction status by TX id

Describe the solution you'd like

  • Mock transaction, should use something similar to Ethereum transaction
  • All API calls MUST use the async / await javascript pattern
  • Use typed promises

Describe alternatives you've considered

Contribution Guide

Please checkout the contribution guide

samparsky avatar Oct 12 '18 01:10 samparsky

@avive Can I take this ?

ImmanuelSegol avatar Oct 18 '18 07:10 ImmanuelSegol

Please create a component called SpacemeshApiClientMock that mock implements all the methods described in this issue via one or more typescript interfaces. e.g. ISpacemeshApi. For the real app, we'll replace the mock implementation with a real one - e.g. SpacemeshApiClient component.

avive avatar Oct 18 '18 07:10 avive

@avive Can I take this ?

Yes but please see my proposal for next steps in the gitter chat...

avive avatar Oct 18 '18 07:10 avive

Please add

  • [ ] Get SMC from Tap on testnet
  • [ ] Get transaction status by TX id

avive avatar Oct 18 '18 08:10 avive

done

samparsky avatar Oct 18 '18 08:10 samparsky

Please make all API calls async using the async / await javascript pattern. Even methods that can return data immediately should use a typed promise for consistent behavior. e.g. Promise<SomeInterfaceToData>. I think that the ts-lint pattern is to end all methods with Async... this makes working against the API much easier.

avive avatar Oct 18 '18 09:10 avive

@avive Should there be some sort of API auth mechanism?

samparsky avatar Oct 23 '18 21:10 samparsky

@avive @samparsky I think Post a Transaction should be broad cast transaction.

ImmanuelSegol avatar Oct 25 '18 05:10 ImmanuelSegol