Socket
Book a DemoInstallSign in
Socket

@settlemint/sdk-eas

Package Overview
Dependencies
Maintainers
3
Versions
890
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@settlemint/sdk-eas

Ethereum Attestation Service (EAS) integration for SettleMint SDK

Source
npmnpm
Version
2.2.2-pr5e99366e
Version published
Weekly downloads
3.1K
-8.93%
Maintainers
3
Weekly downloads
 
Created
Source

SettleMint logo

SettleMint SDK

https://settlemint.com
Integrate SettleMint into your application with ease.

CI status License npm stars

Documentation   •   NPM   •   Issues

Table of Contents

About

The SettleMint EAS SDK provides a lightweight wrapper for the Ethereum Attestation Service (EAS), enabling developers to easily create, manage, and verify attestations within their applications. It simplifies the process of working with EAS by handling contract interactions, schema management, and The Graph integration, while ensuring proper integration with the SettleMint platform. This allows developers to quickly implement document verification, identity attestation, and other EAS-based features without manual setup.

API Reference

Functions

buildSchemaString()

buildSchemaString(fields): string

Defined in: schema.ts:166

Builds an EAS schema string from an array of fields.

Parameters
ParameterTypeDescription
fieldsSchemaField[]The fields to include in the schema
Returns

string

The EAS-compatible schema string

Throws

Error if any field is invalid

Example
import { buildSchemaString, SchemaField } from '@settlemint/sdk-eas';

const fields: SchemaField[] = [
  { name: "userAddress", type: "address" },
  { name: "age", type: "uint8" },
  { name: "isActive", type: "bool" }
];

const schemaString = buildSchemaString(fields);
// Result: "address userAddress, uint8 age, bool isActive"

registerSchema()

registerSchema(options): Promise<string>

Defined in: schema.ts:246

Registers a new schema with EAS.

Parameters
ParameterTypeDescription
optionsRegisterSchemaOptionsThe schema registration options
Returns

Promise<string>

A promise that resolves to the schema UID

Throws

Error if the schema registration fails

Example
import { registerSchema, SchemaField } from '@settlemint/sdk-eas';

const fields: SchemaField[] = [
  { name: "userAddress", type: "address" },
  { name: "age", type: "uint8" }
];

const schemaUID = await registerSchema({
  fields,
  resolverAddress: "0x1234567890123456789012345678901234567890",
  revocable: true
});

console.log(`Schema registered with UID: ${schemaUID}`);

validateEthereumAddress()

validateEthereumAddress(address): void

Defined in: schema.ts:214

Validates an Ethereum address.

Parameters
ParameterTypeDescription
addressstringThe address to validate
Returns

void

Throws

Error if the address is invalid

Example
import { validateEthereumAddress } from '@settlemint/sdk-eas';

// Valid address
validateEthereumAddress("0x1234567890123456789012345678901234567890"); // OK

// Invalid addresses
validateEthereumAddress("0x123"); // Throws: "Invalid Ethereum address format"
validateEthereumAddress(""); // Throws: "Resolver address cannot be empty"

validateFieldName()

validateFieldName(name): void

Defined in: schema.ts:71

Validates a schema field name.

Parameters
ParameterTypeDescription
namestringThe field name to validate
Returns

void

Throws

Error if the name is invalid

Example
import { validateFieldName } from '@settlemint/sdk-eas';

// Valid names
validateFieldName("userAddress"); // OK
validateFieldName("user_address"); // OK

// Invalid names
validateFieldName("user address"); // Throws: "Field name cannot contain spaces"
validateFieldName("123user"); // Throws: "Field name must start with a letter or underscore"

validateFieldType()

validateFieldType(type): asserts type is "string" | "address" | "bool" | "bytes" | "bytes32" | "uint256" | "int256" | "uint8" | "int8"

Defined in: schema.ts:101

Validates a schema field type.

