LogoLogo
DocsHomeSupportContact
  • Getting Started
    • Introduction
    • Build on DIMO
  • DEVELOPER GUIDE
    • Developer Overview
    • Developer Console
    • Authentication
    • DIMO Developer SDKs
      • Data SDK
      • Login with DIMO SDK
        • React Component
        • Login with DIMO Redirect
        • Core Functionalities
      • TypeScript: Transactions SDK
      • SDK Release Notes
    • Low Code Tools
      • n8n: Getting Started
    • Permissions Contract: SACD
    • DIMO Credits
    • Response Types
    • Rate Limits
    • Developer FAQ
    • Developer Changelogs
    • Troubleshooting Common Issues
  • API References
    • Overview of DIMO API
    • Attestation API
    • Device Definitions API
    • Identity API
      • Schema & Types
      • Scalars
      • Nodes & Objects
        • AftermarketDevice
        • AftermarketDeviceConnection
        • DCN
        • DCNConnection
        • DeveloperLicense
        • DeviceDefinition
        • Earning
        • EarningsConnection
        • Manufacturer
        • Sacd
        • SyntheticDevice
        • Vehicle
        • VehicleConnection
        • VehicleEarnings
        • UserRewards
      • Common Queries
    • Telemetry API
      • Schema & Types
      • Scalars
      • Nodes & Objects
        • Signals
        • SignalsLatest
      • Common Queries
    • Token Exchange API
    • Trips API
    • Valuations API
  • DIMO Hardware
    • Introduction
    • DIMO Hardware Application
    • DIMO Manufacturing License
    • Development & Certification
    • Audits & Assessments
      • Hardware & Security Audit
      • Customer Experience Assessment
      • Integration Testing & Quality Control
      • Final Approval
    • DIMO Device License
      • Device Minting Certificates
    • Essential Documents
      • Hardware & Security Audit Checklist
      • Approved Hardware Auditors
      • DIMO Memorandum of Understanding (MOU)
  • Additional References
    • Developer License
    • DIMO GraphQL Basics
  • Deprecated Resources
    • Guides
      • Developer Journey
      • Quick Start Guide
      • Hello World
      • Code Exchange Flow
    • Data Availability
Powered by GitBook
On this page
  • Overview
  • Getting Started
  • Using the SDK
  • Installation
  • Import
  • Initialization
  • Function Calls
  • Contributions

Was this helpful?

  1. DEVELOPER GUIDE
  2. DIMO Developer SDKs

TypeScript: Transactions SDK

Interact with the blockchain using Transactions SDK

PreviousCore FunctionalitiesNextSDK Release Notes

Last updated 5 months ago

Was this helpful?

DIMO Check-in

Transactions SDK is being utilized by alongside . If you are looking to build apps, we highly recommend using the Login with DIMO component instead and streamline that with the Data SDK.

Overview

The DIMO Transactions SDK is an open-source TypeScript SDK built to facilitate developers in creating transactions. The objective of the Transactions SDK is to allow developer interactions with the DIMO vehicles and permissions on behalf of an end-user.

Getting Started

To get started with the Transactions SDK, you should understand some of the terminologies.

Terms
What we mean

Batch Operations

Batch is the term used when multiple operations are included in one function call. Example: In the vehicle permission sharing function, use setVehiclePermissionsBatch to send requests for different vehicles with different permissions in one operation.

Bulk Operations

Bulk is the term used when multiple operations of the same kind are included in one function call. Example: In the vehicle permission sharing function, use setVehiclePermissionsBulk to send requests for different vehicles with the same permissions in one operation.

Mint

Mint simply means to create and publish (vehicles) onto the network. Do note that minting a vehicle does not mean the vehicle is connected to a data feed or earning rewards. Minting is the first step before connecting and earning. Example: In the mintVehicleWithDeviceDefinition function, developers can create a vehicle on behalf of the user with a provided vehicle definition.

Permissions

SACD

Stampers

A signature provided by the user, in the SDK, this is the passkey that the user provides (face ID, fingerprint, etc).

The user is in the driver's seat and full control over their own account but developers can perform actions when the user provides their passkey in an application.

Using the SDK

Installation

npm install @dimo-network/transactions

Import

import { PasskeyStamper } from "@turnkey/react-native-passkey-stamper";
import { KernelSigner, newKernelConfig, sacdPermissionValue } from '@dimo-network/transactions';

Initialization

// Set up the Signer configs
const kernelSignerConfig = newKernelConfig({
  rpcUrl: RPC_URL,
  bundlerUrl: BUNDLER_RPC,
  paymasterUrl: PAYMASTER_RPC,
  environment: 'dev', // omit to default to prod
});

// Initialize a new passkey stamper
const stamper = new PasskeyStamper({
  rpId: RPID,
});

// Initialize a new Signer session based on the Signer configs above
const kernelSigner = new KernelSigner(kernelSignerConfig);

// Pass the passkey received to initialize signer with user account infos	
await kernelSigner.passkeyInit(
  subOrganizationId,
  walletAddress as `0x${string}`,
  stamper,
);

// Optionally, set up the permissions
const permissions = sacdPermissionValue({
  ALLTIME_LOCATION: true,
});

// Optionally, set up the SACD agreement and upload to IPFS
const ipfsRes = await kernelSigner.signAndUploadSACDAgreement({
  driverID: grantee,
  appID: DIMO_APP_ID,
  appName: APP_NAME,
  expiration: expiration,
  permissions: permissions,
  tokenId: tokenId,
  grantee: grantee,
  attachments: [],
  grantor: kernelSigner.smartContractAddress!,
});

if (!ipfsRes.success) {
  throw new Error(
    `Unable to sign and upload SACD agreement: ${ipfsRes.error}`,
  );
}

Function Calls

const result = await kernelSigner.setVehiclePermissions({
  tokenId,
  grantee,
  permissions,
  expiration,
  source: `ipfs://${ipfsRes.data?.cid}`,
});

Contributions

(Contribution standards to be defined)

The access control on data types that the end user grants to developers. For details on permissions, refer to .

Refers to permissions contract .

Used in Account Abstraction (AA) models in , DIMO Global Accounts removes the dependencies on private keys and gas fees and allow the developers to initiate functions. DIMO utilizes to facilitate signing transactions on behalf of an end-user.

SACD
SACD
Login with DIMO
Accounts API
ERC-4337
Logonpm: @dimo-network/transactionsnpm
Transactions SDK on NPM Registry
Passkey Stamper