Michael Bradley, Jr 555986233d refactor: return object instead of string from stickers backend
Related to https://github.com/status-im/status-desktop/issues/3725.

Introduce `type PendingTransaction` in `status/types/transaction.nim`. Refactor
`proc buyPack` in `status/stickers.nim` to return an instance of that type
instead of `string`. Eliminate unnecessary threading of `var success` argument
through successive calls in favor of tracking `success` in a field on
`PendingTransaction`.

---

NOTES

Several files in this project have "sticker" in their names or make reference
to "sticker". All those were reviewed as candidates for changes
logically-related to the purpose of this PR:

`status/accounts.nim`
`status/chat.nim`
`status/chat/stickers.nim`
`status/eth/contracts.nim`
`status/eth/stickers.nim`
`status/status.nim`
`status/statusgo_backend/chat.nim`
`status/statusgo_backend/edn_helpers.nim`
`status/stickers.nim`
`status/types/message.nim`
`status/types/pending_transaction_type.nim`
`status/types/setting.nim`
`status/types/sticker.nim`
`status/utils.nim`
`status/wallet/collectibles.nim`

`sendStickerMessage` in `status/statusgo_backend/chat.nim` returns `string` but
refactoring it seems out of scope for this set of changes.

A comment has been left in `status/stickers.nim` re: an additional refactor
that can be made to simplify `trackPendingTransaction` as called by
`buyPack`. The refactor will involve changes in other modules as well.

`type Message` in `status/types/message.nim` has a `sticker*: string` field
that doesn't seem to be made use of by the Nim side of status-desktop, but it
it is made use of by desktop's QML side (see:
`status-desktop/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml`). In the
future it may be preferable to use a different type, or a type alias for
`string`.

`decodeContentHash` in `status/utils.nim` could return an instance of `type
Cid` without converting it to a string, leaving it up to call sites in
status-lib and status-desktop to convert to `string`.

`getStickers` in `status/wallet/collectibles.nim` returns `string`, used by
`{.slot.}` procs in status-desktop (see Nim sources in
`status-desktop/src/app`) that expose the JSON data (as `string`) to
QML. Refactoring the return value seems out of scope for this PR, given ongoing
refactors in status-desktop's front-end architecture.
2021-10-10 18:51:07 -05:00
2021-09-10 11:29:10 -04:00
2021-09-10 11:29:10 -04:00
2021-10-04 17:21:07 -04:00
2021-10-08 10:28:57 +02:00
2021-10-04 17:21:07 -04:00
2021-09-08 14:09:35 -04:00
2021-09-08 12:16:18 -04:00
2021-10-04 17:21:07 -04:00
2021-09-08 14:09:35 -04:00
2021-09-10 11:29:10 -04:00

nim-status-lib

WIP refactor to extract business logic from status-desktop into a reusable library

Description
originally src/status from desktop, refactored as a library [archived]
Readme MPL-2.0
Languages
Nim 91.5%
Makefile 8.1%
Shell 0.4%