BD-2124 - SDK Refactor

tl;dr

I recommend creating a non-backward compatible fiosdk_typescript V2.0 that includes:

Overview

We have received feedback from integrators and have experienced development and deployment issues with the current SDK architecture. These include:

  • The use of custom endpoints in the SDKs creates the need to continuously upgraded the SDK when new FIPs are rolled out. This will make ongoing maintenance difficult.

  • Both Edge and Shapeshift have asked for access to the intermediate transaction structures (signed transactions, packed transactions, etc.). This is useful if a wallet wants to re-submit transactions that fail.

  • Documentation for the SDKs is somewhat flat. We would like to make this more of a user-experience based approach that walks integrators through the steps of integrating different features.

  • Documentation for SDKs emphasizes the individual API endpoints. We would like to update the SDK to use push_transaction instead of the individual API endpoints. We may also want to just use push_transaction in general.

  • Possibly reduce the number of calls needed by integrators by aggregating actions in a single call in the chain code.

API signed transactions

One release concern is the need to continually update the chain plugin when adding new transaction endpoints. It was suggested that it might be possible to have a "redirect" that sends all signed transactions to a generic function that unpacks the parameters and forwards it to the appropriate push_transaction contract action.

See the following for a discussion of using individual API endpoints versus a single endpoint: Individual API endpoints versus single endpoint

API getters

Currently it is necessary to update the chain code every time a new getter API endpoint is added. It is an open discussion as to whether it would be possible to refactor and simplify the getter code to enable adding new getter API endpoints without having to update the chain code.

Proposed Changes

Push Transaction

Mock Server

I do not think any integrator is using this mock server option and it is a bit confusing. The only reason we have not removed it sooner is that it is a breaking change.

Compatibility

These fixes will require wallets to migrate their code to use the new structure. See the following Dev Guide to upgrade for more details: https://github.com/fioprotocol/fiosdk_typescript/pull/65

Decisions

  • Agree with v2.0 release?

  • Timing of release?

  • Messaging to ensure wallets know there is a migration.

  • Timing for desupport of v1.0 SDK (when do we stop adding new endpoints?)

  • Make similar changes to Kotlin? Timing?