dashed-slug.net › Forums › Exchange extension support › how does this extension connect to read DB
Tagged: coin adapter, development
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by
alexg.
-
AuthorPosts
-
January 31, 2019 at 11:17 pm #5727
Anonymous
Inactivei use a points system on my site
i would like to make it tradeable with my coin.
so if the user balance etc being pulled from DB to check if able to trade, theoretically it should be able to pull the users balance from the points DB correct?
i know this is probably out of the scope of the plugin, but i have a reason for it.
if you could point me in the right direction i think i could make this happen OR make it its own stripped down “coin adapter” ??
February 1, 2019 at 8:23 am #5730alexg
KeymasterHello,
The high-level architecture is as follows:
The parent plugin is responsible for holding a list of transactions for each user account. From this the balance is calculated on the fly.
The coin adapters are responsible for communicating with wallets. They do the withdrawals and notify the plugin of incoming deposits.
The Exchange extension holds markets, orderbooks, orders and trades. It affects the balances by inserting trade transactions in the transaction table of the parent plugin.
What you want to do, would be possible with a coin adapter. If you are interested in a simple example of how this works, you can have a look at the now deprecated Litecoin adapter. The Full Node Multi Coin Adapter is the evolution of that, for handling multiple wallets.
If you attempt to develop your own coin adapter, feel free to ask me any questions. You should start by subclassing
Dashed_Slug_Wallets_Coin_Adapter
. Implement the abstract methods and override the other methods as needed. Then, make sure the class still has a no-argument constructor, and include the class file on the wallets_declare_adapters action. The plugin will discover and instantiate your adapter using reflection.with regards
February 1, 2019 at 10:35 pm #5761Anonymous
Inactivei use the old litecoin in my site now. thats where i got the idea.. i cant find the instructions on how i did it b4, and which files etc to change. where were thos instructions again? cant find any where on the site or google search
so i just need to strip out where it connects to my node and do mysql calls correct?
if so where would i look to do this? in more than one file?
February 4, 2019 at 10:17 am #5768alexg
KeymasterHello,
The instructions are the ones I just gave you here. There is nothing else to it.
Other material that you can also review: https://www.dashed-slug.net/developers-coin-adapters-api/
There is also some info in the documentation under the “Adapters” section.
Follow the instructions and ask me if you get stuck.
Also, you do not need to edit any files. I would recommend that you create your own adapter class, and add it into a plugin file in any way you see fit. Just remember to make the code include/require the class file on the
wallets_declare_adapters
action, as discussed above.with regards
-
AuthorPosts
- You must be logged in to reply to this topic.