Configure a Stream

DIMO Check-in

💡 This guide depicts the full flow on how to create/unset/check streams, which requires inputting private_key of your wallet. We recommend hiding this private_key interaction from your users by implementing a wallet integration.

Pre-Requisites

Ensure that there is a vehicle that's connected to your wallet address.

Semi-automatic Stream Operations

We've built a simple application to help with creating a vehicle stream. Simply click on Create under DIMO Buddy > Vehicles > More > Create vehicle stream to create your vehicle stream. Once created, you should be able to see your stream with a link. The user interface also assists with checking the vehicle stream or deleting (unsetting) the stream.

Manual Stream Operations

Create a Stream

  1. Configure a new JSON RPC Provider: new ethers.providers.JsonRpcProvider(rpc)

  2. Create a new signer using the private_key of your wallet, and the provider object initiated in step 1: new ethers.Wallet(private_key.value || '', provider);.

  3. Get the contract object using the DIMO registry address, ABI file, and signer.

  4. Call the createVehicleStream with your accessible vehicle token_id to create the stream.

Developer Notes

When you create a stream, you are automatically a subscriber of it.

Unset a Stream

  1. Same as Create a Stream from steps 1 to 4

  2. Call the unsetVehicleStream with your accessible vehicle token_id to unset the stream.

Check for a Stream

  1. Same as Create a Stream from steps 1 to 4

  2. Call the getVehicleStream with your accessible vehicle token_id to check if a vehicle stream exists or not. Expect the stream ID to be returned if a stream for the vehicle already exist.

Last updated