SettleMint SDK
✨ https://settlemint.com ✨
Integrate SettleMint into your application with ease.
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
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);
registerSchema()
registerSchema(options
): Promise
<string
>
Defined in: schema.ts:246
Registers a new schema with EAS.
Parameters
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
address | string | The address to validate |
Returns
void
Throws
Error if the address is invalid
Example
import { validateEthereumAddress } from '@settlemint/sdk-eas';
validateEthereumAddress("0x1234567890123456789012345678901234567890");
validateEthereumAddress("0x123");
validateEthereumAddress("");
validateFieldName()
validateFieldName(name
): void
Defined in: schema.ts:71
Validates a schema field name.
Parameters
name | string | The field name to validate |
Returns
void
Throws
Error if the name is invalid
Example
import { validateFieldName } from '@settlemint/sdk-eas';
validateFieldName("userAddress");
validateFieldName("user_address");
validateFieldName("user address");
validateFieldName("123user");
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
type | string | The 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';
validateFieldType("string");
validateFieldType("address");
validateFieldType("invalidType");
validateSchemaFields()
validateSchemaFields(fields
): void
Defined in: schema.ts:130
Validates an array of schema fields.
Parameters
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);
validateSchemaFields([]);
validateSchemaFields([
{ name: "userAddress", type: "address" },
{ name: "userAddress", type: "uint8" }
]);
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
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
description? | string | Optional description of the field | schema.ts:51 |
name | string | The name of the field | schema.ts:47 |
type | "string" | "address" | "bool" | "bytes" | "bytes32" | "uint256" | "int256" | "uint8" | "int8" | The type of the field | schema.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
Example
import { EAS_FIELD_TYPES } from '@settlemint/sdk-eas';
type MyFieldType = keyof typeof EAS_FIELD_TYPES;
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.