d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
136 lines
4.2 KiB
TypeScript
136 lines
4.2 KiB
TypeScript
import type { PolymarketMarketHolders } from '@/tools/polymarket/types'
|
|
import { buildDataUrl, handlePolymarketError } from '@/tools/polymarket/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export interface PolymarketGetHoldersParams {
|
|
market: string
|
|
limit?: string
|
|
minBalance?: string
|
|
}
|
|
|
|
export interface PolymarketGetHoldersResponse {
|
|
success: boolean
|
|
output: {
|
|
holders: PolymarketMarketHolders[]
|
|
}
|
|
}
|
|
|
|
export const polymarketGetHoldersTool: ToolConfig<
|
|
PolymarketGetHoldersParams,
|
|
PolymarketGetHoldersResponse
|
|
> = {
|
|
id: 'polymarket_get_holders',
|
|
name: 'Get Market Holders from Polymarket',
|
|
description: 'Retrieve top holders of a specific market token',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
market: {
|
|
type: 'string',
|
|
required: true,
|
|
description:
|
|
'Comma-separated list of condition IDs (e.g., "0x1234...abcd" or "0x1234...abcd,0x5678...efgh").',
|
|
visibility: 'user-or-llm',
|
|
},
|
|
limit: {
|
|
type: 'string',
|
|
required: false,
|
|
description: 'Number of holders to return (e.g., "10"). Range: 0-20, default: 20.',
|
|
visibility: 'user-or-llm',
|
|
},
|
|
minBalance: {
|
|
type: 'string',
|
|
required: false,
|
|
description: 'Minimum balance threshold (default: 1)',
|
|
visibility: 'user-or-llm',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const queryParams = new URLSearchParams()
|
|
queryParams.append('market', params.market)
|
|
if (params.limit) queryParams.append('limit', params.limit)
|
|
if (params.minBalance) queryParams.append('minBalance', params.minBalance)
|
|
return `${buildDataUrl('/holders')}?${queryParams.toString()}`
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!response.ok) {
|
|
handlePolymarketError(data, response.status, 'get_holders')
|
|
}
|
|
|
|
const marketHolders = Array.isArray(data) ? data : []
|
|
|
|
const holders: PolymarketMarketHolders[] = marketHolders.map((mh: any) => ({
|
|
token: mh.token ?? '',
|
|
holders: (mh.holders ?? []).map((h: any) => ({
|
|
proxyWallet: h.proxyWallet ?? '',
|
|
bio: h.bio ?? null,
|
|
asset: h.asset ?? '',
|
|
pseudonym: h.pseudonym ?? null,
|
|
amount: h.amount ?? 0,
|
|
displayUsernamePublic: h.displayUsernamePublic ?? false,
|
|
outcomeIndex: h.outcomeIndex ?? 0,
|
|
name: h.name ?? null,
|
|
profileImage: h.profileImage ?? null,
|
|
profileImageOptimized: h.profileImageOptimized ?? null,
|
|
verified: h.verified ?? false,
|
|
})),
|
|
}))
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
holders,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
holders: {
|
|
type: 'array',
|
|
description: 'Array of market holder groups by token',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
token: { type: 'string', description: 'Token/asset ID' },
|
|
holders: {
|
|
type: 'array',
|
|
description: 'Array of holders for this token',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
proxyWallet: { type: 'string', description: 'Holder wallet address' },
|
|
bio: { type: 'string', description: 'Holder bio' },
|
|
asset: { type: 'string', description: 'Asset ID' },
|
|
pseudonym: { type: 'string', description: 'Holder pseudonym' },
|
|
amount: { type: 'number', description: 'Amount held' },
|
|
displayUsernamePublic: {
|
|
type: 'boolean',
|
|
description: 'Whether username is publicly displayed',
|
|
},
|
|
outcomeIndex: { type: 'number', description: 'Outcome index' },
|
|
name: { type: 'string', description: 'Holder display name' },
|
|
profileImage: { type: 'string', description: 'Profile image URL' },
|
|
profileImageOptimized: {
|
|
type: 'string',
|
|
description: 'Optimized profile image URL',
|
|
},
|
|
verified: { type: 'boolean', description: 'Whether the holder is verified' },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|