Although neo now have a dApp Platform Provider Interface standard, A dApp that uses one dApi wallet cannot invoke another dApi wallet, which is not so convinient for dApp developers.
Neo Unified dApi(NUDApi) is to enable dApp to use one unified interface to invoke all wallets that aggrees to the dApi standard.
- PERFECT: As long as it's a dApi standard wallet, it can be invoked by NUDApi.
- This is difficult because if all web plugin wallets injects into web same object, they will contradict with each other.
- CONFIGURE: A dApi wallet need to add its configuration in this project to be involved.
- This is what we should try to accomplish, currently O3, NEOLine and Teemo top level interfaces are not similar.
- CODE-SPECIFIED: If top level interfaces are not similar, we need to specify the difference in code.
Refer to #1
NUDApi is just like a router for dApp to invoke different neo dapi wallet providers. If dApp developer plans to include O3, you need to prepare as instructed on https://neodapidocs.o3.network/#installation. For web plugin wallets NEOLine and Teemo, developer don't have to specify anything.
We have not released this, cdn and npm installations would be enabled after release.
const apis = neoUnifiedDapi.getAvailableWalletAPIs();
console.log(apis);
// Choose API, developer could add some UI interface for users to choose
const useApi = neoUnifiedDapi.useAPI(apis[0]);
The invocation of dApi is just like what's in neo-project/proposals#69. Just pay attention: you have to choose api before you execute any invocations.
neoUnifiedDapi.getAccount().then(accountInfo => {
console.log(accountInfo)
})
neoUnifiedDapi.addEventListener(neoUnifiedDapi.Events.READY, () => {
neoUnifiedDapi.getAccount().then(accountInfo => {
console.log(accountInfo)
});
})