@ancient8/connect
v2.1.31
Published
[Ancient8 Connect](https://id.ancient8.gg) UMD library.
Downloads
694
Keywords
Readme
Description
Ancient8 Connect UMD library.
This is the browser APIs version. The implementation below will be only valid when in browser environment.
Documentation
For detail of browser APIs please refer the docs.
For detail of server APIs please refer the docs.
For detail of adapter APIs please refer the docs.
Installation
$ yarn add @ancient8/connect
Examples
Please see the demo here
Usages
Three main usages of A8Connect
.
- Initialize Login/Connect Wallet Flow
import {
init,
closeModal,
openModal,
Types
} from "@ancient8/connect"
// Remember to import css stylesheet
import "@ancient8/connect/lib.css";
await init({
chainType: Types.Adapters.ChainType.ALL,
networkType:
Types.Providers.NetworkType.testnet ||
Types.Providers.NetworkType.mainnet,
disableCloseButton: true,
cleanWalletCache: false, // Enable this option to `true` to always show connect wallet popup.
onClose: () => {
// do something
},
onAuth: (payload) => {
// do something
console.log({payload});
},
onLoggedOut: () => {
// do something
},
onConnected: (payload) => {
// do something
console.log({payload});
},
onDisconnected: () => {
// do something
}
}).then(() => {
openModal();
});
- Initialize Add Wallet Flow
import {
init,
closeModal,
openModal,
Types
} from "@ancient8/connect"
// Remember to import css stylesheet
import "@ancient8/connect/lib.css";
await init({
chainType: Types.Adapters.ChainType.ALL,
networkType:
Types.Providers.NetworkType.testnet ||
Types.Providers.NetworkType.mainnet,
initAppFlow: Types.Router.AppFlow.ADD_WALLET_FLOW,
cleanWalletCache: true,
onClose: () => {
// do something
},
onAuth: (payload) => {
// do something
console.log({payload});
},
onLoggedOut: () => {
// do something
},
onConnected: (payload) => {
// do something
console.log({payload});
},
onDisconnected: () => {
// do something
}
}).then(() => {
openModal();
});
- Initialize Lost Wallet Flow
import {
init,
closeModal,
openModal,
Types
} from "@ancient8/connect"
// Remember to import css stylesheet
import "@ancient8/connect/lib.css";
await init({
chainType: Types.Adapters.ChainType.ALL,
networkType:
Types.Providers.NetworkType.testnet ||
Types.Providers.NetworkType.mainnet,
initAppFlow: Types.Router.AppFlow.LOST_WALLET_FLOW,
withCredential: authToken as string,
cleanWalletCache: true,
onClose: () => {
// do something
},
onAuth: (payload) => {
// do something
console.log({payload});
},
onLoggedOut: () => {
// do something
},
onConnected: (payload) => {
// do something
console.log({payload});
},
onDisconnected: () => {
// do something
}
}).then(() => {
openModal();
});
Notes
This library is still in beta development. Significant changes may happen anytime.
Contact
If you have any inquiries please send emails to [email protected].
License
Copyright (c) 2022 Ancient8.
Licensed under the GPL-3.0