when you do this is works, but if you declare $main before $free variable, it mixes up things. This means it is bound to some static variables on backend. So, if you do write the code in the following order;
It will give you "Insufficent Funds" error, as it will try to use the last active wallet's balance. "getWallet" function should not be static variable bound. Normally if you save it in memory on $main variable, when you use $main variable, it should point to the state of its declaration no matter which variable you change afterwards, as long as you don't change the main variable.
If it is working as non-static library, it should be completely compatible with it.
To reproduce this problem,
Just create two wallets, one of them should be empty. Put the empty wallet to $free variable section and the other to the $main. The second code group I sent will give you "Insufficent Funds" error no matter how much you have on the main wallet.
when you do this is works, but if you declare $main before $free variable, it mixes up things. This means it is bound to some static variables on backend. So, if you do write the code in the following order;
It will give you "Insufficent Funds" error, as it will try to use the last active wallet's balance. "getWallet" function should not be static variable bound. Normally if you save it in memory on $main variable, when you use $main variable, it should point to the state of its declaration no matter which variable you change afterwards, as long as you don't change the main variable.
If it is working as non-static library, it should be completely compatible with it.
To reproduce this problem, Just create two wallets, one of them should be empty. Put the empty wallet to $free variable section and the other to the $main. The second code group I sent will give you "Insufficent Funds" error no matter how much you have on the main wallet.