@evergonlabs/tmi-protocol-api
v0.10.1
Published
REST API for Evergon's RWA tokenization and staking platform. Built with [Hono](https://hono.dev/) and OpenAPI.
Readme
@evergonlabs/tmi-protocol-api
REST API for Evergon's RWA tokenization and staking platform. Built with Hono and OpenAPI.
Entry Points
| Subpath | Purpose |
|---|---|
| ./app | Server-side: buildApps() to create the Hono application |
| ./client | Client-side: buildClients() / buildNextClients() for typed RPC clients |
Client Usage
Note:
@evergonlabs/tmi-protocol-api-clientis deprecated. Use this package's./cliententry point instead.
Setup
import { buildClients, buildNextClients, parseResponse } from "@evergonlabs/tmi-protocol-api/client";
// Create typed clients for all API domains
const clients = buildClients("http://localhost:3000");
// Optionally, create clients for next-gen fractions endpoints
const nextClients = buildNextClients("http://localhost:3000");buildClients returns an object with per-domain clients:
clients.staking— staking platforms, pools, stakes, rolesclients.stakingTemplates— pre-built staking templates (RWA, reputation, reputation-lock)clients.fractions— fractionalization markets, sales, approvals, vestingclients.general— balances, gas estimationclients.issuance— ERC20/ERC721 token deployment and management
buildNextClients returns:
nextClients.fractions— NFT fractions and lending markets
Examples
All endpoint calls should be wrapped with parseResponse which handles the response parsing and returns typed data directly.
Deploy a staking platform
import { buildClients, parseResponse } from "@evergonlabs/tmi-protocol-api/client";
const clients = buildClients("http://localhost:3000");
const transaction = await parseResponse(
clients.stakingTemplates.reputation.v0.createPlatform.$post({
json: {
chainId: 11155111,
adminAddress: "0xYourAddress",
isSoulbound: true,
erc721: {
symbol: "TT",
name: "Test",
baseUri: "ipfs://",
},
},
}),
);
// Send `transaction.details` via your wallet (viem, ethers, etc.)Deploy an ERC20 token via factory
const transaction = await parseResponse(
clients.issuance.erc20.deploy.$post({
json: {
chainId: "sepolia",
factoryAddress: "0xFactoryAddress",
tokenName: "My Token",
tokenSymbol: "MTK",
supplyCap: "1000000000000000000000000",
defaultTokenAdmin: "0xAdminAddress",
minter: "0xMinterAddress",
},
}),
);Query token balances
const balances = await parseResponse(
clients.general.balances.$post({
json: {
chainId: 11155111,
address: "0xOwnerAddress",
contracts: ["0xTokenAddress"],
},
}),
);Query staking platforms
const platforms = await parseResponse(
clients.staking.platforms.searchV0.$post({
json: {
page: { limit: 10, skip: 0 },
filter: {},
},
}),
);Deploy a lending market (next-gen)
import { buildNextClients, parseResponse } from "@evergonlabs/tmi-protocol-api/client";
const nextClients = buildNextClients("http://localhost:3000");
const transaction = await parseResponse(
nextClients.fractions.lending.deploy.$post({
json: {
chainId: "sepolia",
adminAddress: "0xAdminAddress",
lending: {
minInterest: 1000,
maxInterest: 2000,
minDuration: "86400",
maxDuration: "172800",
minimumProportionOverObligation: "2000",
},
},
}),
);Type Inference
Use InferRequestType and InferResponseType to extract request/response types from any endpoint:
import { InferRequestType, InferResponseType } from "@evergonlabs/tmi-protocol-api/client";
type CreatePlatformRequest = InferRequestType<
typeof clients.stakingTemplates.reputation.v0.createPlatform.$post
>;
type CreatePlatformResponse = InferResponseType<
typeof clients.stakingTemplates.reputation.v0.createPlatform.$post
>;Additional Exports
The ./client entry point also re-exports:
FractionsChainId,StakingChainId,PolymorphicChainId— chain ID Zod schemasFactoryChainId— chain ID schema restricted to factory-supported chainsErc20GatedRole,Erc721TokenRole— role enums for token access controlDeployTransactionSchema,TransactionSchema,PageSchema— reusable Zod schemasparseResponse— parses Hono RPC response and returns typed data
Server Usage
import { buildApps } from "@evergonlabs/tmi-protocol-api/app";
const { composite: app } = buildApps(config);
// `app` is a standard Hono app — serve with @hono/node-server, Bun, Deno, etc.