pendulum-chain / substrate-stellar-sdk

A Rust SDK for Stellar that can be used for Substrate projects
Apache License 2.0
11 stars 11 forks source link

move some code from spacewalk + added `GeneralizedTxSet` methods for retrieving a TransactionSet for pendulum-chain/spacewalk#401 #21

Closed b-yap closed 1 year ago

b-yap commented 1 year ago

This is partly for https://github.com/pendulum-chain/spacewalk/issues/401, to support Stellar's protocol 20.

  1. Some stellar-relevant codes in spacewalk are better fit in stellar-substrate-sdk since these are used by both spacewalk pallets and client:

  2. To get information (similar to TransactionSet) out of a GeneralizedTxSet, I added methods like fn previous_ledger_hash(&self) and fn txes(&self).

    • the ~trait ComputeHash~ trait IntoHash will replace spacewalk's fn compute_non_generic_tx_set_content_hash(). This will remove code duplication both in stellar-relay-lib and stellar-relay pallet.
    • having a fn to_base64_encoded_xdr_string() is helpful when decoding xdr in stellar laboratory's XDR viewer.
  3. Added a spacewalk-only enum: TransactionSetType that covers both TransactionSet and GeneralizedTransactionSet.

note: merge this to branch polkadot-v0.9.40 or a new branch like polkadot-v0.9.40-protocol20 AFTER https://github.com/pendulum-chain/substrate-stellar-sdk/pull/20 is merged.

b-yap commented 1 year ago

Moved to draft; found some errors during implementation in spacewalk.