# Is there an AfterHook for WalletsUpdate?

**URL:** <https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825>\
**Category:** Runtime Framework\
**Created:** [January 3, 2024, 12:21pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825 "2024-01-03T12:21:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![RickCastle2018](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/rickcastle2018/32/1878_2.png) [@RickCastle2018](https://forum.heroiclabs.com/u/RickCastle2018)\
**Post date:** [January 3, 2024, 12:21pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/1 "2024-01-03T12:21:19Z")

</div>

Hi!

While connecting our game’s Nakama balances to another (blockchain-dependent) system, turned out there is no obvious way to monitor Nakama’s account wallet updates.

I wonder if there’s a way or a nice workaround you could suggest?

Nikita

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 3, 2024, 1:44pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/2 "2024-01-03T13:44:00Z")

</div>

Wallet updates are always authoritative and needs to run from within a RPC. You can implement any type of observable patterns in your own RPC code. Would this help?

---

<div class="post-metadata">

**Author:** ![RickCastle2018](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/rickcastle2018/32/1878_2.png) [@RickCastle2018](https://forum.heroiclabs.com/u/RickCastle2018)\
**Post date:** [January 3, 2024, 2:35pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/3 "2024-01-03T14:35:47Z")

</div>

Hey! I understand it, however we’re developing some kind of a Go common module for all of our games, so I wanted to use standard APIs in our JS game code to change balances and then just monitor it with Go. But it does not seem like the best idea, will try to implement something smarter.

---

<div class="post-metadata">

**Author:** ![RickCastle2018](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/rickcastle2018/32/1878_2.png) [@RickCastle2018](https://forum.heroiclabs.com/u/RickCastle2018)\
**Post date:** [January 3, 2024, 2:47pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/4 "2024-01-03T14:47:25Z")

</div>

Random thought: would be still cool if there was some kind of an internal bus available for communication/queues inside the Runtime Framework of Nakama

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 3, 2024, 4:29pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/5 "2024-01-03T16:29:19Z")

</div>

We’ve considered an Event Bus observer/observable pattern in Nakama in the past. We’ve settled on not adding this at Nakama layer due to the complexity added to the learning curve for developers and so many variations and indirections it can bring in (especially for lesser experienced developers).

We’ve implemented this pattern in Hiro where we are in much more control of the way the code is written and exposure is measured.

---

<div class="post-metadata">

**Author:** ![RickCastle2018](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/rickcastle2018/32/1878_2.png) [@RickCastle2018](https://forum.heroiclabs.com/u/RickCastle2018)\
**Post date:** [January 11, 2024, 6:59pm UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/6 "2024-01-11T18:59:55Z")

</div>

However, what about go-lua-js calls? For now I have to make a http request from JS to Go, which seems not that beautiful. Do you plan on implementing some kind of a system for this? I wonder if I could contribute to Nakama myself, if you don’t have anything against this idea?

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 12, 2024, 10:39am UTC](https://forum.heroiclabs.com/t/is-there-an-afterhook-for-walletsupdate/4825/7 "2024-01-12T10:39:50Z")

</div>

We’ve considered a way to have Go/Lua/JS interop calls. This is not easy to do - there are memory allocation considerations, there are type safety/hinting considerations (or lack of), and referencing VMs that may have gone away issues. By all means, if you think you can open a PR that covers it, I’m all for it, but you may hit some very difficult challenges that we’ve not been able to solve ourselves 😛
