SnapSync

Made with šŸ’œ by AE Studio

Sync your MetaMask snaps!

SnapSync is a MetaMask Snap that saves data from snaps across devices securely using IPFS. Get started by installing the snap and setting your PiƱata JWT.

Connect

Get started by connecting MetaMask to the snap.

Add your PiƱata JWT

Enter a PiƱata JWT to connect to your PiƱata account and save your data.

Integrate SnapSync into your snaps

Snap developers can easily integrate SnapSync into their
snaps to enable data persistence on IPFS.

Add SnapSync to your snap manifest

Add SnapSync to your snap manifest to allow your snap to work with third-party snaps using RPC calls. Here's an example manifest from the Pet Fox snap.

const IPFS_SNAP_ID = 'npm:@ae-studio/snapsync'

Call methods to persist/retrieve data

Send messages to SnapSync to persist and retrieve data from IPFS. Here's an example of
getting and persisting the state.

// Get latest data from IPFS, or null if not found
await snap.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: IPFS_SNAP_ID,
    request: {method: 'get' },
  },
});

// Persist state in IPFS
await snap.request({
  method: 'wallet_invokeSnap',
  params: { 
    snapId: IPFS_SNAP_ID,
    request: { method: 'set', params: state } 
  } 
});

Your snap is automatically identified in the request messages. If the user doesn't have SnapSync installed, they will be prompted to install it and setup the integration.

That's all you need to do! For more information, please check the GitHub repository.