-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-nansen): update parameter types to use z.infer for better …
…type safety Co-Authored-By: Alfonso Gomez Jordana Manas <[email protected]>
- Loading branch information
1 parent
e28f35d
commit 5f28ddc
Showing
4 changed files
with
55 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,51 @@ | ||
import { createToolParameters, type ToolParametersStatic } from "@goat-sdk/core"; | ||
import { createToolParameters } from "@goat-sdk/core"; | ||
import { z } from "zod"; | ||
|
||
const AddressDetailsSchema = z.object({ | ||
address: z.string().describe("Ethereum address to get details for"), | ||
}); | ||
export class GetAddressDetailsParams implements ToolParametersStatic<typeof AddressDetailsSchema> { | ||
static schema = AddressDetailsSchema; | ||
constructor() {} | ||
} | ||
export class GetAddressDetailsParams extends createToolParameters( | ||
z.object({ | ||
address: z.string().describe("Ethereum address to get details for"), | ||
}), | ||
) {} | ||
|
||
const TokenDetailsSchema = z.object({ | ||
address: z.string().describe("Token contract address"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
}); | ||
export class GetTokenDetailsParams implements ToolParametersStatic<typeof TokenDetailsSchema> { | ||
static schema = TokenDetailsSchema; | ||
constructor() {} | ||
} | ||
export class GetTokenDetailsParams extends createToolParameters( | ||
z.object({ | ||
address: z.string().describe("Token contract address"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
}), | ||
) {} | ||
|
||
const NFTDetailsSchema = z.object({ | ||
address: z.string().describe("NFT contract address"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
tokenId: z.string().optional().describe("Specific NFT token ID"), | ||
}); | ||
export class GetNFTDetailsParams implements ToolParametersStatic<typeof NFTDetailsSchema> { | ||
static schema = NFTDetailsSchema; | ||
constructor() {} | ||
} | ||
export class GetNFTDetailsParams extends createToolParameters( | ||
z.object({ | ||
address: z.string().describe("NFT contract address"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
tokenId: z.string().optional().describe("Specific NFT token ID"), | ||
}), | ||
) {} | ||
|
||
const SmartMoneySchema = z.object({ | ||
address: z.string().describe("Address to check smart money status"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
}); | ||
export class GetSmartMoneyParams implements ToolParametersStatic<typeof SmartMoneySchema> { | ||
static schema = SmartMoneySchema; | ||
constructor() {} | ||
} | ||
export class GetSmartMoneyParams extends createToolParameters( | ||
z.object({ | ||
address: z.string().describe("Address to check smart money status"), | ||
chain: z.enum(["ethereum", "polygon", "bsc"]).describe("Blockchain network"), | ||
}), | ||
) {} | ||
|
||
const EntityDetailsSchema = z.object({ | ||
entityId: z.string().describe("Nansen entity ID"), | ||
}); | ||
export class GetEntityDetailsParams implements ToolParametersStatic<typeof EntityDetailsSchema> { | ||
static schema = EntityDetailsSchema; | ||
constructor() {} | ||
} | ||
export class GetEntityDetailsParams extends createToolParameters( | ||
z.object({ | ||
entityId: z.string().describe("Nansen entity ID"), | ||
}), | ||
) {} | ||
|
||
const ExchangeFlowsSchema = z.object({ | ||
exchange: z.string().describe("Exchange name or address"), | ||
token: z.string().optional().describe("Specific token address to filter by"), | ||
timeframe: z.enum(["1h", "24h", "7d", "30d"]).default("24h").describe("Time period for flow data"), | ||
}); | ||
export class GetExchangeFlowsParams implements ToolParametersStatic<typeof ExchangeFlowsSchema> { | ||
static schema = ExchangeFlowsSchema; | ||
constructor() {} | ||
} | ||
export class GetExchangeFlowsParams extends createToolParameters( | ||
z.object({ | ||
exchange: z.string().describe("Exchange name or address"), | ||
token: z.string().optional().describe("Specific token address to filter by"), | ||
timeframe: z.enum(["1h", "24h", "7d", "30d"]).default("24h").describe("Time period for flow data"), | ||
}), | ||
) {} | ||
|
||
const SignalSchema = z.object({ | ||
signalId: z.string().describe("Nansen signal ID"), | ||
parameters: z.record(z.any()).optional().describe("Additional parameters required by the signal"), | ||
}); | ||
export class GetSignalParams implements ToolParametersStatic<typeof SignalSchema> { | ||
static schema = SignalSchema; | ||
constructor() {} | ||
} | ||
export class GetSignalParams extends createToolParameters( | ||
z.object({ | ||
signalId: z.string().describe("Nansen signal ID"), | ||
parameters: z.record(z.any()).optional().describe("Additional parameters required by the signal"), | ||
}), | ||
) {} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.