You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Define the metadata objectconstmetadata={name:'Bob',about:'Learning about Smart Vaults!'}// Set profileawaitsmartVaults.setProfile(metadata)constmyPublicKey=authenticator.getPublicKey()// Fetch profileconstmyProfile=awaitsmartVaults.getProfile(myPublicKey)// Create another account to add as contactconstotherAuthenticator=newDirectPrivateKeyAuthenticator(generatePrivateKey())constcontactPubKey=otherAuthenticator.getPublicKey()constcontact=newContact({publicKey: contactPubKey})// Add contactawaitsmartVaults.upsertContacts(contact);// Fetch contactsconstcontacts=awaitsmartVaults.getContacts()// Fetch contacts including their metadata ( profile )constcontactsProfiles=awaitsmartVaults.getContactProfiles()
Example: Create an 2-of-2 Multisig Vault
// For this example lets assume that we have created an account using one of the Smart Vaults apps ( iOs, Android or Desktop ).// Get your SignersconstmySigners=awaitsmartVaults.getOwnedSigners()// For simplicity lets assume that we only have one signerconstmySigner=mySigners[0]// Get your signer's KeyconstmySignerKey=mySigner.key// Get co-Signer's KeyconstcoSigner=awaitsmartVaults.getSharedSigners()constcoSignerKey=coSigner[0].keyconstkeys=[mySignerKey,coSignerKey]// Define the thresholdconstthreshold=2// Create the multisig miniscriptconstminiscript=MiniscriptBuilder.multisig({threshold, keys})// Define the other parametersconstname='My First Vault'constdescription="2 of 2 Multisig"constnostrPublicKeys=[myPublicKey,contactPubKey]// Create the vaultawaitsmartVaults.savePolicy({ name, description, miniscript, nostrPublicKeys })