@flop-labs/sdk 0.0.0-stage → 0.5.1
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 +391 -0
- package/LICENSE +238 -0
- package/README.md +673 -2
- package/dist/a2a/agent-card.d.ts +106 -0
- package/dist/a2a/agent-card.d.ts.map +1 -0
- package/dist/a2a/agent-card.js +131 -0
- package/dist/a2a/agent-card.js.map +1 -0
- package/dist/a2a/index.d.ts +11 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +11 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/task-lifecycle.d.ts +41 -0
- package/dist/a2a/task-lifecycle.d.ts.map +1 -0
- package/dist/a2a/task-lifecycle.js +60 -0
- package/dist/a2a/task-lifecycle.js.map +1 -0
- package/dist/a2a/types.d.ts +96 -0
- package/dist/a2a/types.d.ts.map +1 -0
- package/dist/a2a/types.js +23 -0
- package/dist/a2a/types.js.map +1 -0
- package/dist/a2a-cjs/agent-card.js +137 -0
- package/dist/a2a-cjs/agent-card.js.map +1 -0
- package/dist/a2a-cjs/index.js +23 -0
- package/dist/a2a-cjs/index.js.map +1 -0
- package/dist/a2a-cjs/package.json +1 -0
- package/dist/a2a-cjs/task-lifecycle.js +64 -0
- package/dist/a2a-cjs/task-lifecycle.js.map +1 -0
- package/dist/a2a-cjs/types.js +26 -0
- package/dist/a2a-cjs/types.js.map +1 -0
- package/dist/adaptor.d.ts +39 -0
- package/dist/adaptor.d.ts.map +1 -0
- package/dist/adaptor.js +130 -0
- package/dist/adaptor.js.map +1 -0
- package/dist/agent/errors.d.ts +95 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +132 -0
- package/dist/agent/errors.js.map +1 -0
- package/dist/agent/task-delegation.d.ts +283 -0
- package/dist/agent/task-delegation.d.ts.map +1 -0
- package/dist/agent/task-delegation.js +413 -0
- package/dist/agent/task-delegation.js.map +1 -0
- package/dist/agent/types.d.ts +19 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +7 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent-wallet.d.ts +197 -0
- package/dist/agent-wallet.d.ts.map +1 -0
- package/dist/agent-wallet.js +391 -0
- package/dist/agent-wallet.js.map +1 -0
- package/dist/amhl.d.ts +61 -0
- package/dist/amhl.d.ts.map +1 -0
- package/dist/amhl.js +161 -0
- package/dist/amhl.js.map +1 -0
- package/dist/attestation.d.ts +126 -0
- package/dist/attestation.d.ts.map +1 -0
- package/dist/attestation.js +287 -0
- package/dist/attestation.js.map +1 -0
- package/dist/bip340-adaptor.d.ts +8 -0
- package/dist/bip340-adaptor.d.ts.map +1 -0
- package/dist/bip340-adaptor.js +129 -0
- package/dist/bip340-adaptor.js.map +1 -0
- package/dist/btc-relayer.d.ts +42 -0
- package/dist/btc-relayer.d.ts.map +1 -0
- package/dist/btc-relayer.js +40 -0
- package/dist/btc-relayer.js.map +1 -0
- package/dist/bundle/index.esm.js +2 -0
- package/dist/bundle/index.esm.js.map +1 -0
- package/dist/bundle/index.umd.cjs +2 -0
- package/dist/bundle/index.umd.cjs.map +1 -0
- package/dist/capability-claim-sink.d.ts +5 -0
- package/dist/capability-claim-sink.d.ts.map +1 -0
- package/dist/capability-claim-sink.js +6 -0
- package/dist/capability-claim-sink.js.map +1 -0
- package/dist/chain-text.d.ts +3 -0
- package/dist/chain-text.d.ts.map +1 -0
- package/dist/chain-text.js +27 -0
- package/dist/chain-text.js.map +1 -0
- package/dist/chain.d.ts +63 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +100 -0
- package/dist/chain.js.map +1 -0
- package/dist/client.d.ts +368 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +870 -0
- package/dist/client.js.map +1 -0
- package/dist/compute-channel/adaptor-settlement.d.ts +19 -0
- package/dist/compute-channel/adaptor-settlement.d.ts.map +1 -0
- package/dist/compute-channel/adaptor-settlement.js +40 -0
- package/dist/compute-channel/adaptor-settlement.js.map +1 -0
- package/dist/compute-channel/agent-client.d.ts +141 -0
- package/dist/compute-channel/agent-client.d.ts.map +1 -0
- package/dist/compute-channel/agent-client.js +265 -0
- package/dist/compute-channel/agent-client.js.map +1 -0
- package/dist/compute-channel/agent-driver.d.ts +59 -0
- package/dist/compute-channel/agent-driver.d.ts.map +1 -0
- package/dist/compute-channel/agent-driver.js +351 -0
- package/dist/compute-channel/agent-driver.js.map +1 -0
- package/dist/compute-channel/chain.d.ts +245 -0
- package/dist/compute-channel/chain.d.ts.map +1 -0
- package/dist/compute-channel/chain.js +490 -0
- package/dist/compute-channel/chain.js.map +1 -0
- package/dist/compute-channel/chat-render.d.ts +21 -0
- package/dist/compute-channel/chat-render.d.ts.map +1 -0
- package/dist/compute-channel/chat-render.js +87 -0
- package/dist/compute-channel/chat-render.js.map +1 -0
- package/dist/compute-channel/crypto.d.ts +19 -0
- package/dist/compute-channel/crypto.d.ts.map +1 -0
- package/dist/compute-channel/crypto.js +52 -0
- package/dist/compute-channel/crypto.js.map +1 -0
- package/dist/compute-channel/da.d.ts +111 -0
- package/dist/compute-channel/da.d.ts.map +1 -0
- package/dist/compute-channel/da.js +320 -0
- package/dist/compute-channel/da.js.map +1 -0
- package/dist/compute-channel/deepseek-v41.d.ts +56 -0
- package/dist/compute-channel/deepseek-v41.d.ts.map +1 -0
- package/dist/compute-channel/deepseek-v41.js +267 -0
- package/dist/compute-channel/deepseek-v41.js.map +1 -0
- package/dist/compute-channel/direct-session-chain.d.ts +3 -0
- package/dist/compute-channel/direct-session-chain.d.ts.map +1 -0
- package/dist/compute-channel/direct-session-chain.js +271 -0
- package/dist/compute-channel/direct-session-chain.js.map +1 -0
- package/dist/compute-channel/direct-session.d.ts +78 -0
- package/dist/compute-channel/direct-session.d.ts.map +1 -0
- package/dist/compute-channel/direct-session.js +241 -0
- package/dist/compute-channel/direct-session.js.map +1 -0
- package/dist/compute-channel/dispute.d.ts +103 -0
- package/dist/compute-channel/dispute.d.ts.map +1 -0
- package/dist/compute-channel/dispute.js +314 -0
- package/dist/compute-channel/dispute.js.map +1 -0
- package/dist/compute-channel/fcu-admission.d.ts +37 -0
- package/dist/compute-channel/fcu-admission.d.ts.map +1 -0
- package/dist/compute-channel/fcu-admission.js +53 -0
- package/dist/compute-channel/fcu-admission.js.map +1 -0
- package/dist/compute-channel/fcu-agent.d.ts +27 -0
- package/dist/compute-channel/fcu-agent.d.ts.map +1 -0
- package/dist/compute-channel/fcu-agent.js +35 -0
- package/dist/compute-channel/fcu-agent.js.map +1 -0
- package/dist/compute-channel/fcu-policy.d.ts +67 -0
- package/dist/compute-channel/fcu-policy.d.ts.map +1 -0
- package/dist/compute-channel/fcu-policy.js +121 -0
- package/dist/compute-channel/fcu-policy.js.map +1 -0
- package/dist/compute-channel/fcu-profile.d.ts +56 -0
- package/dist/compute-channel/fcu-profile.d.ts.map +1 -0
- package/dist/compute-channel/fcu-profile.js +100 -0
- package/dist/compute-channel/fcu-profile.js.map +1 -0
- package/dist/compute-channel/fcu-serving.d.ts +146 -0
- package/dist/compute-channel/fcu-serving.d.ts.map +1 -0
- package/dist/compute-channel/fcu-serving.js +350 -0
- package/dist/compute-channel/fcu-serving.js.map +1 -0
- package/dist/compute-channel/fcu-sla.d.ts +88 -0
- package/dist/compute-channel/fcu-sla.d.ts.map +1 -0
- package/dist/compute-channel/fcu-sla.js +154 -0
- package/dist/compute-channel/fcu-sla.js.map +1 -0
- package/dist/compute-channel/fcu-store-node.d.ts +10 -0
- package/dist/compute-channel/fcu-store-node.d.ts.map +1 -0
- package/dist/compute-channel/fcu-store-node.js +98 -0
- package/dist/compute-channel/fcu-store-node.js.map +1 -0
- package/dist/compute-channel/fcu-timing.d.ts +34 -0
- package/dist/compute-channel/fcu-timing.d.ts.map +1 -0
- package/dist/compute-channel/fcu-timing.js +79 -0
- package/dist/compute-channel/fcu-timing.js.map +1 -0
- package/dist/compute-channel/flop-meter.d.ts +96 -0
- package/dist/compute-channel/flop-meter.d.ts.map +1 -0
- package/dist/compute-channel/flop-meter.js +210 -0
- package/dist/compute-channel/flop-meter.js.map +1 -0
- package/dist/compute-channel/flop-submitter.d.ts +40 -0
- package/dist/compute-channel/flop-submitter.d.ts.map +1 -0
- package/dist/compute-channel/flop-submitter.js +124 -0
- package/dist/compute-channel/flop-submitter.js.map +1 -0
- package/dist/compute-channel/hybrid-candidate.d.ts +22 -0
- package/dist/compute-channel/hybrid-candidate.d.ts.map +1 -0
- package/dist/compute-channel/hybrid-candidate.js +155 -0
- package/dist/compute-channel/hybrid-candidate.js.map +1 -0
- package/dist/compute-channel/hybrid-metering.d.ts +36 -0
- package/dist/compute-channel/hybrid-metering.d.ts.map +1 -0
- package/dist/compute-channel/hybrid-metering.js +69 -0
- package/dist/compute-channel/hybrid-metering.js.map +1 -0
- package/dist/compute-channel/hybrid.d.ts +16 -0
- package/dist/compute-channel/hybrid.d.ts.map +1 -0
- package/dist/compute-channel/hybrid.js +98 -0
- package/dist/compute-channel/hybrid.js.map +1 -0
- package/dist/compute-channel/index.d.ts +55 -0
- package/dist/compute-channel/index.d.ts.map +1 -0
- package/dist/compute-channel/index.js +56 -0
- package/dist/compute-channel/index.js.map +1 -0
- package/dist/compute-channel/lane-producer.d.ts +92 -0
- package/dist/compute-channel/lane-producer.d.ts.map +1 -0
- package/dist/compute-channel/lane-producer.js +265 -0
- package/dist/compute-channel/lane-producer.js.map +1 -0
- package/dist/compute-channel/layered.d.ts +77 -0
- package/dist/compute-channel/layered.d.ts.map +1 -0
- package/dist/compute-channel/layered.js +220 -0
- package/dist/compute-channel/layered.js.map +1 -0
- package/dist/compute-channel/lineage.d.ts +19 -0
- package/dist/compute-channel/lineage.d.ts.map +1 -0
- package/dist/compute-channel/lineage.js +28 -0
- package/dist/compute-channel/lineage.js.map +1 -0
- package/dist/compute-channel/miner-host.d.ts +329 -0
- package/dist/compute-channel/miner-host.d.ts.map +1 -0
- package/dist/compute-channel/miner-host.js +880 -0
- package/dist/compute-channel/miner-host.js.map +1 -0
- package/dist/compute-channel/model-config.d.ts +87 -0
- package/dist/compute-channel/model-config.d.ts.map +1 -0
- package/dist/compute-channel/model-config.js +697 -0
- package/dist/compute-channel/model-config.js.map +1 -0
- package/dist/compute-channel/offers.d.ts +57 -0
- package/dist/compute-channel/offers.d.ts.map +1 -0
- package/dist/compute-channel/offers.js +182 -0
- package/dist/compute-channel/offers.js.map +1 -0
- package/dist/compute-channel/peer-info.d.ts +15 -0
- package/dist/compute-channel/peer-info.d.ts.map +1 -0
- package/dist/compute-channel/peer-info.js +33 -0
- package/dist/compute-channel/peer-info.js.map +1 -0
- package/dist/compute-channel/point-claim-sink.d.ts +5 -0
- package/dist/compute-channel/point-claim-sink.d.ts.map +1 -0
- package/dist/compute-channel/point-claim-sink.js +6 -0
- package/dist/compute-channel/point-claim-sink.js.map +1 -0
- package/dist/compute-channel/protocol.d.ts +243 -0
- package/dist/compute-channel/protocol.d.ts.map +1 -0
- package/dist/compute-channel/protocol.js +249 -0
- package/dist/compute-channel/protocol.js.map +1 -0
- package/dist/compute-channel/runtime-storage.d.ts +6 -0
- package/dist/compute-channel/runtime-storage.d.ts.map +1 -0
- package/dist/compute-channel/runtime-storage.js +11 -0
- package/dist/compute-channel/runtime-storage.js.map +1 -0
- package/dist/compute-channel/sampled-audit.d.ts +24 -0
- package/dist/compute-channel/sampled-audit.d.ts.map +1 -0
- package/dist/compute-channel/sampled-audit.js +97 -0
- package/dist/compute-channel/sampled-audit.js.map +1 -0
- package/dist/compute-channel/session-auth.d.ts +6 -0
- package/dist/compute-channel/session-auth.d.ts.map +1 -0
- package/dist/compute-channel/session-auth.js +23 -0
- package/dist/compute-channel/session-auth.js.map +1 -0
- package/dist/compute-channel/session-estimate.d.ts +103 -0
- package/dist/compute-channel/session-estimate.d.ts.map +1 -0
- package/dist/compute-channel/session-estimate.js +140 -0
- package/dist/compute-channel/session-estimate.js.map +1 -0
- package/dist/compute-channel/session-prior-bank.d.ts +61 -0
- package/dist/compute-channel/session-prior-bank.d.ts.map +1 -0
- package/dist/compute-channel/session-prior-bank.js +74 -0
- package/dist/compute-channel/session-prior-bank.js.map +1 -0
- package/dist/compute-channel/session-prior.d.ts +145 -0
- package/dist/compute-channel/session-prior.d.ts.map +1 -0
- package/dist/compute-channel/session-prior.js +325 -0
- package/dist/compute-channel/session-prior.js.map +1 -0
- package/dist/compute-channel/session-store.d.ts +51 -0
- package/dist/compute-channel/session-store.d.ts.map +1 -0
- package/dist/compute-channel/session-store.js +186 -0
- package/dist/compute-channel/session-store.js.map +1 -0
- package/dist/compute-channel/session.d.ts +120 -0
- package/dist/compute-channel/session.d.ts.map +1 -0
- package/dist/compute-channel/session.js +232 -0
- package/dist/compute-channel/session.js.map +1 -0
- package/dist/compute-channel/toploc-checker.d.ts +384 -0
- package/dist/compute-channel/toploc-checker.d.ts.map +1 -0
- package/dist/compute-channel/toploc-checker.js +794 -0
- package/dist/compute-channel/toploc-checker.js.map +1 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts +26 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts.map +1 -0
- package/dist/compute-channel/toploc-completion-rpc.js +391 -0
- package/dist/compute-channel/toploc-completion-rpc.js.map +1 -0
- package/dist/compute-channel/toploc-completion.d.ts +109 -0
- package/dist/compute-channel/toploc-completion.d.ts.map +1 -0
- package/dist/compute-channel/toploc-completion.js +301 -0
- package/dist/compute-channel/toploc-completion.js.map +1 -0
- package/dist/compute-channel/toploc-evidence.d.ts +185 -0
- package/dist/compute-channel/toploc-evidence.d.ts.map +1 -0
- package/dist/compute-channel/toploc-evidence.js +299 -0
- package/dist/compute-channel/toploc-evidence.js.map +1 -0
- package/dist/compute-channel/toploc-gumbel.d.ts +149 -0
- package/dist/compute-channel/toploc-gumbel.d.ts.map +1 -0
- package/dist/compute-channel/toploc-gumbel.js +245 -0
- package/dist/compute-channel/toploc-gumbel.js.map +1 -0
- package/dist/compute-channel/toploc.d.ts +63 -0
- package/dist/compute-channel/toploc.d.ts.map +1 -0
- package/dist/compute-channel/toploc.js +197 -0
- package/dist/compute-channel/toploc.js.map +1 -0
- package/dist/compute-channel/transcript.d.ts +127 -0
- package/dist/compute-channel/transcript.d.ts.map +1 -0
- package/dist/compute-channel/transcript.js +279 -0
- package/dist/compute-channel/transcript.js.map +1 -0
- package/dist/compute-channel/transport-http.d.ts +223 -0
- package/dist/compute-channel/transport-http.d.ts.map +1 -0
- package/dist/compute-channel/transport-http.js +661 -0
- package/dist/compute-channel/transport-http.js.map +1 -0
- package/dist/connect.d.ts +4 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +24 -0
- package/dist/connect.js.map +1 -0
- package/dist/coordination.d.ts +341 -0
- package/dist/coordination.d.ts.map +1 -0
- package/dist/coordination.js +483 -0
- package/dist/coordination.js.map +1 -0
- package/dist/da-client.d.ts +124 -0
- package/dist/da-client.d.ts.map +1 -0
- package/dist/da-client.js +127 -0
- package/dist/da-client.js.map +1 -0
- package/dist/discovery/capabilities.d.ts +129 -0
- package/dist/discovery/capabilities.d.ts.map +1 -0
- package/dist/discovery/capabilities.js +398 -0
- package/dist/discovery/capabilities.js.map +1 -0
- package/dist/discovery/discovery-service.d.ts +476 -0
- package/dist/discovery/discovery-service.d.ts.map +1 -0
- package/dist/discovery/discovery-service.js +996 -0
- package/dist/discovery/discovery-service.js.map +1 -0
- package/dist/discovery/examples.d.ts +50 -0
- package/dist/discovery/examples.d.ts.map +1 -0
- package/dist/discovery/examples.js +163 -0
- package/dist/discovery/examples.js.map +1 -0
- package/dist/discovery/fee-estimation.d.ts +550 -0
- package/dist/discovery/fee-estimation.d.ts.map +1 -0
- package/dist/discovery/fee-estimation.js +921 -0
- package/dist/discovery/fee-estimation.js.map +1 -0
- package/dist/discovery/index.d.ts +38 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +32 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/metered-pricing.d.ts +100 -0
- package/dist/discovery/metered-pricing.d.ts.map +1 -0
- package/dist/discovery/metered-pricing.js +150 -0
- package/dist/discovery/metered-pricing.js.map +1 -0
- package/dist/discovery/priority.d.ts +16 -0
- package/dist/discovery/priority.d.ts.map +1 -0
- package/dist/discovery/priority.js +17 -0
- package/dist/discovery/priority.js.map +1 -0
- package/dist/discovery/scoring.d.ts +231 -0
- package/dist/discovery/scoring.d.ts.map +1 -0
- package/dist/discovery/scoring.js +354 -0
- package/dist/discovery/scoring.js.map +1 -0
- package/dist/ecdsa-adaptor.d.ts +72 -0
- package/dist/ecdsa-adaptor.d.ts.map +1 -0
- package/dist/ecdsa-adaptor.js +351 -0
- package/dist/ecdsa-adaptor.js.map +1 -0
- package/dist/errors.d.ts +98 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +190 -0
- package/dist/errors.js.map +1 -0
- package/dist/escrow.d.ts +116 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +172 -0
- package/dist/escrow.js.map +1 -0
- package/dist/evm-relayer.d.ts +12 -0
- package/dist/evm-relayer.d.ts.map +1 -0
- package/dist/evm-relayer.js +25 -0
- package/dist/evm-relayer.js.map +1 -0
- package/dist/experimental.d.ts +3 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +3 -0
- package/dist/experimental.js.map +1 -0
- package/dist/faucet.d.ts +146 -0
- package/dist/faucet.d.ts.map +1 -0
- package/dist/faucet.js +300 -0
- package/dist/faucet.js.map +1 -0
- package/dist/finality-status.d.ts +21 -0
- package/dist/finality-status.d.ts.map +1 -0
- package/dist/finality-status.js +10 -0
- package/dist/finality-status.js.map +1 -0
- package/dist/generated-client/capabilities.d.ts +83 -0
- package/dist/generated-client/capabilities.d.ts.map +1 -0
- package/dist/generated-client/capabilities.js +87 -0
- package/dist/generated-client/capabilities.js.map +1 -0
- package/dist/generated-client/cli.d.ts +3 -0
- package/dist/generated-client/cli.d.ts.map +1 -0
- package/dist/generated-client/cli.js +33 -0
- package/dist/generated-client/cli.js.map +1 -0
- package/dist/generated-client/errors.d.ts +13 -0
- package/dist/generated-client/errors.d.ts.map +1 -0
- package/dist/generated-client/errors.js +23 -0
- package/dist/generated-client/errors.js.map +1 -0
- package/dist/generated-client/factory.d.ts +28 -0
- package/dist/generated-client/factory.d.ts.map +1 -0
- package/dist/generated-client/factory.js +182 -0
- package/dist/generated-client/factory.js.map +1 -0
- package/dist/generated-client/generator.d.ts +9 -0
- package/dist/generated-client/generator.d.ts.map +1 -0
- package/dist/generated-client/generator.js +80 -0
- package/dist/generated-client/generator.js.map +1 -0
- package/dist/generated-client/index.d.ts +11 -0
- package/dist/generated-client/index.d.ts.map +1 -0
- package/dist/generated-client/index.js +6 -0
- package/dist/generated-client/index.js.map +1 -0
- package/dist/generated-client/profile.d.ts +166 -0
- package/dist/generated-client/profile.d.ts.map +1 -0
- package/dist/generated-client/profile.js +158 -0
- package/dist/generated-client/profile.js.map +1 -0
- package/dist/generated-client/templates/agent-chat.d.ts +16 -0
- package/dist/generated-client/templates/agent-chat.d.ts.map +1 -0
- package/dist/generated-client/templates/agent-chat.js +12 -0
- package/dist/generated-client/templates/agent-chat.js.map +1 -0
- package/dist/generated-client/templates/index.d.ts +4 -0
- package/dist/generated-client/templates/index.d.ts.map +1 -0
- package/dist/generated-client/templates/index.js +4 -0
- package/dist/generated-client/templates/index.js.map +1 -0
- package/dist/generated-client/templates/miner-operator.d.ts +16 -0
- package/dist/generated-client/templates/miner-operator.d.ts.map +1 -0
- package/dist/generated-client/templates/miner-operator.js +12 -0
- package/dist/generated-client/templates/miner-operator.js.map +1 -0
- package/dist/generated-client/templates/model-publisher.d.ts +21 -0
- package/dist/generated-client/templates/model-publisher.d.ts.map +1 -0
- package/dist/generated-client/templates/model-publisher.js +13 -0
- package/dist/generated-client/templates/model-publisher.js.map +1 -0
- package/dist/hardware.d.ts +68 -0
- package/dist/hardware.d.ts.map +1 -0
- package/dist/hardware.js +222 -0
- package/dist/hardware.js.map +1 -0
- package/dist/htlc-appraisal.d.ts +4 -0
- package/dist/htlc-appraisal.d.ts.map +1 -0
- package/dist/htlc-appraisal.js +25 -0
- package/dist/htlc-appraisal.js.map +1 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +144 -0
- package/dist/index.js.map +1 -0
- package/dist/inference-purchase.d.ts +40 -0
- package/dist/inference-purchase.d.ts.map +1 -0
- package/dist/inference-purchase.js +43 -0
- package/dist/inference-purchase.js.map +1 -0
- package/dist/miner-admission.d.ts +124 -0
- package/dist/miner-admission.d.ts.map +1 -0
- package/dist/miner-admission.js +259 -0
- package/dist/miner-admission.js.map +1 -0
- package/dist/model-loader/canonical.d.ts +79 -0
- package/dist/model-loader/canonical.d.ts.map +1 -0
- package/dist/model-loader/canonical.js +116 -0
- package/dist/model-loader/canonical.js.map +1 -0
- package/dist/model-loader/dir.d.ts +26 -0
- package/dist/model-loader/dir.d.ts.map +1 -0
- package/dist/model-loader/dir.js +109 -0
- package/dist/model-loader/dir.js.map +1 -0
- package/dist/model-loader/dmverity.d.ts +78 -0
- package/dist/model-loader/dmverity.d.ts.map +1 -0
- package/dist/model-loader/dmverity.js +141 -0
- package/dist/model-loader/dmverity.js.map +1 -0
- package/dist/model-loader/download-state.d.ts +24 -0
- package/dist/model-loader/download-state.d.ts.map +1 -0
- package/dist/model-loader/download-state.js +99 -0
- package/dist/model-loader/download-state.js.map +1 -0
- package/dist/model-loader/fetch.d.ts +51 -0
- package/dist/model-loader/fetch.d.ts.map +1 -0
- package/dist/model-loader/fetch.js +410 -0
- package/dist/model-loader/fetch.js.map +1 -0
- package/dist/model-loader/file-table.d.ts +38 -0
- package/dist/model-loader/file-table.d.ts.map +1 -0
- package/dist/model-loader/file-table.js +106 -0
- package/dist/model-loader/file-table.js.map +1 -0
- package/dist/model-loader/hf-preflight.d.ts +65 -0
- package/dist/model-loader/hf-preflight.d.ts.map +1 -0
- package/dist/model-loader/hf-preflight.js +179 -0
- package/dist/model-loader/hf-preflight.js.map +1 -0
- package/dist/model-loader/index.d.ts +27 -0
- package/dist/model-loader/index.d.ts.map +1 -0
- package/dist/model-loader/index.js +21 -0
- package/dist/model-loader/index.js.map +1 -0
- package/dist/model-loader/registry.d.ts +24 -0
- package/dist/model-loader/registry.d.ts.map +1 -0
- package/dist/model-loader/registry.js +99 -0
- package/dist/model-loader/registry.js.map +1 -0
- package/dist/model-loader/types.d.ts +101 -0
- package/dist/model-loader/types.d.ts.map +1 -0
- package/dist/model-loader/types.js +13 -0
- package/dist/model-loader/types.js.map +1 -0
- package/dist/model-loader/verify.d.ts +83 -0
- package/dist/model-loader/verify.d.ts.map +1 -0
- package/dist/model-loader/verify.js +138 -0
- package/dist/model-loader/verify.js.map +1 -0
- package/dist/model-qualification.d.ts +79 -0
- package/dist/model-qualification.d.ts.map +1 -0
- package/dist/model-qualification.js +135 -0
- package/dist/model-qualification.js.map +1 -0
- package/dist/near-relayer.d.ts +30 -0
- package/dist/near-relayer.d.ts.map +1 -0
- package/dist/near-relayer.js +81 -0
- package/dist/near-relayer.js.map +1 -0
- package/dist/paid-storage/bytes.d.ts +21 -0
- package/dist/paid-storage/bytes.d.ts.map +1 -0
- package/dist/paid-storage/bytes.js +71 -0
- package/dist/paid-storage/bytes.js.map +1 -0
- package/dist/paid-storage/chain.d.ts +20 -0
- package/dist/paid-storage/chain.d.ts.map +1 -0
- package/dist/paid-storage/chain.js +182 -0
- package/dist/paid-storage/chain.js.map +1 -0
- package/dist/paid-storage/client.d.ts +161 -0
- package/dist/paid-storage/client.d.ts.map +1 -0
- package/dist/paid-storage/client.js +1038 -0
- package/dist/paid-storage/client.js.map +1 -0
- package/dist/paid-storage/cloudflare.d.ts +4 -0
- package/dist/paid-storage/cloudflare.d.ts.map +1 -0
- package/dist/paid-storage/cloudflare.js +9 -0
- package/dist/paid-storage/cloudflare.js.map +1 -0
- package/dist/paid-storage/codec.d.ts +8 -0
- package/dist/paid-storage/codec.d.ts.map +1 -0
- package/dist/paid-storage/codec.js +92 -0
- package/dist/paid-storage/codec.js.map +1 -0
- package/dist/paid-storage/crypto.d.ts +27 -0
- package/dist/paid-storage/crypto.d.ts.map +1 -0
- package/dist/paid-storage/crypto.js +91 -0
- package/dist/paid-storage/crypto.js.map +1 -0
- package/dist/paid-storage/heads.d.ts +26 -0
- package/dist/paid-storage/heads.d.ts.map +1 -0
- package/dist/paid-storage/heads.js +208 -0
- package/dist/paid-storage/heads.js.map +1 -0
- package/dist/paid-storage/index.d.ts +14 -0
- package/dist/paid-storage/index.d.ts.map +1 -0
- package/dist/paid-storage/index.js +7 -0
- package/dist/paid-storage/index.js.map +1 -0
- package/dist/paid-storage/memory-wire.d.ts +85 -0
- package/dist/paid-storage/memory-wire.d.ts.map +1 -0
- package/dist/paid-storage/memory-wire.js +147 -0
- package/dist/paid-storage/memory-wire.js.map +1 -0
- package/dist/paid-storage/node-store.d.ts +9 -0
- package/dist/paid-storage/node-store.d.ts.map +1 -0
- package/dist/paid-storage/node-store.js +34 -0
- package/dist/paid-storage/node-store.js.map +1 -0
- package/dist/paid-storage/profile.d.ts +21 -0
- package/dist/paid-storage/profile.d.ts.map +1 -0
- package/dist/paid-storage/profile.js +22 -0
- package/dist/paid-storage/profile.js.map +1 -0
- package/dist/paid-storage/store.d.ts +18 -0
- package/dist/paid-storage/store.d.ts.map +1 -0
- package/dist/paid-storage/store.js +32 -0
- package/dist/paid-storage/store.js.map +1 -0
- package/dist/paid-storage/transport.d.ts +70 -0
- package/dist/paid-storage/transport.d.ts.map +1 -0
- package/dist/paid-storage/transport.js +140 -0
- package/dist/paid-storage/transport.js.map +1 -0
- package/dist/paid-storage/vouchers.d.ts +75 -0
- package/dist/paid-storage/vouchers.d.ts.map +1 -0
- package/dist/paid-storage/vouchers.js +239 -0
- package/dist/paid-storage/vouchers.js.map +1 -0
- package/dist/paid-storage-wire.d.ts +11 -0
- package/dist/paid-storage-wire.d.ts.map +1 -0
- package/dist/paid-storage-wire.js +184 -0
- package/dist/paid-storage-wire.js.map +1 -0
- package/dist/point-claims.d.ts +40 -0
- package/dist/point-claims.d.ts.map +1 -0
- package/dist/point-claims.js +98 -0
- package/dist/point-claims.js.map +1 -0
- package/dist/quickstart.d.ts +307 -0
- package/dist/quickstart.d.ts.map +1 -0
- package/dist/quickstart.js +536 -0
- package/dist/quickstart.js.map +1 -0
- package/dist/react/context.d.ts +10 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +16 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/hooks.d.ts +206 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +560 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider.d.ts +18 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +17 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/relayer.d.ts +122 -0
- package/dist/relayer.d.ts.map +1 -0
- package/dist/relayer.js +203 -0
- package/dist/relayer.js.map +1 -0
- package/dist/runtime-compatibility.d.ts +8 -0
- package/dist/runtime-compatibility.d.ts.map +1 -0
- package/dist/runtime-compatibility.js +23 -0
- package/dist/runtime-compatibility.js.map +1 -0
- package/dist/session-manager.d.ts +197 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +429 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/solana-ptlc.d.ts +64 -0
- package/dist/solana-ptlc.d.ts.map +1 -0
- package/dist/solana-ptlc.js +137 -0
- package/dist/solana-ptlc.js.map +1 -0
- package/dist/staking-client.d.ts +103 -0
- package/dist/staking-client.d.ts.map +1 -0
- package/dist/staking-client.js +308 -0
- package/dist/staking-client.js.map +1 -0
- package/dist/staking-types.d.ts +203 -0
- package/dist/staking-types.d.ts.map +1 -0
- package/dist/staking-types.js +16 -0
- package/dist/staking-types.js.map +1 -0
- package/dist/submit-tx.d.ts +14 -0
- package/dist/submit-tx.d.ts.map +1 -0
- package/dist/submit-tx.js +25 -0
- package/dist/submit-tx.js.map +1 -0
- package/dist/templates/index.d.ts +52 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +123 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/ton/index.d.ts +52 -0
- package/dist/ton/index.d.ts.map +1 -0
- package/dist/ton/index.js +163 -0
- package/dist/ton/index.js.map +1 -0
- package/dist/ton-relayer.d.ts +26 -0
- package/dist/ton-relayer.d.ts.map +1 -0
- package/dist/ton-relayer.js +22 -0
- package/dist/ton-relayer.js.map +1 -0
- package/dist/tracing.d.ts +48 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +108 -0
- package/dist/tracing.js.map +1 -0
- package/dist/transaction-signer.d.ts +13 -0
- package/dist/transaction-signer.d.ts.map +1 -0
- package/dist/transaction-signer.js +13 -0
- package/dist/transaction-signer.js.map +1 -0
- package/dist/trust-root.d.ts +56 -0
- package/dist/trust-root.d.ts.map +1 -0
- package/dist/trust-root.js +28 -0
- package/dist/trust-root.js.map +1 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validator-staking-client.d.ts +87 -0
- package/dist/validator-staking-client.d.ts.map +1 -0
- package/dist/validator-staking-client.js +226 -0
- package/dist/validator-staking-client.js.map +1 -0
- package/dist/virtuals-acp.d.ts +149 -0
- package/dist/virtuals-acp.d.ts.map +1 -0
- package/dist/virtuals-acp.js +418 -0
- package/dist/virtuals-acp.js.map +1 -0
- package/dist/wallet-manager.d.ts +199 -0
- package/dist/wallet-manager.d.ts.map +1 -0
- package/dist/wallet-manager.js +425 -0
- package/dist/wallet-manager.js.map +1 -0
- package/dist/wallets/burner.d.ts +45 -0
- package/dist/wallets/burner.d.ts.map +1 -0
- package/dist/wallets/burner.js +58 -0
- package/dist/wallets/burner.js.map +1 -0
- package/dist/wallets/index.d.ts +26 -0
- package/dist/wallets/index.d.ts.map +1 -0
- package/dist/wallets/index.js +20 -0
- package/dist/wallets/index.js.map +1 -0
- package/dist/wallets/injected.d.ts +22 -0
- package/dist/wallets/injected.d.ts.map +1 -0
- package/dist/wallets/injected.js +45 -0
- package/dist/wallets/injected.js.map +1 -0
- package/dist/wallets/ledger.d.ts +76 -0
- package/dist/wallets/ledger.d.ts.map +1 -0
- package/dist/wallets/ledger.js +106 -0
- package/dist/wallets/ledger.js.map +1 -0
- package/dist/wallets/near.d.ts +69 -0
- package/dist/wallets/near.d.ts.map +1 -0
- package/dist/wallets/near.js +101 -0
- package/dist/wallets/near.js.map +1 -0
- package/dist/wallets/types.d.ts +42 -0
- package/dist/wallets/types.d.ts.map +1 -0
- package/dist/wallets/types.js +31 -0
- package/dist/wallets/types.js.map +1 -0
- package/dist/wallets/walletconnect.d.ts +38 -0
- package/dist/wallets/walletconnect.d.ts.map +1 -0
- package/dist/wallets/walletconnect.js +94 -0
- package/dist/wallets/walletconnect.js.map +1 -0
- package/dist/watch-transaction.d.ts +26 -0
- package/dist/watch-transaction.d.ts.map +1 -0
- package/dist/watch-transaction.js +91 -0
- package/dist/watch-transaction.js.map +1 -0
- package/dist/weak-subjectivity.d.ts +213 -0
- package/dist/weak-subjectivity.d.ts.map +1 -0
- package/dist/weak-subjectivity.js +389 -0
- package/dist/weak-subjectivity.js.map +1 -0
- package/dist/x402-types/channel-types.d.ts +78 -0
- package/dist/x402-types/channel-types.d.ts.map +1 -0
- package/dist/x402-types/channel-types.js +5 -0
- package/dist/x402-types/channel-types.js.map +1 -0
- package/dist/x402-types/exact-flop.d.ts +29 -0
- package/dist/x402-types/exact-flop.d.ts.map +1 -0
- package/dist/x402-types/exact-flop.js +64 -0
- package/dist/x402-types/exact-flop.js.map +1 -0
- package/dist/x402-types/index.d.ts +65 -0
- package/dist/x402-types/index.d.ts.map +1 -0
- package/dist/x402-types/index.js +26 -0
- package/dist/x402-types/index.js.map +1 -0
- package/dist/x402.d.ts +113 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +218 -0
- package/dist/x402.js.map +1 -0
- package/package.json +172 -3
package/README.md
CHANGED
|
@@ -1,3 +1,674 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @flop-labs/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`FaucetClient.healthCheck()` reports the faucet's HTTP readiness as a boolean.
|
|
4
|
+
It returns `false` for HTTP 503 or a request failure, including a live faucet
|
|
5
|
+
whose caller IP classification has not been checked. This is not a process-liveness
|
|
6
|
+
or grant-eligibility test. The health GET does not request funds or classify the IP.
|
|
7
|
+
An explicit `requestFaucetFunding()` attempt performs admission and returns the
|
|
8
|
+
refusal reason and `retryAfterSeconds`; respect that delay before retrying.
|
|
9
|
+
Do not gate a user's explicit funding request solely on `healthCheck()`.
|
|
10
|
+
|
|
11
|
+
Ordinary HTLC creation requires a registered EconomicCritical appraisal profile.
|
|
12
|
+
Supply `tee_requirements` / `teeRequirements` as `{profile: {profile_id, version}, model_hash, measurement_hash}` (32-byte hex hashes), or its canonical 100-byte SCALE hex.
|
|
13
|
+
The runtime checks that the registered profile and immutable commitments match its policy; there is no simulator default.
|
|
14
|
+
For the examples, set `FLOP_HTLC_TEE_REQUIREMENTS` to that canonical hex from your network's registered profile.
|
|
15
|
+
|
|
16
|
+
TypeScript SDK for the FLOP Network — HTLC workflows, PoI proofs, and account management.
|
|
17
|
+
|
|
18
|
+
`SUPPORTED_SPEC_VERSIONS` in this source admits exactly `1013000`, `1014000`, `1014001`, `1014002`, `1014003`, `1014004`, `1014005`, `1014007`, `1014008`, `1014009`, `1014010`, `1014011`, `1014012`, `1014013`, `1014014`.
|
|
19
|
+
`SUPPORTED_SPEC_VERSION_RANGE` retains its exported shape as the envelope
|
|
20
|
+
`1013000..1014014`; admission requires exact membership (including no `1014006`). The published `0.4.0` executable stops at `1014011` and also excludes `1014006`;
|
|
21
|
+
its bundled README has stale connection and HTLC examples. These source corrections
|
|
22
|
+
are unreleased: installing `@latest` does not deliver them until a new version is
|
|
23
|
+
published. The examples below describe this source candidate. Qualification covers
|
|
24
|
+
runtime `1013000` at `44a5fedc88614b9a6e8c97605c2ec943faf47d9d`, the
|
|
25
|
+
registrar runtime `1014000` at `e4f01cc849fa6c768d5c0f9c111dffb450ea4fa9`
|
|
26
|
+
(PR #2726), runtime `1014001` at `de4e2779dbf6f8d25348953ce0992ef8e89756bd`
|
|
27
|
+
(PR #2803), runtime `1014002`, the #2637 devnet hybrid-verifier fast path, and runtime
|
|
28
|
+
`1014003` at `9035450361681a69c6c02c9c53e47351999ef6f8` (PR #3096). Candidate runtime
|
|
29
|
+
`1014004` (1.14.4, PR #3006) has source compatibility coverage for uploader-funded
|
|
30
|
+
qualification. Candidate runtime `1014005` (1.14.5) has source compatibility coverage for the
|
|
31
|
+
preactivation FCU name replacement; this does not qualify physical latency or deployment.
|
|
32
|
+
Candidate specs beyond `1014003` have source compatibility coverage; acceptance by
|
|
33
|
+
the SDK does not establish deployment or end-to-end inference qualification.
|
|
34
|
+
Other versions require separate qualification.
|
|
35
|
+
Every `FlopClient` connection path checks it. Unsupported runtime upgrades detected
|
|
36
|
+
by polkadot.js metadata events disconnect the API and make subsequent SDK operations
|
|
37
|
+
raise `FlopError` with code `RUNTIME_INCOMPATIBLE`, the qualified versions, and upgrade guidance.
|
|
38
|
+
Generated clients apply the same exact-version guard; explicit profile constraints can
|
|
39
|
+
narrow compatibility and require a spec name. Upgrade with `pnpm add @flop-labs/sdk@latest` to a release
|
|
40
|
+
supporting the chain's runtime; allowlist changes require compatibility validation.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @flop-labs/sdk
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Peer Dependencies
|
|
49
|
+
|
|
50
|
+
React is optional (only needed if using React hooks):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @flop-labs/sdk react # Optional: for React integration
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
The live devnet was checked at finalized block 2,764,673 on 3 November 2026:
|
|
59
|
+
spec `1014003`, with an empty `attest.profiles` registry. The HTLC example below
|
|
60
|
+
cannot run there until authorized governance registers its exact EconomicCritical
|
|
61
|
+
appraisal policy, verifier set and version. Neither simulator mode nor an arbitrary
|
|
62
|
+
profile ID supplies that prerequisite. Use `assertHtlcAppraisalProfile(api, hex)`
|
|
63
|
+
before signing; the runtime independently enforces the policy and commitments.
|
|
64
|
+
The three exported ghost/TOPLOC/DA profile references are not HTLC profiles.
|
|
65
|
+
|
|
66
|
+
For a direct compute-channel purchase, prepare and persist the original intent:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { FlopClient } from '@flop-labs/sdk';
|
|
70
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
71
|
+
|
|
72
|
+
const client = await FlopClient.createWithKeypair('wss://rpc.devnet.flop.network', keypair);
|
|
73
|
+
try {
|
|
74
|
+
// Run preparation once, in a private directory. The intent contains a session seed.
|
|
75
|
+
const intent = await client.prepareInferenceSession({ minerUrl, escrowFlop: 0.01, maxTurns: 1 });
|
|
76
|
+
await writeFile('purchase.json', JSON.stringify(intent), { flag: 'wx', mode: 0o600 });
|
|
77
|
+
const saved = JSON.parse(await readFile('purchase.json', 'utf8'));
|
|
78
|
+
const result = await client.buyInferenceSession({ intent: saved, prompt: 'Hello' });
|
|
79
|
+
console.log(result.channelId, result.status);
|
|
80
|
+
} finally { await client.disconnect(); }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
On restart, read the existing file and pass that intent; never run preparation
|
|
84
|
+
again for the same purchase. Hold exclusive ownership of the file while using it.
|
|
85
|
+
Alternatively, `buyInferenceSession` accepts an awaited `onPrepared` persistence
|
|
86
|
+
callback. Calls without an intent or callback stop before signing. This tightens
|
|
87
|
+
the former convenience API and needs a breaking-change release.
|
|
88
|
+
The SDK reads finalized state before submitting. A missing record is still an
|
|
89
|
+
unconfirmed outcome; resubmission retains the original channel nonce and key.
|
|
90
|
+
An existing channel stops with `INFERENCE_PURCHASE_UNCONFIRMED` and its public ID.
|
|
91
|
+
Even `Open` may have streamed off-chain turns: do not replay them with fresh counters.
|
|
92
|
+
Inspect settlement or recover the retained transcript; if an undelivered Open
|
|
93
|
+
channel exceeds its SLA, use the permissionless timeout path after confirming
|
|
94
|
+
eligibility. Retain the intent until recovery and settlement/refund are finalized.
|
|
95
|
+
Repeated extrinsics may still pay fees. `settlement_posted` opens a challenge
|
|
96
|
+
window and does not establish a finalized miner payment.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { FlopClient, createAgentWallet } from '@flop-labs/sdk';
|
|
100
|
+
|
|
101
|
+
// Connect to FLOP node
|
|
102
|
+
const client = await FlopClient.create({ endpoint: 'ws://127.0.0.1:9944', signer: '//Alice' });
|
|
103
|
+
|
|
104
|
+
// Check node health
|
|
105
|
+
const health = await client.health();
|
|
106
|
+
console.log('Node healthy:', health);
|
|
107
|
+
|
|
108
|
+
// Create an agent wallet
|
|
109
|
+
const wallet = await createAgentWallet(client.api, client.signer, {
|
|
110
|
+
agent: client.address,
|
|
111
|
+
dailyCap: 100n * 10n ** 18n,
|
|
112
|
+
perTxLimit: 5n * 10n ** 18n,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Create HTLC for inference purchase
|
|
116
|
+
const htlc = await client.createHtlc({
|
|
117
|
+
agent: 'my-agent',
|
|
118
|
+
task: {
|
|
119
|
+
model: 'llama-3-8b',
|
|
120
|
+
prompt: 'Hello, world!',
|
|
121
|
+
tee_requirements: process.env.FLOP_HTLC_TEE_REQUIREMENTS
|
|
122
|
+
},
|
|
123
|
+
rewardFlop: 5.0,
|
|
124
|
+
timeoutBlocks: 60
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log('HTLC created:', htlc.htlcId);
|
|
128
|
+
|
|
129
|
+
// Wait for settlement
|
|
130
|
+
const status = await client.waitForSettlement(htlc.hashLock);
|
|
131
|
+
console.log('Settlement:', status);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## API Reference
|
|
135
|
+
|
|
136
|
+
### FlopClient
|
|
137
|
+
|
|
138
|
+
Main client for interacting with the FLOP Network.
|
|
139
|
+
|
|
140
|
+
#### Connection factories
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
await FlopClient.create(options?: FlopClientOptions)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Options:**
|
|
147
|
+
- `endpoint` (string, optional): RPC endpoint URL. Default: `ws://127.0.0.1:9944`
|
|
148
|
+
- `signer` (string, optional): local signer URI; the `//Alice` default is for disposable local development only.
|
|
149
|
+
- `createWithKeypair(endpoint, keypair)`: connect using an existing decoded keypair.
|
|
150
|
+
|
|
151
|
+
#### Methods
|
|
152
|
+
|
|
153
|
+
##### `health()`
|
|
154
|
+
|
|
155
|
+
Check node health status.
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
await client.health();
|
|
159
|
+
// Returns: { isSyncing: boolean, peers: number, shouldHavePeers: boolean }
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
##### `createHtlc(params)`
|
|
163
|
+
|
|
164
|
+
Create a Hash Time Lock Contract for atomic inference purchase.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
await client.createHtlc({
|
|
168
|
+
agent: string,
|
|
169
|
+
task: ComputeTask,
|
|
170
|
+
rewardFlop: number,
|
|
171
|
+
timeoutBlocks: number,
|
|
172
|
+
hashLock?: string // Auto-generated if not provided
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Returns:**
|
|
177
|
+
```typescript
|
|
178
|
+
{
|
|
179
|
+
htlcId: string;
|
|
180
|
+
hashLock: string;
|
|
181
|
+
preImage: string;
|
|
182
|
+
txHash: string;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
##### `createCrossChainHtlc(params)`
|
|
187
|
+
|
|
188
|
+
Create a cross-chain HTLC for a FLOP ↔ BTC atomic swap (bilateral HTLC path). The
|
|
189
|
+
FLOP leg must outlive the counter-chain leg (timelock symmetry, enforced on-chain),
|
|
190
|
+
so `timeoutBlocks` is the longer leg and `btcTimelockHours` the shorter. USDT on
|
|
191
|
+
TON/TRON settles via NEAR Intents instead — see `docs/bridge/settlement.md`.
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
await client.createCrossChainHtlc({
|
|
195
|
+
agent: string,
|
|
196
|
+
task: ComputeTask,
|
|
197
|
+
rewardFlop: number,
|
|
198
|
+
btcAddress: string,
|
|
199
|
+
btcAmountSats: number | bigint,
|
|
200
|
+
timeoutBlocks?: number, // FLOP side, default 7200 (~2h)
|
|
201
|
+
btcTimelockHours?: number, // counter-chain side, default 1
|
|
202
|
+
hashLock?: string // auto-generated if omitted
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
##### `checkHtlcStatus(hashLock)`
|
|
207
|
+
|
|
208
|
+
Query HTLC status by hash lock.
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
await client.checkHtlcStatus('0x...');
|
|
212
|
+
// Returns: HtlcInfo | null (RPC fields include reward_amount and timeout_block)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
##### `waitForSettlement(hashLock, timeoutMs?, pollIntervalMs?)`
|
|
216
|
+
|
|
217
|
+
Poll HTLC until settled or timeout.
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
await client.waitForSettlement('0x...', 30_000, 1_000);
|
|
221
|
+
// Returns: HtlcInfo with status SETTLED or REFUNDED, or null on polling timeout.
|
|
222
|
+
// null does not refund funds; reconcile the original HTLC before retrying.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
##### `getBalance(address?)`
|
|
226
|
+
|
|
227
|
+
Get account balance in FLOP tokens.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
await client.getBalance(); // Defaults to the connected account's SS58 address.
|
|
231
|
+
// Returns: string (human-readable FLOP, preserving decimal precision)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
##### `submitPoUI(proofs, gnWeight, taskHash)`
|
|
235
|
+
|
|
236
|
+
Submit TEE-verified PoI proof batch.
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
await client.submitPoUI(proofs, 1450, '0x...');
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
##### `getAccountInfo(address)`
|
|
243
|
+
|
|
244
|
+
Get account information including nonce and metadata.
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
await client.getAccountInfo('flop1qyq...');
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
##### `getComputeTask(taskId)`
|
|
251
|
+
|
|
252
|
+
Get compute task details.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
await client.getComputeTask('task_0x...');
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
##### `getTeeQuote(task)`
|
|
259
|
+
|
|
260
|
+
Get TEE quote for compute task.
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
await client.getTeeQuote({ model: 'llama-3-8b', prompt: '...' });
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Agent Wallet
|
|
267
|
+
|
|
268
|
+
Create and manage agent wallets with session keys.
|
|
269
|
+
|
|
270
|
+
#### `createAgentWallet(api, signer, options)`
|
|
271
|
+
|
|
272
|
+
Create a new agent wallet.
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
import { createAgentWallet } from '@flop-labs/sdk';
|
|
276
|
+
|
|
277
|
+
const walletTxHash = await createAgentWallet(client.api, client.signer, {
|
|
278
|
+
agent: agentAddress, // Existing agent SS58 account, distinct from the owner.
|
|
279
|
+
dailyCap: 100n * 10n ** 18n,
|
|
280
|
+
perTxLimit: 5n * 10n ** 18n,
|
|
281
|
+
});
|
|
282
|
+
// Returns the transaction hash, not a wallet object.
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### `fundAgentWallet(api, signer, agent, amountRaw)`
|
|
286
|
+
|
|
287
|
+
Fund an agent wallet from owner account.
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { fundAgentWallet } from '@flop-labs/sdk';
|
|
291
|
+
|
|
292
|
+
await fundAgentWallet(client.api, client.signer, agentAddress, 50n * 10n ** 18n);
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### `agentTransfer(client, fromWallet, toAddress, amount)`
|
|
296
|
+
|
|
297
|
+
Transfer funds between agent wallets.
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
import { agentTransfer } from '@flop-labs/sdk';
|
|
301
|
+
|
|
302
|
+
await agentTransfer(client, 'flop1agent1...', 'flop1agent2...', 10.0);
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### `ownerWithdraw(client, walletAddress, amount)`
|
|
306
|
+
|
|
307
|
+
Withdraw funds from agent wallet to owner account.
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
import { ownerWithdraw } from '@flop-labs/sdk';
|
|
311
|
+
|
|
312
|
+
await ownerWithdraw(client, 'flop1agent...', 25.0);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### `createSession(client, walletAddress, options)`
|
|
316
|
+
|
|
317
|
+
Create a session key with spending limits.
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import { createSession } from '@flop-labs/sdk';
|
|
321
|
+
|
|
322
|
+
const session = await createSession(client, 'flop1agent...', {
|
|
323
|
+
spendingLimit: 10.0,
|
|
324
|
+
expiresAt: Date.now() + 3600000 // 1 hour
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### `executeViaSession(client, sessionKey, call)`
|
|
329
|
+
|
|
330
|
+
Execute a call using session key.
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
import { executeViaSession } from '@flop-labs/sdk';
|
|
334
|
+
|
|
335
|
+
await executeViaSession(client, sessionKey, {
|
|
336
|
+
pallet: 'htlc',
|
|
337
|
+
method: 'create',
|
|
338
|
+
args: { ... }
|
|
339
|
+
});
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### x402 Payment Protocol
|
|
343
|
+
|
|
344
|
+
Utilities for x402 payment headers.
|
|
345
|
+
|
|
346
|
+
#### `x402Fetch(url, options, paymentParams)`
|
|
347
|
+
|
|
348
|
+
Fetch with x402 payment headers.
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
import { x402Fetch } from '@flop-labs/sdk';
|
|
352
|
+
|
|
353
|
+
const response = await x402Fetch('https://api.example.com/inference', {
|
|
354
|
+
method: 'POST',
|
|
355
|
+
body: JSON.stringify({ prompt: '...' })
|
|
356
|
+
}, {
|
|
357
|
+
amount: 5.0,
|
|
358
|
+
recipient: 'flop1qyq...'
|
|
359
|
+
});
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### `parsePaymentHeaders(headers)`
|
|
363
|
+
|
|
364
|
+
Parse x402 payment headers from response.
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
import { parsePaymentHeaders } from '@flop-labs/sdk';
|
|
368
|
+
|
|
369
|
+
const payment = parsePaymentHeaders(response.headers);
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Named-miner sessions
|
|
373
|
+
|
|
374
|
+
`runDirectSession({ api, signer, miner, model, endpoint, prompt, maxFlop, maxTokens })`
|
|
375
|
+
opens a channel on the named miner, verifies its identity and signed response, and
|
|
376
|
+
settles or recovers escrow. `maxFlop` is raw chain units; `maxTokens` is a positive
|
|
377
|
+
safe integer and defaults to 256 completion tokens. The request carries that limit
|
|
378
|
+
in the chat envelope bound by the verified receipt. Inspect `receipts[0].finishReason` and
|
|
379
|
+
`completionTokens` for truncation. The 60-second turn deadline remains in force;
|
|
380
|
+
larger token budgets do not extend it. Settlement separately waits for the channel's
|
|
381
|
+
finalized calibration allowance before submitting payment. Cooperative delivery and
|
|
382
|
+
finalized-event discovery each have a bounded 60-second window. Expired channels use
|
|
383
|
+
timeout recovery. If the result is unknown, retain the channel ID and inspect finalized
|
|
384
|
+
channel state and terminal events before retrying; a closed channel alone does not prove
|
|
385
|
+
successful settlement. A zero-turn force-open can be expired after its acknowledgement
|
|
386
|
+
deadline, and an open channel can be timed out after its lifetime.
|
|
387
|
+
|
|
388
|
+
### Session Estimation (compute channel)
|
|
389
|
+
|
|
390
|
+
Size a compute-channel session before opening it, entirely off chain, using the chain's own meter:
|
|
391
|
+
|
|
392
|
+
- `computeChannel.estimateSession` turns a turn profile into `G_n`, minimum blocks, channel count and escrow.
|
|
393
|
+
- `computeChannel.sessionPrior` returns P50/P90/P99 profiles for a task you have not run yet.
|
|
394
|
+
- `computeChannel.calibrateSessionPrior` fits that prior to your model and agent configuration from about 10 probe runs.
|
|
395
|
+
- `computeChannel.reforecastSession` updates the quantiles mid-run.
|
|
396
|
+
|
|
397
|
+
See the [session estimation guide](https://github.com/flop-labs/flop-core/blob/main/docs/sdk/session-estimation.md).
|
|
398
|
+
|
|
399
|
+
### React Hooks (Optional)
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
import { useFlopClient, useWalletBalance, useHtlcStatus } from '@flop-labs/sdk/react';
|
|
403
|
+
|
|
404
|
+
function MyComponent() {
|
|
405
|
+
const client = useFlopClient('http://127.0.0.1:16111/rpc');
|
|
406
|
+
const { balance } = useWalletBalance(client, 'flop1qyq...');
|
|
407
|
+
const { status } = useHtlcStatus(client, '0x...');
|
|
408
|
+
|
|
409
|
+
return <div>Balance: {balance} FLOP</div>;
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Types
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
interface ComputeTask {
|
|
417
|
+
model: string;
|
|
418
|
+
prompt: string;
|
|
419
|
+
maxTokens?: number;
|
|
420
|
+
temperature?: number;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
type HtlcInfo = import('@flop-labs/sdk').HtlcInfo;
|
|
424
|
+
|
|
425
|
+
interface PoUISubmission {
|
|
426
|
+
proofHash: string;
|
|
427
|
+
gnMeasured: number;
|
|
428
|
+
teeQuote: string;
|
|
429
|
+
timestamp: number;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
interface WalletInfo {
|
|
433
|
+
address: string;
|
|
434
|
+
balance: number;
|
|
435
|
+
dailyLimit: number;
|
|
436
|
+
dailySpent: number;
|
|
437
|
+
allowedPallets: string[];
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## Error Handling
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
import { FlopClient, FlopError } from '@flop-labs/sdk';
|
|
445
|
+
|
|
446
|
+
let client: FlopClient | undefined;
|
|
447
|
+
try {
|
|
448
|
+
client = await FlopClient.create({ endpoint: 'ws://127.0.0.1:9944', signer: '//Alice' });
|
|
449
|
+
console.log(await client.health());
|
|
450
|
+
} catch (error: unknown) {
|
|
451
|
+
if (error instanceof FlopError) {
|
|
452
|
+
// Includes RUNTIME_INCOMPATIBLE raised while awaiting the connection factory.
|
|
453
|
+
console.error(error.code, error.message);
|
|
454
|
+
} else if (error instanceof Error) {
|
|
455
|
+
console.error(error.message);
|
|
456
|
+
} else {
|
|
457
|
+
console.error('Unexpected error:', error);
|
|
458
|
+
}
|
|
459
|
+
} finally {
|
|
460
|
+
await client?.disconnect();
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Complete Example
|
|
465
|
+
|
|
466
|
+
This source example uses the public, well-known `//Alice` key only on a disposable
|
|
467
|
+
local chain. Set `FLOP_AGENT_ADDRESS` to the agent's SS58 account and
|
|
468
|
+
`FLOP_HTLC_TEE_REQUIREMENTS` to the registered appraisal requirements matching
|
|
469
|
+
the model used below. Use a private working directory. The HTLC recovery file is created exclusively before
|
|
470
|
+
transactions; retain it on errors and reconcile its original hash lock before
|
|
471
|
+
resuming, rather than rerunning this one-time setup. Never log its pre-image.
|
|
472
|
+
|
|
473
|
+
```typescript
|
|
474
|
+
import { writeFile } from 'node:fs/promises';
|
|
475
|
+
import { FlopClient, assertHtlcAppraisalProfile, createAgentWallet, fundAgentWallet } from '@flop-labs/sdk';
|
|
476
|
+
|
|
477
|
+
async function main() {
|
|
478
|
+
const agentAddress = process.env.FLOP_AGENT_ADDRESS;
|
|
479
|
+
const teeRequirements = process.env.FLOP_HTLC_TEE_REQUIREMENTS;
|
|
480
|
+
if (!agentAddress || !teeRequirements) throw new Error('Set the agent address and registered HTLC appraisal requirements');
|
|
481
|
+
const client = await FlopClient.create({ endpoint: 'ws://127.0.0.1:9944', signer: '//Alice' });
|
|
482
|
+
try {
|
|
483
|
+
await assertHtlcAppraisalProfile(client.api, teeRequirements);
|
|
484
|
+
const { preImage, hashLock } = FlopClient.generateSecrets();
|
|
485
|
+
await writeFile('htlc-purchase.json', JSON.stringify({ preImage, hashLock }) + '\n', { flag: 'wx', mode: 0o600 });
|
|
486
|
+
|
|
487
|
+
const FLOP = 10n ** 18n;
|
|
488
|
+
const walletTxHash = await createAgentWallet(client.api, client.signer, {
|
|
489
|
+
agent: agentAddress,
|
|
490
|
+
dailyCap: 100n * FLOP,
|
|
491
|
+
perTxLimit: 5n * FLOP,
|
|
492
|
+
});
|
|
493
|
+
console.log('Wallet creation transaction:', walletTxHash);
|
|
494
|
+
await fundAgentWallet(client.api, client.signer, agentAddress, 50n * FLOP);
|
|
495
|
+
|
|
496
|
+
// This direct HTLC uses the owner's balance, separately from the agent wallet.
|
|
497
|
+
const htlc = await client.createHtlc({
|
|
498
|
+
agent: agentAddress,
|
|
499
|
+
task: { model: 'llama-3-8b', prompt: 'Analyze BTC price trend', tee_requirements: teeRequirements },
|
|
500
|
+
rewardFlop: 5.0,
|
|
501
|
+
timeoutBlocks: 60,
|
|
502
|
+
hashLock,
|
|
503
|
+
});
|
|
504
|
+
console.log('HTLC created:', htlc.htlcId);
|
|
505
|
+
|
|
506
|
+
const settlement = await client.waitForSettlement(hashLock, 30_000, 1_000);
|
|
507
|
+
if (settlement?.status === 'SETTLED') {
|
|
508
|
+
console.log('Node reports settlement:', settlement.miner, settlement.gn_used);
|
|
509
|
+
} else if (settlement?.status === 'REFUNDED') {
|
|
510
|
+
console.log('Node reports a refund; confirm finality before treating it as complete');
|
|
511
|
+
} else {
|
|
512
|
+
console.log('Unconfirmed: polling timed out without a refund. Keep the original intent and reconcile chain state');
|
|
513
|
+
}
|
|
514
|
+
} finally {
|
|
515
|
+
await client.disconnect();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
main().catch(console.error);
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## Development
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
# Install dependencies
|
|
526
|
+
npm install
|
|
527
|
+
|
|
528
|
+
# Build the SDK
|
|
529
|
+
npm run build
|
|
530
|
+
|
|
531
|
+
# Watch mode
|
|
532
|
+
npm run dev
|
|
533
|
+
|
|
534
|
+
# Clean build artifacts
|
|
535
|
+
npm clean
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## License
|
|
539
|
+
|
|
540
|
+
Apache-2.0 © FLOP Network
|
|
541
|
+
|
|
542
|
+
## NVIDIA GPU Operators
|
|
543
|
+
|
|
544
|
+
For miners operating NVIDIA GPUs to earn rewards, see the complete guide:
|
|
545
|
+
|
|
546
|
+
- **[Run a FLOP miner on a GPU host](https://ask.flop.finance/docs/run-miner)** - Mining setup and workflows
|
|
547
|
+
- [Put your GPU to work on FLOP](https://ask.flop.finance/docs/run-gpu-provider) - Plain-language start for GPU owners new to crypto
|
|
548
|
+
|
|
549
|
+
Quick example for GPU operators:
|
|
550
|
+
|
|
551
|
+
```typescript
|
|
552
|
+
import { FlopClient, type TeeQuote } from '@flop-labs/sdk';
|
|
553
|
+
|
|
554
|
+
// Connect as miner
|
|
555
|
+
const client = await FlopClient.create({
|
|
556
|
+
endpoint: 'ws://127.0.0.1:9944',
|
|
557
|
+
signer: '//Miner'
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// Monitor for HTLCs
|
|
561
|
+
const htlc = await client.checkHtlcStatus(hashLock);
|
|
562
|
+
if (htlc && htlc.status === 'CREATED') {
|
|
563
|
+
// Execute inference on NVIDIA GPU
|
|
564
|
+
const result = await executeOnGpu(htlc.task); // Your GPU execution logic
|
|
565
|
+
|
|
566
|
+
// Generate TEE quote
|
|
567
|
+
const teeQuote: TeeQuote = {
|
|
568
|
+
version: '1.0',
|
|
569
|
+
miner_address: client.address,
|
|
570
|
+
task_reference: {
|
|
571
|
+
htlc_hash_lock: htlc.hashLock,
|
|
572
|
+
model_hash: `sha256:${htlc.task.model}`,
|
|
573
|
+
task_timestamp: Math.floor(Date.now() / 1000),
|
|
574
|
+
},
|
|
575
|
+
compute_output: {
|
|
576
|
+
gn_weight: result.gnWeight, // G_n weight (BFLOPs)
|
|
577
|
+
execution_time_ms: result.executionTime,
|
|
578
|
+
encrypted_result: result.encryptedOutput,
|
|
579
|
+
},
|
|
580
|
+
attestation: {
|
|
581
|
+
tee_type: 'NVIDIA_HOPPER_CC', // or 'NVIDIA_RUBIN_CC', 'CPU_WRAPPED_TEE'
|
|
582
|
+
hardware_pubkey: hardwarePubkey,
|
|
583
|
+
quote_hex: teeQuoteHex,
|
|
584
|
+
signature: minerSignature,
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// Redeem HTLC with TEE quote
|
|
589
|
+
const txHash = await client.redeemHtlc(
|
|
590
|
+
htlc.htlcId,
|
|
591
|
+
preImage,
|
|
592
|
+
teeQuote,
|
|
593
|
+
);
|
|
594
|
+
console.log('✓ HTLC redeemed:', txHash);
|
|
595
|
+
|
|
596
|
+
// Submit PoUI proof batch (optional, for additional rewards)
|
|
597
|
+
const proofs = generateStarkProofs(result);
|
|
598
|
+
const taskHash = generateTaskHash(htlc);
|
|
599
|
+
const proofTxHash = await client.submitPoUI(proofs, result.gnWeight, taskHash);
|
|
600
|
+
console.log('✓ PoUI proof submitted:', proofTxHash);
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### TEE Quote Format
|
|
605
|
+
|
|
606
|
+
```typescript
|
|
607
|
+
interface TeeQuote {
|
|
608
|
+
version: string; // "1.0"
|
|
609
|
+
miner_address: string; // flop1... address
|
|
610
|
+
task_reference: {
|
|
611
|
+
htlc_hash_lock: string; // HTLC identifier
|
|
612
|
+
model_hash: string; // sha256:model...
|
|
613
|
+
task_timestamp: number; // Unix timestamp (seconds)
|
|
614
|
+
};
|
|
615
|
+
compute_output: {
|
|
616
|
+
gn_weight: number; // G_n weight (BFLOPs)
|
|
617
|
+
execution_time_ms: number;
|
|
618
|
+
encrypted_result: string; // 0x... encrypted output
|
|
619
|
+
};
|
|
620
|
+
attestation: {
|
|
621
|
+
tee_type: string; // "NVIDIA_HOPPER_CC" | "NVIDIA_RUBIN_CC" | "CPU_WRAPPED_TEE"
|
|
622
|
+
hardware_pubkey: string; // 0x... hardware public key
|
|
623
|
+
quote_hex: string; // 0x... raw TEE quote
|
|
624
|
+
signature: string; // 0x... miner signature
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Supported TEE Types
|
|
630
|
+
|
|
631
|
+
| TEE Type | Hardware | Production Ready |
|
|
632
|
+
|----------|----------|------------------|
|
|
633
|
+
| `NVIDIA_HOPPER_CC` | H100, H200 | ✅ Yes |
|
|
634
|
+
| `NVIDIA_RUBIN_CC` | B100, B200 | ✅ Yes |
|
|
635
|
+
| `CPU_WRAPPED_TEE` | RTX 4090+ + AMD SEV/Intel TDX | ⚠️ Testnet only |
|
|
636
|
+
|
|
637
|
+
### TEE Verification
|
|
638
|
+
|
|
639
|
+
The TEE bridge validates quotes with:
|
|
640
|
+
|
|
641
|
+
- **Timestamp freshness:** Quotes must be < 60 seconds old
|
|
642
|
+
- **Signature verification:** Validates miner signature
|
|
643
|
+
- **Replay protection:** Tracks task hashes to prevent double-spending
|
|
644
|
+
- **Hardware verification:** Checks hardware keys against registry (production only)
|
|
645
|
+
|
|
646
|
+
```typescript
|
|
647
|
+
import { verifyTeeQuote, type PouiPayload } from '@flop-labs/sdk/tee';
|
|
648
|
+
|
|
649
|
+
const bridge = new TeeBridge({ simulatorMode: false });
|
|
650
|
+
|
|
651
|
+
// Register known hardware keys (production)
|
|
652
|
+
bridge.registerHardwareKey('0x...');
|
|
653
|
+
|
|
654
|
+
// Verify TEE quote
|
|
655
|
+
const payload: PouiPayload = parseTeeQuote(quoteJson);
|
|
656
|
+
const result = await bridge.verify(payload);
|
|
657
|
+
|
|
658
|
+
if (result.valid) {
|
|
659
|
+
console.log(`✓ TEE verified: ${result.gnWeight} G_n`);
|
|
660
|
+
} else {
|
|
661
|
+
console.error(`✗ Verification failed: ${result.error}`);
|
|
662
|
+
}
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
For complete setup instructions, hardware requirements, and production deployment guide:
|
|
666
|
+
|
|
667
|
+
- **[Run a FLOP miner on a GPU host](https://ask.flop.finance/docs/run-miner)** - Production setup and workflows
|
|
668
|
+
- **[Put your GPU to work on FLOP](https://ask.flop.finance/docs/run-gpu-provider)** - Plain-language start for GPU owners: hardware, account, deposit, access
|
|
669
|
+
|
|
670
|
+
## Links
|
|
671
|
+
|
|
672
|
+
- [FLOP documentation](https://ask.flop.finance/docs/what-is-flop)
|
|
673
|
+
- [Operator configuration and RPC reference](https://ask.flop.finance/docs/operator-config-reference)
|
|
674
|
+
- [Agent accounts and spend control](https://ask.flop.finance/docs/agent-accounts-and-spend-control)
|