Parameters
ParameterTypeDescription
typestringThe field type to validate
Returns

asserts type is "string" | "address" | "bool" | "bytes" | "bytes32" | "uint256" | "int256" | "uint8" | "int8"

Throws

Error if the type is invalid

Example
import { validateFieldType } from '@settlemint/sdk-eas';

// Valid types
validateFieldType("string"); // OK
validateFieldType("address"); // OK

// Invalid types
validateFieldType("invalidType"); // Throws: "Invalid field type: invalidType"

validateSchemaFields()

validateSchemaFields(fields): void

Defined in: schema.ts:130

Validates an array of schema fields.

Parameters
ParameterTypeDescription
fieldsSchemaField[]The fields to validate
Returns

void

Throws

Error if any field is invalid

Example
import { validateSchemaFields, SchemaField } from '@settlemint/sdk-eas';

const fields: SchemaField[] = [
  { name: "userAddress", type: "address" },
  { name: "age", type: "uint8" }
];

validateSchemaFields(fields); // OK

// Invalid fields
validateSchemaFields([]); // Throws: "Schema must have at least one field"
validateSchemaFields([
  { name: "userAddress", type: "address" },
  { name: "userAddress", type: "uint8" }
]); // Throws: "Duplicate field name: userAddress"

Interfaces

RegisterSchemaOptions

Defined in: schema.ts:187

Options for registering a schema.

Example
import { RegisterSchemaOptions, SchemaField } from '@settlemint/sdk-eas';

const options: RegisterSchemaOptions = {
  fields: [
    { name: "userAddress", type: "address" },
    { name: "age", type: "uint8" }
  ],
  resolverAddress: "0x1234567890123456789012345678901234567890",
  revocable: true
};
Properties
PropertyTypeDescriptionDefined in
fieldsSchemaField[]The fields that make up the schemaschema.ts:189
resolverAddressstringThe Ethereum address of the resolverschema.ts:191
revocablebooleanWhether attestations using this schema can be revokedschema.ts:193

SchemaField

Defined in: schema.ts:45

Interface for defining a schema field.

Example
import { SchemaField } from '@settlemint/sdk-eas';

const field: SchemaField = {
  name: "userAddress",
  type: "address",
  description: "The Ethereum address of the user"
};
Properties
PropertyTypeDescriptionDefined in
description?stringOptional description of the fieldschema.ts:51
namestringThe name of the fieldschema.ts:47
type"string" | "address" | "bool" | "bytes" | "bytes32" | "uint256" | "int256" | "uint8" | "int8"The type of the fieldschema.ts:49

Type Aliases

EASFieldType

EASFieldType = keyof typeof EAS_FIELD_TYPES

Defined in: schema.ts:30

Type representing all valid EAS field types.

Variables

EAS_FIELD_TYPES

const EAS_FIELD_TYPES: object

Defined in: schema.ts:15

Supported EAS schema field types. Maps user-friendly type names to EAS-compatible type strings.

Type declaration
NameTypeDefault valueDefined in
address"address""address"schema.ts:17
bool"bool""bool"schema.ts:18
bytes"bytes""bytes"schema.ts:19
bytes32"bytes32""bytes32"schema.ts:20
int256"int256""int256"schema.ts:22
int8"int8""int8"schema.ts:24
string"string""string"schema.ts:16
uint256"uint256""uint256"schema.ts:21
uint8"uint8""uint8"schema.ts:23
Example
import { EAS_FIELD_TYPES } from '@settlemint/sdk-eas';

// Use in type definitions
type MyFieldType = keyof typeof EAS_FIELD_TYPES;

// Check if a type is supported
const isValidType = "string" in EAS_FIELD_TYPES;

Contributing

We welcome contributions from the community! Please check out our Contributing guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.

License

The SettleMint SDK is released under the FSL Software License. See the LICENSE file for more details.

Keywords

settlemint

FAQs

Package last updated on 07 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts