@agirails/sdk 2.0.1-beta → 2.0.2
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/LICENSE +190 -0
- package/README.md +116 -108
- package/bin/actp +10 -0
- package/dist/ACTPClient.d.ts +456 -33
- package/dist/ACTPClient.d.ts.map +1 -1
- package/dist/ACTPClient.js +477 -93
- package/dist/ACTPClient.js.map +1 -1
- package/dist/abi/AgentRegistry.json +782 -0
- package/dist/abi/EscrowVault.json +106 -38
- package/dist/abi/IdentityRegistry.json +316 -0
- package/dist/adapters/BaseAdapter.d.ts +231 -0
- package/dist/adapters/BaseAdapter.d.ts.map +1 -0
- package/dist/adapters/BaseAdapter.js +393 -0
- package/dist/adapters/BaseAdapter.js.map +1 -0
- package/dist/adapters/BeginnerAdapter.d.ts +152 -0
- package/dist/adapters/BeginnerAdapter.d.ts.map +1 -0
- package/dist/adapters/BeginnerAdapter.js +168 -0
- package/dist/adapters/BeginnerAdapter.js.map +1 -0
- package/dist/adapters/IntermediateAdapter.d.ts +211 -0
- package/dist/adapters/IntermediateAdapter.d.ts.map +1 -0
- package/dist/adapters/IntermediateAdapter.js +260 -0
- package/dist/adapters/IntermediateAdapter.js.map +1 -0
- package/dist/adapters/index.d.ts +15 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +26 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/builders/DeliveryProofBuilder.d.ts +60 -1
- package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
- package/dist/builders/DeliveryProofBuilder.js +81 -5
- package/dist/builders/DeliveryProofBuilder.js.map +1 -1
- package/dist/builders/QuoteBuilder.d.ts +101 -0
- package/dist/builders/QuoteBuilder.d.ts.map +1 -1
- package/dist/builders/QuoteBuilder.js +120 -3
- package/dist/builders/QuoteBuilder.js.map +1 -1
- package/dist/builders/index.d.ts +4 -0
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +4 -0
- package/dist/builders/index.js.map +1 -1
- package/dist/cli/commands/balance.d.ts +13 -0
- package/dist/cli/commands/balance.d.ts.map +1 -0
- package/dist/cli/commands/balance.js +89 -0
- package/dist/cli/commands/balance.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +24 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +424 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/config.d.ts +13 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +192 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/init.d.ts +19 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +143 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/mint.d.ts +13 -0
- package/dist/cli/commands/mint.d.ts.map +1 -0
- package/dist/cli/commands/mint.js +91 -0
- package/dist/cli/commands/mint.js.map +1 -0
- package/dist/cli/commands/pay.d.ts +18 -0
- package/dist/cli/commands/pay.d.ts.map +1 -0
- package/dist/cli/commands/pay.js +87 -0
- package/dist/cli/commands/pay.js.map +1 -0
- package/dist/cli/commands/simulate.d.ts +32 -0
- package/dist/cli/commands/simulate.d.ts.map +1 -0
- package/dist/cli/commands/simulate.js +290 -0
- package/dist/cli/commands/simulate.js.map +1 -0
- package/dist/cli/commands/time.d.ts +29 -0
- package/dist/cli/commands/time.d.ts.map +1 -0
- package/dist/cli/commands/time.js +252 -0
- package/dist/cli/commands/time.js.map +1 -0
- package/dist/cli/commands/tx.d.ts +16 -0
- package/dist/cli/commands/tx.d.ts.map +1 -0
- package/dist/cli/commands/tx.js +379 -0
- package/dist/cli/commands/tx.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +20 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +160 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +104 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/client.d.ts +70 -0
- package/dist/cli/utils/client.d.ts.map +1 -0
- package/dist/cli/utils/client.js +240 -0
- package/dist/cli/utils/client.js.map +1 -0
- package/dist/cli/utils/config.d.ts +91 -0
- package/dist/cli/utils/config.d.ts.map +1 -0
- package/dist/cli/utils/config.js +240 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/cli/utils/output.d.ts +174 -0
- package/dist/cli/utils/output.d.ts.map +1 -0
- package/dist/cli/utils/output.js +380 -0
- package/dist/cli/utils/output.js.map +1 -0
- package/dist/config/networks.d.ts +28 -0
- package/dist/config/networks.d.ts.map +1 -1
- package/dist/config/networks.js +60 -12
- package/dist/config/networks.js.map +1 -1
- package/dist/errors/index.d.ts +165 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +260 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/index.d.ts +61 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -36
- package/dist/index.js.map +1 -1
- package/dist/level0/Provider.d.ts +106 -0
- package/dist/level0/Provider.d.ts.map +1 -0
- package/dist/level0/Provider.js +10 -0
- package/dist/level0/Provider.js.map +1 -0
- package/dist/level0/ServiceDirectory.d.ts +74 -0
- package/dist/level0/ServiceDirectory.d.ts.map +1 -0
- package/dist/level0/ServiceDirectory.js +122 -0
- package/dist/level0/ServiceDirectory.js.map +1 -0
- package/dist/level0/index.d.ts +10 -0
- package/dist/level0/index.d.ts.map +1 -0
- package/dist/level0/index.js +15 -0
- package/dist/level0/index.js.map +1 -0
- package/dist/level0/provide.d.ts +51 -0
- package/dist/level0/provide.d.ts.map +1 -0
- package/dist/level0/provide.js +113 -0
- package/dist/level0/provide.js.map +1 -0
- package/dist/level0/request.d.ts +53 -0
- package/dist/level0/request.d.ts.map +1 -0
- package/dist/level0/request.js +462 -0
- package/dist/level0/request.js.map +1 -0
- package/dist/level1/Agent.d.ts +472 -0
- package/dist/level1/Agent.d.ts.map +1 -0
- package/dist/level1/Agent.js +1091 -0
- package/dist/level1/Agent.js.map +1 -0
- package/dist/level1/index.d.ts +10 -0
- package/dist/level1/index.d.ts.map +1 -0
- package/dist/level1/index.js +30 -0
- package/dist/level1/index.js.map +1 -0
- package/dist/level1/pricing/PriceCalculator.d.ts +62 -0
- package/dist/level1/pricing/PriceCalculator.d.ts.map +1 -0
- package/dist/level1/pricing/PriceCalculator.js +237 -0
- package/dist/level1/pricing/PriceCalculator.js.map +1 -0
- package/dist/level1/pricing/PricingStrategy.d.ts +179 -0
- package/dist/level1/pricing/PricingStrategy.d.ts.map +1 -0
- package/dist/level1/pricing/PricingStrategy.js +11 -0
- package/dist/level1/pricing/PricingStrategy.js.map +1 -0
- package/dist/level1/types/Job.d.ts +166 -0
- package/dist/level1/types/Job.d.ts.map +1 -0
- package/dist/level1/types/Job.js +11 -0
- package/dist/level1/types/Job.js.map +1 -0
- package/dist/level1/types/Options.d.ts +258 -0
- package/dist/level1/types/Options.d.ts.map +1 -0
- package/dist/level1/types/Options.js +8 -0
- package/dist/level1/types/Options.js.map +1 -0
- package/dist/level1/types/index.d.ts +8 -0
- package/dist/level1/types/index.d.ts.map +1 -0
- package/dist/level1/types/index.js +8 -0
- package/dist/level1/types/index.js.map +1 -0
- package/dist/protocol/ACTPKernel.d.ts +229 -2
- package/dist/protocol/ACTPKernel.d.ts.map +1 -1
- package/dist/protocol/ACTPKernel.js +367 -33
- package/dist/protocol/ACTPKernel.js.map +1 -1
- package/dist/protocol/AgentRegistry.d.ts +177 -0
- package/dist/protocol/AgentRegistry.d.ts.map +1 -0
- package/dist/protocol/AgentRegistry.js +449 -0
- package/dist/protocol/AgentRegistry.js.map +1 -0
- package/dist/protocol/DIDManager.d.ts +289 -0
- package/dist/protocol/DIDManager.d.ts.map +1 -0
- package/dist/protocol/DIDManager.js +481 -0
- package/dist/protocol/DIDManager.js.map +1 -0
- package/dist/protocol/DIDResolver.d.ts +236 -0
- package/dist/protocol/DIDResolver.d.ts.map +1 -0
- package/dist/protocol/DIDResolver.js +495 -0
- package/dist/protocol/DIDResolver.js.map +1 -0
- package/dist/protocol/EASHelper.d.ts +57 -2
- package/dist/protocol/EASHelper.d.ts.map +1 -1
- package/dist/protocol/EASHelper.js +230 -37
- package/dist/protocol/EASHelper.js.map +1 -1
- package/dist/protocol/EscrowVault.d.ts +93 -2
- package/dist/protocol/EscrowVault.d.ts.map +1 -1
- package/dist/protocol/EscrowVault.js +122 -33
- package/dist/protocol/EscrowVault.js.map +1 -1
- package/dist/protocol/EventMonitor.d.ts +45 -1
- package/dist/protocol/EventMonitor.d.ts.map +1 -1
- package/dist/protocol/EventMonitor.js +64 -8
- package/dist/protocol/EventMonitor.js.map +1 -1
- package/dist/protocol/MessageSigner.d.ts +116 -2
- package/dist/protocol/MessageSigner.d.ts.map +1 -1
- package/dist/protocol/MessageSigner.js +215 -9
- package/dist/protocol/MessageSigner.js.map +1 -1
- package/dist/protocol/ProofGenerator.d.ts +93 -0
- package/dist/protocol/ProofGenerator.d.ts.map +1 -1
- package/dist/protocol/ProofGenerator.js +194 -9
- package/dist/protocol/ProofGenerator.js.map +1 -1
- package/dist/protocol/QuoteBuilder.d.ts +8 -0
- package/dist/protocol/QuoteBuilder.d.ts.map +1 -1
- package/dist/protocol/QuoteBuilder.js +8 -0
- package/dist/protocol/QuoteBuilder.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts +360 -0
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -0
- package/dist/runtime/BlockchainRuntime.js +767 -0
- package/dist/runtime/BlockchainRuntime.js.map +1 -0
- package/dist/runtime/IACTPRuntime.d.ts +271 -0
- package/dist/runtime/IACTPRuntime.d.ts.map +1 -0
- package/dist/runtime/IACTPRuntime.js +15 -0
- package/dist/runtime/IACTPRuntime.js.map +1 -0
- package/dist/runtime/MockRuntime.d.ts +445 -0
- package/dist/runtime/MockRuntime.d.ts.map +1 -0
- package/dist/runtime/MockRuntime.js +1065 -0
- package/dist/runtime/MockRuntime.js.map +1 -0
- package/dist/runtime/MockStateManager.d.ts +233 -0
- package/dist/runtime/MockStateManager.d.ts.map +1 -0
- package/dist/runtime/MockStateManager.js +533 -0
- package/dist/runtime/MockStateManager.js.map +1 -0
- package/dist/runtime/index.d.ts +14 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +42 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/types/MockState.d.ts +167 -0
- package/dist/runtime/types/MockState.d.ts.map +1 -0
- package/dist/runtime/types/MockState.js +43 -0
- package/dist/runtime/types/MockState.js.map +1 -0
- package/dist/types/agent.d.ts +76 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +8 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/did.d.ts +192 -0
- package/dist/types/did.d.ts.map +1 -0
- package/dist/types/did.js +38 -0
- package/dist/types/did.js.map +1 -0
- package/dist/types/eip712.d.ts +34 -0
- package/dist/types/eip712.d.ts.map +1 -1
- package/dist/types/eip712.js +31 -5
- package/dist/types/eip712.js.map +1 -1
- package/dist/types/escrow.d.ts +17 -10
- package/dist/types/escrow.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/message.d.ts +32 -0
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js +4 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/state.d.ts +28 -0
- package/dist/types/state.d.ts.map +1 -1
- package/dist/types/state.js +37 -6
- package/dist/types/state.js.map +1 -1
- package/dist/types/transaction.d.ts +17 -0
- package/dist/types/transaction.d.ts.map +1 -1
- package/dist/utils/ErrorRecoveryGuide.d.ts +125 -0
- package/dist/utils/ErrorRecoveryGuide.d.ts.map +1 -0
- package/dist/utils/ErrorRecoveryGuide.js +579 -0
- package/dist/utils/ErrorRecoveryGuide.js.map +1 -0
- package/dist/utils/Helpers.d.ts +453 -0
- package/dist/utils/Helpers.d.ts.map +1 -0
- package/dist/utils/Helpers.js +623 -0
- package/dist/utils/Helpers.js.map +1 -0
- package/dist/utils/IPFSClient.d.ts +113 -0
- package/dist/utils/IPFSClient.d.ts.map +1 -1
- package/dist/utils/IPFSClient.js +128 -7
- package/dist/utils/IPFSClient.js.map +1 -1
- package/dist/utils/Logger.d.ts +195 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +382 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/NonceManager.d.ts +234 -1
- package/dist/utils/NonceManager.d.ts.map +1 -1
- package/dist/utils/NonceManager.js +372 -7
- package/dist/utils/NonceManager.js.map +1 -1
- package/dist/utils/RateLimiter.d.ts +253 -0
- package/dist/utils/RateLimiter.d.ts.map +1 -0
- package/dist/utils/RateLimiter.js +424 -0
- package/dist/utils/RateLimiter.js.map +1 -0
- package/dist/utils/ReceivedNonceTracker.d.ts +175 -0
- package/dist/utils/ReceivedNonceTracker.d.ts.map +1 -1
- package/dist/utils/ReceivedNonceTracker.js +261 -5
- package/dist/utils/ReceivedNonceTracker.js.map +1 -1
- package/dist/utils/SDKLifecycle.d.ts +156 -0
- package/dist/utils/SDKLifecycle.d.ts.map +1 -0
- package/dist/utils/SDKLifecycle.js +347 -0
- package/dist/utils/SDKLifecycle.js.map +1 -0
- package/dist/utils/SecureNonce.d.ts +57 -0
- package/dist/utils/SecureNonce.d.ts.map +1 -0
- package/dist/utils/SecureNonce.js +80 -0
- package/dist/utils/SecureNonce.js.map +1 -0
- package/dist/utils/Semaphore.d.ts +123 -0
- package/dist/utils/Semaphore.d.ts.map +1 -0
- package/dist/utils/Semaphore.js +247 -0
- package/dist/utils/Semaphore.js.map +1 -0
- package/dist/utils/UsedAttestationTracker.d.ts +167 -0
- package/dist/utils/UsedAttestationTracker.d.ts.map +1 -0
- package/dist/utils/UsedAttestationTracker.js +309 -0
- package/dist/utils/UsedAttestationTracker.js.map +1 -0
- package/dist/utils/canonicalJson.d.ts +22 -0
- package/dist/utils/canonicalJson.d.ts.map +1 -1
- package/dist/utils/canonicalJson.js +26 -3
- package/dist/utils/canonicalJson.js.map +1 -1
- package/dist/utils/computeTypeHash.d.ts +14 -0
- package/dist/utils/computeTypeHash.d.ts.map +1 -1
- package/dist/utils/computeTypeHash.js +19 -2
- package/dist/utils/computeTypeHash.js.map +1 -1
- package/dist/utils/fsSafe.d.ts +14 -0
- package/dist/utils/fsSafe.d.ts.map +1 -0
- package/dist/utils/fsSafe.js +89 -0
- package/dist/utils/fsSafe.js.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +51 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/security.d.ts +147 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +391 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/utils/validation.d.ts +40 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +184 -7
- package/dist/utils/validation.js.map +1 -1
- package/package.json +54 -37
- package/src/ACTPClient.ts +692 -178
- package/src/abi/AgentRegistry.json +782 -0
- package/src/abi/EscrowVault.json +106 -38
- package/src/abi/IdentityRegistry.json +316 -0
- package/src/adapters/BaseAdapter.ts +473 -0
- package/src/adapters/BeginnerAdapter.ts +232 -0
- package/src/adapters/IntermediateAdapter.ts +316 -0
- package/src/adapters/index.ts +25 -0
- package/src/builders/DeliveryProofBuilder.ts +3 -2
- package/src/cli/commands/balance.ts +110 -0
- package/src/cli/commands/batch.ts +487 -0
- package/src/cli/commands/config.ts +231 -0
- package/src/cli/commands/init.ts +161 -0
- package/src/cli/commands/mint.ts +116 -0
- package/src/cli/commands/pay.ts +113 -0
- package/src/cli/commands/simulate.ts +345 -0
- package/src/cli/commands/time.ts +303 -0
- package/src/cli/commands/tx.ts +448 -0
- package/src/cli/commands/watch.ts +211 -0
- package/src/cli/index.ts +116 -0
- package/src/cli/utils/client.ts +249 -0
- package/src/cli/utils/config.ts +282 -0
- package/src/cli/utils/output.ts +465 -0
- package/src/config/networks.ts +32 -9
- package/src/errors/index.ts +298 -1
- package/src/index.ts +207 -71
- package/src/level0/Provider.ts +117 -0
- package/src/level0/ServiceDirectory.ts +131 -0
- package/src/level0/index.ts +10 -0
- package/src/level0/provide.ts +131 -0
- package/src/level0/request.ts +494 -0
- package/src/level1/Agent.ts +1432 -0
- package/src/level1/index.ts +10 -0
- package/src/level1/pricing/PriceCalculator.ts +255 -0
- package/src/level1/pricing/PricingStrategy.ts +198 -0
- package/src/level1/types/Job.ts +179 -0
- package/src/level1/types/Options.ts +291 -0
- package/src/level1/types/index.ts +8 -0
- package/src/protocol/ACTPKernel.ts +175 -23
- package/src/protocol/AgentRegistry.ts +559 -0
- package/src/protocol/DIDManager.ts +629 -0
- package/src/protocol/DIDResolver.ts +554 -0
- package/src/protocol/EASHelper.ts +230 -46
- package/src/protocol/EscrowVault.ts +68 -50
- package/src/protocol/EventMonitor.ts +44 -15
- package/src/protocol/MessageSigner.ts +193 -13
- package/src/protocol/ProofGenerator.ts +223 -4
- package/src/runtime/BlockchainRuntime.ts +993 -0
- package/src/runtime/IACTPRuntime.ts +284 -0
- package/src/runtime/MockRuntime.ts +1244 -0
- package/src/runtime/MockStateManager.ts +576 -0
- package/src/runtime/index.ts +25 -0
- package/src/runtime/types/MockState.ts +227 -0
- package/src/types/agent.ts +79 -0
- package/src/types/did.ts +223 -0
- package/src/types/escrow.ts +12 -11
- package/src/types/index.ts +5 -1
- package/src/types/state.ts +12 -3
- package/src/types/transaction.ts +4 -1
- package/src/utils/ErrorRecoveryGuide.ts +675 -0
- package/src/utils/Helpers.ts +688 -0
- package/src/utils/IPFSClient.ts +122 -5
- package/src/utils/Logger.ts +484 -0
- package/src/utils/NonceManager.ts +305 -8
- package/src/utils/RateLimiter.ts +534 -0
- package/src/utils/ReceivedNonceTracker.ts +170 -0
- package/src/utils/SDKLifecycle.ts +416 -0
- package/src/utils/SecureNonce.ts +78 -0
- package/src/utils/Semaphore.ts +276 -0
- package/src/utils/UsedAttestationTracker.ts +387 -0
- package/src/utils/fsSafe.ts +75 -0
- package/src/utils/index.ts +80 -0
- package/src/utils/security.ts +418 -0
- package/src/utils/validation.ts +164 -0
- package/src/__tests__/ProofGenerator.test.ts +0 -124
- package/src/__tests__/QuoteBuilder.test.ts +0 -516
- package/src/__tests__/StateMachine.test.ts +0 -82
- package/src/__tests__/builders/DeliveryProofBuilder.test.ts +0 -581
- package/src/__tests__/integration/ACTPClient.test.ts +0 -263
- package/src/__tests__/integration.test.ts +0 -289
- package/src/__tests__/protocol/EASHelper.test.ts +0 -472
- package/src/__tests__/protocol/EventMonitor.test.ts +0 -382
- package/src/__tests__/security/ACTPKernel.security.test.ts +0 -1167
- package/src/__tests__/security/EscrowVault.security.test.ts +0 -570
- package/src/__tests__/security/MessageSigner.security.test.ts +0 -286
- package/src/__tests__/security/NonceReplay.security.test.ts +0 -501
- package/src/__tests__/security/validation.security.test.ts +0 -376
- package/src/__tests__/utils/IPFSClient.test.ts +0 -262
- package/src/__tests__/utils/NonceManager.test.ts +0 -205
- package/src/__tests__/utils/canonicalJson.test.ts +0 -153
|
@@ -3,38 +3,98 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProofGenerator = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
5
|
const eip712_1 = require("../types/eip712");
|
|
6
|
+
/**
|
|
7
|
+
* Default URL validation config - SECURE by default
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_URL_CONFIG = {
|
|
10
|
+
allowedProtocols: ['https:'],
|
|
11
|
+
allowLocalhost: false,
|
|
12
|
+
maxSize: 10 * 1024 * 1024, // 10MB
|
|
13
|
+
timeout: 30000, // 30 seconds
|
|
14
|
+
blockedHosts: [
|
|
15
|
+
'metadata.google.internal',
|
|
16
|
+
'169.254.169.254', // AWS/GCP metadata
|
|
17
|
+
'metadata.aws.internal',
|
|
18
|
+
'localhost',
|
|
19
|
+
'127.0.0.1',
|
|
20
|
+
'0.0.0.0',
|
|
21
|
+
'[::1]',
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* ProofGenerator - Content hashing and delivery proofs
|
|
26
|
+
* Reference: Yellow Paper §11.4.1
|
|
27
|
+
*
|
|
28
|
+
* SECURITY FIX (MEDIUM-2): Now includes URL validation for SSRF prevention
|
|
29
|
+
*/
|
|
6
30
|
class ProofGenerator {
|
|
31
|
+
/**
|
|
32
|
+
* Create ProofGenerator with optional URL validation config
|
|
33
|
+
*
|
|
34
|
+
* @param urlConfig - URL validation configuration for hashFromUrl()
|
|
35
|
+
*/
|
|
36
|
+
constructor(urlConfig) {
|
|
37
|
+
this.urlConfig = {
|
|
38
|
+
...DEFAULT_URL_CONFIG,
|
|
39
|
+
...urlConfig,
|
|
40
|
+
};
|
|
41
|
+
// If localhost is explicitly allowed, remove from blocked hosts
|
|
42
|
+
if (urlConfig?.allowLocalhost) {
|
|
43
|
+
this.urlConfig.blockedHosts = this.urlConfig.blockedHosts.filter((h) => !['localhost', '127.0.0.1', '0.0.0.0', '[::1]'].includes(h));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Hash deliverable content
|
|
48
|
+
* Uses Keccak256 per Yellow Paper §11.4.1
|
|
49
|
+
*/
|
|
7
50
|
hashContent(content) {
|
|
8
51
|
const buffer = typeof content === 'string' ? (0, ethers_1.toUtf8Bytes)(content) : content;
|
|
9
52
|
return (0, ethers_1.keccak256)(buffer);
|
|
10
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate delivery proof (AIP-4)
|
|
56
|
+
* Reference: Yellow Paper §8.2
|
|
57
|
+
* Complete schema with type field for AIP compliance
|
|
58
|
+
* Computed fields (size, mimeType) cannot be overwritten
|
|
59
|
+
*/
|
|
11
60
|
generateDeliveryProof(params) {
|
|
12
61
|
const { txId, deliverable, deliveryUrl, metadata = {} } = params;
|
|
13
62
|
const contentHash = this.hashContent(deliverable);
|
|
14
63
|
const size = typeof deliverable === 'string'
|
|
15
64
|
? Buffer.from(deliverable).length
|
|
16
65
|
: deliverable.length;
|
|
66
|
+
// Spread user metadata first, then enforce computed fields
|
|
67
|
+
// This prevents users from spoofing size/mimeType
|
|
17
68
|
const { size: _ignoredSize, mimeType: _ignoredMimeType, ...userMetadata } = metadata;
|
|
18
69
|
return {
|
|
19
|
-
type: 'delivery.proof',
|
|
70
|
+
type: 'delivery.proof', // Required per AIP-4
|
|
20
71
|
txId,
|
|
21
72
|
contentHash,
|
|
22
73
|
timestamp: Date.now(),
|
|
23
|
-
deliveryUrl,
|
|
74
|
+
deliveryUrl, // Optional: IPFS/Arweave link
|
|
24
75
|
metadata: {
|
|
25
|
-
...userMetadata,
|
|
26
|
-
size,
|
|
27
|
-
mimeType: metadata.mimeType || 'application/octet-stream'
|
|
76
|
+
...userMetadata, // User-supplied fields (excluding reserved)
|
|
77
|
+
size, // Enforced: computed from deliverable
|
|
78
|
+
mimeType: metadata.mimeType || 'application/octet-stream' // Enforced with fallback
|
|
28
79
|
}
|
|
29
80
|
};
|
|
30
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert a generated delivery proof into typed EIP-712 data
|
|
84
|
+
*/
|
|
31
85
|
toDeliveryProofTypedData(proof) {
|
|
32
86
|
return (0, eip712_1.deliveryProofDataFromProof)(proof);
|
|
33
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Encode proof for on-chain submission
|
|
90
|
+
*/
|
|
34
91
|
encodeProof(proof) {
|
|
35
92
|
const abiCoder = ethers_1.AbiCoder.defaultAbiCoder();
|
|
36
93
|
return abiCoder.encode(['bytes32', 'bytes32', 'uint256'], [proof.txId, proof.contentHash, proof.timestamp]);
|
|
37
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Decode proof from on-chain data
|
|
97
|
+
*/
|
|
38
98
|
decodeProof(proofData) {
|
|
39
99
|
const abiCoder = ethers_1.AbiCoder.defaultAbiCoder();
|
|
40
100
|
const [txId, contentHash, timestamp] = abiCoder.decode(['bytes32', 'bytes32', 'uint256'], proofData);
|
|
@@ -44,21 +104,146 @@ class ProofGenerator {
|
|
|
44
104
|
timestamp: Number(timestamp)
|
|
45
105
|
};
|
|
46
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Verify deliverable matches expected hash
|
|
109
|
+
*/
|
|
47
110
|
verifyDeliverable(deliverable, expectedHash) {
|
|
48
111
|
const actualHash = this.hashContent(deliverable);
|
|
49
112
|
return actualHash.toLowerCase() === expectedHash.toLowerCase();
|
|
50
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Generate content hash from URL (for IPFS/Arweave)
|
|
116
|
+
*
|
|
117
|
+
* SECURITY FIX (MEDIUM-2): Now includes:
|
|
118
|
+
* - Protocol validation (HTTPS only by default)
|
|
119
|
+
* - Hostname blocklist (prevents SSRF to internal services)
|
|
120
|
+
* - Size limits (prevents DoS via large responses)
|
|
121
|
+
* - Request timeout
|
|
122
|
+
*
|
|
123
|
+
* @param url - URL to fetch content from
|
|
124
|
+
* @returns Keccak256 hash of content
|
|
125
|
+
* @throws Error if URL is blocked, too large, or fetch fails
|
|
126
|
+
*/
|
|
51
127
|
async hashFromUrl(url) {
|
|
128
|
+
// SECURITY FIX (MEDIUM-2): Validate URL before fetching
|
|
129
|
+
this.validateUrl(url);
|
|
130
|
+
// In browser/Node.js environment with fetch
|
|
52
131
|
try {
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
132
|
+
// Create AbortController for timeout
|
|
133
|
+
const controller = new AbortController();
|
|
134
|
+
const timeoutId = setTimeout(() => controller.abort(), this.urlConfig.timeout);
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetch(url, {
|
|
137
|
+
signal: controller.signal,
|
|
138
|
+
// Prevent following redirects to blocked hosts
|
|
139
|
+
redirect: 'follow',
|
|
140
|
+
});
|
|
141
|
+
clearTimeout(timeoutId);
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
|
|
144
|
+
}
|
|
145
|
+
// SECURITY FIX (MEDIUM-2): Check Content-Length header first
|
|
146
|
+
const contentLength = response.headers.get('content-length');
|
|
147
|
+
if (contentLength) {
|
|
148
|
+
const size = parseInt(contentLength, 10);
|
|
149
|
+
if (size > this.urlConfig.maxSize) {
|
|
150
|
+
throw new Error(`Content too large: ${size} bytes exceeds maximum of ${this.urlConfig.maxSize} bytes`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// SECURITY FIX (MEDIUM-2): Read response with size limit
|
|
154
|
+
const chunks = [];
|
|
155
|
+
let totalSize = 0;
|
|
156
|
+
const reader = response.body?.getReader();
|
|
157
|
+
if (!reader) {
|
|
158
|
+
throw new Error('Response body is not readable');
|
|
159
|
+
}
|
|
160
|
+
while (true) {
|
|
161
|
+
const { done, value } = await reader.read();
|
|
162
|
+
if (done)
|
|
163
|
+
break;
|
|
164
|
+
totalSize += value.length;
|
|
165
|
+
// Check size limit during streaming
|
|
166
|
+
if (totalSize > this.urlConfig.maxSize) {
|
|
167
|
+
reader.cancel();
|
|
168
|
+
throw new Error(`Content too large: ${totalSize}+ bytes exceeds maximum of ${this.urlConfig.maxSize} bytes`);
|
|
169
|
+
}
|
|
170
|
+
chunks.push(value);
|
|
171
|
+
}
|
|
172
|
+
// Concatenate chunks
|
|
173
|
+
const buffer = Buffer.concat(chunks.map(c => Buffer.from(c)));
|
|
174
|
+
return this.hashContent(buffer);
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
clearTimeout(timeoutId);
|
|
178
|
+
}
|
|
57
179
|
}
|
|
58
180
|
catch (error) {
|
|
181
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
182
|
+
throw new Error(`Request timed out after ${this.urlConfig.timeout}ms for ${url}`);
|
|
183
|
+
}
|
|
59
184
|
throw new Error(`Failed to fetch content from ${url}: ${error}`);
|
|
60
185
|
}
|
|
61
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* SECURITY FIX (MEDIUM-2): Validate URL against security rules
|
|
189
|
+
*
|
|
190
|
+
* @param url - URL to validate
|
|
191
|
+
* @throws Error if URL is not allowed
|
|
192
|
+
*/
|
|
193
|
+
validateUrl(url) {
|
|
194
|
+
let parsed;
|
|
195
|
+
try {
|
|
196
|
+
parsed = new URL(url);
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
200
|
+
}
|
|
201
|
+
// Check protocol
|
|
202
|
+
if (!this.urlConfig.allowedProtocols.includes(parsed.protocol)) {
|
|
203
|
+
throw new Error(`URL protocol "${parsed.protocol}" not allowed. ` +
|
|
204
|
+
`Allowed protocols: ${this.urlConfig.allowedProtocols.join(', ')}`);
|
|
205
|
+
}
|
|
206
|
+
// Check blocked hosts
|
|
207
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
208
|
+
if (this.urlConfig.blockedHosts.includes(hostname)) {
|
|
209
|
+
throw new Error(`URL hostname "${hostname}" is blocked for security reasons. ` +
|
|
210
|
+
`This prevents SSRF attacks to internal services.`);
|
|
211
|
+
}
|
|
212
|
+
// Check for private IP ranges (additional SSRF protection)
|
|
213
|
+
if (this.isPrivateIP(hostname)) {
|
|
214
|
+
throw new Error(`URL hostname "${hostname}" resolves to a private IP address. ` +
|
|
215
|
+
`This is blocked for security reasons (SSRF prevention).`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Check if hostname is a private IP address
|
|
220
|
+
*
|
|
221
|
+
* @param hostname - Hostname to check
|
|
222
|
+
* @returns true if hostname is a private IP
|
|
223
|
+
*/
|
|
224
|
+
isPrivateIP(hostname) {
|
|
225
|
+
// IPv4 private ranges
|
|
226
|
+
const ipv4PrivateRanges = [
|
|
227
|
+
/^10\./, // 10.0.0.0 - 10.255.255.255
|
|
228
|
+
/^172\.(1[6-9]|2[0-9]|3[0-1])\./, // 172.16.0.0 - 172.31.255.255
|
|
229
|
+
/^192\.168\./, // 192.168.0.0 - 192.168.255.255
|
|
230
|
+
/^127\./, // 127.0.0.0 - 127.255.255.255 (loopback)
|
|
231
|
+
/^169\.254\./, // 169.254.0.0 - 169.254.255.255 (link-local)
|
|
232
|
+
/^0\./, // 0.0.0.0/8
|
|
233
|
+
];
|
|
234
|
+
for (const range of ipv4PrivateRanges) {
|
|
235
|
+
if (range.test(hostname)) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get the URL validation config (for testing/inspection)
|
|
243
|
+
*/
|
|
244
|
+
getUrlConfig() {
|
|
245
|
+
return { ...this.urlConfig };
|
|
246
|
+
}
|
|
62
247
|
}
|
|
63
248
|
exports.ProofGenerator = ProofGenerator;
|
|
64
249
|
//# sourceMappingURL=ProofGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProofGenerator.js","sourceRoot":"","sources":["../../src/protocol/ProofGenerator.ts"],"names":[],"mappings":";;;AAAA,mCAAqE;AAErE,4CAAgF;
|
|
1
|
+
{"version":3,"file":"ProofGenerator.js","sourceRoot":"","sources":["../../src/protocol/ProofGenerator.ts"],"names":[],"mappings":";;;AAAA,mCAAqE;AAErE,4CAAgF;AAiChF;;GAEG;AACH,MAAM,kBAAkB,GAAkC;IACxD,gBAAgB,EAAE,CAAC,QAAQ,CAAC;IAC5B,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO;IAClC,OAAO,EAAE,KAAK,EAAE,aAAa;IAC7B,YAAY,EAAE;QACZ,0BAA0B;QAC1B,iBAAiB,EAAE,mBAAmB;QACtC,uBAAuB;QACvB,WAAW;QACX,WAAW;QACX,SAAS;QACT,OAAO;KACR;C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,MAAM,EAAY,YAAY;SAC/B,CAAC;QAEF,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;YACtC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAC/B,CAAC;CACF;AArRD,wCAqRC"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuoteBuilder - AIP-2 Price Quote Construction
|
|
3
|
+
*
|
|
4
|
+
* This module re-exports the full QuoteBuilder implementation from builders/
|
|
5
|
+
* Reference: AIP-2 §6.1
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Import from builders/QuoteBuilder directly
|
|
8
|
+
*/
|
|
1
9
|
export { QuoteBuilder, QuoteMessage, QuoteParams, AIP2QuoteTypes } from '../builders/QuoteBuilder';
|
|
2
10
|
//# sourceMappingURL=QuoteBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteBuilder.d.ts","sourceRoot":"","sources":["../../src/protocol/QuoteBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QuoteBuilder.d.ts","sourceRoot":"","sources":["../../src/protocol/QuoteBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACf,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QuoteBuilder - AIP-2 Price Quote Construction
|
|
4
|
+
*
|
|
5
|
+
* This module re-exports the full QuoteBuilder implementation from builders/
|
|
6
|
+
* Reference: AIP-2 §6.1
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Import from builders/QuoteBuilder directly
|
|
9
|
+
*/
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
11
|
exports.AIP2QuoteTypes = exports.QuoteBuilder = void 0;
|
|
4
12
|
var QuoteBuilder_1 = require("../builders/QuoteBuilder");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteBuilder.js","sourceRoot":"","sources":["../../src/protocol/QuoteBuilder.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"QuoteBuilder.js","sourceRoot":"","sources":["../../src/protocol/QuoteBuilder.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,yDAKkC;AAJhC,4GAAA,YAAY,OAAA;AAGZ,8GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlockchainRuntime - Real blockchain implementation of ACTP protocol
|
|
3
|
+
*
|
|
4
|
+
* Implements IACTPRuntime interface using actual smart contracts deployed
|
|
5
|
+
* on Base Sepolia (testnet) or Base Mainnet (production).
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Real blockchain transactions via ethers.js
|
|
9
|
+
* - ACTPKernel smart contract integration
|
|
10
|
+
* - EscrowVault contract integration
|
|
11
|
+
* - EIP-712 message signing support
|
|
12
|
+
* - Event monitoring and indexing
|
|
13
|
+
* - Gas optimization
|
|
14
|
+
*
|
|
15
|
+
* @module runtime/BlockchainRuntime
|
|
16
|
+
*/
|
|
17
|
+
import { Signer, JsonRpcProvider } from 'ethers';
|
|
18
|
+
import { ACTPKernel } from '../protocol/ACTPKernel';
|
|
19
|
+
import { EscrowVault } from '../protocol/EscrowVault';
|
|
20
|
+
import { EventMonitor } from '../protocol/EventMonitor';
|
|
21
|
+
import { MessageSigner } from '../protocol/MessageSigner';
|
|
22
|
+
import { EASHelper, EASConfig } from '../protocol/EASHelper';
|
|
23
|
+
import { NetworkConfig } from '../config/networks';
|
|
24
|
+
import { IACTPRuntime, CreateTransactionParams } from './IACTPRuntime';
|
|
25
|
+
import { MockTransaction, TransactionState } from './types/MockState';
|
|
26
|
+
import { IUsedAttestationTracker } from '../utils/UsedAttestationTracker';
|
|
27
|
+
import { IReceivedNonceTracker } from '../utils/ReceivedNonceTracker';
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for BlockchainRuntime
|
|
30
|
+
*/
|
|
31
|
+
export interface BlockchainRuntimeConfig {
|
|
32
|
+
/** Network to connect to */
|
|
33
|
+
network: 'base-sepolia' | 'base-mainnet';
|
|
34
|
+
/** Ethers signer for transaction signing */
|
|
35
|
+
signer: Signer;
|
|
36
|
+
/** Ethers provider for blockchain queries */
|
|
37
|
+
provider: JsonRpcProvider;
|
|
38
|
+
/** Optional contract address overrides */
|
|
39
|
+
contracts?: {
|
|
40
|
+
actpKernel?: string;
|
|
41
|
+
escrowVault?: string;
|
|
42
|
+
usdc?: string;
|
|
43
|
+
eas?: string;
|
|
44
|
+
};
|
|
45
|
+
/** Optional gas settings */
|
|
46
|
+
gasSettings?: {
|
|
47
|
+
maxFeePerGas?: bigint;
|
|
48
|
+
maxPriorityFeePerGas?: bigint;
|
|
49
|
+
};
|
|
50
|
+
/** EAS (Ethereum Attestation Service) configuration for delivery proof verification */
|
|
51
|
+
easConfig?: EASConfig;
|
|
52
|
+
/**
|
|
53
|
+
* SECURITY FIX (CRITICAL-2): Require attestation verification before escrow release
|
|
54
|
+
* When true, releaseEscrow() will require a valid EAS attestation
|
|
55
|
+
* Default: false for backward compatibility, SHOULD be true in production
|
|
56
|
+
*/
|
|
57
|
+
requireAttestation?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* State directory for persistent attestation tracking
|
|
60
|
+
* If provided, attestation replay protection will survive restarts
|
|
61
|
+
*/
|
|
62
|
+
stateDirectory?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* BlockchainRuntime - Production blockchain implementation
|
|
66
|
+
*
|
|
67
|
+
* Bridges the IACTPRuntime interface to actual smart contracts.
|
|
68
|
+
* Provides seamless migration path from MockRuntime to production.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const provider = new ethers.JsonRpcProvider(rpcUrl);
|
|
73
|
+
* const signer = new ethers.Wallet(privateKey, provider);
|
|
74
|
+
*
|
|
75
|
+
* const runtime = new BlockchainRuntime({
|
|
76
|
+
* network: 'base-sepolia',
|
|
77
|
+
* signer,
|
|
78
|
+
* provider
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* // Now use with adapters
|
|
82
|
+
* const adapter = new BeginnerAdapter(runtime, requesterAddress);
|
|
83
|
+
* await adapter.createJob({...});
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare class BlockchainRuntime implements IACTPRuntime {
|
|
87
|
+
private readonly kernel;
|
|
88
|
+
private readonly escrow;
|
|
89
|
+
private readonly events;
|
|
90
|
+
private messageSigner;
|
|
91
|
+
private easHelper;
|
|
92
|
+
private readonly attestationTracker;
|
|
93
|
+
private readonly requireAttestation;
|
|
94
|
+
private readonly nonceTracker;
|
|
95
|
+
private readonly networkConfig;
|
|
96
|
+
private readonly provider;
|
|
97
|
+
private readonly signer;
|
|
98
|
+
private readonly easConfig?;
|
|
99
|
+
private reconnectAttempts;
|
|
100
|
+
private readonly maxReconnectAttempts;
|
|
101
|
+
private readonly baseReconnectDelay;
|
|
102
|
+
private lastConnectionCheck;
|
|
103
|
+
private readonly connectionCheckInterval;
|
|
104
|
+
/**
|
|
105
|
+
* Create new BlockchainRuntime instance
|
|
106
|
+
*
|
|
107
|
+
* @param config - Runtime configuration
|
|
108
|
+
*/
|
|
109
|
+
constructor(config: BlockchainRuntimeConfig);
|
|
110
|
+
/**
|
|
111
|
+
* Initialize async components (must be called after construction)
|
|
112
|
+
*
|
|
113
|
+
* CRITICAL: This method MUST be called before using the runtime.
|
|
114
|
+
* It initializes the MessageSigner with proper EIP-712 domain and
|
|
115
|
+
* optionally the EASHelper for attestation verification.
|
|
116
|
+
*
|
|
117
|
+
* SECURITY FIX (CHAINID-VALIDATION): Validates that the connected network
|
|
118
|
+
* matches the expected network configuration to prevent cross-chain attacks.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const runtime = new BlockchainRuntime(config);
|
|
123
|
+
* await runtime.initialize();
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
initialize(): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if runtime has been initialized
|
|
129
|
+
* @returns true if initialize() has been called
|
|
130
|
+
*/
|
|
131
|
+
isInitialized(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Require initialization before use
|
|
134
|
+
*
|
|
135
|
+
* SECURITY FIX (M-4): Enforces initialize() call before operations
|
|
136
|
+
* @throws Error if initialize() has not been called
|
|
137
|
+
*/
|
|
138
|
+
private requireInitialized;
|
|
139
|
+
/**
|
|
140
|
+
* Ensure provider connection is healthy with automatic reconnection
|
|
141
|
+
*
|
|
142
|
+
* SECURITY FIX (HIGH-3): Implements exponential backoff reconnection
|
|
143
|
+
* to handle transient network failures gracefully.
|
|
144
|
+
*
|
|
145
|
+
* SECURITY FIX (H-4): Converted from recursive to iterative loop
|
|
146
|
+
* to prevent stack overflow on prolonged network failures.
|
|
147
|
+
*
|
|
148
|
+
* @throws Error if connection cannot be established after max attempts
|
|
149
|
+
*/
|
|
150
|
+
private ensureConnected;
|
|
151
|
+
/**
|
|
152
|
+
* Get provider connection status
|
|
153
|
+
*
|
|
154
|
+
* SECURITY FIX (HIGH-3): Monitoring method for connection health
|
|
155
|
+
*
|
|
156
|
+
* @returns Connection status information
|
|
157
|
+
*/
|
|
158
|
+
getConnectionStatus(): {
|
|
159
|
+
isHealthy: boolean;
|
|
160
|
+
reconnectAttempts: number;
|
|
161
|
+
maxReconnectAttempts: number;
|
|
162
|
+
lastCheckTimestamp: number;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Creates a new transaction on-chain
|
|
166
|
+
*
|
|
167
|
+
* @param params - Transaction creation parameters
|
|
168
|
+
* @returns Promise resolving to transaction ID (bytes32 hex string)
|
|
169
|
+
*/
|
|
170
|
+
createTransaction(params: CreateTransactionParams): Promise<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Links escrow to a transaction and locks funds
|
|
173
|
+
*
|
|
174
|
+
* SIMPLIFICATION (ESCROW-ID): Uses txId as escrowId.
|
|
175
|
+
* Per ACTP standard, escrowId = txId simplifies tracking and eliminates
|
|
176
|
+
* the need for separate escrowId→txId mapping.
|
|
177
|
+
*
|
|
178
|
+
* @param txId - Transaction ID
|
|
179
|
+
* @param amount - Amount to lock (must match transaction amount)
|
|
180
|
+
* @returns Promise resolving to escrow ID (same as txId)
|
|
181
|
+
*/
|
|
182
|
+
linkEscrow(txId: string, amount: string): Promise<string>;
|
|
183
|
+
/**
|
|
184
|
+
* Transitions a transaction to a new state
|
|
185
|
+
*
|
|
186
|
+
* SECURITY FIX (PROOF-PARAM): Added optional proof parameter for DELIVERED state.
|
|
187
|
+
* The kernel contract uses proof data for dispute window configuration and
|
|
188
|
+
* delivery verification. Without proof, default dispute window applies.
|
|
189
|
+
*
|
|
190
|
+
* @param txId - Transaction ID
|
|
191
|
+
* @param newState - Target state
|
|
192
|
+
* @param proof - Optional proof data (hex string, e.g., ABI-encoded delivery proof)
|
|
193
|
+
*/
|
|
194
|
+
transitionState(txId: string, newState: TransactionState, proof?: string): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Gets a transaction by ID
|
|
197
|
+
*
|
|
198
|
+
* @param txId - Transaction ID
|
|
199
|
+
* @returns Promise resolving to transaction or null if not found
|
|
200
|
+
*/
|
|
201
|
+
getTransaction(txId: string): Promise<MockTransaction | null>;
|
|
202
|
+
/**
|
|
203
|
+
* Gets all transactions
|
|
204
|
+
*
|
|
205
|
+
* @returns Promise resolving to array of all transactions
|
|
206
|
+
*/
|
|
207
|
+
getAllTransactions(): Promise<MockTransaction[]>;
|
|
208
|
+
/**
|
|
209
|
+
* Releases escrow funds to provider by settling the transaction
|
|
210
|
+
*
|
|
211
|
+
* SECURITY FIX (CRITICAL-2): This method now validates:
|
|
212
|
+
* 1. Transaction state is DELIVERED
|
|
213
|
+
* 2. Dispute window has elapsed
|
|
214
|
+
* 3. EAS attestation is valid (if requireAttestation is true)
|
|
215
|
+
*
|
|
216
|
+
* SECURITY FIX (SETTLEMENT-FLOW): Uses transitionState(SETTLED) instead of
|
|
217
|
+
* direct releaseEscrow() call. Per ACTPKernel.sol, settlement via state transition
|
|
218
|
+
* automatically handles escrow release through _releaseEscrow() internal call.
|
|
219
|
+
* This ensures proper state machine progression and event emission.
|
|
220
|
+
*
|
|
221
|
+
* SIMPLIFICATION (ESCROW-ID): Uses escrowId = txId standard.
|
|
222
|
+
* The on-chain contract uses txId as the escrow identifier, so we simply
|
|
223
|
+
* treat escrowId and txId as equivalent (no complex parsing needed).
|
|
224
|
+
*
|
|
225
|
+
* @param escrowId - Escrow ID (equivalent to txId in ACTP standard)
|
|
226
|
+
* @param attestationUID - Optional EAS attestation UID for verification
|
|
227
|
+
* @throws Error if transaction not found, not in DELIVERED state, or attestation invalid
|
|
228
|
+
*/
|
|
229
|
+
releaseEscrow(escrowId: string, attestationUID?: string): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Gets escrow balance
|
|
232
|
+
*
|
|
233
|
+
* MEDIUM: Returns the locked balance for a transaction from the escrow vault.
|
|
234
|
+
* Queries the EscrowVault contract for the actual balance.
|
|
235
|
+
*
|
|
236
|
+
* @param escrowId - Escrow ID or transaction ID
|
|
237
|
+
* @returns Promise resolving to balance as string (in USDC wei)
|
|
238
|
+
*/
|
|
239
|
+
getEscrowBalance(escrowId: string): Promise<string>;
|
|
240
|
+
/**
|
|
241
|
+
* Time interface (uses real blockchain time)
|
|
242
|
+
*/
|
|
243
|
+
readonly time: {
|
|
244
|
+
/**
|
|
245
|
+
* Get current blockchain timestamp
|
|
246
|
+
*/
|
|
247
|
+
now: () => number;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Get the current signer address
|
|
251
|
+
*/
|
|
252
|
+
getAddress(): Promise<string>;
|
|
253
|
+
/**
|
|
254
|
+
* Get current block number
|
|
255
|
+
*/
|
|
256
|
+
getBlockNumber(): Promise<number>;
|
|
257
|
+
/**
|
|
258
|
+
* Get network configuration
|
|
259
|
+
*/
|
|
260
|
+
getNetworkConfig(): NetworkConfig;
|
|
261
|
+
/**
|
|
262
|
+
* Get ACTPKernel instance (for advanced usage)
|
|
263
|
+
*/
|
|
264
|
+
getKernel(): ACTPKernel;
|
|
265
|
+
/**
|
|
266
|
+
* Get EscrowVault instance (for advanced usage)
|
|
267
|
+
*/
|
|
268
|
+
getEscrow(): EscrowVault;
|
|
269
|
+
/**
|
|
270
|
+
* Get EventMonitor instance (for advanced usage)
|
|
271
|
+
*/
|
|
272
|
+
getEvents(): EventMonitor;
|
|
273
|
+
/**
|
|
274
|
+
* Get MessageSigner instance (for advanced usage)
|
|
275
|
+
*
|
|
276
|
+
* @throws Error if initialize() has not been called
|
|
277
|
+
*/
|
|
278
|
+
getMessageSigner(): MessageSigner;
|
|
279
|
+
/**
|
|
280
|
+
* Get EASHelper instance (for attestation operations)
|
|
281
|
+
*
|
|
282
|
+
* @throws Error if EAS config not provided or initialize() not called
|
|
283
|
+
*/
|
|
284
|
+
getEASHelper(): EASHelper;
|
|
285
|
+
/**
|
|
286
|
+
* Get attestation tracker instance
|
|
287
|
+
*/
|
|
288
|
+
getAttestationTracker(): IUsedAttestationTracker;
|
|
289
|
+
/**
|
|
290
|
+
* Get nonce tracker instance (for monitoring/debugging)
|
|
291
|
+
*
|
|
292
|
+
* SECURITY FIX (MEDIUM-9): Exposed for monitoring nonce replay protection
|
|
293
|
+
*/
|
|
294
|
+
getNonceTracker(): IReceivedNonceTracker;
|
|
295
|
+
/**
|
|
296
|
+
* Check if attestation verification is required
|
|
297
|
+
*/
|
|
298
|
+
isAttestationRequired(): boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Validate and normalize service hash for on-chain storage
|
|
301
|
+
*
|
|
302
|
+
* SECURITY FIX (CRITICAL): ACTPKernel expects bytes32 serviceHash.
|
|
303
|
+
* This method validates format and hashes raw strings if needed.
|
|
304
|
+
*
|
|
305
|
+
* @param serviceDescription - Service hash or description string
|
|
306
|
+
* @returns Valid bytes32 hash
|
|
307
|
+
*/
|
|
308
|
+
private validateServiceHash;
|
|
309
|
+
/**
|
|
310
|
+
* Estimate gas for createTransaction operation
|
|
311
|
+
*
|
|
312
|
+
* SECURITY FIX (M-2): Pre-transaction gas estimation helps:
|
|
313
|
+
* - Prevent failed transactions due to insufficient gas
|
|
314
|
+
* - Allow users to make informed decisions about costs
|
|
315
|
+
* - Catch potential issues before spending gas
|
|
316
|
+
*
|
|
317
|
+
* @param params - Transaction parameters
|
|
318
|
+
* @returns Estimated gas limit and cost in wei
|
|
319
|
+
*/
|
|
320
|
+
estimateCreateTransactionGas(params: CreateTransactionParams): Promise<{
|
|
321
|
+
gasLimit: bigint;
|
|
322
|
+
gasCostWei: bigint;
|
|
323
|
+
gasCostGwei: string;
|
|
324
|
+
}>;
|
|
325
|
+
/**
|
|
326
|
+
* Estimate gas for linkEscrow operation
|
|
327
|
+
*
|
|
328
|
+
* @param txId - Transaction ID
|
|
329
|
+
* @returns Estimated gas limit and cost
|
|
330
|
+
*/
|
|
331
|
+
estimateLinkEscrowGas(txId: string): Promise<{
|
|
332
|
+
gasLimit: bigint;
|
|
333
|
+
gasCostWei: bigint;
|
|
334
|
+
gasCostGwei: string;
|
|
335
|
+
}>;
|
|
336
|
+
/**
|
|
337
|
+
* Estimate gas for state transition
|
|
338
|
+
*
|
|
339
|
+
* @param txId - Transaction ID
|
|
340
|
+
* @param newState - Target state
|
|
341
|
+
* @returns Estimated gas limit and cost
|
|
342
|
+
*/
|
|
343
|
+
estimateTransitionGas(txId: string, newState: string): Promise<{
|
|
344
|
+
gasLimit: bigint;
|
|
345
|
+
gasCostWei: bigint;
|
|
346
|
+
gasCostGwei: string;
|
|
347
|
+
}>;
|
|
348
|
+
/**
|
|
349
|
+
* Get current gas price information
|
|
350
|
+
*
|
|
351
|
+
* @returns Current gas price data
|
|
352
|
+
*/
|
|
353
|
+
getGasPrice(): Promise<{
|
|
354
|
+
gasPrice: bigint;
|
|
355
|
+
gasPriceGwei: string;
|
|
356
|
+
maxFeePerGas?: bigint;
|
|
357
|
+
maxPriorityFeePerGas?: bigint;
|
|
358
|
+
}>;
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=BlockchainRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockchainRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/BlockchainRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,MAAM,EAAE,eAAe,EAA0B,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,EAAE,uBAAuB,EAAgC,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAA8B,MAAM,+BAA+B,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,4BAA4B;IAC5B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