@noves/intent-typescript-sdk
Version:
Noves Intent Typescript SDK
181 lines (171 loc) • 5.47 kB
TypeScript
// Auto-generated types for Noves Intent SDK
// Do not modify this file directly
export type IntentModeType = {
stream: "stream";
value: "value";
};
export type IntentMap = {
/** @id 0x - A manual intent for testing purposes. */
"0x": {
name: "manual-test",
params: {
topic: "test-topic" | "mmednik-test";
},
response: any,
mode: "stream",
description: "A manual intent for testing purposes."
},
/** @id token-price-ticks - Produces a stream of price ticks for a given token on a given chain, from now onwards. */
"token-price-ticks": {
name: "token-price-ticks",
params: {
chain: string;
token_address: string;
},
response: any,
mode: "stream",
description: "Produces a stream of price ticks for a given token on a given chain, from now onwards."
},
/** @id txs - Produces a stream of classified txs involving an address on a given chain. */
"txs": {
name: "txs",
params: {
chain: string;
address: string;
},
response: any,
mode: "stream",
description: "Produces a stream of classified txs involving an address on a given chain."
},
/** @id translated-tx - Returns a translated tx on a given the chain. */
"translated-tx": {
name: "translated-tx",
params: {
chain: string;
tx: string;
},
response: any,
mode: "value",
description: "Returns a translated tx on a given the chain."
},
/** @id collection-nfts - Returns the NFTs belonging to a collection on the given chain. */
"collection-nfts": {
name: "collection-nfts",
params: {
chain: string;
address: string;
},
response: any,
mode: "value",
description: "Returns the NFTs belonging to a collection on the given chain."
},
/** @id owned-nfts - Returns the NFTs owned by an address on the given chain. */
"owned-nfts": {
name: "owned-nfts",
params: {
chain: string;
address: string;
},
response: any,
mode: "value",
description: "Returns the NFTs owned by an address on the given chain."
},
/** @id wallet-view - Produces a view of a wallet on a given chain. */
"wallet-view": {
name: "wallet-view",
params: {
address: string;
chain: string;
},
response: any,
mode: "stream",
description: "Produces a view of a wallet on a given chain."
},
/** @id odos-swaps - Produces a stream of swaps through Odos involving an address on a given chain. */
"odos-swaps": {
name: "odos-swaps",
params: {
chain: "eth" | "polygon" | "base" | "avalanche" | "arbitrum" | "optimism";
wallet: string;
odos_address: string;
start_block: number;
end_block: number;
},
response: any,
mode: "stream",
description: "Produces a stream of swaps through Odos involving an address on a given chain."
},
/** @id token-price-history - Produces a one month window of one token's hourly price on a given chain. */
"token-price-history": {
name: "token-price-history",
params: {
chain: string;
token_address: string;
},
response: any,
mode: "value",
description: "Produces a one month window of one token's hourly price on a given chain."
},
/** @id historical-bridge-txs - Produces historical data of bridge activity on Avalanche */
"historical-bridge-txs": {
name: "historical-bridge-txs",
params: {},
response: any,
mode: "stream",
description: "Produces historical data of bridge activity on Avalanche"
},
/** @id ink-bridges - Produces a stream of translated bridge activity on Ink. */
"ink-bridges": {
name: "ink-bridges",
params: {},
response: any,
mode: "stream",
description: "Produces a stream of translated bridge activity on Ink."
},
/** @id ink-types - Produces a stream of translated type activity on Ink. */
"ink-types": {
name: "ink-types",
params: {
type: "AddLiquidity" | "RemoveLiquidity" | "Swap" | "Stake" | "DepositCollateral" | "WithdrawCollateral" | "Borrow";
},
response: any,
mode: "stream",
description: "Produces a stream of translated type activity on Ink."
}}
export type IntentId = keyof IntentMap;
export type IntentName = IntentMap[IntentId]['name'];
export type IntentParams<T extends IntentId> = IntentMap[T]['params'];
export type IntentResponse<T extends IntentId> = IntentMap[T]['response'];
export type IntentMode<T extends IntentId> = IntentMap[T]['mode'];
// Filter intents by mode
export type StreamableIntentId = StreamIntent<IntentId>;
export type ValueIntentId = ValueIntent<IntentId>;
/** @deprecated Use StreamableIntentId or ValueIntentId instead */
export type ExecuteParams<T extends IntentId> = {
intentId: T;
params: IntentParams<T>;
};
// Add JSDoc comments for better IDE hints
/** Intent map for streaming operations */
export type StreamIntentMap = {
[K in StreamableIntentId]: IntentMap[K]
};
/** Intent map for value operations */
export type ValueIntentMap = {
[K in ValueIntentId]: IntentMap[K]
};
// Helper type to ensure proper distribution of conditional types
type DistributiveOmit<T, K extends keyof any> = T extends any
? Omit<T, K>
: never;
// More precise intent filtering types
export type StreamIntent<T extends IntentId> = T extends any
? IntentMap[T]['mode'] extends 'stream'
? T
: never
: never;
export type ValueIntent<T extends IntentId> = T extends any
? IntentMap[T]['mode'] extends 'value'
? T
: never
: never;