@jinn-network/client 0.1.1 → 0.1.2-canary.6237288d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/CONTRIBUTING.md +123 -0
- package/README.md +213 -37
- package/deployments/deployment-claim-registry-baseSepolia.json +13 -0
- package/deployments/deployment-jinn-testnet-faucet-baseSepolia-fast.json +15 -0
- package/dist/adapters/adapter.d.ts +7 -0
- package/dist/adapters/claim-registry/abi.d.ts +127 -0
- package/dist/adapters/claim-registry/abi.js +93 -0
- package/dist/adapters/claim-registry/abi.js.map +1 -0
- package/dist/adapters/claim-registry/client.d.ts +89 -0
- package/dist/adapters/claim-registry/client.js +205 -0
- package/dist/adapters/claim-registry/client.js.map +1 -0
- package/dist/adapters/mech/adapter.d.ts +5 -0
- package/dist/adapters/mech/adapter.js +211 -56
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +19 -1
- package/dist/adapters/mech/contracts.js +112 -8
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/ipfs.d.ts +38 -5
- package/dist/adapters/mech/ipfs.js +174 -17
- package/dist/adapters/mech/ipfs.js.map +1 -1
- package/dist/adapters/mech/safe.js +8 -6
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +22 -46
- package/dist/adapters/mech/types.js +16 -35
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/api/balance-build.js +3 -3
- package/dist/api/balance-build.js.map +1 -1
- package/dist/api/fleet-build.js +35 -40
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.d.ts +6 -0
- package/dist/api/gather-status.js +187 -4
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/history-build.d.ts +5 -1
- package/dist/api/history-build.js +51 -26
- package/dist/api/history-build.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +83 -0
- package/dist/api/portfolio-v0-build.js +143 -0
- package/dist/api/portfolio-v0-build.js.map +1 -0
- package/dist/api/portfolio-v0-doctor.d.ts +37 -0
- package/dist/api/portfolio-v0-doctor.js +123 -0
- package/dist/api/portfolio-v0-doctor.js.map +1 -0
- package/dist/api/rewards-build.js +30 -14
- package/dist/api/rewards-build.js.map +1 -1
- package/dist/api/status-build.d.ts +39 -6
- package/dist/api/status-build.js +3 -1
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/status-rollup-build.d.ts +2 -0
- package/dist/api/status-rollup-build.js +30 -3
- package/dist/api/status-rollup-build.js.map +1 -1
- package/dist/bin/jinn-mcp.d.ts +0 -12
- package/dist/bin/jinn-mcp.js +5 -14
- package/dist/bin/jinn-mcp.js.map +1 -1
- package/dist/build-meta.json +1 -1
- package/dist/cli/commands/auth.js +137 -25
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/balance.js +8 -1
- package/dist/cli/commands/balance.js.map +1 -1
- package/dist/cli/commands/bootstrap.js +23 -0
- package/dist/cli/commands/bootstrap.js.map +1 -1
- package/dist/cli/commands/doctor.js +160 -14
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/fleet-scale.js +1 -0
- package/dist/cli/commands/fleet-scale.js.map +1 -1
- package/dist/cli/commands/fleet.js +10 -1
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/fund-requirements.js +2 -0
- package/dist/cli/commands/fund-requirements.js.map +1 -1
- package/dist/cli/commands/history.js +25 -6
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/intents.d.ts +17 -0
- package/dist/cli/commands/intents.js +489 -0
- package/dist/cli/commands/intents.js.map +1 -0
- package/dist/cli/commands/keys-backup.js +13 -11
- package/dist/cli/commands/keys-backup.js.map +1 -1
- package/dist/cli/commands/logs.js +35 -11
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts +3 -0
- package/dist/cli/commands/mcp.js +19 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/plugin-install.js +8 -4
- package/dist/cli/commands/plugin-install.js.map +1 -1
- package/dist/cli/commands/quickstart.js +99 -5
- package/dist/cli/commands/quickstart.js.map +1 -1
- package/dist/cli/commands/rewards.js +27 -1
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/run.js +38 -0
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/status.js +11 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/submit-intent.js +110 -44
- package/dist/cli/commands/submit-intent.js.map +1 -1
- package/dist/cli/commands/version.js +1 -0
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/deployment-digest.js +5 -0
- package/dist/cli/deployment-digest.js.map +1 -1
- package/dist/cli/execution-context.js +1 -0
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/intent-registry-access.d.ts +62 -0
- package/dist/cli/intent-registry-access.js +165 -0
- package/dist/cli/intent-registry-access.js.map +1 -0
- package/dist/cli/introspection-context.js +12 -8
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/password.d.ts +21 -9
- package/dist/cli/password.js +45 -24
- package/dist/cli/password.js.map +1 -1
- package/dist/config.d.ts +137 -8
- package/dist/config.js +70 -12
- package/dist/config.js.map +1 -1
- package/dist/daemon/balance-topup-loop.js +32 -4
- package/dist/daemon/balance-topup-loop.js.map +1 -1
- package/dist/daemon/creator.d.ts +7 -4
- package/dist/daemon/creator.js +55 -26
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +35 -3
- package/dist/daemon/daemon.js +99 -7
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/delivery-watcher.d.ts +3 -1
- package/dist/daemon/delivery-watcher.js +19 -1
- package/dist/daemon/delivery-watcher.js.map +1 -1
- package/dist/daemon/reward-claim-loop.js +38 -1
- package/dist/daemon/reward-claim-loop.js.map +1 -1
- package/dist/dashboard/index.html +71 -496
- package/dist/discovery/registry.d.ts +54 -0
- package/dist/discovery/registry.js +73 -0
- package/dist/discovery/registry.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +2 -1
- package/dist/earning/bootstrap.js +71 -33
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +10 -0
- package/dist/earning/contracts.js +24 -0
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +9 -0
- package/dist/earning/jinn-rewards.js +7 -0
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/earning/stolas-claim.d.ts +6 -0
- package/dist/earning/stolas-claim.js +7 -0
- package/dist/earning/stolas-claim.js.map +1 -1
- package/dist/intents/kinds/constants.d.ts +5 -0
- package/dist/intents/kinds/constants.js +6 -0
- package/dist/intents/kinds/constants.js.map +1 -0
- package/dist/intents/kinds/index.d.ts +28 -0
- package/dist/intents/kinds/index.js +50 -0
- package/dist/intents/kinds/index.js.map +1 -0
- package/dist/intents/kinds/portfolio-v0.d.ts +2 -0
- package/dist/intents/kinds/portfolio-v0.js +13 -0
- package/dist/intents/kinds/portfolio-v0.js.map +1 -0
- package/dist/intents/kinds/prediction-apy-v0.d.ts +3 -0
- package/dist/intents/kinds/prediction-apy-v0.js +21 -0
- package/dist/intents/kinds/prediction-apy-v0.js.map +1 -0
- package/dist/intents/kinds/prediction-v0.d.ts +3 -0
- package/dist/intents/kinds/prediction-v0.js +32 -0
- package/dist/intents/kinds/prediction-v0.js.map +1 -0
- package/dist/intents/kinds/spec-kind.d.ts +38 -0
- package/dist/intents/kinds/spec-kind.js +6 -0
- package/dist/intents/kinds/spec-kind.js.map +1 -0
- package/dist/intents/posting-service.d.ts +26 -0
- package/dist/intents/posting-service.js +218 -0
- package/dist/intents/posting-service.js.map +1 -0
- package/dist/intents/prediction-apy-v0-auto.d.ts +11 -0
- package/dist/intents/prediction-apy-v0-auto.js +46 -0
- package/dist/intents/prediction-apy-v0-auto.js.map +1 -0
- package/dist/intents/prediction-apy-v0-template.d.ts +8 -0
- package/dist/intents/prediction-apy-v0-template.js +22 -0
- package/dist/intents/prediction-apy-v0-template.js.map +1 -0
- package/dist/intents/prediction-v0-auto.d.ts +53 -0
- package/dist/intents/prediction-v0-auto.js +84 -0
- package/dist/intents/prediction-v0-auto.js.map +1 -0
- package/dist/intents/prediction-v0-template.d.ts +70 -0
- package/dist/intents/prediction-v0-template.js +145 -0
- package/dist/intents/prediction-v0-template.js.map +1 -0
- package/dist/intents/sources.d.ts +39 -0
- package/dist/intents/sources.js +42 -0
- package/dist/intents/sources.js.map +1 -0
- package/dist/main.js +175 -3
- package/dist/main.js.map +1 -1
- package/dist/mcp/operator-server.d.ts +1 -1
- package/dist/mcp/operator-server.js +1 -1
- package/dist/mcp/server.js +8 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/observability/emit-event.d.ts +12 -0
- package/dist/observability/emit-event.js +27 -0
- package/dist/observability/emit-event.js.map +1 -0
- package/dist/preflight/api-port.d.ts +13 -0
- package/dist/preflight/api-port.js +32 -0
- package/dist/preflight/api-port.js.map +1 -0
- package/dist/preflight/claude-auth.d.ts +12 -1
- package/dist/preflight/claude-auth.js +21 -3
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/preflight/rpc-network.d.ts +44 -0
- package/dist/preflight/rpc-network.js +121 -0
- package/dist/preflight/rpc-network.js.map +1 -0
- package/dist/restorer/engine/canonical-json.d.ts +18 -0
- package/dist/restorer/engine/canonical-json.js +59 -0
- package/dist/restorer/engine/canonical-json.js.map +1 -0
- package/dist/restorer/engine/claim.d.ts +69 -0
- package/dist/restorer/engine/claim.js +104 -0
- package/dist/restorer/engine/claim.js.map +1 -0
- package/dist/restorer/engine/delivery.d.ts +52 -0
- package/dist/restorer/engine/delivery.js +63 -0
- package/dist/restorer/engine/delivery.js.map +1 -0
- package/dist/restorer/engine/engine.d.ts +213 -0
- package/dist/restorer/engine/engine.js +769 -0
- package/dist/restorer/engine/engine.js.map +1 -0
- package/dist/restorer/engine/manifest-assembly.d.ts +67 -0
- package/dist/restorer/engine/manifest-assembly.js +79 -0
- package/dist/restorer/engine/manifest-assembly.js.map +1 -0
- package/dist/restorer/engine/packaging.d.ts +87 -0
- package/dist/restorer/engine/packaging.js +350 -0
- package/dist/restorer/engine/packaging.js.map +1 -0
- package/dist/restorer/engine/persistence.d.ts +170 -0
- package/dist/restorer/engine/persistence.js +381 -0
- package/dist/restorer/engine/persistence.js.map +1 -0
- package/dist/restorer/engine/recovery.d.ts +22 -0
- package/dist/restorer/engine/recovery.js +24 -0
- package/dist/restorer/engine/recovery.js.map +1 -0
- package/dist/restorer/engine/registry.d.ts +62 -0
- package/dist/restorer/engine/registry.js +73 -0
- package/dist/restorer/engine/registry.js.map +1 -0
- package/dist/restorer/engine/signing.d.ts +30 -0
- package/dist/restorer/engine/signing.js +39 -0
- package/dist/restorer/engine/signing.js.map +1 -0
- package/dist/restorer/engine/state.d.ts +42 -0
- package/dist/restorer/engine/state.js +87 -0
- package/dist/restorer/engine/state.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.d.ts +64 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js +96 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.d.ts +104 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js +721 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.d.ts +137 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js +865 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.d.ts +74 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js +74 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +97 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js +226 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.d.ts +44 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.js +239 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.d.ts +38 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js +135 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.d.ts +8 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js +54 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.d.ts +36 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js +137 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.d.ts +84 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.js +6 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.d.ts +34 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js +233 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.d.ts +18 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js +136 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.d.ts +7 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js +46 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +27 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js +128 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.d.ts +64 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.js +6 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.js.map +1 -0
- package/dist/restorer/impls/evaluation-context.d.ts +16 -0
- package/dist/restorer/impls/evaluation-context.js +18 -0
- package/dist/restorer/impls/evaluation-context.js.map +1 -0
- package/dist/restorer/impls/index.d.ts +46 -0
- package/dist/restorer/impls/index.js +88 -0
- package/dist/restorer/impls/index.js.map +1 -0
- package/dist/restorer/impls/legacy-claude/index.d.ts +52 -0
- package/dist/restorer/impls/legacy-claude/index.js +140 -0
- package/dist/restorer/impls/legacy-claude/index.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +68 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js +117 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.d.ts +49 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js +91 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.d.ts +78 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js +274 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +23 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js +49 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.d.ts +25 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js +44 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.d.ts +17 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js +43 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.d.ts +44 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js +440 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.d.ts +21 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js +32 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.d.ts +34 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js +8 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.d.ts +40 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js +107 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.d.ts +2 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js +7 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.d.ts +4 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.js +2 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +6 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js +11 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.d.ts +42 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js +208 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +7 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js +29 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.d.ts +9 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js +20 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js +2 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.d.ts +31 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.js +100 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.d.ts +8 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js +41 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.js +2 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.d.ts +20 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js +66 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.d.ts +9 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js +23 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.d.ts +3 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js +13 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.d.ts +13 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js +111 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.d.ts +5 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js +20 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.d.ts +36 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.js +234 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.d.ts +8 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.js +15 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.js +2 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/types.d.ts +194 -0
- package/dist/restorer/types.js +28 -0
- package/dist/restorer/types.js.map +1 -0
- package/dist/rpc-error-context.d.ts +10 -0
- package/dist/rpc-error-context.js +26 -0
- package/dist/rpc-error-context.js.map +1 -0
- package/dist/store/store.d.ts +101 -1
- package/dist/store/store.js +334 -4
- package/dist/store/store.js.map +1 -1
- package/dist/trajectory/schema.d.ts +510 -0
- package/dist/trajectory/schema.js +74 -0
- package/dist/trajectory/schema.js.map +1 -0
- package/dist/types/desired-state.d.ts +53 -0
- package/dist/types/desired-state.js +20 -0
- package/dist/types/desired-state.js.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.js +4 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/portfolio.d.ts +1000 -0
- package/dist/types/portfolio.js +168 -0
- package/dist/types/portfolio.js.map +1 -0
- package/dist/types/prediction-apy.d.ts +930 -0
- package/dist/types/prediction-apy.js +133 -0
- package/dist/types/prediction-apy.js.map +1 -0
- package/dist/types/prediction.d.ts +926 -0
- package/dist/types/prediction.js +141 -0
- package/dist/types/prediction.js.map +1 -0
- package/dist/venues/aave-v3/addresses.d.ts +6 -0
- package/dist/venues/aave-v3/addresses.js +19 -0
- package/dist/venues/aave-v3/addresses.js.map +1 -0
- package/dist/venues/aave-v3/client.d.ts +85 -0
- package/dist/venues/aave-v3/client.js +106 -0
- package/dist/venues/aave-v3/client.js.map +1 -0
- package/dist/venues/chainlink/client.d.ts +99 -0
- package/dist/venues/chainlink/client.js +130 -0
- package/dist/venues/chainlink/client.js.map +1 -0
- package/dist/venues/chainlink/feeds.d.ts +8 -0
- package/dist/venues/chainlink/feeds.js +9 -0
- package/dist/venues/chainlink/feeds.js.map +1 -0
- package/dist/venues/hyperliquid/account-value.d.ts +30 -0
- package/dist/venues/hyperliquid/account-value.js +30 -0
- package/dist/venues/hyperliquid/account-value.js.map +1 -0
- package/dist/venues/hyperliquid/client.d.ts +63 -0
- package/dist/venues/hyperliquid/client.js +135 -0
- package/dist/venues/hyperliquid/client.js.map +1 -0
- package/dist/venues/hyperliquid/grid.d.ts +36 -0
- package/dist/venues/hyperliquid/grid.js +61 -0
- package/dist/venues/hyperliquid/grid.js.map +1 -0
- package/dist/venues/hyperliquid/types.d.ts +81 -0
- package/dist/venues/hyperliquid/types.js +8 -0
- package/dist/venues/hyperliquid/types.js.map +1 -0
- package/dist/withdraw/run-withdraw-plan.js +2 -0
- package/dist/withdraw/run-withdraw-plan.js.map +1 -1
- package/docker-compose.yml +44 -0
- package/package.json +15 -3
- package/skills/jinn-operator/SKILL.md +85 -0
- package/dist/daemon/restorer.d.ts +0 -19
- package/dist/daemon/restorer.js +0 -82
- package/dist/daemon/restorer.js.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed ABI fragments for ClaimRegistry.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Solidity interface in contracts/src/claiming/ClaimRegistry.sol.
|
|
5
|
+
* Use these instead of the inline fragment in adapters/mech/types.ts when
|
|
6
|
+
* constructing a ClaimRegistryClient — they include the full event set.
|
|
7
|
+
*/
|
|
8
|
+
export const CLAIM_REGISTRY_ABI = [
|
|
9
|
+
// ── Write functions ──────────────────────────────────────────────────────────
|
|
10
|
+
{
|
|
11
|
+
name: 'claimJob',
|
|
12
|
+
type: 'function',
|
|
13
|
+
stateMutability: 'nonpayable',
|
|
14
|
+
inputs: [{ name: 'requestId', type: 'bytes32' }],
|
|
15
|
+
outputs: [],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'releaseClaim',
|
|
19
|
+
type: 'function',
|
|
20
|
+
stateMutability: 'nonpayable',
|
|
21
|
+
inputs: [{ name: 'requestId', type: 'bytes32' }],
|
|
22
|
+
outputs: [],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'expireClaim',
|
|
26
|
+
type: 'function',
|
|
27
|
+
stateMutability: 'nonpayable',
|
|
28
|
+
inputs: [{ name: 'requestId', type: 'bytes32' }],
|
|
29
|
+
outputs: [],
|
|
30
|
+
},
|
|
31
|
+
// ── Read functions ───────────────────────────────────────────────────────────
|
|
32
|
+
{
|
|
33
|
+
name: 'getJobClaim',
|
|
34
|
+
type: 'function',
|
|
35
|
+
stateMutability: 'view',
|
|
36
|
+
inputs: [{ name: 'requestId', type: 'bytes32' }],
|
|
37
|
+
outputs: [
|
|
38
|
+
{ name: 'claimer', type: 'address' },
|
|
39
|
+
{ name: 'expiresAt', type: 'uint256' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'claims',
|
|
44
|
+
type: 'function',
|
|
45
|
+
stateMutability: 'view',
|
|
46
|
+
inputs: [{ name: '', type: 'bytes32' }],
|
|
47
|
+
outputs: [
|
|
48
|
+
{ name: 'claimer', type: 'address' },
|
|
49
|
+
{ name: 'expiresAt', type: 'uint256' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'claimTTL',
|
|
54
|
+
type: 'function',
|
|
55
|
+
stateMutability: 'view',
|
|
56
|
+
inputs: [],
|
|
57
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'expiredClaimCount',
|
|
61
|
+
type: 'function',
|
|
62
|
+
stateMutability: 'view',
|
|
63
|
+
inputs: [{ name: '', type: 'address' }],
|
|
64
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
65
|
+
},
|
|
66
|
+
// ── Events ───────────────────────────────────────────────────────────────────
|
|
67
|
+
{
|
|
68
|
+
name: 'JobClaimed',
|
|
69
|
+
type: 'event',
|
|
70
|
+
inputs: [
|
|
71
|
+
{ name: 'requestId', type: 'bytes32', indexed: true },
|
|
72
|
+
{ name: 'claimer', type: 'address', indexed: true },
|
|
73
|
+
{ name: 'expiresAt', type: 'uint256', indexed: false },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'ClaimExpired',
|
|
78
|
+
type: 'event',
|
|
79
|
+
inputs: [
|
|
80
|
+
{ name: 'requestId', type: 'bytes32', indexed: true },
|
|
81
|
+
{ name: 'previousClaimer', type: 'address', indexed: true },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'ClaimReleased',
|
|
86
|
+
type: 'event',
|
|
87
|
+
inputs: [
|
|
88
|
+
{ name: 'requestId', type: 'bytes32', indexed: true },
|
|
89
|
+
{ name: 'claimer', type: 'address', indexed: true },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
//# sourceMappingURL=abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../../../src/adapters/claim-registry/abi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gFAAgF;IAEhF;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAChD,OAAO,EAAE,EAAE;KACZ;IACD;QACE,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAChD,OAAO,EAAE,EAAE;KACZ;IACD;QACE,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAChD,OAAO,EAAE,EAAE;KACZ;IAED,gFAAgF;IAEhF;QACE,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAChD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;SACvC;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAA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AAE,IAAI,EAAE;SAC5D;KACF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;YACrD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;SACpD;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClaimRegistryClient — typed wrapper for the ClaimRegistry contract.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the read/write surfaces of ClaimRegistry with proper types and
|
|
5
|
+
* idiomatic async interfaces.
|
|
6
|
+
*
|
|
7
|
+
* Write operations (claimJob, releaseClaim) go through the Safe multisig via
|
|
8
|
+
* executeSafeTransaction. This is required so that the on-chain claimer address
|
|
9
|
+
* matches the Safe — our canonical OLAS/staking identity. Using the raw EOA
|
|
10
|
+
* would cause a mismatch: OnChainClaimPolicy already claims through the Safe,
|
|
11
|
+
* so `weAlreadyClaimed()` would return false even when the Safe holds the claim,
|
|
12
|
+
* triggering a redundant on-chain write that reverts as JobAlreadyClaimed.
|
|
13
|
+
*
|
|
14
|
+
* expireClaim() is permissionless (anyone can GC others' expired claims) and
|
|
15
|
+
* is kept as a direct EOA call — the gas payer does not affect claim ownership.
|
|
16
|
+
*/
|
|
17
|
+
import { type Address, type Hex, type PublicClient, type WalletClient } from 'viem';
|
|
18
|
+
export declare const ZERO_ADDRESS: Address;
|
|
19
|
+
export interface JobClaimInfo {
|
|
20
|
+
claimer: Address;
|
|
21
|
+
/** Unix timestamp (seconds) when the claim expires. 0 if no active claim. */
|
|
22
|
+
expiresAt: bigint;
|
|
23
|
+
/** True if claimer !== ZERO_ADDRESS and expiresAt > 0 (claim is still active per contract). */
|
|
24
|
+
isActive: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ClaimJobResult {
|
|
27
|
+
/** Transaction hash. Empty string when skipped (already ours or failed). */
|
|
28
|
+
txHash: string;
|
|
29
|
+
/** True if we now hold the claim (new or pre-existing). */
|
|
30
|
+
claimed: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare class ClaimRegistryClient {
|
|
33
|
+
private readonly publicClient;
|
|
34
|
+
private readonly walletClient;
|
|
35
|
+
private readonly contractAddress;
|
|
36
|
+
/**
|
|
37
|
+
* The Safe multisig address — used as the canonical claimer identity.
|
|
38
|
+
* claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
|
|
39
|
+
* is the Safe address, matching the OLAS staking identity.
|
|
40
|
+
*/
|
|
41
|
+
private readonly safeAddress;
|
|
42
|
+
constructor(publicClient: PublicClient, walletClient: WalletClient, contractAddress: Address,
|
|
43
|
+
/**
|
|
44
|
+
* The Safe multisig address — used as the canonical claimer identity.
|
|
45
|
+
* claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
|
|
46
|
+
* is the Safe address, matching the OLAS staking identity.
|
|
47
|
+
*/
|
|
48
|
+
safeAddress: Address);
|
|
49
|
+
/**
|
|
50
|
+
* Read the active claim for a request.
|
|
51
|
+
* Returns `(ZERO_ADDRESS, 0, false)` if no active claim (contract returns
|
|
52
|
+
* (address(0), 0) for expired/non-existent claims).
|
|
53
|
+
*/
|
|
54
|
+
getJobClaim(requestId: Hex): Promise<JobClaimInfo>;
|
|
55
|
+
/**
|
|
56
|
+
* Check whether the Safe already holds an active claim for this request.
|
|
57
|
+
* Used for idempotency on resume.
|
|
58
|
+
*/
|
|
59
|
+
weAlreadyClaimed(requestId: Hex): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Claim a marketplace request through the Safe multisig.
|
|
62
|
+
*
|
|
63
|
+
* Idempotent: if the Safe already holds an active claim, returns
|
|
64
|
+
* `{ txHash: '', claimed: true }` without submitting a transaction.
|
|
65
|
+
*
|
|
66
|
+
* Returns `{ txHash: '', claimed: false }` when:
|
|
67
|
+
* - Another address holds an active claim
|
|
68
|
+
* - The eligibility check fails (IneligibleToClaim)
|
|
69
|
+
* - The tx reverts for any other handled reason
|
|
70
|
+
*
|
|
71
|
+
* Throws on unrecognised RPC errors.
|
|
72
|
+
*/
|
|
73
|
+
claimJob(requestId: Hex): Promise<ClaimJobResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Voluntarily release a claim through the Safe multisig (no punishment).
|
|
76
|
+
* Should only be called when the Safe holds the claim.
|
|
77
|
+
* No-op (returns false) if the Safe doesn't hold the claim.
|
|
78
|
+
*/
|
|
79
|
+
releaseClaim(requestId: Hex): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Garbage-collect a stale (expired) claim.
|
|
82
|
+
*
|
|
83
|
+
* expireClaim is permissionless — anyone can call it to GC others' expired
|
|
84
|
+
* claims. The caller gets no reward; the previous claimer gets an
|
|
85
|
+
* expiredClaimCount increment. Since the gas payer doesn't affect claim
|
|
86
|
+
* ownership, this is sent directly from the EOA (cheaper than a Safe tx).
|
|
87
|
+
*/
|
|
88
|
+
expireClaim(requestId: Hex): Promise<boolean>;
|
|
89
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClaimRegistryClient — typed wrapper for the ClaimRegistry contract.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the read/write surfaces of ClaimRegistry with proper types and
|
|
5
|
+
* idiomatic async interfaces.
|
|
6
|
+
*
|
|
7
|
+
* Write operations (claimJob, releaseClaim) go through the Safe multisig via
|
|
8
|
+
* executeSafeTransaction. This is required so that the on-chain claimer address
|
|
9
|
+
* matches the Safe — our canonical OLAS/staking identity. Using the raw EOA
|
|
10
|
+
* would cause a mismatch: OnChainClaimPolicy already claims through the Safe,
|
|
11
|
+
* so `weAlreadyClaimed()` would return false even when the Safe holds the claim,
|
|
12
|
+
* triggering a redundant on-chain write that reverts as JobAlreadyClaimed.
|
|
13
|
+
*
|
|
14
|
+
* expireClaim() is permissionless (anyone can GC others' expired claims) and
|
|
15
|
+
* is kept as a direct EOA call — the gas payer does not affect claim ownership.
|
|
16
|
+
*/
|
|
17
|
+
import { encodeFunctionData, } from 'viem';
|
|
18
|
+
import { CLAIM_REGISTRY_ABI } from './abi.js';
|
|
19
|
+
import { executeSafeTransaction } from '../mech/safe.js';
|
|
20
|
+
import { waitForTransactionReceiptWithRetry } from '../../tx-retry.js';
|
|
21
|
+
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
22
|
+
// ── ClaimRegistryClient ───────────────────────────────────────────────────────
|
|
23
|
+
export class ClaimRegistryClient {
|
|
24
|
+
publicClient;
|
|
25
|
+
walletClient;
|
|
26
|
+
contractAddress;
|
|
27
|
+
safeAddress;
|
|
28
|
+
constructor(publicClient, walletClient, contractAddress,
|
|
29
|
+
/**
|
|
30
|
+
* The Safe multisig address — used as the canonical claimer identity.
|
|
31
|
+
* claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
|
|
32
|
+
* is the Safe address, matching the OLAS staking identity.
|
|
33
|
+
*/
|
|
34
|
+
safeAddress) {
|
|
35
|
+
this.publicClient = publicClient;
|
|
36
|
+
this.walletClient = walletClient;
|
|
37
|
+
this.contractAddress = contractAddress;
|
|
38
|
+
this.safeAddress = safeAddress;
|
|
39
|
+
}
|
|
40
|
+
// ── Read methods ─────────────────────────────────────────────────────────────
|
|
41
|
+
/**
|
|
42
|
+
* Read the active claim for a request.
|
|
43
|
+
* Returns `(ZERO_ADDRESS, 0, false)` if no active claim (contract returns
|
|
44
|
+
* (address(0), 0) for expired/non-existent claims).
|
|
45
|
+
*/
|
|
46
|
+
async getJobClaim(requestId) {
|
|
47
|
+
const result = await this.publicClient.readContract({
|
|
48
|
+
address: this.contractAddress,
|
|
49
|
+
abi: CLAIM_REGISTRY_ABI,
|
|
50
|
+
functionName: 'getJobClaim',
|
|
51
|
+
args: [requestId],
|
|
52
|
+
});
|
|
53
|
+
const claimer = result[0];
|
|
54
|
+
const expiresAt = result[1];
|
|
55
|
+
return {
|
|
56
|
+
claimer,
|
|
57
|
+
expiresAt,
|
|
58
|
+
isActive: claimer !== ZERO_ADDRESS && expiresAt > 0n,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check whether the Safe already holds an active claim for this request.
|
|
63
|
+
* Used for idempotency on resume.
|
|
64
|
+
*/
|
|
65
|
+
async weAlreadyClaimed(requestId) {
|
|
66
|
+
const info = await this.getJobClaim(requestId);
|
|
67
|
+
return (info.isActive &&
|
|
68
|
+
info.claimer.toLowerCase() === this.safeAddress.toLowerCase());
|
|
69
|
+
}
|
|
70
|
+
// ── Write methods ─────────────────────────────────────────────────────────────
|
|
71
|
+
/**
|
|
72
|
+
* Claim a marketplace request through the Safe multisig.
|
|
73
|
+
*
|
|
74
|
+
* Idempotent: if the Safe already holds an active claim, returns
|
|
75
|
+
* `{ txHash: '', claimed: true }` without submitting a transaction.
|
|
76
|
+
*
|
|
77
|
+
* Returns `{ txHash: '', claimed: false }` when:
|
|
78
|
+
* - Another address holds an active claim
|
|
79
|
+
* - The eligibility check fails (IneligibleToClaim)
|
|
80
|
+
* - The tx reverts for any other handled reason
|
|
81
|
+
*
|
|
82
|
+
* Throws on unrecognised RPC errors.
|
|
83
|
+
*/
|
|
84
|
+
async claimJob(requestId) {
|
|
85
|
+
// Idempotency: already claimed by our Safe
|
|
86
|
+
const existing = await this.getJobClaim(requestId);
|
|
87
|
+
if (existing.isActive) {
|
|
88
|
+
if (existing.claimer.toLowerCase() === this.safeAddress.toLowerCase()) {
|
|
89
|
+
return { txHash: '', claimed: true };
|
|
90
|
+
}
|
|
91
|
+
// Someone else has an active claim
|
|
92
|
+
return { txHash: '', claimed: false };
|
|
93
|
+
}
|
|
94
|
+
const data = encodeFunctionData({
|
|
95
|
+
abi: CLAIM_REGISTRY_ABI,
|
|
96
|
+
functionName: 'claimJob',
|
|
97
|
+
args: [requestId],
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
const txHash = await executeSafeTransaction(this.publicClient, this.walletClient, {
|
|
101
|
+
safeAddress: this.safeAddress,
|
|
102
|
+
to: this.contractAddress,
|
|
103
|
+
value: 0n,
|
|
104
|
+
data,
|
|
105
|
+
});
|
|
106
|
+
// executeSafeTransaction waits for the receipt internally, but does not
|
|
107
|
+
// inspect its status. Wait again with full retry and throw if reverted so
|
|
108
|
+
// callers don't see a false-positive claimed=true on a reverted claim.
|
|
109
|
+
const receipt = await waitForTransactionReceiptWithRetry(this.publicClient, txHash, {
|
|
110
|
+
onRetry: ({ attempt, message }) => {
|
|
111
|
+
console.error(`[claim-registry] wait claimJob receipt retry ${attempt}: ${message}`);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
if (receipt.status !== 'success') {
|
|
115
|
+
throw new Error(`claimJob transaction reverted (status=${receipt.status}, txHash=${txHash})`);
|
|
116
|
+
}
|
|
117
|
+
return { txHash, claimed: true };
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
121
|
+
if (message.includes('JobAlreadyClaimed') ||
|
|
122
|
+
message.includes('IneligibleToClaim') ||
|
|
123
|
+
message.includes('execution reverted')) {
|
|
124
|
+
return { txHash: '', claimed: false };
|
|
125
|
+
}
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Voluntarily release a claim through the Safe multisig (no punishment).
|
|
131
|
+
* Should only be called when the Safe holds the claim.
|
|
132
|
+
* No-op (returns false) if the Safe doesn't hold the claim.
|
|
133
|
+
*/
|
|
134
|
+
async releaseClaim(requestId) {
|
|
135
|
+
// Verify the Safe holds the claim before sending a tx that would revert
|
|
136
|
+
const existing = await this.getJobClaim(requestId);
|
|
137
|
+
if (!existing.isActive ||
|
|
138
|
+
existing.claimer.toLowerCase() !== this.safeAddress.toLowerCase()) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const data = encodeFunctionData({
|
|
142
|
+
abi: CLAIM_REGISTRY_ABI,
|
|
143
|
+
functionName: 'releaseClaim',
|
|
144
|
+
args: [requestId],
|
|
145
|
+
});
|
|
146
|
+
try {
|
|
147
|
+
await executeSafeTransaction(this.publicClient, this.walletClient, {
|
|
148
|
+
safeAddress: this.safeAddress,
|
|
149
|
+
to: this.contractAddress,
|
|
150
|
+
value: 0n,
|
|
151
|
+
data,
|
|
152
|
+
});
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
157
|
+
// NotClaimOwner or NoClaimExists — claim was already gone
|
|
158
|
+
if (message.includes('NotClaimOwner') || message.includes('NoClaimExists')) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Garbage-collect a stale (expired) claim.
|
|
166
|
+
*
|
|
167
|
+
* expireClaim is permissionless — anyone can call it to GC others' expired
|
|
168
|
+
* claims. The caller gets no reward; the previous claimer gets an
|
|
169
|
+
* expiredClaimCount increment. Since the gas payer doesn't affect claim
|
|
170
|
+
* ownership, this is sent directly from the EOA (cheaper than a Safe tx).
|
|
171
|
+
*/
|
|
172
|
+
async expireClaim(requestId) {
|
|
173
|
+
const account = this.walletClient.account;
|
|
174
|
+
if (!account)
|
|
175
|
+
throw new Error('[ClaimRegistryClient] walletClient has no account');
|
|
176
|
+
const data = encodeFunctionData({
|
|
177
|
+
abi: CLAIM_REGISTRY_ABI,
|
|
178
|
+
functionName: 'expireClaim',
|
|
179
|
+
args: [requestId],
|
|
180
|
+
});
|
|
181
|
+
try {
|
|
182
|
+
const txHash = await this.walletClient.sendTransaction({
|
|
183
|
+
account,
|
|
184
|
+
chain: null,
|
|
185
|
+
to: this.contractAddress,
|
|
186
|
+
data,
|
|
187
|
+
value: 0n,
|
|
188
|
+
});
|
|
189
|
+
await waitForTransactionReceiptWithRetry(this.publicClient, txHash, {
|
|
190
|
+
onRetry: ({ attempt, message }) => {
|
|
191
|
+
console.error(`[claim-registry] wait expireClaim receipt retry ${attempt}: ${message}`);
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
198
|
+
if (message.includes('NoClaimExists') || message.includes('ClaimNotExpired')) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/adapters/claim-registry/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,kBAAkB,GAKnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,kCAAkC,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,CAAC,MAAM,YAAY,GAAY,4CAA4C,CAAC;AAmBlF,iFAAiF;AAEjF,MAAM,OAAO,mBAAmB;IAEX;IACA;IACA;IAMA;IATnB,YACmB,YAA0B,EAC1B,YAA0B,EAC1B,eAAwB;IACzC;;;;OAIG;IACc,WAAoB;QARpB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,oBAAe,GAAf,eAAe,CAAS;QAMxB,gBAAW,GAAX,WAAW,CAAS;IACpC,CAAC;IAEJ,gFAAgF;IAEhF;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,SAAc;QAC9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;YAClD,OAAO,EAAE,IAAI,CAAC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D,CAAC,CAAC;QAEnF,MAAM,IAAI,GAAG,kBAAkB,CAAC;YAC9B,GAAG,EAAE,kBAAkB;YACvB,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,CAAC,SAAS,CAAC;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;gBACrD,OAAO;gBACP,KAAK,EAAE,IAAI;gBACX,EAAE,EAAE,IAAI,CAAC,eAAe;gBACxB,IAAI;gBACJ,KAAK,EAAE,EAAE;aACV,CAAC,CAAC;YAEH,MAAM,kCAAkC,CAAC,IAAI,CAAC,YAAY,EAAE,MAAa,EAAE;gBACzE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;oBAChC,OAAO,CAAC,KAAK,CAAC,mDAAmD,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC;gBAC1F,CAAC;aACF,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,IAAI,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC7E,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -13,17 +13,22 @@ export declare class MechAdapter implements ExecutionAdapter {
|
|
|
13
13
|
private pendingEvaluations;
|
|
14
14
|
private pendingEvaluationClaims;
|
|
15
15
|
private claimedButNotEvaluated;
|
|
16
|
+
private pendingEvaluationResults;
|
|
17
|
+
private backfillMissRids;
|
|
16
18
|
private originalStates;
|
|
19
|
+
private _lastPostedIntentCid;
|
|
17
20
|
private store?;
|
|
18
21
|
private claimPolicy;
|
|
19
22
|
constructor(config: MechAdapterConfig, store?: Store);
|
|
20
23
|
initialize(): Promise<void>;
|
|
21
24
|
private recoverPendingState;
|
|
25
|
+
getLastPostedIntentCid(): string | undefined;
|
|
22
26
|
postDesiredState(state: DesiredState): Promise<RequestId>;
|
|
23
27
|
watchForRequests(): AsyncIterable<RestorationRequest>;
|
|
24
28
|
claimRequest(requestId: RequestId): Promise<void>;
|
|
25
29
|
submitResult(requestId: RequestId, result: RestorationResult): Promise<void>;
|
|
26
30
|
watchForDeliveries(): AsyncIterable<DeliveredResult>;
|
|
31
|
+
private backfillRestorationResultFromChain;
|
|
27
32
|
private tryCreateEvaluationJob;
|
|
28
33
|
private verifyRestorationClaimed;
|
|
29
34
|
stop(): Promise<void>;
|