@lokavaluto/lokapi-backend-comchain v0.1.1-alpha.202405151629
This is a backend for managing any comchain currency through LokAPI.
The latter aims at providing a simple framework for building client
app to manage currency payments. You can refer to
@lokavaluto/lokapi
's doc to get more knowledge of how to use it.
Adding @lokavaluto/lokapi-backend-comchain
to your project
From the root of your project:
npm install --save @lokavaluto/lokapi-backend-comchain
Or better, as @lokavaluto/lokapi-backend-comchain
is still in early release,
npm install --save Lokavaluto/lokapi-backend-comchain#master
To be sure to get the latest version, relaunch this last command whenever you want to update.
Usage
You can provide this backend when subclassing LokAPI:
For instance:
import LokAPIBrowserAbstract from "@lokavaluto/lokapi-browser"
import comchain from '@lokavaluto/lokapi-backend-comchain'
class LokAPI extends LokAPIBrowserAbstract {
BackendFactories = {
comchain,
}
requestLocalPassword = async function (state: string) {
// ... your UI code to request password from user
}
requestLogin() {
// ... your UI code to request password from user
}
}
if (!process.env.VUE_APP_LOKAPI_HOST) {
throw new Error("Please specify VUE_APP_LOKAPI_HOST in '.env'")
}
if (!process.env.VUE_APP_LOKAPI_DB) {
throw new Error("Please specify VUE_APP_LOKAPI_DB in '.env'")
}
export var lokAPI = new LokAPI(
process.env.VUE_APP_LOKAPI_HOST,
process.env.VUE_APP_LOKAPI_DB,
)
For usage of @lokavaluto/lokapi
, please refer to
@lokavaluto/lokapi
's documentation.
Developers
To get started developing and tinkering with this code, you can:
Install dependencies
npm install
Build the project
npx tsc -w
Changelog
0.1.1-alpha.202405151629
New
Add check of transaction id format on
recipient.transfer(..)
Valentin LabAdd
getGlobalBalance
to get balance at specific block points. SeddikAdd
Recipient.discardCreateRequest()
Seddik KadiAdd
Backend.registerWallet()
to register a new wallet. Seddik KadiProvide
UserAccount.getPendingTopUp()
for convenience. Valentin LabUse new base
Account
provided bylokapi
Valentin Lab
Changes
- Make
Recipient.transfer()
return a fullTransaction
object. Valentin Lab
Fix
Move misplaced
console.log
Valentin LabCompatibility with latest
credit-request
API endpoint. Valentin LabValue is not anymore a string representing a date, but a timestamp. As a consequence we get a full date and time information for pending top-up requests.
Maintain compatibility with new
jsc3l
throwing realError
Valentin Lab
0.1.0 (2023-05-08)
New
Add
Transaction.pending
implementation. Valentin LabAdd compatibility with new smartcontract with pledge and property admin. Valentin Lab
Add date filter to
getTransactions(..)
Valentin LabUpdate odoo API calls from
comchain/partners
tocomchain/contact
Valentin LabAdd
Recipient.getSymbol()
method implementation. Valentin LabAdd
Recipient.fromUserAccount
property. Valentin LabAdd
UserAccount.requestCredentials(..)
to check credentials and return them. Valentin LabNote that
UserAccount.unlockWallet(..)
andUserAccount.requestCredentials(..)
can both provide their override of the general.requestLocalPassword
method.Provide
UserAccount.requiresUnlock()
to advertise if an unlock is required on currentuserAccount
Valentin LabMake
Backend.createUserAccount(..)
return aUserAccount
Valentin LabSingle out insufficient balance error to throw common exception. Seddik Kadi
Throw exception upon transfer of invalid amounts. Valentin Lab
Add
.makeCreditRequest(..)
on backend and user account. Valentin LabAdd
.isActiveAccount()
on user account. Valentin LabAdd
.creditable
property on money account. Valentin LabAdd
.hasCreditRequestValidationRights()
Valentin LabAdd
.validateCreation()
on recipient. Valentin LabCatch and properly throw
InactiveAccount
when account seems locked. Valentin LabAdd
.hasUserAccountValidationRights()
support. Valentin LabAdd
createUserAccount(..)
Valentin LabInactive user account don't have any money account accessible. Valentin Lab
User accounts can now act as money accounts containing other accounts. Valentin Lab
In comchain we want a global account view and 2 sub accounts, so we can exploit this new feature.
Bank account provide a
type
property. Valentin Labtype
property can return string "Nant" or "Cm". These are the two bank account type that can be attached to a comchain wallet.Api v12 changed structure of backend data
bank_accounts
->accounts
Valentin LabBackend.internalId
is now provided by super class. Valentin Lab
Changes
Remove API point
{creditRequest,Transacion}.relatedUser
Valentin LabWas not bringing anything more than already existing API point
related
.
Fix
Make validated account standard user. Valentin Lab
It doesn't change anything in current contract but costs less for the smart-contract and is probably a better default value for most current users.
Return source user for incoming transaction. Valentin Lab
Prior to this fix, current user was returned.
Correct
.getCreditUrl()
from bogus behavior due to copy-paste typo. Valentin LabPrevent exception coming from deciphering transaction memo to break and provide sane default. Valentin Lab
Correctly provide the currency for each
type
of account. Valentin LabDon't try to uncipher transaction messages if no message key is available. Valentin Lab
Use account hex address in transaction if not found in administrative backend. Valentin Lab
0.0.1 (2021-11-17)
Other
- First import. Valentin Lab
6 days ago
7 days ago
3 months ago
3 months ago
3 months ago
3 months ago
10 months ago
8 months ago
10 months ago
1 year ago
11 months ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago