├── .nvmrc ├── AGENTS.md ├── apps ├── torus-wallet │ ├── public │ │ ├── og.webp │ │ ├── favicon.ico │ │ ├── logo.svg │ │ └── wallet-info-logo.svg │ ├── postcss.config.mjs │ ├── src │ │ ├── utils │ │ │ ├── fonts.ts │ │ │ └── constants.ts │ │ ├── app │ │ │ ├── (transfers) │ │ │ │ └── _components │ │ │ │ │ └── faucet │ │ │ │ │ └── faucet-form-schema.ts │ │ │ ├── _components │ │ │ │ └── apr-bar │ │ │ │ │ └── apr-bar-base.tsx │ │ │ └── staking │ │ │ │ └── _components │ │ │ │ └── staking-calculator │ │ │ │ └── staking-calculator-header.tsx │ │ └── context │ │ │ └── usd-price-provider.tsx │ ├── next-env.d.ts │ ├── turbo.json │ ├── tsconfig.json │ ├── eslint.config.js │ ├── values.yaml │ └── next.config.mjs ├── torus-portal │ ├── .prettierignore │ ├── tailwind.config.ts │ ├── postcss.config.mjs │ ├── src │ │ ├── utils │ │ │ ├── dsl.ts │ │ │ ├── parse-search-params.ts │ │ │ └── try-catch.ts │ │ ├── app │ │ │ ├── (pages) │ │ │ │ ├── root-allocator │ │ │ │ │ ├── _components │ │ │ │ │ │ ├── agent-banner │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ ├── allocation-sheet │ │ │ │ │ │ │ └── components │ │ │ │ │ │ │ │ ├── selected-agents-label.tsx │ │ │ │ │ │ │ │ └── status-label.tsx │ │ │ │ │ │ └── page-layout.tsx │ │ │ │ │ └── (main-page) │ │ │ │ │ │ └── allocated-agents │ │ │ │ │ │ └── layout.tsx │ │ │ │ ├── loading.tsx │ │ │ │ ├── permissions │ │ │ │ │ └── create-permission │ │ │ │ │ │ ├── wallet │ │ │ │ │ │ └── page.tsx │ │ │ │ │ │ └── capability │ │ │ │ │ │ └── _components │ │ │ │ │ │ └── create-capability-flow │ │ │ │ │ │ └── create-capability-flow-panels │ │ │ │ │ │ ├── stats-panel.tsx │ │ │ │ │ │ └── action-buttons-panel.tsx │ │ │ │ ├── (landing-page) │ │ │ │ │ ├── layout.tsx │ │ │ │ │ └── _components │ │ │ │ │ │ └── hover-header │ │ │ │ │ │ └── _components │ │ │ │ │ │ └── custom-button.tsx │ │ │ │ ├── capabilities │ │ │ │ │ └── register-capability │ │ │ │ │ │ └── _components │ │ │ │ │ │ └── create-capability-path-preview.tsx │ │ │ │ ├── playground │ │ │ │ │ └── layout.tsx │ │ │ │ ├── signals │ │ │ │ │ └── signal-list │ │ │ │ │ │ └── layout.tsx │ │ │ │ ├── portal │ │ │ │ │ ├── layout.tsx │ │ │ │ │ ├── 2d-hypergraph │ │ │ │ │ │ └── layout.tsx │ │ │ │ │ └── _components │ │ │ │ │ │ └── force-graph │ │ │ │ │ │ └── use-graph-interactions.ts │ │ │ │ └── constraints │ │ │ │ │ └── page.tsx │ │ │ └── _components │ │ │ │ ├── portal-form-separator.tsx │ │ │ │ ├── portal-form-header.tsx │ │ │ │ ├── react-flow-layout │ │ │ │ ├── react-flow-layout-types.ts │ │ │ │ └── react-flow-layout-utils.ts │ │ │ │ ├── sidebar │ │ │ │ └── conditional-sidebar.tsx │ │ │ │ └── portal-form-container.tsx │ │ ├── hooks │ │ │ ├── use-post-penalty-emission.ts │ │ │ └── use-blob-url.tsx │ │ ├── stores │ │ │ ├── submitStore.ts │ │ │ ├── tutorialStore.ts │ │ │ └── capabilityTutorialStore.ts │ │ └── trpc │ │ │ └── server.ts │ ├── public │ │ ├── banner_.png │ │ ├── favicon.ico │ │ ├── img1_.jpg │ │ ├── img2_.jpg │ │ ├── img3_.jpg │ │ ├── img4_.jpg │ │ ├── img5_.jpg │ │ ├── img6_.jpg │ │ ├── img7_.jpg │ │ ├── img8_.jpg │ │ └── logo.svg │ ├── next-env.d.ts │ ├── turbo.json │ ├── eslint.config.js │ ├── tsconfig.json │ └── next.config.mjs ├── torus-bridge │ ├── tailwind.config.ts │ ├── postcss.config.mjs │ ├── public │ │ ├── favicon.ico │ │ └── assets │ │ │ └── icons │ │ │ ├── balance │ │ │ ├── torus.svg │ │ │ ├── torus-base.svg │ │ │ └── torus-native.svg │ │ │ ├── bridge │ │ │ ├── torus-base-simple.svg │ │ │ ├── torus-native-simple.svg │ │ │ ├── torus-base.svg │ │ │ └── torus-evm.svg │ │ │ └── ui │ │ │ └── logo.svg │ ├── src │ │ ├── app │ │ │ ├── page.tsx │ │ │ ├── fast │ │ │ │ └── _components │ │ │ │ │ └── fast-bridge.tsx │ │ │ └── _components │ │ │ │ ├── transfer-token │ │ │ │ ├── index.tsx │ │ │ │ ├── _components │ │ │ │ │ └── token-balance.tsx │ │ │ │ └── _sections │ │ │ │ │ ├── token-section.tsx │ │ │ │ │ └── select-chain-section.tsx │ │ │ │ ├── toast │ │ │ │ └── use-toast-error.tsx │ │ │ │ └── transfer-details │ │ │ │ └── _components │ │ │ │ └── get-icon-by-transfer-status.tsx │ │ ├── hooks │ │ │ ├── use-multi-provider.ts │ │ │ ├── chain │ │ │ │ ├── use-chain-protocol.ts │ │ │ │ ├── use-chain-metadata.ts │ │ │ │ └── use-chain-display-name.ts │ │ │ ├── sanctioned │ │ │ │ └── use-is-account-sanctioned.ts │ │ │ ├── balance │ │ │ │ ├── use-destination-balance.ts │ │ │ │ └── use-origin-balance.ts │ │ │ └── use-ready-multi-provider.ts │ │ ├── consts │ │ │ ├── blacklist.ts │ │ │ ├── warp-route-whitelist.ts │ │ │ └── warp-routes.json │ │ ├── utils │ │ │ ├── helpers.ts │ │ │ └── logger.ts │ │ ├── global.d.ts │ │ └── components │ │ │ └── apr-bar-wrapper.tsx │ ├── README.md │ ├── next-env.d.ts │ ├── turbo.json │ ├── tsconfig.json │ └── eslint.config.js ├── torus-page │ ├── tailwind.config.ts │ ├── postcss.config.mjs │ ├── public │ │ ├── favicon.ico │ │ └── logo.svg │ ├── next-env.d.ts │ ├── turbo.json │ ├── next.config.mjs │ ├── tsconfig.json │ ├── eslint.config.js │ └── src │ │ └── app │ │ └── _components │ │ └── hover-header │ │ └── _components │ │ └── custom-button.tsx ├── prediction-swarm │ ├── tailwind.config.ts │ ├── postcss.config.mjs │ ├── public │ │ ├── favicon.ico │ │ ├── background.jpg │ │ └── logo.svg │ ├── next-env.d.ts │ ├── turbo.json │ ├── tsconfig.json │ ├── eslint.config.js │ └── src │ │ ├── store │ │ └── search-store.ts │ │ ├── app │ │ └── (pages) │ │ │ └── (expanded-pages) │ │ │ └── layout.tsx │ │ └── trpc │ │ └── server.ts └── torus-governance │ ├── tailwind.config.ts │ ├── postcss.config.mjs │ ├── public │ ├── favicon.ico │ ├── themis.glb │ └── logo.svg │ ├── next-env.d.ts │ ├── turbo.json │ ├── src │ ├── context │ │ └── auth-provider.tsx │ ├── app │ │ ├── _components │ │ │ ├── agent-application │ │ │ │ └── agent-activity-label.tsx │ │ │ ├── scroll-fade-effect.tsx │ │ │ ├── dao-card │ │ │ │ └── components │ │ │ │ │ ├── author-info.tsx │ │ │ │ │ └── expiration-info.tsx │ │ │ ├── cadre │ │ │ │ └── candidate-card │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── components │ │ │ │ │ └── handle-vote-label.tsx │ │ │ ├── proposal │ │ │ │ └── proposal-vote-label.tsx │ │ │ └── page-container.tsx │ │ ├── loader.tsx │ │ ├── (expanded-pages) │ │ │ └── proposal │ │ │ │ └── [id] │ │ │ │ └── loader.tsx │ │ ├── page.tsx │ │ └── (pages) │ │ │ └── dao-dashboard │ │ │ ├── _components │ │ │ ├── agent-health-tab │ │ │ │ └── agent-health-tab.tsx │ │ │ └── dashboard-tab │ │ │ │ └── dashboard.tsx │ │ │ └── layout.tsx │ ├── utils │ │ ├── types.ts │ │ └── try-catch.ts │ └── trpc │ │ └── server.ts │ ├── tsconfig.json │ ├── eslint.config.js │ └── next.config.mjs ├── packages ├── ui │ ├── src │ │ ├── hooks │ │ │ ├── .gitkeep │ │ │ ├── use-mobile.ts │ │ │ └── use-debounce.ts │ │ ├── components │ │ │ ├── apr-bar │ │ │ │ ├── index.ts │ │ │ │ └── apr-bar-base.tsx │ │ │ ├── apr │ │ │ │ └── index.ts │ │ │ ├── skeleton.tsx │ │ │ ├── container.tsx │ │ │ ├── keyboard-shortcut-badge.tsx │ │ │ ├── loading.tsx │ │ │ ├── markdown-view.tsx │ │ │ ├── destructive-alert-with-description.tsx │ │ │ ├── content-not-found.tsx │ │ │ ├── header.tsx │ │ │ ├── text-area.tsx │ │ │ ├── separator.tsx │ │ │ ├── label.tsx │ │ │ └── collapsible.tsx │ │ └── lib │ │ │ └── utils.ts │ ├── .prettierrc │ ├── postcss.config.mjs │ ├── tsconfig.lint.json │ ├── tsconfig.json │ └── components.json ├── torus-sdk-ts │ ├── src │ │ ├── interfaces │ │ │ ├── default │ │ │ │ ├── .keep │ │ │ │ ├── index.ts │ │ │ │ └── types.ts │ │ │ ├── definitions.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ ├── augment-api.ts │ │ │ └── README.md │ │ ├── agent-client │ │ │ └── index.ts │ │ ├── metadata │ │ │ └── index.ts │ │ ├── types │ │ │ ├── namespace │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── agent │ │ │ └── index.ts │ │ ├── substrate-parsers │ │ │ ├── index.ts │ │ │ ├── address.ts │ │ │ ├── hash.ts │ │ │ └── text.ts │ │ ├── __tests__ │ │ │ └── agent │ │ │ │ └── python-client │ │ │ │ └── pyproject.toml │ │ ├── chain │ │ │ ├── common │ │ │ │ ├── errors.ts │ │ │ │ └── types.ts │ │ │ └── permission0 │ │ │ │ └── permission0.test.ts │ │ ├── testing │ │ │ ├── env.ts │ │ │ └── getApi.ts │ │ └── utils │ │ │ └── index.ts │ ├── .prettierignore │ ├── eslint.config.js │ ├── CHANGELOG.md │ ├── tsconfig.json │ ├── .env.example │ ├── justfile │ └── LICENSE ├── db │ ├── src │ │ ├── schema │ │ │ ├── webapps.ts │ │ │ ├── prediction-swarm.ts │ │ │ ├── index.ts │ │ │ └── swarm-filter.ts │ │ ├── index.ts │ │ ├── utils.ts │ │ └── client.ts │ ├── drizzle │ │ ├── 0002_stiff_paladin.sql │ │ ├── 0004_lovely_jocasta.sql │ │ ├── 0009_fix-userAgentWeight-real.sql │ │ ├── 0008_fix-cadre-notified-db.sql │ │ ├── 0010_fix-computedAgentWeight-unique-agentKey.sql │ │ ├── 0007_seed-discord.sql │ │ ├── 0006_living_raider.sql │ │ └── meta │ │ │ └── _journal.json │ ├── drizzle.config.d.ts.map │ ├── tsconfig.json │ ├── drizzle.config.d.ts │ ├── eslint.config.js │ └── drizzle.config.js ├── env-validation │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── eslint.config.js │ └── package.json ├── api │ ├── tsconfig.json │ ├── eslint.config.js │ └── src │ │ ├── services │ │ └── credits │ │ │ └── index.ts │ │ └── router │ │ ├── cadre │ │ ├── cadre.ts │ │ └── cadre-vote-history.ts │ │ └── prediction │ │ └── prediction-report.ts ├── torus-utils │ ├── src │ │ ├── result │ │ │ └── index.ts │ │ ├── base-api-client │ │ │ ├── auth │ │ │ │ ├── index.ts │ │ │ │ ├── api-key-auth.ts │ │ │ │ ├── bearer-auth.ts │ │ │ │ └── strategies.ts │ │ │ └── index.ts │ │ ├── subspace.ts │ │ ├── torus │ │ │ ├── index.ts │ │ │ └── constants.ts │ │ ├── env.ts │ │ └── collections.ts │ ├── tsconfig.json │ ├── CHANGELOG.md │ ├── eslint.config.js │ ├── justfile │ ├── vitest.config.ts │ └── LICENSE ├── dsl │ ├── eslint.config.js │ └── tsconfig.json ├── query-provider │ ├── tsconfig.json │ ├── .gitignore │ └── eslint.config.js ├── torus-provider │ ├── tsconfig.json │ └── eslint.config.js └── twitter-client │ ├── tsconfig.json │ ├── eslint.config.js │ ├── src │ ├── index.ts │ └── types.ts │ └── package.json ├── services ├── torus-worker │ ├── trigger │ ├── tsconfig.json │ ├── turbo.json │ ├── eslint.config.js │ └── src │ │ ├── common │ │ └── env.ts │ │ └── discord.ts ├── torus-cache │ ├── tsconfig.json │ ├── turbo.json │ ├── eslint.config.js │ └── src │ │ ├── env.ts │ │ ├── utils.ts │ │ └── index.ts ├── swarm-services │ ├── tsconfig.json │ ├── .prettierrc.mjs │ ├── eslint.config.js │ ├── .gitignore │ ├── src │ │ └── services │ │ │ └── reward-distribution.ts │ └── helmfile.yaml ├── swarm-twitter │ ├── tsconfig.json │ ├── turbo.json │ ├── eslint.config.js │ ├── src │ │ ├── env.ts │ │ ├── utils.ts │ │ └── index.ts │ └── vitest.config.ts ├── swarm-verifier │ ├── tsconfig.json │ ├── src │ │ ├── logger.ts │ │ ├── env.ts │ │ └── utils.ts │ ├── turbo.json │ └── eslint.config.js ├── swarm-api │ ├── tsconfig.json │ ├── eslint.config.js │ ├── src │ │ ├── middleware │ │ │ └── context.ts │ │ └── index.ts │ └── helmfile.yaml └── swarm-filter │ ├── tsconfig.json │ ├── src │ └── index.test.ts │ ├── eslint.config.js │ ├── prompts │ └── check-has-prediction.toml │ └── helmfile.yaml ├── .github ├── CODEOWNERS ├── actionlint.yaml ├── ISSUE_TEMPLATE │ └── config.yml ├── renovate.json └── actions │ └── setup │ └── action.yml ├── examples └── example-client │ ├── .envrc │ ├── .gitignore │ ├── justfile │ ├── README.md │ ├── package.json │ ├── tsconfig.json │ └── flake.nix ├── helm ├── values.yaml.gotmpl └── values-utils.yaml ├── atlas └── migrations │ ├── webapps │ ├── 20250331021309.sql │ ├── 20250814214020_explode-my-problems.sql │ ├── 20250717144322_singal_fulfilled.sql │ ├── 20250829160959_chain-spec-25.sql │ ├── 20250803041431_stream-view.sql │ ├── 20250814170621_fix-accumulatedStreamAmounts-pk.sql │ ├── 20250331020820.sql │ ├── 20250618211953.sql │ ├── 20250805172619_target-stream-id.sql │ ├── 20250813031009_accumulated-stream-amounts.sql │ ├── 20250331002504.sql │ ├── 20250618150632.sql │ ├── 20251001165829_worker-lastblock.sql │ ├── 20251016230311_add_ask_torus_usage.sql │ └── 20250719232839_agent-cascade-delete.sql │ └── prediction_swarm │ ├── 20251120161044_rename_goal.sql │ ├── 20251120172816.sql │ ├── 20251121194902.sql │ ├── 20251120235235.sql │ ├── 20251121140154.sql │ ├── 20251120185109.sql │ ├── 20251126135959.sql │ ├── atlas.sum │ └── 20251130132124.sql ├── .npmrc ├── turbo └── generators │ └── templates │ ├── tsconfig.json.hbs │ └── eslint.config.js.hbs ├── .envrc ├── tooling ├── eslint │ ├── tsconfig.json │ ├── nextjs.js │ └── react.js ├── typescript │ ├── package.json │ ├── app-node.json │ ├── internal-package.json │ ├── external-package.json │ ├── app-next.json │ └── base.json └── prettier │ ├── tsconfig.json │ ├── index.js │ └── package.json ├── .helix └── languages.toml ├── .vscode └── extensions.json ├── scripts ├── git-hooks │ ├── pre-push │ └── pre-commit └── get-metadata.sh ├── .prettierignore ├── .mcp.json ├── .dockerignore ├── drizzle.config.ts ├── .changeset ├── README.md └── config.json ├── .gitignore └── docs └── HELM_VALUES.md /.nvmrc: -------------------------------------------------------------------------------- 1 | 20.16 -------------------------------------------------------------------------------- /AGENTS.md: -------------------------------------------------------------------------------- 1 | CLAUDE.md -------------------------------------------------------------------------------- /apps/torus-wallet/public/og.webp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/ui/src/hooks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/torus-worker/trigger: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @renlabs-dev/web 2 | -------------------------------------------------------------------------------- /apps/torus-portal/.prettierignore: -------------------------------------------------------------------------------- 1 | values.yaml -------------------------------------------------------------------------------- /examples/example-client/.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /helm/values.yaml.gotmpl: -------------------------------------------------------------------------------- 1 | {{ .Values | toYaml }} -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/default/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /apps/torus-bridge/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | export * from "@torus-ts/ui/tailwind.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-page/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | export * from "@torus-ts/ui/tailwind.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-portal/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | export * from "@torus-ts/ui/tailwind.config"; 2 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250331021309.sql: -------------------------------------------------------------------------------- 1 | DROP TYPE "public"."application_status"; 2 | -------------------------------------------------------------------------------- /packages/ui/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-tailwindcss"] 3 | } 4 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | node-linker=hoisted 2 | link-workspace-packages=true 3 | 4 | publish-branch=dev 5 | -------------------------------------------------------------------------------- /apps/prediction-swarm/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | export * from "@torus-ts/ui/tailwind.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-governance/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | export * from "@torus-ts/ui/tailwind.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-page/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /packages/db/src/schema/webapps.ts: -------------------------------------------------------------------------------- 1 | export * from "./base"; 2 | export * from "./utils"; 3 | -------------------------------------------------------------------------------- /packages/env-validation/src/index.ts: -------------------------------------------------------------------------------- 1 | export { buildZodEnvScript } from "./EnvScript"; 2 | -------------------------------------------------------------------------------- /apps/torus-bridge/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-portal/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-wallet/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /packages/api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json" 3 | } 4 | -------------------------------------------------------------------------------- /services/torus-cache/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json" 3 | } 4 | -------------------------------------------------------------------------------- /apps/prediction-swarm/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /apps/torus-governance/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | export { default } from "@torus-ts/ui/postcss.config"; 2 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/definitions.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | types: { 3 | } 4 | }; 5 | -------------------------------------------------------------------------------- /packages/torus-utils/src/result/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./sync.js"; 2 | export * from "./async.js"; 3 | -------------------------------------------------------------------------------- /services/swarm-services/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json" 3 | } 4 | -------------------------------------------------------------------------------- /services/swarm-twitter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json" 3 | } 4 | -------------------------------------------------------------------------------- /services/swarm-verifier/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json" 3 | } 4 | -------------------------------------------------------------------------------- /services/torus-worker/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/db/drizzle/0002_stiff_paladin.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "proposal" ADD COLUMN "proposal_id" integer NOT NULL; -------------------------------------------------------------------------------- /apps/torus-portal/src/utils/dsl.ts: -------------------------------------------------------------------------------- 1 | // Re-export the shared DSL package 2 | export * from "@torus-ts/dsl"; 3 | -------------------------------------------------------------------------------- /turbo/generators/templates/tsconfig.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json" 3 | } 4 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | 3 | if [ -f ".env" ]; then 4 | set -o allexport 5 | source .env 6 | set +o allexport 7 | fi 8 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/agent-client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./keypair.js"; 2 | export * from "./agent-client.js"; 3 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/metadata/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./metadata.js"; 2 | export * from "./agent-metadata.js"; 3 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-bridge/public/favicon.ico -------------------------------------------------------------------------------- /apps/torus-page/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-page/public/favicon.ico -------------------------------------------------------------------------------- /apps/torus-portal/public/banner_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/banner_.png -------------------------------------------------------------------------------- /apps/torus-portal/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/favicon.ico -------------------------------------------------------------------------------- /apps/torus-portal/public/img1_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img1_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img2_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img2_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img3_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img3_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img4_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img4_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img5_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img5_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img6_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img6_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img7_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img7_.jpg -------------------------------------------------------------------------------- /apps/torus-portal/public/img8_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-portal/public/img8_.jpg -------------------------------------------------------------------------------- /apps/torus-wallet/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-wallet/public/favicon.ico -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/types/namespace/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./agent-name.js"; 2 | export * from "./namespace-path.js"; 3 | -------------------------------------------------------------------------------- /examples/example-client/.gitignore: -------------------------------------------------------------------------------- 1 | # Nix / direnv 2 | /.direnv 3 | 4 | # Build 5 | /dist 6 | 7 | # Node.js 8 | node_modules 9 | -------------------------------------------------------------------------------- /packages/db/drizzle/0004_lovely_jocasta.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "proposal" ADD CONSTRAINT "proposal_proposal_id_unique" UNIQUE("proposal_id"); -------------------------------------------------------------------------------- /packages/dsl/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | export default [...baseConfig]; 4 | -------------------------------------------------------------------------------- /apps/prediction-swarm/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/prediction-swarm/public/favicon.ico -------------------------------------------------------------------------------- /apps/torus-governance/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-governance/public/favicon.ico -------------------------------------------------------------------------------- /apps/torus-governance/public/themis.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/torus-governance/public/themis.glb -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251120161044_rename_goal.sql: -------------------------------------------------------------------------------- 1 | ALTER TYPE failure_cause_enum RENAME VALUE 'VAGUE_GOAL' TO 'VAGUE_TARGET'; -------------------------------------------------------------------------------- /apps/prediction-swarm/public/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/renlabs-dev/torus-ts/HEAD/apps/prediction-swarm/public/background.jpg -------------------------------------------------------------------------------- /packages/torus-sdk-ts/.prettierignore: -------------------------------------------------------------------------------- 1 | /src/interfaces 2 | !src/interfaces/definitions.ts 3 | !src/interfaces/README.md 4 | /src/__tests__ 5 | -------------------------------------------------------------------------------- /services/swarm-services/.prettierrc.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import("prettier").Config} */ 2 | const config = {}; 3 | 4 | export default config; 5 | -------------------------------------------------------------------------------- /tooling/eslint/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/base.json", 3 | "include": ["."], 4 | "exclude": ["node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250814214020_explode-my-problems.sql: -------------------------------------------------------------------------------- 1 | -- Drop accumulatedStreamAmounts table 2 | DROP TABLE IF EXISTS "accumulated_stream_amounts"; -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/agent/index.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { AgentServer } from "./agent.js"; 3 | 4 | export { AgentServer as Agent, z }; 5 | -------------------------------------------------------------------------------- /.github/actionlint.yaml: -------------------------------------------------------------------------------- 1 | self-hosted-runner: 2 | labels: 3 | - ubicloud-standard-2 4 | - ubicloud-standard-16 5 | - ubicloud-standard-2-ubuntu-2404 6 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import FastBridgePage from "./fast/page"; 2 | 3 | export default function HomePage() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /packages/db/drizzle.config.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"drizzle.config.d.ts","sourceRoot":"","sources":["drizzle.config.ts"],"names":[],"mappings":";;;;;;;AAQA,wBAImB"} -------------------------------------------------------------------------------- /services/swarm-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json", 3 | "exclude": ["node_modules", "dist", "test-*.ts", "tests/**/*"] 4 | } 5 | -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251120172816.sql: -------------------------------------------------------------------------------- 1 | -- Modify "twitter_users" table 2 | ALTER TABLE "public"."twitter_users" ADD COLUMN "scraped_at" timestamptz NULL; 3 | -------------------------------------------------------------------------------- /packages/env-validation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json", 3 | "compilerOptions": { 4 | "jsx": "react-jsx" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tooling/typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@torus-ts/tsconfig", 3 | "version": "0.1.0", 4 | "private": true, 5 | "files": [ 6 | "*.json" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from './types.js'; 5 | -------------------------------------------------------------------------------- /apps/torus-bridge/README.md: -------------------------------------------------------------------------------- 1 | # torus-bridge 2 | 3 | ## Setup 4 | 5 | ### Dependencies 6 | 7 | Run `pnpm install` to the dependencies: 8 | 9 | - `@hyperlane-xyz/cli` 10 | -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251121194902.sql: -------------------------------------------------------------------------------- 1 | -- Modify "twitter_users" table 2 | ALTER TABLE "public"."twitter_users" ALTER COLUMN "username" TYPE character varying(30); 3 | -------------------------------------------------------------------------------- /packages/torus-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/external-package.json", 3 | "compilerOptions": { 4 | "types": ["vitest/importMeta"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.helix/languages.toml: -------------------------------------------------------------------------------- 1 | [[language]] 2 | name = "typescript" 3 | formatter = { command = "pnpm", args = ["prettier", "--stdin-filepath", "%{buffer_name}"] } 4 | auto-format = true 5 | 6 | -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251120235235.sql: -------------------------------------------------------------------------------- 1 | -- Modify "parsed_prediction" table 2 | ALTER TABLE "public"."parsed_prediction" ADD COLUMN "filter_agent_signature" text NULL; 3 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/default/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from './types.js'; 5 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from './default/types.js'; 5 | -------------------------------------------------------------------------------- /services/swarm-verifier/src/logger.ts: -------------------------------------------------------------------------------- 1 | import { BasicLogger } from "@torus-network/torus-utils/logger"; 2 | 3 | export const logger = BasicLogger.create({ name: "swarm-verifier" }); 4 | -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251121140154.sql: -------------------------------------------------------------------------------- 1 | -- Modify "parsed_prediction" table 2 | ALTER TABLE "public"."parsed_prediction" ADD COLUMN "agent_alleged_timestamp" timestamptz NULL; 3 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/fast/_components/fast-bridge.tsx: -------------------------------------------------------------------------------- 1 | import { FastBridgeForm } from "./fast-bridge-form"; 2 | 3 | export function FastBridge() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/use-multi-provider.ts: -------------------------------------------------------------------------------- 1 | import { useStore } from "~/utils/store"; 2 | 3 | export function useMultiProvider() { 4 | return useStore((s) => s.multiProvider); 5 | } 6 | -------------------------------------------------------------------------------- /packages/db/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json", 3 | "compilerOptions": { 4 | "noEmit": false, 5 | "emitDeclarationOnly": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /services/swarm-api/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | export default [ 4 | { 5 | ignores: ["tests/**/*"], 6 | }, 7 | ...baseConfig, 8 | ]; 9 | -------------------------------------------------------------------------------- /services/swarm-filter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-node.json", 3 | "compilerOptions": { 4 | "rootDir": "." 5 | }, 6 | "include": ["src", "scripts"] 7 | } 8 | -------------------------------------------------------------------------------- /services/swarm-services/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [...baseConfig]; 5 | -------------------------------------------------------------------------------- /packages/db/drizzle/0009_fix-userAgentWeight-real.sql: -------------------------------------------------------------------------------- 1 | -- Custom SQL migration file, put your code below! -- 2 | ALTER TABLE user_agent_weight 3 | ALTER COLUMN weight TYPE real USING weight::real; 4 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/default/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export type PHANTOM_DEFAULT = 'default'; 5 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250717144322_singal_fulfilled.sql: -------------------------------------------------------------------------------- 1 | -- Modify "agent_demand_signal" table 2 | ALTER TABLE "public"."agent_demand_signal" ADD COLUMN "fulfilled" boolean NOT NULL DEFAULT false; 3 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250829160959_chain-spec-25.sql: -------------------------------------------------------------------------------- 1 | -- Modify "namespace_permissions" table 2 | ALTER TABLE "public"."namespace_permissions" ADD COLUMN "max_instances" integer NOT NULL DEFAULT 0; 3 | -------------------------------------------------------------------------------- /examples/example-client/justfile: -------------------------------------------------------------------------------- 1 | help: 2 | @just --list 3 | 4 | # Install dependencies 5 | install: 6 | npm install 7 | 8 | dev: 9 | npm run dev 10 | 11 | build: 12 | npm run build 13 | -------------------------------------------------------------------------------- /packages/db/drizzle/0008_fix-cadre-notified-db.sql: -------------------------------------------------------------------------------- 1 | -- Custom SQL migration file, put your code below! -- 2 | ALTER TABLE "cadre_candidate" ADD COLUMN "notified" BOOLEAN DEFAULT false;--> statement-breakpoint -------------------------------------------------------------------------------- /packages/ui/src/components/apr-bar/index.ts: -------------------------------------------------------------------------------- 1 | export { APRBar } from "./apr-bar"; 2 | export { APRBarBase } from "./apr-bar-base"; 3 | export { AppBarDataGroup, AppBarSeparator } from "./apr-bar-shared"; 4 | -------------------------------------------------------------------------------- /apps/torus-wallet/src/utils/fonts.ts: -------------------------------------------------------------------------------- 1 | import { Fira_Mono } from "next/font/google"; 2 | 3 | export const firaMono = Fira_Mono({ 4 | subsets: ["latin"], 5 | display: "swap", 6 | weight: "400", 7 | }); 8 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/transfer-token/index.tsx: -------------------------------------------------------------------------------- 1 | import { TransferTokenForm } from "./_components/transfer-token-form"; 2 | 3 | export function TransferToken() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /packages/query-provider/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json", 3 | "compilerOptions": { 4 | "lib": ["dom", "dom.iterable", "ES2022"], 5 | "jsx": "react-jsx" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/torus-provider/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json", 3 | "compilerOptions": { 4 | "lib": ["dom", "dom.iterable", "ES2022"], 5 | "jsx": "react-jsx" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /services/swarm-filter/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | 3 | describe("swarm-filter", () => { 4 | it("placeholder test", () => { 5 | expect(true).toBe(true); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/ui/src/components/apr/index.ts: -------------------------------------------------------------------------------- 1 | export { APRBarClient } from "./apr-bar-client"; 2 | export { TorusToUSD } from "./torus-to-usd"; 3 | export { useAPR } from "./hooks"; 4 | export type { APRResult } from "./hooks"; 5 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/consts/blacklist.ts: -------------------------------------------------------------------------------- 1 | // A list of addresses that are cannot be used in the app 2 | // If a wallet with this address is connected, the app will show an error 3 | export const ADDRESS_BLACKLIST: string[] = []; 4 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250803041431_stream-view.sql: -------------------------------------------------------------------------------- 1 | -- Add value to enum type: "permission_revocation_type" 2 | ALTER TYPE "public"."permission_revocation_type" ADD VALUE 'revocable_by_delegator' AFTER 'revocable_by_grantor'; 3 | -------------------------------------------------------------------------------- /packages/db/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "drizzle-orm"; 2 | export * from "drizzle-orm/sql"; 3 | export { createDb } from "./client"; 4 | export type { DB, Transaction } from "./client"; 5 | // TODO: migrations management workflow 6 | -------------------------------------------------------------------------------- /packages/ui/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | autoprefixer: {}, 6 | }, 7 | }; 8 | 9 | export default config; 10 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src", "turbo"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/root-allocator/_components/agent-banner/index.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Animation } from "./_components/animation"; 4 | 5 | export function AgentBanner() { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /packages/torus-utils/src/base-api-client/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { ApiKeyAuth } from "./api-key-auth.js"; 2 | export { BearerTokenAuth } from "./bearer-auth.js"; 3 | export type { AuthStrategy, TokenProvider } from "./strategies.js"; 4 | -------------------------------------------------------------------------------- /packages/db/drizzle/0010_fix-computedAgentWeight-unique-agentKey.sql: -------------------------------------------------------------------------------- 1 | -- Custom SQL migration file, put your code below! -- 2 | ALTER TABLE computed_agent_weight 3 | ADD CONSTRAINT computed_agent_weight_agent_key_unique UNIQUE (agent_key); 4 | -------------------------------------------------------------------------------- /packages/db/src/schema/prediction-swarm.ts: -------------------------------------------------------------------------------- 1 | // Re-export schemas for prediction swarm (Twitter/predictions) 2 | export * from "./utils"; 3 | export * from "./memory"; 4 | export * from "./context-schemas"; 5 | export * from "./swarm-filter"; 6 | -------------------------------------------------------------------------------- /services/swarm-twitter/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "dev": { 6 | "persistent": true, 7 | "interactive": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /services/swarm-verifier/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "dev": { 6 | "persistent": true, 7 | "interactive": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /services/torus-cache/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "dev": { 6 | "persistent": true, 7 | "interactive": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /services/torus-worker/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "dev": { 6 | "persistent": true, 7 | "interactive": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tooling/prettier/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/base.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true 6 | }, 7 | "include": ["."], 8 | "exclude": ["node_modules"] 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "esbenp.prettier-vscode", 5 | "yoavbls.pretty-ts-errors", 6 | "bradlc.vscode-tailwindcss", 7 | "dozerg.tsimportsorter" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/api/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: ["dist/**"], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /services/swarm-filter/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /services/swarm-services/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # production 5 | dist 6 | 7 | # cache 8 | .turbo 9 | .cache 10 | 11 | # local env files 12 | .env 13 | .env*.local 14 | 15 | # typescript 16 | *.tsbuildinfo 17 | -------------------------------------------------------------------------------- /services/torus-cache/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /services/torus-worker/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /packages/torus-provider/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /packages/torus-utils/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @torus-network/torus-utils 2 | 3 | ## 1.1.1 4 | 5 | - 5755b53: Publishing SDK and utils packages together with same version always. 6 | 7 | ## 0.1.7 8 | 9 | ### Minor Changes 10 | 11 | - publishing fixes 12 | -------------------------------------------------------------------------------- /packages/twitter-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/base.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "rootDir": "src" 6 | }, 7 | "include": ["src"], 8 | "exclude": ["src/__tests__"] 9 | } 10 | -------------------------------------------------------------------------------- /services/swarm-twitter/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /services/swarm-verifier/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /packages/db/drizzle.config.d.ts: -------------------------------------------------------------------------------- 1 | declare const _default: { 2 | schema: string; 3 | dialect: "postgresql"; 4 | dbCredentials: { 5 | url: string; 6 | }; 7 | }; 8 | export default _default; 9 | //# sourceMappingURL=drizzle.config.d.ts.map 10 | -------------------------------------------------------------------------------- /packages/dsl/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/internal-package.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": ["src"], 7 | "exclude": ["src/**/*.test.ts", "src/**/*.spec.ts", "tests/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/torus-utils/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: ["dist/**"], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /scripts/git-hooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | echo "Checking code formatting..." 5 | pnpm prettier --check --cache --cache-location .cache/.prettiercache --ignore-unknown . 6 | 7 | echo "Running full test suite..." 8 | just check-test 9 | -------------------------------------------------------------------------------- /turbo/generators/templates/eslint.config.js.hbs: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: [], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250814170621_fix-accumulatedStreamAmounts-pk.sql: -------------------------------------------------------------------------------- 1 | -- Rename a column from "last_updated_block" to "last_executed_block" 2 | ALTER TABLE "public"."accumulated_stream_amounts" RENAME COLUMN "last_updated_block" TO "last_executed_block"; 3 | -------------------------------------------------------------------------------- /packages/db/src/schema/index.ts: -------------------------------------------------------------------------------- 1 | // Re-export utilities and base schemas 2 | export * from "./base"; 3 | 4 | export * from "./utils"; 5 | 6 | export * from "./memory"; 7 | 8 | export * from "./swarm-filter"; 9 | 10 | export * from "./context-schemas"; 11 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | pnpm-lock.yaml 2 | 3 | atlas/ 4 | node_modules/ 5 | 6 | /packages/db/drizzle/* 7 | 8 | /packages/torus-sdk-ts/src/interfaces/ 9 | !/packages/torus-sdk-ts/src/interfaces/definitions.ts 10 | !/packages/torus-sdk-ts/src/interfaces/README.md 11 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "../substrate-parsers/index.js"; 2 | 3 | export * from "../chain/common/types.js"; 4 | export * from "../chain/common/errors.js"; 5 | 6 | export * from "./address.js"; 7 | export * from "./namespace/index.js"; 8 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/utils/helpers.ts: -------------------------------------------------------------------------------- 1 | export function isPromise(value: unknown): value is Promise { 2 | return Boolean( 3 | value && 4 | typeof value === "object" && 5 | "then" in value && 6 | typeof value.then === "function", 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /packages/twitter-client/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: ["dist/**", "src/__tests__/**"], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/global.d.ts: -------------------------------------------------------------------------------- 1 | declare type Address = string; 2 | declare type ChainName = string; 3 | declare type ChainId = number | string; 4 | declare type DomainId = number; 5 | 6 | declare module "*.yaml" { 7 | const data: unknown; 8 | export default data; 9 | } 10 | -------------------------------------------------------------------------------- /apps/torus-bridge/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /apps/torus-page/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /apps/torus-portal/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /apps/torus-wallet/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: ["dist/**", "src/interfaces/**", "src/__tests__/**"], 7 | }, 8 | ...baseConfig, 9 | ]; 10 | -------------------------------------------------------------------------------- /apps/prediction-swarm/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /apps/torus-governance/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | import "./.next/types/routes.d.ts"; 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /.mcp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "linear": { 4 | "command": "npx", 5 | "args": ["-y", "mcp-remote", "https://mcp.linear.app/mcp"] 6 | }, 7 | "next-devtools": { 8 | "command": "npx", 9 | "args": ["-y", "next-devtools-mcp@latest"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250331020820.sql: -------------------------------------------------------------------------------- 1 | -- Modify "proposal" table 2 | ALTER TABLE "public"."proposal" ALTER COLUMN "status" TYPE text USING "status"::text; 3 | -- Modify "whitelist_application" table 4 | ALTER TABLE "public"."whitelist_application" ALTER COLUMN "status" TYPE text USING "status"::text; 5 | -------------------------------------------------------------------------------- /examples/example-client/README.md: -------------------------------------------------------------------------------- 1 | # Torus SDK Example 2 | 3 | ## Requirements 4 | 5 | - Node.js 22 6 | - just 7 | 8 | ## Quickstart 9 | 10 | Clone template: 11 | 12 | ```sh 13 | # TODO 14 | ``` 15 | 16 | Install dependencies: 17 | 18 | ```sh 19 | just install 20 | # or 21 | npm install 22 | ``` 23 | -------------------------------------------------------------------------------- /packages/db/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | 3 | /** @type {import('typescript-eslint').Config} */ 4 | export default [ 5 | { 6 | ignores: ["dist/**", "drizzle/**"], 7 | }, 8 | ...baseConfig, 9 | ...restrictEnvAccess, 10 | ]; 11 | -------------------------------------------------------------------------------- /packages/torus-utils/justfile: -------------------------------------------------------------------------------- 1 | default: 2 | @just --list 3 | 4 | clean: 5 | rm -rf node_modules dist 6 | 7 | install: 8 | pnpm install 9 | 10 | check: 11 | pnpm run typecheck 12 | pnpm run lint 13 | 14 | build: 15 | pnpm run build 16 | 17 | publish: clean install check build 18 | pnpm publish 19 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/components/apr-bar-wrapper.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useTorus } from "@torus-ts/torus-provider"; 4 | import { APRBarClient } from "@torus-ts/ui/components/apr"; 5 | 6 | export function APRBarWrapper() { 7 | const { api } = useTorus(); 8 | return ; 9 | } 10 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/chain/use-chain-protocol.ts: -------------------------------------------------------------------------------- 1 | import type { ChainName } from "@hyperlane-xyz/sdk"; 2 | import { useChainMetadata } from "./use-chain-metadata"; 3 | 4 | export function useChainProtocol(chainName?: ChainName) { 5 | const metadata = useChainMetadata(chainName); 6 | return metadata?.protocol; 7 | } 8 | -------------------------------------------------------------------------------- /apps/torus-page/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /apps/prediction-swarm/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-bridge/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-governance/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-portal/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-wallet/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "!.next/cache/**", "next-env.d.ts"] 8 | }, 9 | "dev": { 10 | "persistent": true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/env-validation/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig from "@torus-ts/eslint-config/base"; 2 | import reactConfig from "@torus-ts/eslint-config/react"; 3 | 4 | /** @type {import('typescript-eslint').Config} */ 5 | export default [ 6 | { 7 | ignores: ["dist/**"], 8 | }, 9 | ...baseConfig, 10 | ...reactConfig, 11 | ]; 12 | -------------------------------------------------------------------------------- /atlas/migrations/prediction_swarm/20251120185109.sql: -------------------------------------------------------------------------------- 1 | -- Add value to enum type: "failure_cause_enum" 2 | ALTER TYPE "public"."failure_cause_enum" ADD VALUE 'SELF_ANNOUNCEMENT' AFTER 'PRESENT_STATE'; 3 | -- Add value to enum type: "failure_cause_enum" 4 | ALTER TYPE "public"."failure_cause_enum" ADD VALUE 'PERSONAL_ACTION' AFTER 'SELF_ANNOUNCEMENT'; 5 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | "compilerOptions": { 4 | //"outDir": "dist" 5 | "baseUrl": ".", 6 | "paths": { 7 | "@torus-ts/ui/*": ["./src/*"] 8 | }, 9 | "jsx": "react-jsx" 10 | }, 11 | "include": ["."], 12 | "exclude": ["node_modules", "dist"] 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-governance/src/context/auth-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { SessionProvider } from "next-auth/react"; 4 | import type { ReactNode } from "react"; 5 | 6 | export default function DiscordAuthProvider({ 7 | children, 8 | }: { 9 | children: ReactNode; 10 | }) { 11 | return {children}; 12 | } 13 | -------------------------------------------------------------------------------- /apps/torus-portal/src/utils/parse-search-params.ts: -------------------------------------------------------------------------------- 1 | export function parseSearchParams(searchParams: { 2 | page?: string; 3 | search?: string; 4 | }) { 5 | const pageParam = searchParams.page; 6 | const page = pageParam ? parseInt(pageParam, 10) || 1 : 1; 7 | const search = searchParams.search ?? null; 8 | 9 | return { page, search }; 10 | } 11 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | export const logger = { 2 | debug: (...args: unknown[]) => console.debug(...args), 3 | info: (...args: unknown[]) => console.info(...args), 4 | warn: (...args: unknown[]) => console.warn(...args), 5 | error: (message: string, err: unknown, ...args: unknown[]) => { 6 | console.error(message, err, ...args); 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250618211953.sql: -------------------------------------------------------------------------------- 1 | -- Modify "enforcement_authority" table 2 | ALTER TABLE "public"."enforcement_authority" ADD CONSTRAINT "enforcement_authority_permission_id_ss58_address_unique" UNIQUE ("permission_id", "ss58_address"); 3 | -- Modify "permission_details" table 4 | ALTER TABLE "public"."permission_details" ALTER COLUMN "duration" DROP NOT NULL; 5 | -------------------------------------------------------------------------------- /packages/ui/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx } from "clsx"; 2 | import type { ClassValue } from "clsx"; 3 | import { twMerge } from "tailwind-merge"; 4 | 5 | export function cn(...inputs: ClassValue[]) { 6 | return twMerge(clsx(inputs)); 7 | } 8 | 9 | export async function copyToClipboard(text: string) { 10 | await navigator.clipboard.writeText(text); 11 | } 12 | -------------------------------------------------------------------------------- /scripts/git-hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | readarray -t STAGED_FILES < <(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(ts|tsx|js|jsx|json|md|yaml|yml|css|scss|html)$') 5 | 6 | if [ ${#STAGED_FILES[@]} -eq 0 ]; then 7 | exit 0 8 | fi 9 | 10 | pnpm prettier --write --ignore-unknown "${STAGED_FILES[@]}" 11 | git update-index --again 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Ask a question 3 | url: https://github.com/t3-oss/create-t3-turbo/discussions 4 | about: Ask questions and discuss with other community members 5 | - name: Feature request 6 | url: https://github.com/t3-oss/create-t3-turbo/discussions/new?category=ideas 7 | about: Feature requests should be opened as discussions 8 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/chain/use-chain-metadata.ts: -------------------------------------------------------------------------------- 1 | import type { ChainName } from "@hyperlane-xyz/sdk"; 2 | import { useMultiProvider } from "../use-multi-provider"; 3 | 4 | export function useChainMetadata(chainName?: ChainName) { 5 | const multiProvider = useMultiProvider(); 6 | if (!chainName) return undefined; 7 | return multiProvider.tryGetChainMetadata(chainName); 8 | } 9 | -------------------------------------------------------------------------------- /packages/db/drizzle.config.js: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | const envSchema = z.object({ 4 | POSTGRES_URL: z.string().nonempty({ message: "Missing POSTGRES_URL" }), 5 | }); 6 | 7 | const env = envSchema.parse(process.env); 8 | 9 | export default { 10 | schema: "./src/schema/index.ts", 11 | dialect: "postgresql", 12 | dbCredentials: { url: env.POSTGRES_URL }, 13 | }; 14 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/substrate-parsers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./helpers.js"; 2 | export * from "./primitives.js"; 3 | export * from "./text.js"; 4 | export * from "./bytes.js"; 5 | export * from "./hash.js"; 6 | export * from "./address.js"; 7 | export * from "./option.js"; 8 | export * from "./collections.js"; 9 | export * from "./struct.js"; 10 | export * from "./enum.js"; 11 | -------------------------------------------------------------------------------- /packages/ui/src/components/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@torus-ts/ui/lib/utils"; 2 | 3 | function Skeleton({ className, ...props }: React.ComponentProps<"div">) { 4 | return ( 5 |
10 | ); 11 | } 12 | 13 | export { Skeleton }; 14 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/_components/agent-application/agent-activity-label.tsx: -------------------------------------------------------------------------------- 1 | import { Badge } from "@torus-ts/ui/components/badge"; 2 | 3 | export function AgentActivityLabel() { 4 | return ( 5 | 9 | Registered 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /packages/api/src/services/credits/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | getBalance, 3 | getPurchaseHistory, 4 | purchaseCredits, 5 | CreditsError, 6 | CreditsErrorCode, 7 | } from "./credits-service"; 8 | 9 | export type { 10 | CreditBalance, 11 | CreditPurchaseHistoryItem, 12 | CreditsServiceDeps, 13 | PurchaseCreditsInput, 14 | PurchaseCreditsResult, 15 | } from "./credits-service"; 16 | -------------------------------------------------------------------------------- /packages/db/src/utils.ts: -------------------------------------------------------------------------------- 1 | import type { PgEnum } from "drizzle-orm/pg-core"; 2 | 3 | export function extract_pgenum_values( 4 | pgEnum: PgEnum, 5 | ): { 6 | [K in T[number]]: K; 7 | } { 8 | const map = {} as { [K in T[number]]: K }; 9 | pgEnum.enumValues.forEach((value: T[number]) => { 10 | map[value] = value; 11 | }); 12 | return map; 13 | } 14 | -------------------------------------------------------------------------------- /packages/twitter-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export { KaitoTwitterAPI } from "./kaito-client"; 2 | export type { KaitoClientConfig } from "./types"; 3 | export type { User } from "./schemas/user"; 4 | export type { SimpleTweet } from "./schemas/tweet"; 5 | export { 6 | KaitoAuthenticationError, 7 | KaitoRateLimitError, 8 | KaitoTwitterAPIError, 9 | KaitoValidationError, 10 | } from "./utils/errors"; 11 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/loader.tsx: -------------------------------------------------------------------------------- 1 | import { LoaderCircle } from "lucide-react"; 2 | 3 | export default function Loader() { 4 | return ( 5 |
6 |

Loading...

7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/loading.tsx: -------------------------------------------------------------------------------- 1 | import { Loading } from "@torus-ts/ui/components/loading"; 2 | 3 | export default function LoadingPage() { 4 | return ( 5 |
6 | 7 | 8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @torus-network/sdk 2 | 3 | ## 1.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 5755b53: Publishing SDK and utils packages together with same version always. 8 | - @torus-network/torus-utils@1.1.1 9 | 10 | ## 1.1.0 11 | 12 | ### Minor Changes 13 | 14 | - bd30c52: Add TORUS_RPC_URLS env vars 15 | 16 | ## 0.1.7 17 | 18 | ### Minor Changes 19 | 20 | - publishing fixes 21 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/augment-api.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-chain`, do not edit 2 | /* eslint-disable */ 3 | 4 | import './augment-api-consts.js'; 5 | import './augment-api-errors.js'; 6 | import './augment-api-events.js'; 7 | import './augment-api-query.js'; 8 | import './augment-api-tx.js'; 9 | import './augment-api-rpc.js'; 10 | import './augment-api-runtime.js'; 11 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | /data/ 2 | /tmp/ 3 | 4 | /.direnv/ 5 | 6 | # local env files 7 | .env 8 | .env.* 9 | !.env.example 10 | 11 | # dependencies 12 | **/node_modules 13 | 14 | # next.js 15 | **/.next 16 | **/.vercel/ 17 | **/out/ 18 | **/**/build 19 | **/.swc/ 20 | 21 | # turbo 22 | .turbo 23 | 24 | # typescript 25 | **/dist/ 26 | **/.cache/ 27 | 28 | # misc 29 | .DS_Store 30 | *.pem 31 | 32 | # git 33 | .git 34 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/_components/scroll-fade-effect.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { cn } from "@torus-ts/ui/lib/utils"; 4 | 5 | export function ScrollFadeEffect() { 6 | return ( 7 |
8 |
9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /apps/torus-portal/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /apps/torus-wallet/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /apps/prediction-swarm/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /apps/torus-governance/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /apps/torus-page/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tooling/typescript/app-node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./base.json", 3 | "compilerOptions": { 4 | "rootDir": "${configDir}/src", 5 | "outDir": "${configDir}/dist", 6 | "noEmit": false, 7 | "emitDeclarationOnly": false, 8 | "declaration": false, 9 | "sourceMap": true 10 | }, 11 | "include": ["${configDir}/src"], 12 | "exclude": ["${configDir}/node_modules", "${configDir}/dist"] 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-governance/src/utils/types.ts: -------------------------------------------------------------------------------- 1 | import type { AppRouter } from "@torus-ts/api"; 2 | import type { inferProcedureOutput } from "@trpc/server"; 3 | 4 | export type Candidate = NonNullable< 5 | inferProcedureOutput 6 | >[number]; 7 | 8 | export type CandidacyStatus = Candidate["candidacyStatus"]; 9 | 10 | export type VoteStatus = "FAVORABLE" | "AGAINST" | "UNVOTED"; 11 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/external-package.json", 3 | "compilerOptions": { 4 | "noEmit": false, 5 | "emitDeclarationOnly": false, 6 | "paths": { 7 | "@torus-network/sdk/*": ["./src/*"], 8 | "@polkadot/api/augment": ["./src/interfaces/augment-api.ts"], 9 | "@polkadot/types/augment": ["./src/interfaces/augment-types.ts"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/ui/src/components/container.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | export function Container({ 4 | children, 5 | }: Readonly<{ 6 | children: React.ReactNode; 7 | }>) { 8 | return ( 9 |
10 |
11 | {children} 12 |
13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/chain/use-chain-display-name.ts: -------------------------------------------------------------------------------- 1 | import type { ChainName } from "@hyperlane-xyz/sdk"; 2 | import { getChainDisplayName } from "~/utils/chain"; 3 | import { useMultiProvider } from "../use-multi-provider"; 4 | 5 | export function useChainDisplayName(chainName: ChainName, shortName = false) { 6 | const multiProvider = useMultiProvider(); 7 | return getChainDisplayName(multiProvider, chainName, shortName); 8 | } 9 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/(expanded-pages)/proposal/[id]/loader.tsx: -------------------------------------------------------------------------------- 1 | import { LoaderCircle } from "lucide-react"; 2 | 3 | export default function Loader() { 4 | return ( 5 |
6 |

Loading...

7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { StatueAnimation } from "./_components/statue-animation"; 2 | 3 | export function generateMetadata() { 4 | return import("./layout").then((module) => module.generateMetadata()); 5 | } 6 | 7 | export default function HomePage() { 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/torus-utils/src/base-api-client/index.ts: -------------------------------------------------------------------------------- 1 | export { BaseAPIClient, type BaseClientConfig } from "./base-client.js"; 2 | export { 3 | BaseAPIError, 4 | AuthenticationError, 5 | RateLimitError, 6 | ValidationError, 7 | handleRequestError, 8 | handleHttpError, 9 | } from "./errors.js"; 10 | export { 11 | ApiKeyAuth, 12 | BearerTokenAuth, 13 | type AuthStrategy, 14 | type TokenProvider, 15 | } from "./auth/index.js"; 16 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/permissions/create-permission/wallet/page.tsx: -------------------------------------------------------------------------------- 1 | import PortalFormContainer from "~/app/_components/portal-form-container"; 2 | import { WalletStakePermissionForm } from "./_components/wallet-stake-permission-form"; 3 | 4 | export default function CreateWalletStakePermissionPage() { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /tooling/typescript/internal-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "./base.json", 4 | "compilerOptions": { 5 | "rootDir": "${configDir}/src", 6 | "outDir": "${configDir}/dist", 7 | "declaration": true, 8 | "declarationMap": true, 9 | "noEmit": false 10 | }, 11 | "include": ["${configDir}/src"], 12 | "exclude": ["${configDir}/node_modules", "${configDir}/dist"] 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/balance/torus.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/balance/torus-base.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "matchPackagePatterns": ["^@torus-ts/"], 7 | "enabled": false 8 | } 9 | ], 10 | "updateInternalDeps": true, 11 | "rangeStrategy": "bump", 12 | "automerge": true, 13 | "npm": { 14 | "fileMatch": ["(^|/)package\\.json$", "(^|/)package\\.json\\.hbs$"] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apps/torus-page/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import("next").NextConfig} */ 2 | const config = { 3 | reactStrictMode: true, 4 | 5 | reactCompiler: true, 6 | 7 | /** Enables hot reloading for local packages without a build step */ 8 | transpilePackages: ["@torus-ts/ui", "@torus-ts/env-validation"], 9 | 10 | /** We already do typechecking as separate task in CI */ 11 | typescript: { ignoreBuildErrors: true }, 12 | }; 13 | 14 | export default config; 15 | -------------------------------------------------------------------------------- /apps/torus-page/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": [ 12 | "${configDir}", 13 | "${configDir}/.next/types/**/*.ts", 14 | ".next/types/**/*.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /apps/prediction-swarm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": [ 12 | "${configDir}", 13 | "${configDir}/.next/types/**/*.ts", 14 | ".next/types/**/*.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /apps/torus-bridge/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": [ 12 | "${configDir}", 13 | "${configDir}/.next/types/**/*.ts", 14 | ".next/types/**/*.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /apps/torus-governance/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": [ 12 | "${configDir}", 13 | "${configDir}/.next/types/**/*.ts", 14 | ".next/types/**/*.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /apps/torus-page/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | ]; 15 | -------------------------------------------------------------------------------- /apps/torus-wallet/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": [ 12 | "${configDir}", 13 | "${configDir}/.next/types/**/*.ts", 14 | ".next/types/**/*.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250805172619_target-stream-id.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."emission_distribution_targets" DROP CONSTRAINT "emission_distribution_targets_permission_id_target_account_id_u", ADD COLUMN "stream_id" character varying(66), ADD COLUMN "accumulated_tokens" numeric NOT NULL DEFAULT 0, ADD COLUMN "at_block" integer, ADD CONSTRAINT "emission_distribution_targets_permission_id_stream_id_target_ac" UNIQUE ("permission_id", "stream_id", "target_account_id"); 2 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250813031009_accumulated-stream-amounts.sql: -------------------------------------------------------------------------------- 1 | -- Drop index "accumulated_streams_grantor_stream_idx" from table: "accumulated_stream_amounts" 2 | DROP INDEX "public"."accumulated_streams_grantor_stream_idx"; 3 | -- Modify "accumulated_stream_amounts" table 4 | ALTER TABLE "public"."accumulated_stream_amounts" ADD COLUMN "last_updated_block" integer NULL, ADD COLUMN "at_block" integer NOT NULL, ADD COLUMN "execution_count" integer NOT NULL DEFAULT 0; 5 | -------------------------------------------------------------------------------- /packages/ui/src/components/keyboard-shortcut-badge.tsx: -------------------------------------------------------------------------------- 1 | export function KeyboardShortcutBadge({ 2 | keyboardKey, 3 | }: { 4 | keyboardKey: string; 5 | }) { 6 | return ( 7 | 8 | 9 | {keyboardKey} 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /apps/prediction-swarm/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | ]; 15 | -------------------------------------------------------------------------------- /apps/prediction-swarm/src/store/search-store.ts: -------------------------------------------------------------------------------- 1 | import { create } from "zustand"; 2 | 3 | interface SearchStore { 4 | isOpen: boolean; 5 | open: () => void; 6 | close: () => void; 7 | toggle: () => void; 8 | } 9 | 10 | export const useSearchStore = create((set) => ({ 11 | isOpen: false, 12 | open: () => set({ isOpen: true }), 13 | close: () => set({ isOpen: false }), 14 | toggle: () => set((state) => ({ isOpen: !state.isOpen })), 15 | })); 16 | -------------------------------------------------------------------------------- /apps/torus-governance/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | ]; 15 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/_components/portal-form-separator.tsx: -------------------------------------------------------------------------------- 1 | export function PortalFormSeparator({ title }: { title: string }) { 2 | return ( 3 |
4 | 5 | {title} 6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/bridge/torus-base-simple.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /apps/torus-wallet/src/app/(transfers)/_components/faucet/faucet-form-schema.ts: -------------------------------------------------------------------------------- 1 | import { isSS58 } from "@torus-network/sdk/types"; 2 | import { z } from "zod"; 3 | 4 | export type FaucetFormValues = z.infer; 5 | 6 | export const FaucetFormSchema = z.object({ 7 | recipient: z 8 | .string() 9 | .trim() 10 | .min(1, { message: "Recipient address is required" }) 11 | .refine(isSS58, { message: "Invalid recipient address" }), 12 | }); 13 | -------------------------------------------------------------------------------- /packages/api/src/router/cadre/cadre.ts: -------------------------------------------------------------------------------- 1 | import { isNull } from "@torus-ts/db"; 2 | import { cadreSchema } from "@torus-ts/db/schema"; 3 | import type { TRPCRouterRecord } from "@trpc/server"; 4 | import { publicProcedure } from "../../trpc"; 5 | 6 | export const cadreRouter = { 7 | all: publicProcedure.query(({ ctx }) => { 8 | return ctx.db.query.cadreSchema.findMany({ 9 | where: isNull(cadreSchema.deletedAt), 10 | }); 11 | }), 12 | } satisfies TRPCRouterRecord; 13 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/transfer-token/_components/token-balance.tsx: -------------------------------------------------------------------------------- 1 | import type { TokenAmount } from "@hyperlane-xyz/sdk"; 2 | 3 | export function TokenBalance({ 4 | label, 5 | balance, 6 | }: Readonly<{ 7 | label: string; 8 | balance?: TokenAmount | null; 9 | }>) { 10 | const value = balance?.getDecimalFormattedAmount().toFixed(5) ?? "0"; 11 | return ( 12 |
{`${label}: ${value}`}
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /apps/torus-portal/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**", "playground/**"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | ]; 15 | -------------------------------------------------------------------------------- /packages/torus-utils/src/subspace.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @deprecated This file is maintained for backward compatibility. 3 | * Please import from more specific paths: 4 | * - `@torus-network/torus-utils/torus/address` for address utilities 5 | * - `@torus-network/torus-utils/torus/token` for token utilities 6 | * - `@torus-network/torus-utils/torus/constants` for constants 7 | */ 8 | 9 | // Re-export everything from torus for backward compatibility 10 | export * from "./torus/index.js"; 11 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/transfer-token/_sections/token-section.tsx: -------------------------------------------------------------------------------- 1 | import { Label } from "@torus-ts/ui/components/label"; 2 | import { TokenSelectField } from "~/app/_components/tokens/token-select-field"; 3 | 4 | export function TokenSection({ isReview }: Readonly<{ isReview: boolean }>) { 5 | return ( 6 |
7 | 8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /apps/torus-wallet/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**", "public/faucetWorker.js"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | ]; 15 | -------------------------------------------------------------------------------- /drizzle.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "drizzle-kit"; 2 | 3 | if (!process.env.POSTGRES_URL) { 4 | throw new Error("Missing POSTGRES_URL"); 5 | } 6 | 7 | const nonPoolingUrl = process.env.POSTGRES_URL.replace(":6543", ":5432"); 8 | console.log(`Using db url: ${nonPoolingUrl}`); 9 | export default defineConfig({ 10 | schema: "./packages/db/src/schema/index.ts", 11 | dialect: "postgresql", 12 | dbCredentials: { url: nonPoolingUrl }, 13 | out: "./packages/db/drizzle", 14 | }); 15 | -------------------------------------------------------------------------------- /packages/torus-utils/src/torus/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Torus token utilities 3 | * 4 | * This module provides utilities for working with TORUS tokens including: 5 | * - Address formatting 6 | * - Token amount handling with TorAmount type 7 | * - Conversion between TORUS and Rems (smallest unit) 8 | * - Legacy functions for backward compatibility 9 | */ 10 | 11 | export * from "./constants.js"; 12 | export * from "./address.js"; 13 | export * from "./token.js"; 14 | export * from "./legacy.js"; 15 | -------------------------------------------------------------------------------- /apps/torus-portal/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@torus-ts/tsconfig/app-next.json", 3 | // We need these `baseUrl`, `paths`, `include` options in all Next apps 4 | // tsconfig files because Next is dumb 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | }, 10 | "types": ["vitest/importMeta"] 11 | }, 12 | "include": [ 13 | "${configDir}", 14 | "${configDir}/.next/types/**/*.ts", 15 | ".next/types/**/*.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/(landing-page)/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { ReactNode } from "react"; 2 | 3 | /** 4 | * Landing page layout. 5 | * The ConditionalSidebar in the parent layout handles excluding the standard 6 | * sidebar for this route. The landing page has its own custom sidebar 7 | * implementation that appears as an absolute overlay when the user scrolls down. 8 | */ 9 | export default function LandingLayout({ children }: { children: ReactNode }) { 10 | return <>{children}; 11 | } 12 | -------------------------------------------------------------------------------- /packages/db/drizzle/0007_seed-discord.sql: -------------------------------------------------------------------------------- 1 | -- Custom SQL migration file, put your code below! - 2 | INSERT INTO "user_discord_info" ("discord_id", "user_name", "avatar_url") VALUES('353453210389839872', 'kingu0', 'https://cdn.discordapp.com/avatars/353453210389839872/fdc15fcefb3ce48121156dd1a94f5583.png'); 3 | INSERT INTO "user_discord_info" ("discord_id", "user_name", "avatar_url") VALUES('240844942639890433', 'steinerkelvin', 'https://cdn.discordapp.com/avatars/240844942639890433/a_ec888ddd47fa1bbdc8e33e06dcce034b.gif'); -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/interfaces/README.md: -------------------------------------------------------------------------------- 1 | # Subspace Types Generation 2 | 3 | [polkadot.js.org/docs/api/examples/promise/typegen](https://polkadot.js.org/docs/api/examples/promise/typegen/) 4 | 5 | ## Types setup 6 | 7 | We can specify additional type definitions by adding the following: 8 | 9 | - `src/interfaces/definitions.ts` - this just exports all the sub-folder 10 | definitions in one go 11 | - `src/interfaces//definitions.ts` - manual type definitions for a 12 | specific module 13 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/sanctioned/use-is-account-sanctioned.ts: -------------------------------------------------------------------------------- 1 | import { useIsAccountChainalysisSanctioned } from "./use-is-account-chainalysis-sanctioned"; 2 | import { useIsAccountOfacSanctioned } from "./use-is-account-ofac-sanctioned"; 3 | 4 | export function useIsAccountSanctioned() { 5 | const isAccountOfacSanctioned = useIsAccountOfacSanctioned(); 6 | const isAccountChainalysisSanctioned = useIsAccountChainalysisSanctioned(); 7 | 8 | return isAccountOfacSanctioned || isAccountChainalysisSanctioned; 9 | } 10 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/__tests__/agent/python-client/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "agent-test-client" 3 | version = "0.1.0" 4 | description = "Simple Python client for testing TypeScript agent-server" 5 | authors = ["Torus Team"] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.11" 9 | requests = "^2.31.0" 10 | substrate-interface = "^1.7.0" 11 | 12 | [tool.poetry.group.dev.dependencies] 13 | pytest = "^7.4.2" 14 | 15 | [build-system] 16 | requires = ["poetry-core"] 17 | build-backend = "poetry.core.masonry.api" -------------------------------------------------------------------------------- /packages/api/src/router/cadre/cadre-vote-history.ts: -------------------------------------------------------------------------------- 1 | import { isNull } from "@torus-ts/db"; 2 | import { cadreVoteHistory } from "@torus-ts/db/schema"; 3 | import type { TRPCRouterRecord } from "@trpc/server"; 4 | import { publicProcedure } from "../../trpc"; 5 | 6 | export const cadreVoteHistoryRouter = { 7 | // GET 8 | all: publicProcedure.query(({ ctx }) => { 9 | return ctx.db.query.cadreVoteHistory.findMany({ 10 | where: isNull(cadreVoteHistory.deletedAt), 11 | }); 12 | }), 13 | } satisfies TRPCRouterRecord; 14 | -------------------------------------------------------------------------------- /packages/db/src/schema/swarm-filter.ts: -------------------------------------------------------------------------------- 1 | import { integer, text } from "drizzle-orm/pg-core"; 2 | import { createTable, timeFields } from "./utils"; 3 | 4 | /** 5 | * Stores global cursor state for filter processing. 6 | * Single row table (id always = 1) to track where we are in the tweet dataset. 7 | */ 8 | export const filterCursorStateSchema = createTable("filter_cursor_state", { 9 | id: integer("id").primaryKey().default(1), 10 | lastCursor: text("last_cursor").notNull().default("0_0"), 11 | ...timeFields(), 12 | }); 13 | -------------------------------------------------------------------------------- /services/torus-cache/src/env.ts: -------------------------------------------------------------------------------- 1 | import { createEnv } from "@t3-oss/env-core"; 2 | import { z } from "zod"; 3 | 4 | // TODO: replace with validateEnvOrExit 5 | export const env = createEnv({ 6 | shared: { 7 | NODE_ENV: z 8 | .enum(["development", "production", "test"]) 9 | .default("development"), 10 | }, 11 | clientPrefix: "NEXT_PUBLIC_", 12 | server: { 13 | TORUS_RPC_URL: z.string().url(), 14 | PORT: z.string().default("3000"), 15 | }, 16 | client: {}, 17 | runtimeEnv: process.env, 18 | }); 19 | -------------------------------------------------------------------------------- /apps/torus-portal/src/hooks/use-post-penalty-emission.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Utility function for non-hook contexts 3 | */ 4 | // TODO: this is not a hook 5 | export function calculatePostPenaltyEmission( 6 | prePenaltyPercent: number | null | undefined, 7 | penaltyFactor: number | null | undefined, 8 | ): number { 9 | if (prePenaltyPercent == null) return 0; 10 | if (penaltyFactor == null) return prePenaltyPercent; 11 | const p = penaltyFactor > 1 ? penaltyFactor / 100 : penaltyFactor; 12 | return prePenaltyPercent * (1 - p); 13 | } 14 | -------------------------------------------------------------------------------- /apps/torus-portal/src/stores/submitStore.ts: -------------------------------------------------------------------------------- 1 | import { create } from "zustand"; 2 | 3 | interface SubmitState { 4 | isSubmitting: boolean; 5 | setSubmitting: (value: boolean) => void; 6 | toggleSubmitting: () => void; 7 | } 8 | 9 | const useSubmitStore = create((set) => ({ 10 | isSubmitting: false, 11 | setSubmitting: (value: boolean) => set({ isSubmitting: value }), 12 | toggleSubmitting: () => 13 | set((state) => ({ isSubmitting: !state.isSubmitting })), 14 | })); 15 | 16 | export default useSubmitStore; 17 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/chain/common/errors.ts: -------------------------------------------------------------------------------- 1 | import type { z } from "zod"; 2 | 3 | // ==== Error Types ==== 4 | 5 | export type ZError = z.ZodError; 6 | 7 | // ==== Substrate Query Error ==== 8 | 9 | export class SbQueryError extends Error { 10 | constructor(message: string, options?: ErrorOptions) { 11 | super(message, options); 12 | this.name = "SbQueryError"; 13 | } 14 | 15 | static from(error: Error): SbQueryError { 16 | return new SbQueryError(error.message, { cause: error }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/torus-utils/src/env.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | export const validateEnvOrExit = 4 | >(varSchemas: S) => 5 | (env: unknown) => { 6 | const envSchema = z.object(varSchemas); 7 | 8 | const result = envSchema.safeParse(env); 9 | 10 | if (!result.success) { 11 | console.error("❌ Invalid environment variables:"); 12 | console.error(JSON.stringify(result.error.format(), null, 2)); 13 | process.exit(1); 14 | } 15 | 16 | return result.data; 17 | }; 18 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/balance/use-destination-balance.ts: -------------------------------------------------------------------------------- 1 | import type { TransferFormValues } from "~/utils/types"; 2 | import { useTokenByIndex } from "../token"; 3 | import { useBalance } from "./use-balance"; 4 | 5 | export function useDestinationBalance({ 6 | destination, 7 | tokenIndex, 8 | recipient, 9 | }: TransferFormValues) { 10 | const originToken = useTokenByIndex(tokenIndex); 11 | const connection = originToken?.getConnectionForChain(destination); 12 | return useBalance(destination, connection?.token, recipient); 13 | } 14 | -------------------------------------------------------------------------------- /tooling/eslint/nextjs.js: -------------------------------------------------------------------------------- 1 | import nextPlugin from "@next/eslint-plugin-next"; 2 | 3 | /** @type {Awaited} */ 4 | export default [ 5 | { 6 | files: ["**/*.ts", "**/*.tsx"], 7 | plugins: { 8 | "@next/next": nextPlugin, 9 | }, 10 | rules: { 11 | ...nextPlugin.configs.recommended.rules, 12 | ...nextPlugin.configs["core-web-vitals"].rules, 13 | // TypeError: context.getAncestors is not a function 14 | "@next/next/no-duplicate-head": "off", 15 | }, 16 | }, 17 | ]; 18 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250331002504.sql: -------------------------------------------------------------------------------- 1 | -- Add value to enum type: "application_status" 2 | ALTER TYPE "public"."application_status" ADD VALUE 'Open' BEFORE 'OPEN'; 3 | -- Add value to enum type: "application_status" 4 | ALTER TYPE "public"."application_status" ADD VALUE 'Accepted' AFTER 'Open'; 5 | -- Add value to enum type: "application_status" 6 | ALTER TYPE "public"."application_status" ADD VALUE 'Rejected' AFTER 'Accepted'; 7 | -- Add value to enum type: "application_status" 8 | ALTER TYPE "public"."application_status" ADD VALUE 'Expired' AFTER 'Rejected'; 9 | -------------------------------------------------------------------------------- /examples/example-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@torus-network/example-client", 3 | "version": "0.1.0", 4 | "main": "dist/index.js", 5 | "types": "dist/index.d.ts", 6 | "type": "module", 7 | "license": "MIT", 8 | "scripts": { 9 | "build": "tsc", 10 | "dev": "tsx src/index.ts", 11 | "start": "node dist/index.js" 12 | }, 13 | "dependencies": { 14 | "@torus-network/sdk": "^0.1.7" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^24.0.3", 18 | "tsx": "^4.20.3", 19 | "typescript": "^5.8.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/testing/env.ts: -------------------------------------------------------------------------------- 1 | import "dotenv/config"; 2 | import { validateEnvOrExit } from "@torus-network/torus-utils/env"; 3 | import { memo } from "@torus-network/torus-utils/misc"; 4 | import { z } from "zod"; 5 | 6 | /** 7 | * Environment configuration for chain tests. 8 | */ 9 | const testingEnvVarsSchema = { 10 | TEST_CHAIN_RPC_URL: z.string().url(), 11 | }; 12 | 13 | /** 14 | * Lazily parse and cache environment variables. 15 | */ 16 | export const getEnv = memo(() => 17 | validateEnvOrExit(testingEnvVarsSchema)(process.env), 18 | ); 19 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/testing/getApi.ts: -------------------------------------------------------------------------------- 1 | import { ApiPromise, WsProvider } from "@polkadot/api"; 2 | import { memo } from "@torus-network/torus-utils/misc"; 3 | import { getEnv } from "./env.js"; 4 | 5 | /** 6 | * Lazily create and cache ApiPromise instance for chain tests. 7 | * Reuses the same connection across all tests to avoid connection overhead. 8 | */ 9 | export const getApi = memo((): Promise => { 10 | const env = getEnv(); 11 | return ApiPromise.create({ 12 | provider: new WsProvider(env.TEST_CHAIN_RPC_URL), 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/ui/src/components/loading.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { LoaderCircle } from "lucide-react"; 3 | import { cn } from "../lib/utils"; 4 | 5 | export function Loading( 6 | props: Readonly<{ className?: string; size?: number | string }>, 7 | ) { 8 | const { className, size } = props; 9 | return ( 10 | 11 | 12 | Loading... 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /services/swarm-twitter/src/env.ts: -------------------------------------------------------------------------------- 1 | import { createEnv } from "@t3-oss/env-core"; 2 | import { z } from "zod"; 3 | 4 | // TODO: replace with validateEnvOrExit 5 | export const env = createEnv({ 6 | shared: { 7 | NODE_ENV: z 8 | .enum(["development", "production", "test"]) 9 | .default("development"), 10 | }, 11 | clientPrefix: "NEXT_PUBLIC_", 12 | server: { 13 | TORUS_RPC_URL: z.string().url(), 14 | PORT: z.string().default("3000"), 15 | TWITTERAPI_IO_KEY: z.string(), 16 | }, 17 | client: {}, 18 | runtimeEnv: process.env, 19 | }); 20 | -------------------------------------------------------------------------------- /tooling/typescript/external-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "./base.json", 4 | "compilerOptions": { 5 | "target": "ES2020", 6 | "module": "NodeNext", 7 | "moduleResolution": "NodeNext", 8 | "rootDir": "${configDir}/src", 9 | "outDir": "${configDir}/dist", 10 | "declaration": true, 11 | "declarationMap": true, 12 | "sourceMap": true, 13 | "noEmit": false 14 | }, 15 | "include": ["${configDir}/src"], 16 | "exclude": ["${configDir}/node_modules", "${configDir}/dist"] 17 | } 18 | -------------------------------------------------------------------------------- /apps/torus-wallet/src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Shared constants for the Torus Wallet application. 3 | */ 4 | 5 | /** 6 | * Minimum stake amount safeguard - 0.5 TORUS in smallest units. 7 | * Used as a fallback when the network minimum stake value is unavailable. 8 | */ 9 | export const MIN_ALLOWED_STAKE_SAFEGUARD = 500000000000000000n; 10 | 11 | /** 12 | * Minimum existential balance - 0.1 TORUS in smallest units. 13 | * The minimum balance required to keep an account alive on the network. 14 | */ 15 | export const MIN_EXISTENTIAL_BALANCE = 100000000000000000n; 16 | -------------------------------------------------------------------------------- /apps/torus-portal/src/hooks/use-blob-url.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import type { Nullish } from "@torus-network/torus-utils"; 4 | import { useEffect, useState } from "react"; 5 | 6 | export const useBlobUrl = (blob: Blob | Nullish) => { 7 | const [url, setUrl] = useState(null); 8 | 9 | useEffect(() => { 10 | if (!blob) return; 11 | const objectUrl = URL.createObjectURL(blob); 12 | setTimeout(() => setUrl(objectUrl), 0); 13 | return () => { 14 | URL.revokeObjectURL(objectUrl); 15 | }; 16 | }, [blob]); 17 | 18 | return url; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/query-provider/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage 10 | 11 | # next.js 12 | .next/ 13 | out/ 14 | build 15 | .swc/ 16 | 17 | # misc 18 | .DS_Store 19 | *.pem 20 | 21 | # debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # local env files 27 | .env 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # turbo 34 | .turbo 35 | 36 | # ui 37 | dist/ 38 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/capabilities/register-capability/_components/create-capability-path-preview.tsx: -------------------------------------------------------------------------------- 1 | export function RegisterCapabilityPathPreview({ 2 | fullPath, 3 | }: { 4 | fullPath: string; 5 | }) { 6 | return ( 7 |
8 |

Full Capability Path:

9 | 10 | {fullPath || "Select prefix and enter path..."} 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /packages/ui/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/styles/globals.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true 11 | }, 12 | "iconLibrary": "lucide", 13 | "aliases": { 14 | "components": "@torus-ts/ui/components", 15 | "utils": "@torus-ts/ui/lib/utils", 16 | "hooks": "@torus-ts/ui/hooks", 17 | "lib": "@torus-ts/ui/lib", 18 | "ui": "@torus-ts/ui/components" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/example-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "Node16", 5 | "moduleResolution": "Node16", 6 | "lib": ["ES2022"], 7 | "outDir": "./dist", 8 | "rootDir": "./src", 9 | "strict": true, 10 | "esModuleInterop": true, 11 | "skipLibCheck": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "resolveJsonModule": true, 14 | "declaration": true, 15 | "declarationMap": true, 16 | "sourceMap": true 17 | }, 18 | "include": ["src/**/*"], 19 | "exclude": ["node_modules", "dist"] 20 | } 21 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20250618150632.sql: -------------------------------------------------------------------------------- 1 | -- Create "agent_demand_signal" table 2 | CREATE TABLE "public"."agent_demand_signal" ("id" serial NOT NULL, "agent_key" character varying(256) NOT NULL, "title" text NOT NULL, "description" text NOT NULL, "proposed_allocation" integer NOT NULL, "discord" text NULL, "github" text NULL, "telegram" text NULL, "twitter" text NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"), CONSTRAINT "percent_check" CHECK ((proposed_allocation >= 0) AND (proposed_allocation <= 100))); 3 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: "PNPM Setup and install" 2 | description: "Common setup steps for Actions" 3 | 4 | runs: 5 | using: composite 6 | steps: 7 | - uses: extractions/setup-just@v2 8 | 9 | - uses: pnpm/action-setup@v4 10 | name: Install pnpm 11 | with: 12 | run_install: false 13 | 14 | - name: Install Node.js 15 | uses: actions/setup-node@v4 16 | with: 17 | node-version: 20 18 | cache: "pnpm" 19 | 20 | - name: Install dependencies 21 | shell: bash 22 | run: pnpm install --frozen-lockfile --ignore-scripts 23 | -------------------------------------------------------------------------------- /services/swarm-verifier/src/env.ts: -------------------------------------------------------------------------------- 1 | import { createEnv } from "@t3-oss/env-core"; 2 | import { z } from "zod"; 3 | 4 | // TODO: replace with validateEnvOrExit 5 | export const env = createEnv({ 6 | shared: { 7 | NODE_ENV: z 8 | .enum(["development", "production", "test"]) 9 | .default("development"), 10 | }, 11 | clientPrefix: "NEXT_PUBLIC_", 12 | server: { 13 | TORUS_RPC_URL: z.string().url(), 14 | PORT: z.string().default("3000"), 15 | TWITTERAPI_IO_KEY: z.string(), 16 | OPENROUTER_API_KEY: z.string(), 17 | }, 18 | client: {}, 19 | runtimeEnv: process.env, 20 | }); 21 | -------------------------------------------------------------------------------- /packages/ui/src/components/markdown-view.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { cn } from "../lib/utils"; 5 | import MarkdownPreview from "@uiw/react-markdown-preview"; 6 | 7 | interface MarkdownViewProps { 8 | className?: string; 9 | source: string; 10 | } 11 | export function MarkdownView(props: Readonly) { 12 | const { source, className } = props; 13 | return ( 14 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /tooling/typescript/app-next.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "./base.json", 4 | "compilerOptions": { 5 | "lib": ["es2022", "dom", "dom.iterable"], 6 | "jsx": "preserve", 7 | "baseUrl": ".", 8 | "paths": { 9 | "~/*": ["${configDir}/src/*"] 10 | }, 11 | "plugins": [{ "name": "next" }], 12 | "tsBuildInfoFile": "${configDir}/.cache/tsbuildinfo.json", 13 | "module": "esnext" 14 | }, 15 | "include": ["${configDir}", "${configDir}/.next/types/**/*.ts"], 16 | "exclude": ["${configDir}/node_modules", "${configDir}/.next"] 17 | } 18 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/toast/use-toast-error.tsx: -------------------------------------------------------------------------------- 1 | import { errorToString } from "@hyperlane-xyz/utils"; 2 | import { useToast } from "@torus-ts/ui/hooks/use-toast"; 3 | import { logger } from "~/utils/logger"; 4 | import { useEffect } from "react"; 5 | 6 | export function useToastError(error: unknown, errorMsg?: string) { 7 | const { toast } = useToast(); 8 | useEffect(() => { 9 | if (!error) return; 10 | const message = errorMsg ?? errorToString(error, 500); 11 | logger.error(message, error); 12 | toast({ title: "...", description: message }); 13 | }, [error, errorMsg, toast]); 14 | } 15 | -------------------------------------------------------------------------------- /apps/torus-portal/src/utils/try-catch.ts: -------------------------------------------------------------------------------- 1 | // Types for the result object with discriminated union 2 | interface Success { 3 | data: T; 4 | error: null; 5 | } 6 | 7 | interface Failure { 8 | data: null; 9 | error: E; 10 | } 11 | 12 | type Result = Success | Failure; 13 | 14 | // Main wrapper function 15 | export async function tryCatch( 16 | promise: Promise, 17 | ): Promise> { 18 | try { 19 | const data = await promise; 20 | return { data, error: null }; 21 | } catch (error) { 22 | return { data: null, error: error as E }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apps/torus-governance/src/utils/try-catch.ts: -------------------------------------------------------------------------------- 1 | // Types for the result object with discriminated union 2 | interface Success { 3 | data: T; 4 | error: null; 5 | } 6 | 7 | interface Failure { 8 | data: null; 9 | error: E; 10 | } 11 | 12 | type Result = Success | Failure; 13 | 14 | // Main wrapper function 15 | export async function tryCatch( 16 | promise: Promise, 17 | ): Promise> { 18 | try { 19 | const data = await promise; 20 | return { data, error: null }; 21 | } catch (error) { 22 | return { data: null, error: error as E }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/root-allocator/_components/allocation-sheet/components/selected-agents-label.tsx: -------------------------------------------------------------------------------- 1 | import { Label } from "@torus-ts/ui/components/label"; 2 | import { useDelegateAgentStore } from "~/stores/delegateAgentStore"; 3 | 4 | export function SelectedAgentsLabel() { 5 | const { delegatedAgents } = useDelegateAgentStore(); 6 | return ( 7 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/bridge/torus-native-simple.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /services/swarm-api/src/middleware/context.ts: -------------------------------------------------------------------------------- 1 | import { Elysia } from "elysia"; 2 | import type { AppContext } from "../context"; 3 | 4 | export const contextPlugin = (context: AppContext) => 5 | new Elysia({ name: "context" }) 6 | .decorate("db", context.db) 7 | .decorate("wsAPI", context.wsAPI) 8 | .decorate("permissionCache", context.permissionCache) 9 | .decorate("serverSignHash", context.serverSignHash) 10 | .decorate("logger", context.logger) 11 | .decorate("env", context.env) 12 | .decorate("appAgentName", context.appAgentName); 13 | 14 | export type ContextApp = ReturnType; 15 | -------------------------------------------------------------------------------- /apps/torus-portal/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import("next").NextConfig} */ 2 | const config = { 3 | reactStrictMode: true, 4 | 5 | // Disabled: React Compiler breaks tRPC proxy-based APIs 6 | // See docs/TRPC_CLIENT_PATTERN.md 7 | // reactCompiler: true, 8 | 9 | /** Enables hot reloading for local packages without a build step */ 10 | transpilePackages: [ 11 | "@torus-ts/api", 12 | "@torus-ts/db", 13 | "@torus-ts/ui", 14 | "@torus-ts/env-validation", 15 | ], 16 | 17 | /** We already do typechecking as separate task in CI */ 18 | typescript: { ignoreBuildErrors: true }, 19 | }; 20 | 21 | export default config; 22 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/balance/use-origin-balance.ts: -------------------------------------------------------------------------------- 1 | import { useAccountAddressForChain } from "@hyperlane-xyz/widgets"; 2 | import type { TransferFormValues } from "~/utils/types"; 3 | import { useTokenByIndex } from "../token"; 4 | import { useMultiProvider } from "../use-multi-provider"; 5 | import { useBalance } from "./use-balance"; 6 | 7 | export function useOriginBalance({ origin, tokenIndex }: TransferFormValues) { 8 | const multiProvider = useMultiProvider(); 9 | const address = useAccountAddressForChain(multiProvider, origin); 10 | const token = useTokenByIndex(tokenIndex); 11 | return useBalance(origin, token, address); 12 | } 13 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/_components/dao-card/components/author-info.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import type { SS58Address } from "@torus-network/sdk/types"; 4 | import { smallAddress } from "@torus-network/torus-utils/torus/address"; 5 | import { Crown } from "lucide-react"; 6 | 7 | interface AuthorInfoProps { 8 | author: SS58Address; 9 | } 10 | 11 | export function AuthorInfo({ author }: Readonly) { 12 | return ( 13 | 14 | 15 | {smallAddress(author)} 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/root-allocator/_components/allocation-sheet/components/status-label.tsx: -------------------------------------------------------------------------------- 1 | import { Label } from "@torus-ts/ui/components/label"; 2 | import { cn } from "@torus-ts/ui/lib/utils"; 3 | import { SquareCheckBig } from "lucide-react"; 4 | import type { StatusConfig } from "./get-submit-status"; 5 | 6 | export function StatusLabel({ status }: { status: StatusConfig }) { 7 | return ( 8 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/query-provider/eslint.config.js: -------------------------------------------------------------------------------- 1 | import baseConfig, { restrictEnvAccess } from "@torus-ts/eslint-config/base"; 2 | import nextjsConfig from "@torus-ts/eslint-config/nextjs"; 3 | import reactConfig from "@torus-ts/eslint-config/react"; 4 | 5 | /** @type {import('typescript-eslint').Config} */ 6 | export default [ 7 | { 8 | ignores: [".next/**"], 9 | }, 10 | ...baseConfig, 11 | ...reactConfig, 12 | ...nextjsConfig, 13 | ...restrictEnvAccess, 14 | { 15 | rules: { 16 | // Not working 17 | // https://github.com/vercel/next.js/discussions/24254 18 | "no-html-link-for-pages": "off", 19 | }, 20 | }, 21 | ]; 22 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/hooks/use-ready-multi-provider.ts: -------------------------------------------------------------------------------- 1 | // Ensures that the multiProvider has been populated during the onRehydrateStorage hook 2 | // otherwise returns undefined 3 | 4 | import { useMemo } from "react"; 5 | import { useMultiProvider } from "./use-multi-provider"; 6 | 7 | export function useReadyMultiProvider() { 8 | const multiProvider = useMultiProvider(); 9 | 10 | // Use useMemo to ensure we don't cause unnecessary re-renders 11 | return useMemo(() => { 12 | const chainNames = multiProvider.getKnownChainNames(); 13 | if (!chainNames.length) return undefined; 14 | return multiProvider; 15 | }, [multiProvider]); 16 | } 17 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/_components/portal-form-header.tsx: -------------------------------------------------------------------------------- 1 | interface PortalFormHeaderProps { 2 | title: string; 3 | description: string; 4 | extraInfo?: React.ReactNode; 5 | } 6 | export default function PortalFormHeader(props: PortalFormHeaderProps) { 7 | return ( 8 |
9 | 10 | {props.title} {props.extraInfo && {props.extraInfo}} 11 | 12 |

13 | {props.description} 14 |

15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/torus-utils/src/base-api-client/auth/api-key-auth.ts: -------------------------------------------------------------------------------- 1 | import type { AuthStrategy } from "./strategies.js"; 2 | 3 | /** 4 | * API key authentication strategy for services that use API keys in headers 5 | */ 6 | export class ApiKeyAuth implements AuthStrategy { 7 | constructor( 8 | private readonly apiKey: string, 9 | private readonly header: string = "X-API-Key", 10 | ) {} 11 | 12 | async authenticate(request: Request): Promise { 13 | request.headers.set(this.header, this.apiKey); 14 | } 15 | 16 | async isValid(): Promise { 17 | return Boolean(this.apiKey && this.apiKey.trim().length > 0); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/twitter-client/src/types.ts: -------------------------------------------------------------------------------- 1 | export interface KaitoClientConfig { 2 | apiKey: string; 3 | baseURL?: string; 4 | timeout?: number; 5 | retryConfig?: { 6 | limit?: number; 7 | methods?: string[]; 8 | statusCodes?: number[]; 9 | backoffLimit?: number; 10 | }; 11 | } 12 | 13 | export interface PaginationParams { 14 | cursor?: string; 15 | limit?: number; 16 | } 17 | 18 | export interface PaginationResponse { 19 | data: T[]; 20 | cursor?: string; 21 | hasMore?: boolean; 22 | } 23 | 24 | export interface KaitoApiResponse { 25 | data?: T; 26 | status: "success" | "error"; 27 | msg?: string; 28 | } 29 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/transfer-details/_components/get-icon-by-transfer-status.tsx: -------------------------------------------------------------------------------- 1 | import { TransferStatus } from "~/utils/types"; 2 | import { Ban, CircleCheckBig, MailCheck } from "lucide-react"; 3 | 4 | export function getIconByTransferStatus(status: TransferStatus) { 5 | switch (status) { 6 | case TransferStatus.Delivered: 7 | return ; 8 | case TransferStatus.ConfirmedTransfer: 9 | return ; 10 | case TransferStatus.Failed: 11 | return ; 12 | default: 13 | return ; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { ApiPromise, WsProvider } from "@polkadot/api"; 2 | 3 | /** 4 | * Connect to a Torus chain RPC endpoint 5 | * @param wsEndpoint - WebSocket endpoint URL 6 | * @returns Connected ApiPromise instance 7 | */ 8 | export async function connectToChainRpc( 9 | wsEndpoint: string, 10 | ): Promise { 11 | console.debug("Connecting to chain RPC endpoint:", wsEndpoint); 12 | 13 | const wsProvider = new WsProvider(wsEndpoint); 14 | const api = await ApiPromise.create({ provider: wsProvider }); 15 | 16 | if (!api.isConnected) { 17 | throw new Error("API not connected"); 18 | } 19 | 20 | return api; 21 | } 22 | -------------------------------------------------------------------------------- /tooling/eslint/react.js: -------------------------------------------------------------------------------- 1 | import reactPlugin from "eslint-plugin-react"; 2 | import hooksPlugin from "eslint-plugin-react-hooks"; 3 | 4 | /** @type {Awaited} */ 5 | export default [ 6 | { 7 | files: ["**/*.ts", "**/*.tsx"], 8 | plugins: { 9 | react: reactPlugin, 10 | "react-hooks": hooksPlugin, 11 | }, 12 | rules: { 13 | ...reactPlugin.configs["jsx-runtime"].rules, 14 | ...hooksPlugin.configs.recommended.rules, 15 | "react-hooks/preserve-manual-memoization": "off", 16 | }, 17 | languageOptions: { 18 | globals: { 19 | React: "writable", 20 | }, 21 | }, 22 | }, 23 | ]; 24 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/bridge/torus-base.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/.env.example: -------------------------------------------------------------------------------- 1 | # Environment variables for chain tests 2 | # Copy this file to .env.local and update with your values 3 | 4 | 5 | # Chain RPC URL for testing 6 | # Default: wss://api.testnet.torus.network 7 | TEST_CHAIN_RPC_URL="wss://api.testnet.torus.network" 8 | 9 | # Alternative endpoints: 10 | # TEST_CHAIN_RPC_URL="wss://api.torus.network" # Mainnet 11 | # TEST_CHAIN_RPC_URL="wss://api.testnet.torus.network" # Testnet 12 | # TEST_CHAIN_RPC_URL="ws://localhost:9944" # Local node 13 | 14 | # Note: This value is used by chain integration tests in this package. 15 | # Unit tests do not require it. Chain tests will perform real network requests. 16 | -------------------------------------------------------------------------------- /packages/env-validation/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@torus-ts/env-validation", 3 | "version": "0.0.1", 4 | "private": true, 5 | "type": "module", 6 | "exports": { 7 | ".": "./src/index.ts" 8 | }, 9 | "dependencies": { 10 | "next": "catalog:", 11 | "next-runtime-env": "^3.3.0-alpha.1", 12 | "react": "catalog:react19", 13 | "tsafe": "catalog:" 14 | }, 15 | "devDependencies": { 16 | "@torus-ts/tsconfig": "workspace:*" 17 | }, 18 | "peerDependencies": { 19 | "next": "^14 || ^15", 20 | "react": "^18 || ^19" 21 | }, 22 | "compilerOptions": { 23 | "module": "ESNext", 24 | "target": "ESNext", 25 | "esModuleInterop": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/ui/src/hooks/use-mobile.ts: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | const MOBILE_BREAKPOINT = 768; 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState( 7 | undefined, 8 | ); 9 | 10 | React.useEffect(() => { 11 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`); 12 | const onChange = () => { 13 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); 14 | }; 15 | mql.addEventListener("change", onChange); 16 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); 17 | return () => mql.removeEventListener("change", onChange); 18 | }, []); 19 | 20 | return !!isMobile; 21 | } 22 | -------------------------------------------------------------------------------- /scripts/get-metadata.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | show_usage() { 4 | echo "Usage: $0 " 1>&2 5 | } 6 | 7 | case "$1" in 8 | mainnet) 9 | node_url="https://api.torus.network" 10 | ;; 11 | testnet) 12 | node_url="https://api.testnet.torus.network" 13 | ;; 14 | local) 15 | node_url="http://localhost:9951" 16 | ;; 17 | "") 18 | show_usage 19 | exit 1 20 | ;; 21 | *) 22 | node_url="$1" 23 | ;; 24 | esac 25 | shift 1 26 | 27 | echo 1>&2 28 | echo "Getting metadata from $node_url" 1>&2 29 | echo 1>&2 30 | 31 | curl -H "Content-Type: application/json" \ 32 | -d '{"id":"1", "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' \ 33 | "$node_url" 34 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/justfile: -------------------------------------------------------------------------------- 1 | default: 2 | @just --list 3 | 4 | clean: 5 | rm -rf node_modules dist 6 | 7 | install: 8 | pnpm install 9 | 10 | check: 11 | pnpm run typecheck 12 | pnpm run lint 13 | 14 | build: 15 | pnpm run build 16 | 17 | publish: clean install check build 18 | pnpm publish 19 | 20 | gen-types net_name: 21 | pnpm exec tsx ../../node_modules/.bin/polkadot-types-from-defs --package @torus-network/sdk/interfaces --input ./src/interfaces --endpoint ../../data/metadata/{{ net_name }}.json 22 | pnpm exec tsx ../../node_modules/.bin/polkadot-types-from-chain --package @torus-network/sdk/interfaces --endpoint ../../data/metadata/{{ net_name }}.json --output ./src/interfaces 23 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/_components/react-flow-layout/react-flow-layout-types.ts: -------------------------------------------------------------------------------- 1 | import type { Edge, Node } from "@xyflow/react"; 2 | import d3Hierarchy from "./react-flow-layout-d3-algorithm"; 3 | 4 | // the layout direction (T = top, R = right, B = bottom, L = left, TB = top to bottom, ...) 5 | export type Direction = "TB" | "LR" | "RL" | "BT"; 6 | 7 | export interface LayoutAlgorithmOptions { 8 | direction: Direction; 9 | spacing: [number, number]; 10 | } 11 | 12 | export type LayoutAlgorithm = ( 13 | nodes: Node[], 14 | edges: Edge[], 15 | options: LayoutAlgorithmOptions, 16 | ) => Promise<{ nodes: Node[]; edges: Edge[] }>; 17 | 18 | export default { 19 | "d3-hierarchy": d3Hierarchy, 20 | }; 21 | -------------------------------------------------------------------------------- /apps/torus-wallet/public/wallet-info-logo.svg: -------------------------------------------------------------------------------- 1 | 8 | 18 | 23 | 24 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/substrate-parsers/address.ts: -------------------------------------------------------------------------------- 1 | import { GenericAccountId } from "@polkadot/types"; 2 | import { z } from "zod"; 3 | import { SS58_SCHEMA } from "../types/address.js"; 4 | 5 | // ==== Address ==== 6 | 7 | /** 8 | * Schema validator for Substrate `GenericAccountId` types. 9 | */ 10 | export const GenericAccountId_schema = z.custom( 11 | (val) => val instanceof GenericAccountId, 12 | "not a substrate GenericAccountId", 13 | ); 14 | 15 | /** 16 | * Parser that converts Substrate `GenericAccountId` to a branded SS58 address 17 | * string `SS58Address`. 18 | */ 19 | export const sb_address = GenericAccountId_schema.transform((val) => 20 | val.toString(), 21 | ).pipe(SS58_SCHEMA); 22 | -------------------------------------------------------------------------------- /services/swarm-twitter/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | 5 | // wait for something, checking if it's ready every interval ms, until maxTime ms have passed 6 | export const waitFor = async ( 7 | awaiter: string, 8 | resourceName: string, 9 | interval: number, 10 | maxTime: number, 11 | isReady: () => boolean, 12 | verbose: boolean, 13 | ) => { 14 | let totalTime = 0; 15 | while (totalTime < maxTime && !isReady()) { 16 | if (verbose) 17 | console.log( 18 | `${awaiter} is waiting for ${resourceName} for ${totalTime / 1000}s`, 19 | ); 20 | await sleep(interval); 21 | totalTime += interval; 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /services/swarm-verifier/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | 5 | // wait for something, checking if it's ready every interval ms, until maxTime ms have passed 6 | export const waitFor = async ( 7 | awaiter: string, 8 | resourceName: string, 9 | interval: number, 10 | maxTime: number, 11 | isReady: () => boolean, 12 | verbose: boolean, 13 | ) => { 14 | let totalTime = 0; 15 | while (totalTime < maxTime && !isReady()) { 16 | if (verbose) 17 | console.log( 18 | `${awaiter} is waiting for ${resourceName} for ${totalTime / 1000}s`, 19 | ); 20 | await sleep(interval); 21 | totalTime += interval; 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /services/torus-cache/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | 5 | // wait for something, checking if it's ready every interval ms, until maxTime ms have passed 6 | export const waitFor = async ( 7 | awaiter: string, 8 | resourceName: string, 9 | interval: number, 10 | maxTime: number, 11 | isReady: () => boolean, 12 | verbose: boolean, 13 | ) => { 14 | let totalTime = 0; 15 | while (totalTime < maxTime && !isReady()) { 16 | if (verbose) 17 | console.log( 18 | `${awaiter} is waiting for ${resourceName} for ${totalTime / 1000}s`, 19 | ); 20 | await sleep(interval); 21 | totalTime += interval; 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/permissions/create-permission/capability/_components/create-capability-flow/create-capability-flow-panels/stats-panel.tsx: -------------------------------------------------------------------------------- 1 | import { Badge } from "@torus-ts/ui/components/badge"; 2 | 3 | interface StatsPanelProps { 4 | selectedCount: number; 5 | accessibleCount: number; 6 | viewOnlyCount: number; 7 | } 8 | 9 | export function StatsPanel({ 10 | selectedCount, 11 | accessibleCount, 12 | viewOnlyCount, 13 | }: StatsPanelProps) { 14 | return ( 15 |
16 | 17 | {selectedCount} of {accessibleCount} selected 18 | 19 | {viewOnlyCount} view-only 20 |
21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /packages/torus-utils/src/torus/constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Torus token constants 3 | */ 4 | 5 | /** 6 | * Number of decimal places for TORUS token. 7 | * 1 TORUS = 10^18 Rems (smallest unit) 8 | */ 9 | export const DECIMALS = 18; 10 | 11 | /** 12 | * BigInt representation of decimal places. 13 | * Used for BigInt arithmetic operations. 14 | */ 15 | export const DECIMALS_BIG = BigInt(DECIMALS); 16 | 17 | /** 18 | * Multiplier for converting between TORUS and Rems. 19 | * Equals 10^18 or 1,000,000,000,000,000,000. 20 | * 21 | * @example 22 | * ```ts 23 | * // Convert 1 TORUS to Rems 24 | * const rems = 1n * DECIMALS_MULTIPLIER; // 1000000000000000000n 25 | * ``` 26 | */ 27 | export const DECIMALS_MULTIPLIER = 10n ** DECIMALS_BIG; 28 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/chain/common/types.ts: -------------------------------------------------------------------------------- 1 | import type { ApiPromise } from "@polkadot/api"; 2 | import type { ApiDecoration } from "@polkadot/api/types"; 3 | import { z } from "zod"; 4 | import { sb_bigint, sb_number } from "../../substrate-parsers/primitives.js"; 5 | 6 | // ==== API Types ==== 7 | 8 | export type Api = ApiDecoration<"promise"> | ApiPromise; 9 | 10 | // ==== Numbers ==== 11 | 12 | export const sb_id = sb_number.pipe(z.number().int().nonnegative()); 13 | export type Id = z.infer; 14 | 15 | export const sb_blocks = sb_number.pipe(z.number().int().nonnegative()); 16 | export type Blocks = z.infer; 17 | 18 | export const sb_balance = sb_bigint; 19 | export type Balance = z.infer; 20 | -------------------------------------------------------------------------------- /services/torus-cache/src/index.ts: -------------------------------------------------------------------------------- 1 | import { BasicLogger } from "@torus-network/torus-utils/logger"; 2 | import { tryAsync } from "@torus-network/torus-utils/try-catch"; 3 | import { updateStakeDataLoop } from "./data"; 4 | import { app, port, setup } from "./server"; 5 | 6 | const log = BasicLogger.create({ name: "torus-cache" }); 7 | 8 | async function startServer() { 9 | const setupRes = await tryAsync(setup()); 10 | const setupErrorMsg = "Failed to setup server"; 11 | if (log.ifResultIsErr(setupRes, setupErrorMsg)) process.exit(1); 12 | 13 | app.listen(port, () => { 14 | console.log(`Server is running on port ${port}`); 15 | updateStakeDataLoop().catch(console.error); 16 | }); 17 | } 18 | 19 | startServer().catch(console.error); 20 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/playground/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | 4 | export function generateMetadata() { 5 | return createSeoMetadata({ 6 | title: "Playground - Torus Portal", 7 | description: "Internal testing page.", 8 | keywords: [ 9 | "blockchain playground", 10 | "test transactions", 11 | "remark transactions", 12 | "network testing", 13 | "blockchain experiments", 14 | ], 15 | ogSiteName: "Torus Portal", 16 | canonical: "/playground", 17 | baseUrl: env("BASE_URL"), 18 | }); 19 | } 20 | 21 | export default function Layout({ children }: { children: React.ReactNode }) { 22 | return children; 23 | } 24 | -------------------------------------------------------------------------------- /packages/torus-utils/src/base-api-client/auth/bearer-auth.ts: -------------------------------------------------------------------------------- 1 | import type { AuthStrategy, TokenProvider } from "./strategies.js"; 2 | 3 | /** 4 | * Bearer token authentication strategy for services that use Bearer tokens 5 | */ 6 | export class BearerTokenAuth implements AuthStrategy { 7 | constructor(readonly tokenProvider: TokenProvider) {} 8 | 9 | async authenticate(request: Request): Promise { 10 | const token = await this.tokenProvider.getToken(); 11 | request.headers.set("Authorization", `Bearer ${token}`); 12 | } 13 | 14 | async isValid(): Promise { 15 | return await this.tokenProvider.isValid(); 16 | } 17 | 18 | async refresh(): Promise { 19 | await this.tokenProvider.refresh(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/ui/src/components/destructive-alert-with-description.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Ban } from "lucide-react"; 4 | 5 | import { 6 | Alert, 7 | AlertDescription, 8 | AlertTitle, 9 | } from "@torus-ts/ui/components/alert"; 10 | 11 | interface DestructiveAlertWithDescriptionProps { 12 | title: string; 13 | description: string; 14 | } 15 | 16 | export function DestructiveAlertWithDescription( 17 | props: DestructiveAlertWithDescriptionProps, 18 | ) { 19 | return ( 20 | 21 | 22 | {props.title} 23 | {props.description} 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /tooling/typescript/base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "skipLibCheck": true, 6 | "target": "ES2022", 7 | "lib": ["ES2022"], 8 | "allowJs": false, 9 | "resolveJsonModule": true, 10 | "moduleDetection": "force", 11 | "isolatedModules": true, 12 | "incremental": true, 13 | "disableSourceOfProjectReferenceRedirect": true, 14 | "tsBuildInfoFile": "${configDir}/.cache/tsbuildinfo.json", 15 | "strict": true, 16 | "noUncheckedIndexedAccess": true, 17 | "module": "Preserve", 18 | "moduleResolution": "Bundler", 19 | "noEmit": true 20 | }, 21 | "exclude": ["${configDir}/node_modules", "${configDir}/dist"] 22 | } 23 | -------------------------------------------------------------------------------- /apps/prediction-swarm/src/app/(pages)/(expanded-pages)/layout.tsx: -------------------------------------------------------------------------------- 1 | import { DitherBackgroundAnimation } from "~/app/_components/dither-background-animation"; 2 | import { PageNavigation } from "~/app/_components/page-navigation/page-navigation"; 3 | 4 | export default function RootLayout({ 5 | children, 6 | }: Readonly<{ 7 | children: React.ReactNode; 8 | }>) { 9 | return ( 10 | 11 | 12 | {children}{" "} 13 |
14 | 20 |
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /services/torus-worker/src/common/env.ts: -------------------------------------------------------------------------------- 1 | import type { z } from "zod"; 2 | 3 | /** 4 | * @deprecated Use `validateEnvOrExit` from `@torus-network/torus-utils/env` 5 | * instead. 6 | * 7 | * This function is deprecated in favor of `validateEnvOrExit` which 8 | * provides the same functionality with a more consistent API for object 9 | * schemas. 10 | */ 11 | export const parseEnvOrExit = 12 | (envSchema: z.ZodType) => 13 | (env: unknown): Out => { 14 | const result = envSchema.safeParse(env); 15 | 16 | if (!result.success) { 17 | console.error("❌ Invalid environment variables:"); 18 | console.error(JSON.stringify(result.error.format(), null, 2)); 19 | process.exit(1); 20 | } 21 | 22 | return result.data; 23 | }; 24 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/_components/dao-card/components/expiration-info.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { getExpirationTime } from "@torus-network/torus-utils"; 4 | import { Clock } from "lucide-react"; 5 | 6 | interface ExpirationInfoProps { 7 | expirationBlock: number; 8 | currentBlock?: number; 9 | } 10 | 11 | export function ExpirationInfo({ 12 | expirationBlock, 13 | currentBlock, 14 | }: Readonly) { 15 | return ( 16 | 17 | 18 | {currentBlock && currentBlock < expirationBlock ? "Ends" : "Ended"}{" "} 19 | {getExpirationTime(currentBlock, expirationBlock, true)} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /packages/torus-sdk-ts/src/chain/permission0/permission0.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | import { checkSS58 } from "../../types/address.js"; 3 | import { generateRootStreamId } from "./permission0-storage.js"; 4 | 5 | describe("permission0", () => { 6 | describe("generateRootStreamId", () => { 7 | it("should generate the correct root stream ID for a given agent ID", () => { 8 | const agentId = checkSS58( 9 | "5Fk3whq9Fr7yhMfXVMuokMprdPn3PMwkBDGcTG9Cc5m3GMgk", 10 | ); 11 | const expectedStreamId = 12 | "0x1b4da0b134a147e984255a535c45973a94651814b059476fb632a385fa6c02fc"; 13 | 14 | const result = generateRootStreamId(agentId); 15 | 16 | expect(result).toBe(expectedStreamId); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Temporary files 2 | /data/ 3 | /tmp/ 4 | 5 | # Git worktrees 6 | /worktrees 7 | 8 | # Local files 9 | *.local* 10 | 11 | # Git hooks 12 | /.pre-commit-config.yaml 13 | 14 | # Nix / direnv 15 | /.direnv/ 16 | 17 | # Local environment files 18 | .env 19 | .env.* 20 | !.env.example 21 | 22 | # AI assistants 23 | **/.claude/settings.local.json 24 | /.crush 25 | 26 | # Node.js / dependencies 27 | **/node_modules 28 | 29 | # LLM models 30 | **/models/ 31 | 32 | # Next.js 33 | **/.next 34 | **/.vercel/ 35 | **/out/ 36 | **/**/build 37 | **/.swc/ 38 | 39 | # Turborepo 40 | .turbo 41 | 42 | # Typescript 43 | **/dist/ 44 | **/.cache/ 45 | 46 | # OS 47 | .DS_Store 48 | 49 | **/.claude/settings.local.json 50 | *PLANS.md 51 | *TASKS.md 52 | 53 | # Crush 54 | .crush 55 | CRUSH.md 56 | -------------------------------------------------------------------------------- /apps/torus-bridge/public/assets/icons/balance/torus-native.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 9 | -------------------------------------------------------------------------------- /services/swarm-filter/prompts/check-has-prediction.toml: -------------------------------------------------------------------------------- 1 | [system] 2 | content = """ 3 | You are a fast prediction filter. Your job is to quickly determine if a tweet contains a genuine prediction worth extracting. 4 | 5 | {{validity_criteria}} 6 | 7 | Your response must be VERY FAST (< 1 second). 8 | """ 9 | 10 | [user] 11 | template = """ 12 | Does this tweet contain a genuine prediction? Be very critical. If in doubt, mark as true. 13 | 14 | 15 | Tweet text: 16 | {{tweet_text}} 17 | 18 | Context tweets (if any): 19 | {{context_tweets}} 20 | 21 | Respond with valid JSON: 22 | - has_prediction: true only if ALL criteria are met, false otherwise 23 | """ 24 | 25 | # Note: This prompt uses {{validity_criteria}} which should be injected 26 | # from shared-validity-criteria.toml by the prompt loader 27 | -------------------------------------------------------------------------------- /apps/torus-bridge/src/app/_components/transfer-token/_sections/select-chain-section.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { SwapChainsButton } from "../_components/swap-chain-button"; 4 | import { ChainSelectField } from "../../chains/chain-select-field"; 5 | 6 | export function SelectChainSection({ 7 | isReview, 8 | }: Readonly<{ isReview: boolean }>) { 9 | return ( 10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 19 |
20 |
21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /apps/torus-governance/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import("next").NextConfig} */ 2 | const config = { 3 | reactStrictMode: true, 4 | 5 | // Disabled: React Compiler breaks tRPC proxy-based APIs 6 | // See docs/TRPC_CLIENT_PATTERN.md 7 | // reactCompiler: true, 8 | 9 | /** Enables hot reloading for local packages without a build step */ 10 | transpilePackages: [ 11 | "@torus-ts/api", 12 | "@torus-ts/db", 13 | "@torus-ts/ui", 14 | "@torus-ts/env-validation", 15 | ], 16 | 17 | /** We already do typechecking as separate task in CI */ 18 | typescript: { ignoreBuildErrors: true }, 19 | 20 | /** Configure allowed image sources */ 21 | images: { 22 | remotePatterns: [{ protocol: "https", hostname: "cdn.discordapp.com" }], 23 | }, 24 | }; 25 | 26 | export default config; 27 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/signals/signal-list/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | 4 | export function generateMetadata() { 5 | return createSeoMetadata({ 6 | title: "Signal List - Torus Portal", 7 | description: 8 | "View active Signals, their status, and their associated agents.", 9 | keywords: [ 10 | "signal list", 11 | "demand signals", 12 | "network signals", 13 | "signal management", 14 | "signal status", 15 | ], 16 | ogSiteName: "Torus Portal", 17 | canonical: "/signals/signal-list", 18 | baseUrl: env("BASE_URL"), 19 | }); 20 | } 21 | 22 | export default function Layout({ children }: { children: React.ReactNode }) { 23 | return children; 24 | } 25 | -------------------------------------------------------------------------------- /packages/torus-utils/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | test: { 5 | projects: [ 6 | { 7 | extends: true, 8 | test: { 9 | name: "unit", 10 | include: ["src/**/*.test.ts"], 11 | exclude: ["src/**/__tests__/**/*.test.ts"], 12 | environment: "node", 13 | globals: true, 14 | }, 15 | }, 16 | { 17 | extends: true, 18 | test: { 19 | name: "swarm-memory", 20 | include: ["src/swarm-memory-client/__tests__/**/*.test.ts"], 21 | environment: "node", 22 | globals: true, 23 | testTimeout: 10_000, 24 | hookTimeout: 10_000, 25 | }, 26 | }, 27 | ], 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /packages/ui/src/components/content-not-found.tsx: -------------------------------------------------------------------------------- 1 | import { SearchX } from "lucide-react"; 2 | 3 | interface ContentNotFoundProps { 4 | message: string; 5 | errorNumber?: number; 6 | } 7 | 8 | export function ContentNotFound(props: Readonly) { 9 | return ( 10 |
11 |
12 | 13 | {props.errorNumber && ( 14 |

15 | {props.errorNumber} 16 |

17 | )} 18 |
19 |

{props.message}

20 |
21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/_components/cadre/candidate-card/index.tsx: -------------------------------------------------------------------------------- 1 | import { Card, CardContent } from "@torus-ts/ui/components/card"; 2 | import { Separator } from "@torus-ts/ui/components/separator"; 3 | import type { Candidate } from "~/utils/types"; 4 | import { CandidateCardHeader } from "./components/card-header"; 5 | 6 | export interface CandidateCardProps { 7 | candidate: Candidate; 8 | } 9 | 10 | export function CandidateCard(props: CandidateCardProps) { 11 | return ( 12 | 13 | 14 | 15 | 16 | 17 |

18 | {props.candidate.content} 19 |

20 |
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /services/swarm-twitter/src/index.ts: -------------------------------------------------------------------------------- 1 | import { BasicLogger } from "@torus-network/torus-utils/logger"; 2 | import { createDb } from "@torus-ts/db/client"; 3 | import { KaitoTwitterAPI } from "@torus-ts/twitter-client"; 4 | import { TwitterAccountScraper } from "./twitter-account-scraper"; 5 | 6 | export const logger = BasicLogger.create({ name: "swarm-twitter" }); 7 | 8 | if (!process.env.TWITTERAPI_IO_KEY) { 9 | console.error("missing TWITTERAPI_IO_KEY env var"); 10 | process.exit(1); 11 | } 12 | 13 | const scraper = new TwitterAccountScraper( 14 | { 15 | twitterClient: new KaitoTwitterAPI({ 16 | apiKey: process.env.TWITTERAPI_IO_KEY, 17 | }), 18 | concurrency: 8, 19 | dailyTweetLimit: 800_000, 20 | }, 21 | createDb(), 22 | ); 23 | 24 | await scraper.runScraper(() => false); 25 | -------------------------------------------------------------------------------- /packages/db/drizzle/0006_living_raider.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "user_discord_info" ( 2 | "id" serial PRIMARY KEY NOT NULL, 3 | "discord_id" varchar(20) NOT NULL, 4 | "user_name" text NOT NULL, 5 | "avatar_url" text, 6 | "created_at" timestamp with time zone DEFAULT now() NOT NULL, 7 | "updated_at" timestamp with time zone DEFAULT now() NOT NULL, 8 | "deleted_at" timestamp with time zone DEFAULT null, 9 | CONSTRAINT "user_discord_info_discord_id_unique" UNIQUE("discord_id"), 10 | CONSTRAINT "discord_id_check" CHECK (LENGTH("user_discord_info"."discord_id") BETWEEN 17 AND 20 ) 11 | ); 12 | --> statement-breakpoint 13 | ALTER TABLE "cadre_candidate" ADD CONSTRAINT "cadre_candidate_discord_id_unique" UNIQUE("discord_id");--> statement-breakpoint 14 | ALTER TABLE "cadre" ADD CONSTRAINT "cadre_discord_id_unique" UNIQUE("discord_id"); -------------------------------------------------------------------------------- /packages/torus-utils/src/collections.ts: -------------------------------------------------------------------------------- 1 | import { assert } from "tsafe"; 2 | 3 | // ==== Map ==== 4 | 5 | export function getOrSetDefault( 6 | map: Map, 7 | key: K, 8 | defaultValueFn: () => V, 9 | ): V { 10 | if (!map.has(key)) { 11 | const val = defaultValueFn(); 12 | map.set(key, val); 13 | return val; 14 | } 15 | const val = map.get(key); 16 | assert(val !== undefined, "Map should have value for key"); 17 | return val; 18 | } 19 | 20 | export function extractFromMap(map: Map, keys: K[]) { 21 | const permsMap = new Map(); 22 | for (const id of keys) { 23 | const perm = map.get(id); 24 | if (perm === undefined) { 25 | throw new Error(`Key not found: ${String(id)}`); 26 | } 27 | permsMap.set(id, perm); 28 | } 29 | return permsMap; 30 | } 31 | -------------------------------------------------------------------------------- /packages/ui/src/components/apr-bar/apr-bar-base.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | interface APRBarBaseProps { 4 | children: React.ReactNode; 5 | } 6 | 7 | export function APRBarBase({ children }: APRBarBaseProps) { 8 | return ( 9 |
10 |
11 |
12 |
13 |
14 |
15 | {children} 16 |
17 |
18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/portal/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | import type { ReactNode } from "react"; 4 | 5 | export function generateMetadata() { 6 | return createSeoMetadata({ 7 | title: "Torus Portal", 8 | description: 9 | "Manage network permissions, agent allocations, and explore the hypergraph.", 10 | keywords: [ 11 | "torus portal", 12 | "permission management", 13 | "agent allocation", 14 | "network governance", 15 | "web3 platform", 16 | ], 17 | ogSiteName: "Torus Portal", 18 | canonical: "/", 19 | baseUrl: env("BASE_URL"), 20 | }); 21 | } 22 | 23 | export default function PortalLayout({ children }: { children: ReactNode }) { 24 | return <>{children}; 25 | } 26 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/root-allocator/(main-page)/allocated-agents/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | 4 | export function generateMetadata() { 5 | return createSeoMetadata({ 6 | title: "Allocated Agents - Torus Portal", 7 | description: "View agents you have allocated weights.", 8 | keywords: [ 9 | "allocated agents", 10 | "agent allocations", 11 | "weight distribution", 12 | "allocation management", 13 | "delegated agents", 14 | ], 15 | ogSiteName: "Torus Portal", 16 | canonical: "/root-allocator/allocated-agents", 17 | baseUrl: env("BASE_URL"), 18 | }); 19 | } 20 | 21 | export default function Layout({ children }: { children: React.ReactNode }) { 22 | return children; 23 | } 24 | -------------------------------------------------------------------------------- /atlas/migrations/webapps/20251001165829_worker-lastblock.sql: -------------------------------------------------------------------------------- 1 | -- Create enum type "worker_name" 2 | CREATE TYPE "public"."worker_name" AS ENUM ('agent-fetcher', 'dao-notifier', 'process-dao', 'weight-aggregator', 'transfer-watcher'); 3 | -- Create "worker_state" table 4 | CREATE TABLE "public"."worker_state" ( 5 | "id" serial NOT NULL, 6 | "worker_name" "public"."worker_name" NOT NULL, 7 | "last_processed_block" bigint NOT NULL, 8 | "created_at" timestamptz NOT NULL DEFAULT now(), 9 | "updated_at" timestamptz NOT NULL DEFAULT now(), 10 | "deleted_at" timestamptz NULL, 11 | PRIMARY KEY ("id"), 12 | CONSTRAINT "worker_state_worker_name_unique" UNIQUE ("worker_name") 13 | ); 14 | -- Create index "worker_name_index" to table: "worker_state" 15 | CREATE INDEX "worker_name_index" ON "public"."worker_state" ("worker_name"); 16 | -------------------------------------------------------------------------------- /examples/example-client/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; 4 | flake-utils.url = "github:numtide/flake-utils"; 5 | }; 6 | 7 | outputs = { self, nixpkgs, flake-utils }: 8 | flake-utils.lib.eachDefaultSystem (system: 9 | let 10 | pkgs = nixpkgs.legacyPackages.${system}; 11 | # lib = pkgs.lib; 12 | 13 | buildInputs = [ 14 | # Node.js 15 | pkgs.nodejs_22 16 | ]; 17 | shellPkgs = [ 18 | # Run project-specific commands 19 | pkgs.just 20 | # Run Github actions locally 21 | pkgs.act 22 | ]; 23 | in 24 | { 25 | devShell = pkgs.mkShell { 26 | inherit buildInputs; 27 | packages = shellPkgs; 28 | }; 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/_components/react-flow-layout/react-flow-layout-utils.ts: -------------------------------------------------------------------------------- 1 | import { Position } from "@xyflow/react"; 2 | import type { Direction } from "./react-flow-layout-types"; 3 | 4 | export function getSourceHandlePosition(direction: Direction) { 5 | switch (direction) { 6 | case "TB": 7 | return Position.Bottom; 8 | case "BT": 9 | return Position.Top; 10 | case "LR": 11 | return Position.Right; 12 | case "RL": 13 | return Position.Left; 14 | } 15 | } 16 | 17 | export function getTargetHandlePosition(direction: Direction) { 18 | switch (direction) { 19 | case "TB": 20 | return Position.Top; 21 | case "BT": 22 | return Position.Bottom; 23 | case "LR": 24 | return Position.Left; 25 | case "RL": 26 | return Position.Right; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/_components/sidebar/conditional-sidebar.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { usePathname } from "next/navigation"; 4 | import type { ReactNode } from "react"; 5 | import SidebarContainer from "./sidebar-container"; 6 | 7 | /** 8 | * Conditionally renders the SidebarContainer based on the current route. 9 | * The sidebar appears on all pages EXCEPT the landing page ("/"). 10 | */ 11 | export function ConditionalSidebar({ children }: { children: ReactNode }) { 12 | const pathname = usePathname(); 13 | 14 | // Landing page doesn't use the standard sidebar 15 | // It has its own custom sidebar implementation 16 | const isLandingPage = pathname === "/"; 17 | 18 | if (isLandingPage) { 19 | return <>{children}; 20 | } 21 | 22 | return {children}; 23 | } 24 | -------------------------------------------------------------------------------- /apps/torus-wallet/src/app/_components/apr-bar/apr-bar-base.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | interface APRBarBaseProps { 4 | children: React.ReactNode; 5 | } 6 | 7 | export function APRBarBase({ children }: APRBarBaseProps) { 8 | return ( 9 |
10 |
11 |
12 |
13 |
14 |
15 | {children} 16 |
17 |
18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/(pages)/dao-dashboard/_components/agent-health-tab/agent-health-tab.tsx: -------------------------------------------------------------------------------- 1 | import { FilterContent } from "~/app/_components/filter-content"; 2 | import { PageContainer } from "~/app/_components/page-container"; 3 | import { AgentHealthList } from "./_components/agent-health-list"; 4 | 5 | export default function AgentHealthTab() { 6 | return ( 7 | 18 | } 19 | pageContent={} 20 | /> 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/portal/2d-hypergraph/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | 4 | export function generateMetadata() { 5 | return createSeoMetadata({ 6 | title: "2D Hypergraph - Torus Portal", 7 | description: "Network 2D visualization with advanced graph features.", 8 | keywords: [ 9 | "2d hypergraph", 10 | "network visualization", 11 | "permission graph", 12 | "interactive graph", 13 | "hypergraph visualization", 14 | "network exploration", 15 | ], 16 | ogSiteName: "Torus Portal", 17 | canonical: "portal/2d-hypergraph", 18 | baseUrl: env("BASE_URL"), 19 | }); 20 | } 21 | 22 | export default function Layout({ children }: { children: React.ReactNode }) { 23 | return children; 24 | } 25 | -------------------------------------------------------------------------------- /packages/ui/src/components/header.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { cn } from "../lib/utils"; 3 | import { Icons } from "./icons"; 4 | import Link from "next/link"; 5 | 6 | interface HeaderProps { 7 | appName: string; 8 | className?: string; 9 | wallet?: React.ReactNode; 10 | } 11 | 12 | export function Header(props: Readonly) { 13 | return ( 14 |
20 | 21 | 22 | {props.appName} 23 | 24 | 25 | {props.wallet} 26 |
27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /services/swarm-api/src/index.ts: -------------------------------------------------------------------------------- 1 | import { BasicLogger } from "@torus-network/torus-utils/logger"; 2 | import { getEnv } from "./env"; 3 | import { createServer } from "./server"; 4 | 5 | const logger = BasicLogger.create({ name: "swarm-api" }); 6 | 7 | async function main() { 8 | const env = getEnv(process.env); 9 | const app = await createServer(); 10 | app.listen( 11 | { 12 | port: env.PORT, 13 | hostname: "0.0.0.0", 14 | }, 15 | () => { 16 | logger.info(`Prediction Swarm API listening on 0.0.0.0:${env.PORT}`); 17 | logger.info(`Health check: http://localhost:${env.PORT}/health`); 18 | logger.info(`OpenAPI docs: http://localhost:${env.PORT}/openapi`); 19 | }, 20 | ); 21 | } 22 | 23 | main().catch((error) => { 24 | logger.error("Failed to start server:", error); 25 | process.exit(1); 26 | }); 27 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/portal/_components/force-graph/use-graph-interactions.ts: -------------------------------------------------------------------------------- 1 | import type { NodeObject } from "r3f-forcegraph"; 2 | import { useCallback } from "react"; 3 | import type { 4 | CustomGraphLink, 5 | CustomGraphNode, 6 | } from "../permission-graph-types"; 7 | 8 | export function useGraphInteractions( 9 | graphData: { nodes: CustomGraphNode[]; links: CustomGraphLink[] }, 10 | onNodeClick: (node: CustomGraphNode) => void, 11 | _selectedNodeId?: string | null, 12 | ) { 13 | const handleNodeClick = useCallback( 14 | (node: NodeObject) => { 15 | const originalNode = graphData.nodes.find((n) => n.id === node.id); 16 | if (originalNode) { 17 | onNodeClick(originalNode); 18 | } 19 | }, 20 | [graphData, onNodeClick], 21 | ); 22 | 23 | return { 24 | handleNodeClick, 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /services/swarm-twitter/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import path from "node:path"; 2 | import { defineConfig } from "vitest/config"; 3 | 4 | export default defineConfig({ 5 | resolve: { 6 | alias: { 7 | "@": path.resolve(__dirname, "./src"), 8 | }, 9 | }, 10 | test: { 11 | projects: [ 12 | { 13 | extends: true, 14 | test: { 15 | name: "twitterapi", 16 | include: ["src/twitterapi-io/__tests__/**/*.test.ts"], 17 | environment: "node", 18 | globals: true, 19 | testTimeout: 30_000, 20 | hookTimeout: 30_000, 21 | pool: "threads", 22 | maxConcurrency: 5, 23 | poolOptions: { 24 | threads: { 25 | singleThread: false, 26 | }, 27 | }, 28 | }, 29 | }, 30 | ], 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /apps/torus-governance/src/app/(pages)/dao-dashboard/layout.tsx: -------------------------------------------------------------------------------- 1 | import { createSeoMetadata } from "@torus-ts/ui/components/seo"; 2 | import { env } from "~/env"; 3 | 4 | export function generateMetadata() { 5 | return createSeoMetadata({ 6 | title: "DAO Dashboard - Torus Governance", 7 | description: 8 | "Monitor DAO operations, agent health, and root agent applications.", 9 | keywords: [ 10 | "dao dashboard", 11 | "agent health", 12 | "dao applications", 13 | "governance monitoring", 14 | "network status", 15 | ], 16 | ogSiteName: "Torus Governance", 17 | canonical: "/dao-dashboard", 18 | baseUrl: env("BASE_URL"), 19 | }); 20 | } 21 | 22 | export default function DaoDashboardLayout({ 23 | children, 24 | }: { 25 | children: React.ReactNode; 26 | }) { 27 | return <>{children}; 28 | } 29 | -------------------------------------------------------------------------------- /apps/torus-portal/src/app/(pages)/root-allocator/_components/page-layout.tsx: -------------------------------------------------------------------------------- 1 | import type { ReactNode } from "react"; 2 | import type { AgentView } from "./agent-view-toggle"; 3 | import { AgentViewToggle } from "./agent-view-toggle"; 4 | import { Filter } from "./filter-content"; 5 | 6 | interface PageLayoutProps { 7 | search: string | null; 8 | currentView: AgentView; 9 | children: ReactNode; 10 | } 11 | 12 | export function PageLayout({ search, currentView, children }: PageLayoutProps) { 13 | return ( 14 |
15 |
16 | 17 | 18 |
19 | {children} 20 |
21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /packages/ui/src/components/text-area.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "../lib/utils"; 2 | import * as React from "react"; 3 | 4 | export type TextareaProps = React.TextareaHTMLAttributes; 5 | 6 | const Textarea = React.forwardRef( 7 | ({ className, ...props }, ref) => { 8 | return ( 9 |