0.0.10 • Published 2 years ago

@bulla-network/contacts v0.0.10

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Bulla Contacts

Save Web3 contacts and reuse across multiple dApps. Stored and encrypted with Ceramic, SelfId and 3ID Connect.

Get started

npm install @bulla-network/contacts yarn add @bulla-network/contacts

Provider components

This is a React library. There are two main components:

<SelfIdProvider /> and <ContactsProvider />.

SelfIdProvider maintains the connection information to SelfId and Ceramic. It provides the current state of the connection and a function to enable it if disabled.

ContactsProvider uses the SelfId connection to get, set and manipulate the contacts. The rest of the app can operate without knowledge of how contacts are persisted.

Example:

const App = () => {
	const {userAddress} = useWeb3(); // not included, SelfIdProvider needs wallet and network.
	return (
		<SelfIdProvider userAddress={userAddress} notSupported={false} env="mainnet">
			<ContactsProvider  userAddress={userAddress}>
				<YourAppHere />
			</ContactsProvider>
		</SelfIdProvider>
	);
}

Hooks

useContacts

Your main entry point to interact with Contacts.

const contactsContext = useContacts();

where ContactsContext can be of type ContactsRepo | SelfIdNotConnectedState | 'fetching';

This allows for improve type safety and easier UX.

Helper functions are available to help with this inconvenience.

function  isContactsReady(context: ContactsContext): context  is  ContactsRepo;
function  requireContactsReady(): never;
0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago